-
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.
Merge branch 'master' into feature/smart-correlation-prototype
- Loading branch information
Showing
81 changed files
with
2,556 additions
and
615 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
25 changes: 25 additions & 0 deletions
25
...rc/main/java/com/evolveum/midpoint/gui/api/component/wizard/AbstractWizardBasicPanel.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,25 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
|
||
<!-- | ||
~ Copyright (c) 2022 Evolveum | ||
~ | ||
~ This work is dual-licensed under the Apache License 2.0 | ||
~ and European Union Public License. See LICENSE file for details. | ||
--> | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:wicket="http://wicket.apache.org"> | ||
<body> | ||
<wicket:panel> | ||
<div class="d-flex flex-column gap-3 align-items-center mt-5"> | ||
<h2 class="mb-3" wicket:id="text"/> | ||
<h5 class="text-secondary mb-5" wicket:id="subText"/> | ||
<div class="col-12"> | ||
<wicket:child/> | ||
</div> | ||
<div class="d-flex gap-3 justify-content-center"> | ||
<a class="btn" wicket:id="buttons"/> | ||
</div> | ||
</div> | ||
</wicket:panel> | ||
</body> | ||
</html> |
83 changes: 83 additions & 0 deletions
83
...rc/main/java/com/evolveum/midpoint/gui/api/component/wizard/AbstractWizardBasicPanel.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,83 @@ | ||
/* | ||
* 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.api.component.wizard; | ||
|
||
import com.evolveum.midpoint.gui.api.component.BasePanel; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel; | ||
import com.evolveum.midpoint.web.component.AjaxIconButton; | ||
import com.evolveum.midpoint.web.component.util.VisibleBehaviour; | ||
import com.evolveum.midpoint.web.page.admin.resources.PageResources; | ||
|
||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.behavior.AttributeAppender; | ||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.markup.repeater.RepeatingView; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.Model; | ||
|
||
public abstract class AbstractWizardBasicPanel extends BasePanel { | ||
|
||
private static final String ID_TEXT = "text"; | ||
private static final String ID_SUBTEXT = "subText"; | ||
private static final String ID_BUTTONS = "buttons"; | ||
|
||
private final ResourceDetailsModel resourceModel; | ||
public AbstractWizardBasicPanel(String id, ResourceDetailsModel resourceModel) { | ||
super(id); | ||
this.resourceModel = resourceModel; | ||
} | ||
|
||
public ResourceDetailsModel getResourceModel() { | ||
return resourceModel; | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
initLayout(); | ||
} | ||
|
||
private void initLayout() { | ||
|
||
Label mainText = new Label(ID_TEXT, getTextModel()); | ||
mainText.add(new VisibleBehaviour(() -> getTextModel().getObject() != null)); | ||
add(mainText); | ||
|
||
Label secondaryText = new Label(ID_SUBTEXT, getSubTextModel()); | ||
secondaryText.add(new VisibleBehaviour(() -> getSubTextModel().getObject() != null)); | ||
add(secondaryText); | ||
|
||
RepeatingView buttons = new RepeatingView(ID_BUTTONS); | ||
|
||
AjaxIconButton exit = new AjaxIconButton( | ||
buttons.newChildId(), | ||
Model.of("fa fa-right-from-bracket"), | ||
getPageBase().createStringResource("ResourceWizard.exit")) { | ||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
onExitPerformed(target); | ||
} | ||
}; | ||
exit.showTitleAsLabel(true); | ||
exit.add(AttributeAppender.append("class", "btn btn-outline-primary")); | ||
buttons.add(exit); | ||
|
||
addCustomButtons(buttons); | ||
add(buttons); | ||
} | ||
|
||
protected void onExitPerformed(AjaxRequestTarget target) { | ||
getPageBase().navigateToNext(PageResources.class); | ||
} | ||
|
||
protected void addCustomButtons(RepeatingView buttons) { | ||
} | ||
|
||
protected abstract IModel<String> getSubTextModel(); | ||
|
||
protected abstract IModel<String> getTextModel(); | ||
} |
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
7 changes: 7 additions & 0 deletions
7
gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/wizard/TileEnum.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,7 @@ | ||
package com.evolveum.midpoint.gui.api.component.wizard; | ||
|
||
import java.io.Serializable; | ||
|
||
public interface TileEnum extends Serializable { | ||
String getIcon(); | ||
} |
20 changes: 20 additions & 0 deletions
20
...n-gui/src/main/java/com/evolveum/midpoint/gui/api/component/wizard/WizardChoicePanel.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,20 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
|
||
<!-- | ||
~ Copyright (c) 2022 Evolveum | ||
~ | ||
~ This work is dual-licensed under the Apache License 2.0 | ||
~ and European Union Public License. See LICENSE file for details. | ||
--> | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:wicket="http://wicket.apache.org"> | ||
<body> | ||
<wicket:extend> | ||
<div class="request-access-wizard d-flex flex-wrap gap-3 justify-content-center"> | ||
<wicket:container wicket:id="list"> | ||
<div class="card mb-0 simple-tile selectable" wicket:id="tile"/> | ||
</wicket:container> | ||
</div> | ||
</wicket:extend> | ||
</body> | ||
</html> |
89 changes: 89 additions & 0 deletions
89
...n-gui/src/main/java/com/evolveum/midpoint/gui/api/component/wizard/WizardChoicePanel.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,89 @@ | ||
/* | ||
* 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.api.component.wizard; | ||
|
||
import com.evolveum.midpoint.gui.api.model.LoadableModel; | ||
import com.evolveum.midpoint.gui.impl.component.tile.Tile; | ||
import com.evolveum.midpoint.gui.impl.component.tile.TilePanel; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel; | ||
|
||
import org.apache.commons.lang3.Validate; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.markup.html.list.ListItem; | ||
import org.apache.wicket.markup.html.list.ListView; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public abstract class WizardChoicePanel<T extends TileEnum> extends AbstractWizardBasicPanel { | ||
|
||
private static final String ID_LIST = "list"; | ||
private static final String ID_TILE = "tile"; | ||
|
||
private LoadableModel<List<Tile<T>>> tiles; | ||
|
||
private final Class<T> tileTypeClass; | ||
|
||
/** | ||
* @param tileTypeClass have to be Enum class | ||
**/ | ||
public WizardChoicePanel(String id, ResourceDetailsModel resourceModel, Class<T> tileTypeClass) { | ||
super(id, resourceModel); | ||
Validate.isAssignableFrom(Enum.class, tileTypeClass); | ||
this.tileTypeClass = tileTypeClass; | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
initModels(); | ||
initLayout(); | ||
} | ||
|
||
private void initModels() { | ||
tiles = new LoadableModel<>(false) { | ||
|
||
@Override | ||
protected List<Tile<T>> load() { | ||
List<Tile<T>> list = new ArrayList<>(); | ||
|
||
for (T type : tileTypeClass.getEnumConstants()) { | ||
Tile tile = new Tile(type.getIcon(), getString((Enum) type)); | ||
tile.setValue(type); | ||
list.add(tile); | ||
} | ||
addDefaultTile(list); | ||
|
||
return list; | ||
} | ||
}; | ||
} | ||
|
||
protected void addDefaultTile(List<Tile<T>> list) { | ||
} | ||
|
||
private void initLayout() { | ||
ListView<Tile<T>> list = new ListView<>(ID_LIST, tiles) { | ||
|
||
@Override | ||
protected void populateItem(ListItem<Tile<T>> item) { | ||
TilePanel tp = new TilePanel(ID_TILE, item.getModel()) { | ||
|
||
@Override | ||
protected void onClick(AjaxRequestTarget target) { | ||
Tile<T> tile = item.getModelObject(); | ||
onTileClick(tile.getValue(), target); | ||
} | ||
}; | ||
item.add(tp); | ||
} | ||
}; | ||
add(list); | ||
} | ||
|
||
protected abstract void onTileClick(T value, AjaxRequestTarget target); | ||
} |
Oops, something went wrong.