use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction in project midpoint by Evolveum.
the class FocusProjectionsPanel method createShadowMenu.
private List<InlineMenuItem> createShadowMenu() {
List<InlineMenuItem> items = new ArrayList<>();
PrismObjectDefinition<F> def = getObjectWrapperModel().getObject().getObject().getDefinition();
PrismReferenceDefinition ref = def.findReferenceDefinition(UserType.F_LINK_REF);
InlineMenuItem item;
PrismPropertyDefinition<ActivationStatusType> administrativeStatus = def.findPropertyDefinition(SchemaConstants.PATH_ACTIVATION_ADMINISTRATIVE_STATUS);
if (administrativeStatus.canRead() && administrativeStatus.canModify()) {
item = new ButtonInlineMenuItem(createStringResource("pageAdminFocus.button.enable")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
updateShadowActivation(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()), true);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-check");
}
};
items.add(item);
item = new InlineMenuItem(createStringResource("pageAdminFocus.button.disable")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
updateShadowActivation(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()), false);
}
};
}
};
items.add(item);
}
if (ref.canRead() && ref.canAdd()) {
item = new InlineMenuItem(createStringResource("pageAdminFocus.button.unlink")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
unlinkProjectionPerformed(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()));
}
};
}
};
items.add(item);
}
PrismPropertyDefinition<LockoutStatusType> locakoutStatus = def.findPropertyDefinition(SchemaConstants.PATH_ACTIVATION_LOCKOUT_STATUS);
if (locakoutStatus.canRead() && locakoutStatus.canModify()) {
item = new InlineMenuItem(createStringResource("pageAdminFocus.button.unlock")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
unlockShadowPerformed(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()));
}
};
}
};
items.add(item);
}
if (administrativeStatus.canRead() && administrativeStatus.canModify()) {
// items.add(new InlineMenuItem());
item = new InlineMenuItem(createStringResource("pageAdminFocus.button.delete")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
deleteProjectionPerformed(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()));
}
};
}
};
items.add(item);
}
item = new ButtonInlineMenuItem(createStringResource("PageBase.button.edit")) {
private static final long serialVersionUID = 1L;
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_EDIT_MENU_ITEM);
}
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
getMultivalueContainerListPanel().editItemPerformed(target, getRowModel(), getMultivalueContainerListPanel().getSelectedObjects());
target.add(getPageBase().getFeedbackPanel());
}
};
}
};
items.add(item);
return items;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction in project midpoint by Evolveum.
the class ShadowTablePanel method createRowMenuItems.
private List<InlineMenuItem> createRowMenuItems() {
List<InlineMenuItem> items = new ArrayList<>();
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.enableAccount"), true) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<ShadowType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(AjaxRequestTarget target) {
updateResourceObjectStatusPerformed(getRowModel(), target, true);
}
};
}
});
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.disableAccount"), true) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<ShadowType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(AjaxRequestTarget target) {
updateResourceObjectStatusPerformed(getRowModel(), target, false);
}
};
}
});
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.deleteAccount"), true) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<ShadowType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(AjaxRequestTarget target) {
deleteResourceObjectPerformed(getRowModel(), target);
}
};
}
});
items.add(new ButtonInlineMenuItem(createStringResource("pageContentAccounts.menu.importAccount"), true) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ShadowType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(AjaxRequestTarget target) {
if (getRowModel() == null) {
importResourceObject(null, target);
} else {
SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
importResourceObject(shadow.getValue(), target);
}
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_IMPORT_MENU_ITEM);
}
});
// items.add(new InlineMenuItem());
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.removeOwner"), true) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<ShadowType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(AjaxRequestTarget target) {
changeOwner(getRowModel(), target, null, true);
}
};
}
});
items.add(new ButtonInlineMenuItem(createStringResource("pageContentAccounts.menu.changeOwner"), true) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<ShadowType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(AjaxRequestTarget target) {
ObjectBrowserPanel<FocusType> browser = new ObjectBrowserPanel<>(getPageBase().getMainPopupBodyId(), UserType.class, WebComponentUtil.createFocusTypeList(), false, getPageBase()) {
@Override
protected void onSelectPerformed(AjaxRequestTarget target, FocusType focus) {
changeOwner(getRowModel(), target, focus, false);
}
};
getPageBase().showMainPopup(browser, target);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_RECONCILE_MENU_ITEM);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
return items;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction in project midpoint by Evolveum.
the class PageUsers method createRowActions.
private List<InlineMenuItem> createRowActions() {
List<InlineMenuItem> menu = new ArrayList<>();
ButtonInlineMenuItem enableItem = new ButtonInlineMenuItem(createStringResource("pageUsers.menu.enable")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<UserType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
updateActivationPerformed(target, true, getRowModel());
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_OBJECT_USER_ICON);
}
@Override
public IModel<String> getConfirmationMessageModel() {
String actionName = createStringResource("pageUsers.message.enableAction").getString();
return getTable().getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
}
};
enableItem.setVisibilityChecker(FocusListInlineMenuHelper::isObjectDisabled);
menu.add(enableItem);
ButtonInlineMenuItem disableItem = new ButtonInlineMenuItem(createStringResource("pageUsers.menu.disable")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<UserType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
updateActivationPerformed(target, false, getRowModel());
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
CompositedIconBuilder builder = getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_OBJECT_USER_ICON);
builder.appendLayerIcon(WebComponentUtil.createIconType(GuiStyleConstants.CLASS_BAN), IconCssStyle.BOTTOM_RIGHT_STYLE);
return builder;
}
@Override
public IModel<String> getConfirmationMessageModel() {
String actionName = createStringResource("pageUsers.message.disableAction").getString();
return getTable().getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
}
};
disableItem.setVisibilityChecker(FocusListInlineMenuHelper::isObjectEnabled);
menu.add(disableItem);
menu.add(new ButtonInlineMenuItem(createStringResource("pageUsers.menu.reconcile")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<UserType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
reconcilePerformed(target, getRowModel());
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_RECONCILE_MENU_ITEM);
}
@Override
public IModel<String> getConfirmationMessageModel() {
String actionName = createStringResource("pageUsers.message.reconcileAction").getString();
return getTable().getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
}
});
menu.add(new InlineMenuItem(createStringResource("pageUsers.menu.unlock")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<UserType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
unlockPerformed(target, getRowModel());
}
};
}
@Override
public IModel<String> getConfirmationMessageModel() {
String actionName = createStringResource("pageUsers.message.unlockAction").getString();
return getTable().getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
}
});
menu.add(getTable().createDeleteInlineMenu());
// TODO: shouldn't be visible only if supported?
menu.add(new InlineMenuItem(createStringResource("pageUsers.menu.merge")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<UserType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
OperationResult result = new OperationResult(OPERATION_LOAD_MERGE_CONFIGURATION);
List<MergeConfigurationType> mergeConfiguration;
try {
mergeConfiguration = getModelInteractionService().getMergeConfiguration(result);
} catch (ObjectNotFoundException | SchemaException ex) {
LOGGER.error("Couldn't load merge configuration: {}", ex.getLocalizedMessage());
result.recomputeStatus();
getFeedbackMessages().error(PageUsers.this, ex.getLocalizedMessage());
target.add(getFeedbackPanel());
return;
}
if (mergeConfiguration == null || mergeConfiguration.size() == 0) {
getFeedbackMessages().warn(PageUsers.this, createStringResource("PageUsers.noMergeConfigurationMessage").getString());
target.add(getFeedbackPanel());
return;
}
if (getRowModel() == null) {
mergePerformed(target, null);
} else {
SelectableBean<UserType> rowDto = getRowModel().getObject();
mergePerformed(target, rowDto.getValue());
}
}
};
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
return menu;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction in project midpoint by Evolveum.
the class PageResources method createRowMenuItems.
private List<InlineMenuItem> createRowMenuItems() {
List<InlineMenuItem> menuItems = new ArrayList<>();
menuItems.add(new ButtonInlineMenuItem(createStringResource("PageResources.inlineMenuItem.test")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
testResourcePerformed(target, rowDto.getValue());
}
};
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_TEST_CONNECTION_MENU_ITEM);
}
});
menuItems.add(new ButtonInlineMenuItem(createStringResource("pageResources.button.editAsXml")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
editAsXmlPerformed(rowDto.getValue());
}
};
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_EDIT_MENU_ITEM);
}
});
menuItems.add(new InlineMenuItem(createStringResource("pageResources.inlineMenuItem.editResource")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
editResourcePerformed(rowDto.getValue());
}
};
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
menuItems.add(new InlineMenuItem(createStringResource("pageResource.button.refreshSchema")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
refreshSchemaPerformed(rowDto.getValue(), target);
}
};
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
menuItems.add(new ButtonInlineMenuItem(createStringResource("PageBase.button.delete")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
if (getRowModel() == null) {
deleteResourcePerformed(target, null);
} else {
SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
deleteResourcePerformed(target, rowDto.getValue());
}
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_DELETE_MENU_ITEM);
}
});
menuItems.add(new InlineMenuItem(createStringResource("pageResources.inlineMenuItem.deleteSyncToken")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
deleteResourceSyncTokenPerformed(target, rowDto.getValue());
}
};
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
menuItems.add(new InlineMenuItem(createStringResource("pageResources.inlineMenuItem.toggleMaintenance")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ResourceType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBeanImpl<ResourceType> rowDto = getRowModel().getObject();
WebComponentUtil.toggleResourceMaintenance(rowDto.getValue().asPrismContainer(), OPERATION_SET_MAINTENANCE, target, PageResources.this);
target.add(getResourceTable());
}
};
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
return menuItems;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction in project midpoint by Evolveum.
the class ResourceContentPanel method initButton.
private void initButton(String id, String label, String icon, String archetypeOid) {
ObjectQuery existingTasksQuery = getExistingTasksQuery(archetypeOid);
OperationResult result = new OperationResult(OPERATION_SEARCH_TASKS_FOR_RESOURCE);
List<PrismObject<TaskType>> tasksList = WebModelServiceUtils.searchObjects(TaskType.class, existingTasksQuery, result, getPageBase());
List<InlineMenuItem> items = new ArrayList<>();
InlineMenuItem item = new InlineMenuItem(getPageBase().createStringResource("ResourceContentResourcePanel.showExisting")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<TaskType> filteredByKindIntentTasks = getTasksForKind(tasksList);
redirectToTasksListPage(createInTaskOidQuery(filteredByKindIntentTasks), archetypeOid);
}
};
}
};
items.add(item);
item = new InlineMenuItem(getPageBase().createStringResource("ResourceContentResourcePanel.newTask")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
newTaskPerformed(target, archetypeOid);
}
};
}
};
items.add(item);
DropdownButtonPanel button = new DropdownButtonPanel(id, new DropdownButtonDto(String.valueOf(tasksList.size()), icon, label, items)) {
@Override
protected String getSpecialDropdownMenuClass() {
return "pull-left";
}
};
add(button);
}
Aggregations