use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class PageUsers method createRowActions.
private List<InlineMenuItem> createRowActions(boolean isHeader) {
List<InlineMenuItem> menu = new ArrayList<InlineMenuItem>();
menu.add(new InlineMenuItem(createStringResource("pageUsers.menu.enable"), new Model<Boolean>(false), new Model<Boolean>(false), false, new ColumnMenuAction<SelectableBean<UserType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
if (getRowModel() == null) {
updateActivationPerformed(target, true, null);
} else {
SelectableBean<UserType> rowDto = getRowModel().getObject();
updateActivationPerformed(target, true, rowDto.getValue());
}
}
}, isHeader ? InlineMenuItem.FOCUS_LIST_INLINE_MENU_ITEM_ID.HEADER_ENABLE.getMenuItemId() : InlineMenuItem.FOCUS_LIST_INLINE_MENU_ITEM_ID.ENABLE.getMenuItemId(), GuiStyleConstants.CLASS_OBJECT_USER_ICON, DoubleButtonColumn.BUTTON_COLOR_CLASS.SUCCESS.toString()) {
private static final long serialVersionUID = 1L;
@Override
public boolean isShowConfirmationDialog() {
return PageUsers.this.isShowConfirmationDialog((ColumnMenuAction) getAction());
}
@Override
public IModel<String> getConfirmationMessageModel() {
String actionName = createStringResource("pageUsers.message.enableAction").getString();
return PageUsers.this.getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
}
});
menu.add(new InlineMenuItem(createStringResource("pageUsers.menu.disable"), isHeader ? new Model<Boolean>(true) : new Model<Boolean>(false), isHeader ? new Model<Boolean>(true) : new Model<Boolean>(false), false, new ColumnMenuAction<SelectableBean<UserType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
if (getRowModel() == null) {
updateActivationPerformed(target, false, null);
} else {
SelectableBean<UserType> rowDto = getRowModel().getObject();
updateActivationPerformed(target, false, rowDto.getValue());
}
}
}, isHeader ? InlineMenuItem.FOCUS_LIST_INLINE_MENU_ITEM_ID.HEADER_DISABLE.getMenuItemId() : InlineMenuItem.FOCUS_LIST_INLINE_MENU_ITEM_ID.DISABLE.getMenuItemId(), GuiStyleConstants.CLASS_OBJECT_USER_ICON, DoubleButtonColumn.BUTTON_COLOR_CLASS.DANGER.toString()) {
private static final long serialVersionUID = 1L;
@Override
public boolean isShowConfirmationDialog() {
return PageUsers.this.isShowConfirmationDialog((ColumnMenuAction) getAction());
}
@Override
public IModel<String> getConfirmationMessageModel() {
String actionName = createStringResource("pageUsers.message.disableAction").getString();
return PageUsers.this.getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
}
});
menu.add(new InlineMenuItem(createStringResource("pageUsers.menu.reconcile"), new Model<Boolean>(false), new Model<Boolean>(false), false, new ColumnMenuAction<SelectableBean<UserType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
if (getRowModel() == null) {
reconcilePerformed(target, null);
} else {
SelectableBean<UserType> rowDto = getRowModel().getObject();
reconcilePerformed(target, rowDto.getValue());
}
}
}, isHeader ? InlineMenuItem.FOCUS_LIST_INLINE_MENU_ITEM_ID.HEADER_RECONCILE.getMenuItemId() : InlineMenuItem.FOCUS_LIST_INLINE_MENU_ITEM_ID.RECONCILE.getMenuItemId(), GuiStyleConstants.CLASS_RECONCILE_MENU_ITEM, DoubleButtonColumn.BUTTON_COLOR_CLASS.INFO.toString()) {
private static final long serialVersionUID = 1L;
@Override
public boolean isShowConfirmationDialog() {
return PageUsers.this.isShowConfirmationDialog((ColumnMenuAction) getAction());
}
@Override
public IModel<String> getConfirmationMessageModel() {
String actionName = createStringResource("pageUsers.message.reconcileAction").getString();
return PageUsers.this.getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
}
});
menu.add(new InlineMenuItem(createStringResource("pageUsers.menu.unlock"), false, new ColumnMenuAction<SelectableBean<UserType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
if (getRowModel() == null) {
unlockPerformed(target, null);
} else {
SelectableBean<UserType> rowDto = getRowModel().getObject();
unlockPerformed(target, rowDto.getValue());
}
}
}, InlineMenuItem.FOCUS_LIST_INLINE_MENU_ITEM_ID.UNLOCK.getMenuItemId()) {
private static final long serialVersionUID = 1L;
@Override
public boolean isShowConfirmationDialog() {
return PageUsers.this.isShowConfirmationDialog((ColumnMenuAction) getAction());
}
@Override
public IModel<String> getConfirmationMessageModel() {
String actionName = createStringResource("pageUsers.message.unlockAction").getString();
return PageUsers.this.getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
}
});
menu.add(new InlineMenuItem(createStringResource("pageUsers.menu.delete"), false, new ColumnMenuAction<SelectableBean<UserType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
if (getRowModel() == null) {
deleteConfirmedPerformed(target, null);
} else {
SelectableBean<UserType> rowDto = getRowModel().getObject();
deleteConfirmedPerformed(target, rowDto.getValue());
}
}
}, InlineMenuItem.FOCUS_LIST_INLINE_MENU_ITEM_ID.DELETE.getMenuItemId()) {
private static final long serialVersionUID = 1L;
@Override
public boolean isShowConfirmationDialog() {
return PageUsers.this.isShowConfirmationDialog((ColumnMenuAction) getAction());
}
@Override
public IModel<String> getConfirmationMessageModel() {
String actionName = createStringResource("pageUsers.message.deleteAction").getString();
return PageUsers.this.getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
}
});
menu.add(new InlineMenuItem(createStringResource("pageUsers.menu.merge"), isHeader ? new Model<Boolean>(false) : new Model<Boolean>(true), isHeader ? new Model<Boolean>(false) : new Model<Boolean>(true), false, new ColumnMenuAction<SelectableBean<UserType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
if (getRowModel() == null) {
mergePerformed(target, null);
} else {
SelectableBean<UserType> rowDto = getRowModel().getObject();
mergePerformed(target, rowDto.getValue());
}
}
}, InlineMenuItem.FOCUS_LIST_INLINE_MENU_ITEM_ID.MERGE.getMenuItemId(), "", ""));
return menu;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class PageResources method initLayout.
protected void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<ResourceType> table = new MainObjectListPanel<ResourceType>(ID_TABLE, ResourceType.class, getQueryOptions()) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ResourceType object) {
clearSessionStorageForResourcePage();
super.objectDetailsPerformed(target, object);
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_RESOURCES;
}
@Override
protected List<IColumn<SelectableBean<ResourceType>, String>> createDefaultColumns() {
return PageResources.this.initResourceColumns();
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return PageResources.this.createRowMenuItems();
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
table.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_RESOURCE_BOX_CSS_CLASSES);
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem 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.InlineMenuItem in project midpoint by Evolveum.
the class ResourceContentPanel 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<SelectableBeanImpl<ShadowType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(AjaxRequestTarget target) {
if (getRowModel() == null) {
updateResourceObjectStatusPerformed(null, target, true);
} else {
SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
updateResourceObjectStatusPerformed(shadow.getValue(), target, true);
}
}
};
}
});
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.disableAccount"), 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) {
updateResourceObjectStatusPerformed(null, target, false);
} else {
SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
updateResourceObjectStatusPerformed(shadow.getValue(), target, false);
}
}
};
}
});
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.deleteAccount"), 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) {
deleteResourceObjectPerformed(null, target);
} else {
SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
deleteResourceObjectPerformed(shadow.getValue(), 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<SelectableBeanImpl<ShadowType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit(AjaxRequestTarget target) {
if (getRowModel() == null) {
changeOwner(null, target, null, Operation.REMOVE);
} else {
SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
changeOwner(shadow.getValue(), target, null, Operation.REMOVE);
}
}
};
}
});
items.add(new ButtonInlineMenuItem(createStringResource("pageContentAccounts.menu.changeOwner"), 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) {
final SelectableBeanImpl<ShadowType> shadow = getRowModel().getObject();
ObjectBrowserPanel<FocusType> browser = new ObjectBrowserPanel<>(getPageBase().getMainPopupBodyId(), UserType.class, WebComponentUtil.createFocusTypeList(), false, getPageBase()) {
@Override
protected void onSelectPerformed(AjaxRequestTarget target, FocusType focus) {
changeOwner(shadow.getValue(), target, focus, Operation.MODIFY);
}
};
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.InlineMenuItem in project midpoint by Evolveum.
the class ResourceContentPanel method initLayout.
private void initLayout() {
WebMarkupContainer totals = new WebMarkupContainer(ID_TOTALS);
totals.setOutputMarkupId(true);
add(totals);
initShadowStatistics(totals);
MainObjectListPanel<ShadowType> shadowListPanel = new MainObjectListPanel<>(ID_TABLE, ShadowType.class, createSearchOptions(), getPanelConfiguration()) {
private static final long serialVersionUID = 1L;
@Override
protected List<InlineMenuItem> createInlineMenu() {
return ResourceContentPanel.this.createRowMenuItems();
}
@Override
protected List<IColumn<SelectableBean<ShadowType>, String>> createDefaultColumns() {
return ResourceContentPanel.this.initColumns();
}
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ShadowType object) {
shadowDetailsPerformed(target, WebComponentUtil.getName(object), object.getOid());
}
@Override
protected boolean isCreateNewObjectEnabled() {
return false;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return ResourceContentPanel.this.getTableId();
}
@Override
public PageStorage getPageStorage() {
return getPageBase().getSessionStorage().getResourceContentStorage(kind, searchMode);
}
@Override
protected ISelectableDataProvider createProvider() {
provider = createSelectableBeanObjectDataProvider(() -> getResourceContentQuery(), null);
provider.setEmptyListOnNullQuery(true);
provider.setSort(null);
provider.setDefaultCountIfNull(Integer.MAX_VALUE);
return provider;
}
@Override
protected Search createSearch(Class<ShadowType> type) {
return ResourceContentPanel.this.createSearch();
}
@Override
protected CompiledObjectCollectionView getObjectCollectionView() {
CompiledShadowCollectionView compiledView = findContainerPanelConfig();
if (compiledView != null) {
return compiledView;
}
return super.getObjectCollectionView();
}
};
shadowListPanel.setOutputMarkupId(true);
shadowListPanel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return createQuery() != null;
}
});
shadowListPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_SHADOW_BOX_CSS_CLASSES);
add(shadowListPanel);
Label label = new Label(ID_LABEL, "Nothing to show. Select intent to search");
add(label);
label.setOutputMarkupId(true);
label.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return createQuery() == null;
}
});
initButton(ID_IMPORT, "Import", " fa-download", SystemObjectsType.ARCHETYPE_IMPORT_TASK.value());
initButton(ID_RECONCILIATION, "Reconciliation", " fa-link", SystemObjectsType.ARCHETYPE_RECONCILIATION_TASK.value());
initButton(ID_LIVE_SYNC, "Live Sync", " fa-refresh", SystemObjectsType.ARCHETYPE_LIVE_SYNC_TASK.value());
initCustomLayout();
}
Aggregations