Skip to content

Commit

Permalink
adding dropdown button for configuration and task operations on resou…
Browse files Browse the repository at this point in the history
…rce object type tab panel (MID-8827, MID-8800)
  • Loading branch information
skublik committed Aug 26, 2023
1 parent 30da7b2 commit 4da1314
Show file tree
Hide file tree
Showing 15 changed files with 502 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package com.evolveum.midpoint.gui.api.component.button;

import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction;
import com.evolveum.midpoint.web.component.menu.cog.*;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand All @@ -20,8 +20,6 @@
import org.apache.wicket.model.PropertyModel;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.menu.cog.MenuLinkPanel;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;

Expand Down Expand Up @@ -123,25 +121,47 @@ protected boolean visibleCaret() {
protected void populateMenuItem(String componentId, ListItem<InlineMenuItem> menuItem) {
menuItem.setRenderBodyOnly(true);

MenuLinkPanel menuItemBody = new MenuLinkPanel(componentId, menuItem.getModel()){
@Override
protected void onClick(AjaxRequestTarget target, InlineMenuItemAction action, IModel<InlineMenuItem> item) {
onBeforeClickMenuItem(target, action, item);
super.onClick(target, action, item);
}

@Override
protected void onSubmit(AjaxRequestTarget target, InlineMenuItemAction action, IModel<InlineMenuItem> item) {
onBeforeClickMenuItem(target, action, item);
super.onSubmit(target, action, item);
}
};
MenuLinkPanel menuItemBody;
if (showIcon() && menuItem.getModelObject() instanceof ButtonInlineMenuItem) {
IModel model = menuItem.getModel();
menuItemBody = new IconMenuLinkPanel(componentId, model) {
@Override
protected void onClick(AjaxRequestTarget target, InlineMenuItemAction action, IModel<ButtonInlineMenuItem> item) {
onBeforeClickMenuItem(target, action, item);
super.onClick(target, action, item);
}

@Override
protected void onSubmit(AjaxRequestTarget target, InlineMenuItemAction action, IModel<ButtonInlineMenuItem> item) {
onBeforeClickMenuItem(target, action, item);
super.onSubmit(target, action, item);
}
};
} else {
menuItemBody = new MenuLinkPanel<>(componentId, menuItem.getModel()) {
@Override
protected void onClick(AjaxRequestTarget target, InlineMenuItemAction action, IModel<InlineMenuItem> item) {
onBeforeClickMenuItem(target, action, item);
super.onClick(target, action, item);
}

@Override
protected void onSubmit(AjaxRequestTarget target, InlineMenuItemAction action, IModel<InlineMenuItem> item) {
onBeforeClickMenuItem(target, action, item);
super.onSubmit(target, action, item);
}
};
}
menuItemBody.setRenderBodyOnly(true);
menuItem.add(menuItemBody);
menuItem.add(new VisibleBehaviour(() -> menuItem.getModelObject().getVisible().getObject()));
}

protected void onBeforeClickMenuItem(AjaxRequestTarget target, InlineMenuItemAction action, IModel<InlineMenuItem> item) {
protected boolean showIcon() {
return false;
}

protected void onBeforeClickMenuItem(AjaxRequestTarget target, InlineMenuItemAction action, IModel<? extends InlineMenuItem> item) {
}

protected String getSpecialButtonClass() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected String getSpecialButtonClass() {
}

@Override
protected void onBeforeClickMenuItem(AjaxRequestTarget target, InlineMenuItemAction action, IModel<InlineMenuItem> item) {
protected void onBeforeClickMenuItem(AjaxRequestTarget target, InlineMenuItemAction action, IModel<? extends InlineMenuItem> item) {
if (action instanceof ColumnMenuAction) {
((ColumnMenuAction) action).setRowModel(() -> MemberTilePanel.this.getModelObject().getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,54 +151,52 @@ private boolean useNoFetchOption() {
return resource == null || StringUtils.isNotEmpty(resource.getOid());
}

public void showResourceObjectTypeBasicWizard(AjaxRequestTarget target, ItemPath pathToValue) {
ResourceObjectTypeBasicWizardPanel wizardPanel = showWizard(target, pathToValue, ResourceObjectTypeBasicWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
}

public void showResourceObjectTypePreviewWizard(AjaxRequestTarget target, ItemPath pathToValue) {
ResourceObjectTypeWizardPanel wizard = showObjectTypeWizard(target, pathToValue);
wizard.setShowObjectTypePreview(true);
}

public ResourceObjectTypeWizardPanel showObjectTypeWizard(AjaxRequestTarget target, ItemPath pathToValue) {
ResourceObjectTypeWizardPanel wizard =
showWizard(target, pathToValue, ResourceObjectTypeWizardPanel.class);
return wizard;
}

public void showResourceObjectTypeBasicWizard(AjaxRequestTarget target, ItemPath pathToValue) {
showContainerWizard(target, pathToValue, ResourceObjectTypeBasicWizardPanel.class);
}

public void showSynchronizationWizard(AjaxRequestTarget target, ItemPath pathToValue) {
SynchronizationWizardPanel wizardPanel = showWizard(target, pathToValue, SynchronizationWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
showContainerWizard(target, pathToValue, SynchronizationWizardPanel.class);
}

public void showAttributeMappingWizard(AjaxRequestTarget target, ItemPath pathToValue) {
showContainerWizard(target, pathToValue, AttributeMappingWizardPanel.class);
}

public void showCorrelationWizard(AjaxRequestTarget target, ItemPath pathToValue) {
CorrelationWizardPanel wizardPanel = showWizard(target, pathToValue, CorrelationWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
showContainerWizard(target, pathToValue, CorrelationWizardPanel.class);
}

public void showCapabilitiesWizard(AjaxRequestTarget target, ItemPath pathToValue) {
CapabilitiesWizardPanel wizardPanel = showWizard(target, pathToValue, CapabilitiesWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
showContainerWizard(target, pathToValue, CapabilitiesWizardPanel.class);
}

public void showCredentialsWizard(AjaxRequestTarget target, ItemPath pathToValue) {
CredentialsWizardPanel wizardPanel = showWizard(target, pathToValue, CredentialsWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
showContainerWizard(target, pathToValue, CredentialsWizardPanel.class);
}

public void showActivationsWizard(AjaxRequestTarget target, ItemPath pathToValue) {
ActivationsWizardPanel wizardPanel = showWizard(target, pathToValue, ActivationsWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
showContainerWizard(target, pathToValue, ActivationsWizardPanel.class);
}

public void showAssociationsWizard(AjaxRequestTarget target, ItemPath pathToValue) {
AssociationsWizardPanel wizardPanel = showWizard(target, pathToValue, AssociationsWizardPanel.class);
addWizardBreadcrumbsForObjectType(wizardPanel);
showContainerWizard(target, pathToValue, AssociationsWizardPanel.class);
}

public ResourceObjectTypeWizardPanel showObjectTypeWizard(AjaxRequestTarget target, ItemPath pathToValue) {
ResourceObjectTypeWizardPanel wizard =
showWizard(target, pathToValue, ResourceObjectTypeWizardPanel.class);
return wizard;
}

public void showAttributeMappingWizard(AjaxRequestTarget target, ItemPath pathToValue) {
AttributeMappingWizardPanel wizardPanel = showWizard(target, pathToValue, AttributeMappingWizardPanel.class);
private <P extends AbstractWizardPanel> void showContainerWizard(
AjaxRequestTarget target, ItemPath pathToValue, Class<P> wizardClass) {
P wizardPanel = (P) showWizard(target, pathToValue, wizardClass);
addWizardBreadcrumbsForObjectType(wizardPanel);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ public void onClick(AjaxRequestTarget target) {
private void initSychronizationButton(RepeatingView topButtons) {
AjaxIconButton synchConfButton = new AjaxIconButton(
topButtons.newChildId(),
Model.of(ResourceObjectTypePreviewTileType.SYNCHRONIZATION_CONFIG.getIcon()),
getPageBase().createStringResource(ResourceObjectTypePreviewTileType.SYNCHRONIZATION_CONFIG)) {
Model.of(ResourceObjectTypePreviewTileType.SYNCHRONIZATION.getIcon()),
getPageBase().createStringResource(ResourceObjectTypePreviewTileType.SYNCHRONIZATION)) {
@Override
public void onClick(AjaxRequestTarget target) {
IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel =
Expand All @@ -420,8 +420,8 @@ public void onClick(AjaxRequestTarget target) {
private void initCorrelationButton(RepeatingView topButtons) {
AjaxIconButton correlationConfButton = new AjaxIconButton(
topButtons.newChildId(),
Model.of(ResourceObjectTypePreviewTileType.CORRELATION_CONFIG.getIcon()),
getPageBase().createStringResource(ResourceObjectTypePreviewTileType.CORRELATION_CONFIG)) {
Model.of(ResourceObjectTypePreviewTileType.CORRELATION.getIcon()),
getPageBase().createStringResource(ResourceObjectTypePreviewTileType.CORRELATION)) {
@Override
public void onClick(AjaxRequestTarget target) {
IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel =
Expand All @@ -442,8 +442,8 @@ public void onClick(AjaxRequestTarget target) {
private void initCapabilitiesButton(RepeatingView topButtons) {
AjaxIconButton capabilitiesConfButton = new AjaxIconButton(
topButtons.newChildId(),
Model.of(ResourceObjectTypePreviewTileType.CAPABILITIES_CONFIG.getIcon()),
getPageBase().createStringResource(ResourceObjectTypePreviewTileType.CAPABILITIES_CONFIG)) {
Model.of(ResourceObjectTypePreviewTileType.CAPABILITIES.getIcon()),
getPageBase().createStringResource(ResourceObjectTypePreviewTileType.CAPABILITIES)) {
@Override
public void onClick(AjaxRequestTarget target) {
IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> valueModel =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
<h3 wicket:id="title"/>
<div wicket:id="objectType"/>
<div wicket:id="lifecycleState"/>
<div class="d-table">
<button wicket:id="configuration" class="btn btn-sm btn-primary mr-3"/>
<button wicket:id="createTask" class="btn btn-sm btn-default"/>
</div>
<div wicket:id="configuration"/>
<div wicket:id="tasks"/>
<div wicket:id="showStatistics" class="ml-auto"/>
</div>

Expand Down

0 comments on commit 4da1314

Please sign in to comment.