-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding support for construction inducement in role wizard(application…
… role)
- Loading branch information
Showing
36 changed files
with
1,441 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...rc/main/java/com/evolveum/midpoint/gui/impl/component/tile/MultiSelectTileTablePanel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
<wicket:enclosure child="tilesContainer"> | ||
<div class="d-flex flex-column flex-grow-1"> | ||
<div wicket:id="tilesHeader"/> | ||
<div class="card d-flex flex-column p-3 mb-0 mt-4" style="min-height: 5.4rem;" wicket:id="selectedItemsContainer"> | ||
<span> | ||
<wicket:message key="SelectObjectClassesStepPanel.selectedItem"/> | ||
</span> | ||
<div class="d-inline-flex"> | ||
<wicket:container wicket:id="selectedItemContainer"> | ||
<div class="btn-sm btn-primary d-flex" style="cursor: auto;"> | ||
<div wicket:id="selectedItem"/> | ||
<a wicket:id="deselectButton"> | ||
<i class="fa fa-xmark ml-2 text-white"></i> | ||
</a> | ||
</div> | ||
</wicket:container> | ||
</div> | ||
</div> | ||
<div class="row pt-3" wicket:id="tilesContainer"> | ||
<div wicket:id="tiles" style="min-height: 250px;"> | ||
<div wicket:id="tile"/> | ||
</div> | ||
</div> | ||
<div class="d-flex" wicket:id="footerContainer"> | ||
<div class="d-flex"> | ||
<div wicket:id="buttonToolbar"/> | ||
</div> | ||
<div class="ml-auto align-self-end" wicket:id="tilesPaging"/> | ||
</div> | ||
</div> | ||
</wicket:enclosure> | ||
|
||
<div wicket:id="table"/> | ||
</wicket:panel> | ||
</html> |
102 changes: 102 additions & 0 deletions
102
...rc/main/java/com/evolveum/midpoint/gui/impl/component/tile/MultiSelectTileTablePanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package com.evolveum.midpoint.gui.impl.component.tile; | ||
|
||
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.TemplateTile; | ||
import com.evolveum.midpoint.web.component.AjaxButton; | ||
import com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider; | ||
import com.evolveum.midpoint.web.component.util.SelectableBean; | ||
import com.evolveum.midpoint.web.session.UserProfileStorage; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; | ||
|
||
import org.apache.wicket.Component; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.markup.html.list.ListItem; | ||
import org.apache.wicket.markup.html.list.ListView; | ||
import org.apache.wicket.model.IModel; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
public abstract class MultiSelectTileTablePanel<E extends Serializable, O extends ObjectType> extends SingleSelectTileTablePanel<O> { | ||
|
||
private static final String ID_SELECTED_ITEMS_CONTAINER = "selectedItemsContainer"; | ||
private static final String ID_SELECTED_ITEM_CONTAINER = "selectedItemContainer"; | ||
private static final String ID_SELECTED_ITEM = "selectedItem"; | ||
private static final String ID_DESELECT_BUTTON = "deselectButton"; | ||
|
||
public MultiSelectTileTablePanel( | ||
String id, | ||
UserProfileStorage.TableId tableId) { | ||
super(id, tableId); | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
initLayout(); | ||
} | ||
|
||
private void initLayout(){ | ||
WebMarkupContainer selectedItemsContainer = new WebMarkupContainer(ID_SELECTED_ITEMS_CONTAINER); | ||
selectedItemsContainer.setOutputMarkupId(true); | ||
add(selectedItemsContainer); | ||
|
||
ListView<E> selectedContainer = new ListView<>( | ||
ID_SELECTED_ITEM_CONTAINER, | ||
getSelectedItemsModel()) { | ||
|
||
@Override | ||
protected void populateItem(ListItem<E> item) { | ||
E entry = item.getModelObject(); | ||
|
||
item.add(new Label(ID_SELECTED_ITEM, getItemLabelModel(entry))); | ||
AjaxButton deselectButton = new AjaxButton(ID_DESELECT_BUTTON) { | ||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
deselectItem(entry); | ||
refresh(target); | ||
} | ||
}; | ||
item.add(deselectButton); | ||
} | ||
}; | ||
selectedContainer.setOutputMarkupId(true); | ||
selectedItemsContainer.add(selectedContainer); | ||
} | ||
|
||
@Override | ||
public void refresh(AjaxRequestTarget target) { | ||
super.refresh(target); | ||
target.add(get(ID_SELECTED_ITEMS_CONTAINER)); | ||
} | ||
|
||
protected abstract void deselectItem(E entry); | ||
|
||
protected abstract IModel<String> getItemLabelModel(E entry); | ||
|
||
protected abstract IModel<List<E>> getSelectedItemsModel(); | ||
|
||
@Override | ||
public SelectableBeanObjectDataProvider<O> getProvider() { | ||
return (SelectableBeanObjectDataProvider<O>) super.getProvider(); | ||
} | ||
|
||
@Override | ||
protected Component createTile(String id, IModel<TemplateTile<SelectableBean<O>>> model) { | ||
|
||
return new SelectableFocusTilePanel<>(id, model) { | ||
@Override | ||
protected void onClick(AjaxRequestTarget target) { | ||
super.onClick(target); | ||
getModelObject().getValue().setSelected(getModelObject().isSelected()); | ||
|
||
processSelectOrDeselectItem(getModelObject()); | ||
target.add(MultiSelectTileTablePanel.this.get(ID_SELECTED_ITEMS_CONTAINER)); | ||
} | ||
}; | ||
} | ||
|
||
protected void processSelectOrDeselectItem(TemplateTile<SelectableBean<O>> tile) { | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...src/main/java/com/evolveum/midpoint/gui/impl/component/tile/SelectableFocusTilePanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* 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.model.LoadableModel; | ||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.TemplateTile; | ||
import com.evolveum.midpoint.web.component.util.SelectableBean; | ||
import com.evolveum.midpoint.web.component.util.VisibleBehaviour; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; | ||
|
||
import org.apache.wicket.ajax.AjaxEventBehavior; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.behavior.AttributeAppender; | ||
import org.apache.wicket.behavior.Behavior; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.request.resource.IResource; | ||
|
||
/** | ||
* @author lskublik | ||
*/ | ||
public class SelectableFocusTilePanel<O extends ObjectType> extends FocusTilePanel<SelectableBean<O>, TemplateTile<SelectableBean<O>>> { | ||
|
||
public SelectableFocusTilePanel(String id, IModel<TemplateTile<SelectableBean<O>>> model) { | ||
super(id, model); | ||
} | ||
|
||
@Override | ||
protected void initLayout() { | ||
super.initLayout(); | ||
|
||
add(new AjaxEventBehavior("click") { | ||
@Override | ||
protected void onEvent(AjaxRequestTarget target) { | ||
onClick(target); | ||
} | ||
}); | ||
|
||
add(AttributeAppender.append("class", "card catalog-tile-panel d-flex flex-column align-items-center bordered p-3 h-100 mb-0 selectable")); | ||
add(AttributeAppender.append("class", () -> getModelObject().isSelected() ? "active" : null)); | ||
} | ||
|
||
@Override | ||
protected Behavior createDetailsBehaviour() { | ||
return VisibleBehaviour.ALWAYS_INVISIBLE; | ||
} | ||
|
||
@Override | ||
protected IModel<IResource> createPreferredImage(IModel<TemplateTile<SelectableBean<O>>> model) { | ||
return new LoadableModel<>(false) { | ||
@Override | ||
protected IResource load() { | ||
O object = model.getObject().getValue().getValue(); | ||
if (object instanceof FocusType) { | ||
return WebComponentUtil.createJpegPhotoResource((FocusType) object); | ||
} | ||
return null; | ||
} | ||
}; | ||
} | ||
} |
Oops, something went wrong.