-
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.
MID-9514: adding button for creating of new task on unrecognized reso…
…urce objects
- Loading branch information
Showing
14 changed files
with
716 additions
and
486 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
108 changes: 108 additions & 0 deletions
108
.../src/main/java/com/evolveum/midpoint/gui/impl/page/admin/AbstractTemplateChoicePanel.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,108 @@ | ||
/* | ||
* Copyright (C) 2010-2024 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.page.admin; | ||
|
||
import com.evolveum.midpoint.gui.api.util.LocalizationUtil; | ||
import com.evolveum.midpoint.gui.impl.component.tile.Tile; | ||
import com.evolveum.midpoint.gui.impl.component.tile.TilePanel; | ||
import com.evolveum.midpoint.gui.impl.component.wizard.WizardChoicePanel; | ||
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel; | ||
import com.evolveum.midpoint.schema.util.ObjectTypeUtil; | ||
import com.evolveum.midpoint.web.component.util.VisibleBehaviour; | ||
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; | ||
|
||
import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentHolderType; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.wicket.Component; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.apache.wicket.model.IModel; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.xml.namespace.QName; | ||
import java.io.Serializable; | ||
|
||
/** | ||
* Abstract class for panels with tiles for choice of object template. | ||
*/ | ||
public abstract class AbstractTemplateChoicePanel<T extends Serializable> extends WizardChoicePanel<T, AssignmentHolderDetailsModel<AssignmentHolderType>> { | ||
|
||
public AbstractTemplateChoicePanel(String id) { | ||
super(id); | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
if (isSelectable()) { | ||
setOutputMarkupId(true); | ||
} | ||
} | ||
|
||
@Override | ||
protected Component createTilePanel(String id, IModel<Tile<T>> tileModel) { | ||
return new TilePanel<>(id, tileModel) { | ||
|
||
@Override | ||
protected WebMarkupContainer createIconPanel(String idIcon) { | ||
return AbstractTemplateChoicePanel.this.createIconPanel(tileModel, idIcon); | ||
} | ||
|
||
protected VisibleEnableBehaviour getDescriptionBehaviour() { | ||
return new VisibleBehaviour(() -> StringUtils.isNotEmpty(tileModel.getObject().getDescription())); | ||
} | ||
|
||
@Override | ||
protected void onClick(AjaxRequestTarget target) { | ||
Tile<T> selectedTile = tileModel.getObject(); | ||
if (isSelectable()) { | ||
getTilesModel().getObject().forEach(tile -> tile.setSelected(false)); | ||
selectedTile.setSelected(true); | ||
target.add(AbstractTemplateChoicePanel.this); | ||
} | ||
onTemplateChosePerformed(selectedTile.getValue(), target); | ||
} | ||
}; | ||
} | ||
|
||
protected abstract WebMarkupContainer createIconPanel(IModel<Tile<T>> tileModel, String idIcon); | ||
|
||
protected boolean isSelectable() { | ||
return false; | ||
} | ||
|
||
protected abstract void onTemplateChosePerformed(T view, AjaxRequestTarget target); | ||
|
||
@Override | ||
protected @NotNull IModel<String> getBreadcrumbLabel() { | ||
return () -> ""; | ||
} | ||
|
||
@Override | ||
protected boolean isExitButtonVisible() { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected IModel<String> getTextModel() { | ||
return createStringResource( | ||
"TemplateChoicePanel.text", | ||
LocalizationUtil.translateMessage( | ||
ObjectTypeUtil.createTypeDisplayInformation(getType(), false))); | ||
} | ||
|
||
protected abstract QName getType(); | ||
|
||
@Override | ||
protected IModel<String> getSubTextModel() { | ||
return createStringResource( | ||
"TemplateChoicePanel.subText", | ||
LocalizationUtil.translateMessage( | ||
ObjectTypeUtil.createTypeDisplayInformation(getType(), false))); | ||
} | ||
} |
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
Oops, something went wrong.