Skip to content

Commit

Permalink
Merge branch 'feature/simulations' of github.com:Evolveum/midpoint in…
Browse files Browse the repository at this point in the history
…to feature/simulations
  • Loading branch information
1azyman committed Nov 21, 2022
2 parents aa4a5b0 + 129292a commit 9173f33
Show file tree
Hide file tree
Showing 36 changed files with 1,048 additions and 215 deletions.
2 changes: 2 additions & 0 deletions gui/admin-gui/src/frontend/scss/_tiles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
&.active {
border: 2px solid $primary;
border-radius: $border-radius;
background-color: rgba($primary, 15%);
}
}

Expand All @@ -50,6 +51,7 @@

&.active {
border-color: $primary-alt;
background-color: rgba($primary-alt, 15%);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected List<ObjectOrdering> createObjectOrderings(SortParam<String> sortParam
}

@Override
protected Set<? extends O> getSelected() {
public Set<? extends O> getSelected() {
List<O> preselectedObjects = getPreselectedObjectList();
return preselectedObjects == null ? new HashSet<>() : new HashSet<>(preselectedObjects);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<button wicket:id="buttonContainer" class="btn dropdown-toggle dropdown-icon" type="button" data-toggle="dropdown">
<button wicket:id="buttonContainer" class="btn dropdown-icon" type="button" data-toggle="dropdown">
<span class="badge bg-teal" wicket:id="info"></span>
<i class="mr-1 fa " wicket:id="icon"></i>
<span wicket:id="label"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private void initLayout() {
WebMarkupContainer buttonContainer = new WebMarkupContainer(ID_BUTTON_CONTAINER);
buttonContainer.setOutputMarkupId(true);
buttonContainer.add(AttributeAppender.append("class", getSpecialButtonClass()));
buttonContainer.add(AttributeAppender.append("class", () -> hasToggleIcon() ? " dropdown-toggle " : ""));
add(buttonContainer);

Label info = new Label(ID_INFO, new PropertyModel<>(getModel(), DropdownButtonDto.F_INFO));
Expand Down Expand Up @@ -107,6 +108,10 @@ protected void populateItem(ListItem<InlineMenuItem> item) {
dropdownMenuContainer.add(li);
}

protected boolean hasToggleIcon() {
return true;
}

public WebMarkupContainer getButtonContainer() {
return (WebMarkupContainer)get(ID_BUTTON_CONTAINER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
*/
public class CatalogTile<T extends Serializable> extends Tile<T> {

private String description;

private String info;

private RoundedIconPanel.State checkState;
Expand All @@ -30,14 +28,6 @@ public CatalogTile(String icon, String title) {
super(icon, title);
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public String getInfo() {
return info;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,55 +28,27 @@
/**
* Created by Viliam Repan (lazyman).
*/
public class CatalogTilePanel<T extends Serializable> extends BasePanel<CatalogTile<T>> {
public class CatalogTilePanel<T extends Serializable> extends FocusTilePanel<T, CatalogTile<T>> {

private static final long serialVersionUID = 1L;

private static final String ID_LOGO = "logo";
private static final String ID_DESCRIPTION = "description";
private static final String ID_ADD = "add";
private static final String ID_DETAILS = "details";
private static final String ID_ICON = "icon";
private static final String ID_TITLE = "title";
private static final String ID_INFO = "info";
private static final String ID_CHECK = "check";

public CatalogTilePanel(String id, IModel<CatalogTile<T>> model) {
super(id, model);

initLayout();
}

private void initLayout() {
protected void initLayout() {
super.initLayout();

add(AttributeAppender.append("class", "catalog-tile-panel d-flex flex-column align-items-center bordered p-4"));
add(AttributeAppender.append("class", () -> getModelObject().isSelected() ? "active" : null));
setOutputMarkupId(true);

RoundedImagePanel logo1 = new RoundedImagePanel(ID_LOGO, () -> createDisplayType(getModel()), createPreferredImage(getModel()));
add(logo1);

RoundedIconPanel check = new RoundedIconPanel(ID_CHECK, () -> "fa fa-check", () -> getModelObject().getCheckState(), () -> getModelObject().getCheckTitle());
add(check);

Label description = new Label(ID_DESCRIPTION, () -> getModelObject().getDescription());
description.add(AttributeAppender.replace("title", () -> getModelObject().getDescription()));
description.add(new TooltipBehavior());
add(description);

WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
icon.add(AttributeAppender.append("class", () -> getModelObject().getIcon()));
add(icon);

IModel<String> titleModel = () -> {
String title = getModelObject().getTitle();
return title != null ? getString(title, null, title) : null;
};

Label title = new Label(ID_TITLE, titleModel);
title.add(AttributeAppender.replace("title", titleModel));
title.add(new TooltipBehavior());
add(title);

Label info = new Label(ID_INFO);
info.add(AttributeAppender.append("title", () -> getModelObject().getInfo()));
info.add(new TooltipBehavior());
Expand All @@ -93,9 +65,6 @@ protected void onEvent(AjaxRequestTarget target) {

Component add = createAddButton(ID_ADD);
add(add);

Component details = createDetailsButton(ID_DETAILS);
add(details);
}

protected Component createAddButton(String id) {
Expand All @@ -108,34 +77,7 @@ public void onClick(AjaxRequestTarget target) {
};
}

protected Component createDetailsButton(String id) {
return new AjaxLink<>(id) {

@Override
public void onClick(AjaxRequestTarget target) {
CatalogTilePanel.this.onDetails(target);
}
};
}

protected void onAdd(AjaxRequestTarget target) {

}

protected void onDetails(AjaxRequestTarget target) {

}

protected void onClick(AjaxRequestTarget target) {
getModelObject().toggle();
target.add(this);
}

protected DisplayType createDisplayType(IModel<CatalogTile<T>> model) {
return null;
}

protected IModel<IResource> createPreferredImage(IModel<CatalogTile<T>> model) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
~ Copyright (c) 2010-2017 Evolveum
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="logo mt-3" wicket:id="logo"/>
<div class="mt-4 gap-1 d-flex align-items-center justify-content-center w-100">
<i wicket:id="icon"></i>
<div class="font-weight-bold text-truncate" wicket:id="title"/>
</div>
<div class="tile-description mt-2 text-center text-secondary flex-grow-1" style="display: -webkit-box; text-overflow: ellipsis;" wicket:id="description"/>
<a class="btn btn-link text-lightblue mt-3" wicket:id="details">
<wicket:message key="CatalogTilePanel.details"/>
</a>
</wicket:panel>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
* Copyright (c) 2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.gui.impl.component.tile;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.web.component.data.column.RoundedImagePanel;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.util.TooltipBehavior;
import com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.resource.IResource;

import java.io.Serializable;

/**
* @author lskublik
*/
public class FocusTilePanel<F extends Serializable, T extends Tile<F>> extends BasePanel<T> {

private static final long serialVersionUID = 1L;

private static final String ID_LOGO = "logo";
private static final String ID_DESCRIPTION = "description";
private static final String ID_DETAILS = "details";
private static final String ID_ICON = "icon";
private static final String ID_TITLE = "title";

public FocusTilePanel(String id, IModel<T> model) {
super(id, model);

initLayout();
}

protected void initLayout() {
setOutputMarkupId(true);

RoundedImagePanel logo = new RoundedImagePanel(ID_LOGO, () -> createDisplayType(getModel()), createPreferredImage(getModel()));
add(logo);

Label description = new Label(ID_DESCRIPTION, () -> getModelObject().getDescription());
description.add(AttributeAppender.replace("title", () -> getModelObject().getDescription()));
description.add(new TooltipBehavior());
add(description);

WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
icon.add(AttributeAppender.append("class", () -> getModelObject().getIcon()));
add(icon);

IModel<String> titleModel = () -> {
String title = getModelObject().getTitle();
return title != null ? getString(title, null, title) : null;
};

Label title = new Label(ID_TITLE, titleModel);
title.add(AttributeAppender.replace("title", titleModel));
title.add(new TooltipBehavior());
add(title);

// add(new AjaxEventBehavior("click") {
//
// @Override
// protected void onEvent(AjaxRequestTarget target) {
// FocusTilePanel.this.onClick(target);
// }
// });

Component details = createDetailsButton(ID_DETAILS);
add(details);
}

protected Component createDetailsButton(String id) {
return new AjaxLink<>(id) {

@Override
public void onClick(AjaxRequestTarget target) {
FocusTilePanel.this.onDetails(target);
}
};
}

protected void onDetails(AjaxRequestTarget target) {

}

protected void onClick(AjaxRequestTarget target) {
getModelObject().toggle();
target.add(this);
}

protected DisplayType createDisplayType(IModel<T> model) {
return null;
}

protected IModel<IResource> createPreferredImage(IModel<T> model) {
return null;
}

protected RoundedImagePanel getLogo() {
return (RoundedImagePanel) get(ID_LOGO);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!--
~ Copyright (c) 2010-2017 Evolveum
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="w-100 d-flex">
<div class="mr-auto">
<input class="btn p-0" wicket:id="check" type="checkbox"/>
</div>
<div class="ml-auto" wicket:id="menu"/>
</div>
<div class="btn p-0 logo mt-3" wicket:id="logo"/>

<div class="mt-4 gap-1 d-flex align-items-center justify-content-center w-100">
<i wicket:id="icon"/>
<div class="font-weight-bold text-truncate" wicket:id="title"/>
</div>

<div class="mt-2 d-flex align-items-center justify-content-center w-100">
<div wicket:id="tags">
<div class="mx-1 d-flex badge" wicket:id="tag">
<i wicket:id="tagIcon"/>
<div class="ml-1" wicket:id="tagLabel"/>
</div>
</div>
</div>

<div class="tile-description mt-2 text-center text-secondary flex-grow-1" style="display: -webkit-box; text-overflow: ellipsis;" wicket:id="description"/>
<div class="w-100 d-flex">
<a class="btn btn-outline-primary text-lightblue mt-3 mr-auto" wicket:id="details">
<i class="fa fa-pen-to-square mr-2"/>
<wicket:message key="MemberTilePanel.details"/>
</a>
<a class="btn btn-link mt-3 ml-auto" wicket:id="unassign">
<i class="fa fa-link-slash mr-2"/>
<wicket:message key="MemberTilePanel.unassign"/>
</a>
</div>
</wicket:panel>
</html>

0 comments on commit 9173f33

Please sign in to comment.