use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class ResourceContentPanel method createRowMenuItems.
@SuppressWarnings("serial")
private List<InlineMenuItem> createRowMenuItems() {
List<InlineMenuItem> items = new ArrayList<InlineMenuItem>();
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.enableAccount"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
SelectableBean<ShadowType> shadow = getRowModel().getObject();
updateResourceObjectStatusPerformed(shadow.getValue(), target, true);
}
}));
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.disableAccount"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
SelectableBean<ShadowType> shadow = getRowModel().getObject();
updateResourceObjectStatusPerformed(shadow.getValue(), target, false);
}
}));
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.deleteAccount"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
SelectableBean<ShadowType> shadow = getRowModel().getObject();
deleteResourceObjectPerformed(shadow.getValue(), target);
}
}));
items.add(new InlineMenuItem());
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.importAccount"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
SelectableBean<ShadowType> shadow = getRowModel().getObject();
importResourceObject(shadow.getValue(), target);
}
}));
items.add(new InlineMenuItem());
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.removeOwner"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
SelectableBean<ShadowType> shadow = getRowModel().getObject();
changeOwner(shadow.getValue(), target, null, Operation.REMOVE);
}
}));
items.add(new InlineMenuItem(createStringResource("pageContentAccounts.menu.changeOwner"), true, new ColumnMenuAction<SelectableBean<ShadowType>>() {
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
final SelectableBean<ShadowType> shadow = getRowModel().getObject();
ObjectBrowserPanel<FocusType> browser = new ObjectBrowserPanel<FocusType>(pageBase.getMainPopupBodyId(), UserType.class, WebComponentUtil.createFocusTypeList(), false, pageBase) {
@Override
protected void onSelectPerformed(AjaxRequestTarget target, FocusType focus) {
changeOwner(shadow.getValue(), target, focus, Operation.MODIFY);
}
};
pageBase.showMainPopup(browser, target);
}
}));
return items;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class ObjectListPanel method initProvider.
protected BaseSortableDataProvider<SelectableBean<O>> initProvider() {
Set<O> selectedObjectsSet = selectedObjects == null ? null : new HashSet<O>(selectedObjects);
SelectableBeanObjectDataProvider<O> provider = new SelectableBeanObjectDataProvider<O>(parentPage, type, selectedObjectsSet) {
private static final long serialVersionUID = 1L;
@Override
protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) {
String storageKey = getStorageKey();
if (StringUtils.isNotEmpty(storageKey)) {
PageStorage storage = getPageStorage(storageKey);
if (storage != null) {
storage.setPaging(paging);
}
}
}
@Override
public SelectableBean<O> createDataObjectWrapper(O obj) {
SelectableBean<O> bean = super.createDataObjectWrapper(obj);
List<InlineMenuItem> inlineMenu = createInlineMenu();
if (inlineMenu != null) {
bean.getMenuItems().addAll(inlineMenu);
}
return bean;
}
};
if (options == null) {
if (ResourceType.class.equals(type)) {
options = SelectorOptions.createCollection(GetOperationOptions.createNoFetch());
}
} else {
if (ResourceType.class.equals(type)) {
GetOperationOptions root = SelectorOptions.findRootOptions(options);
root.setNoFetch(Boolean.TRUE);
}
provider.setOptions(options);
}
provider.setQuery(getQuery());
return provider;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem in project midpoint by Evolveum.
the class UserDelegationsTabPanel method initLayout.
private void initLayout() {
WebMarkupContainer delegations = new WebMarkupContainer(ID_DELEGATIONS_CONTAINER);
delegations.setOutputMarkupId(true);
add(delegations);
AssignmentTablePanel panel = new AssignmentTablePanel<UserType>(ID_DELEGATIONS_PANEL, createStringResource("FocusType.delegations"), delegationsModel) {
private static final long serialVersionUID = 1L;
@Override
public void populateAssignmentDetailsPanel(ListItem<AssignmentEditorDto> item) {
DelegationEditorPanel editor = new DelegationEditorPanel(ID_ROW, item.getModel(), false, privilegesListModel, pageBase);
item.add(editor);
}
@Override
public String getExcludeOid() {
return getObjectWrapper().getOid();
}
@Override
protected List<InlineMenuItem> createAssignmentMenu() {
List<InlineMenuItem> items = new ArrayList<>();
InlineMenuItem item;
if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_DELEGATE_ACTION_URL)) {
item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.addDelegation"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<QName> supportedTypes = new ArrayList<>();
supportedTypes.add(UserType.COMPLEX_TYPE);
ObjectFilter filter = InOidFilter.createInOid(getObjectWrapper().getOid());
ObjectFilter notFilter = NotFilter.createNot(filter);
ObjectBrowserPanel<UserType> panel = new ObjectBrowserPanel<UserType>(pageBase.getMainPopupBodyId(), UserType.class, supportedTypes, false, pageBase, notFilter) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectPerformed(AjaxRequestTarget target, UserType user) {
pageBase.hideMainPopup(target);
List<ObjectType> newAssignmentsList = new ArrayList<>();
newAssignmentsList.add(user);
addSelectedAssignablePerformed(target, newAssignmentsList, getPageBase().getMainPopup().getId());
}
};
panel.setOutputMarkupId(true);
pageBase.showMainPopup(panel, target);
}
});
items.add(item);
}
if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_UNASSIGN_ACTION_URL)) {
item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.deleteDelegation"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
deleteAssignmentPerformed(target);
}
});
items.add(item);
}
return items;
}
@Override
protected String getNoAssignmentsSelectedMessage() {
return getString("AssignmentTablePanel.message.noDelegationsSelected");
}
@Override
protected String getAssignmentsDeleteMessage(int size) {
return createStringResource("AssignmentTablePanel.modal.message.deleteDelegation", size).getString();
}
@Override
protected void addSelectedAssignablePerformed(AjaxRequestTarget target, List<ObjectType> newAssignments, String popupId) {
ModalWindow window = (ModalWindow) get(popupId);
if (window != null) {
window.close(target);
}
getPageBase().hideMainPopup(target);
if (newAssignments.isEmpty()) {
warn(getString("AssignmentTablePanel.message.noAssignmentSelected"));
target.add(getPageBase().getFeedbackPanel());
return;
}
for (ObjectType object : newAssignments) {
try {
AssignmentEditorDto dto = AssignmentEditorDto.createDtoAddFromSelectedObject(((PrismObject<UserType>) getObjectWrapper().getObject()).asObjectable(), SchemaConstants.ORG_DEPUTY, getPageBase(), (UserType) object);
dto.setPrivilegeLimitationList(privilegesListModel.getObject());
delegationsModel.getObject().add(dto);
} catch (Exception e) {
error(getString("AssignmentTablePanel.message.couldntAssignObject", object.getName(), e.getMessage()));
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't assign object", e);
}
}
reloadAssignmentsPanel(target);
reloadMainFormButtons(target);
}
};
delegations.add(panel);
}
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 PageServices method initLayout.
private void initLayout() {
Form mainForm = new Form(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<ServiceType> servicePanel = new MainObjectListPanel<ServiceType>(ID_TABLE, ServiceType.class, TableId.TABLE_SERVICES, null, this) {
private static final long serialVersionUID = 1L;
@Override
public void objectDetailsPerformed(AjaxRequestTarget target, ServiceType service) {
PageServices.this.serviceDetailsPerformed(target, service);
}
@Override
protected List<IColumn<SelectableBean<ServiceType>, String>> createColumns() {
return ColumnUtils.getDefaultServiceColumns();
}
@Override
protected IColumn<SelectableBean<ServiceType>, String> createActionsColumn() {
return new InlineMenuButtonColumn<SelectableBean<ServiceType>>(listInlineMenuHelper.createRowActions(false), 3, PageServices.this) {
@Override
protected int getHeaderNumberOfButtons() {
return 2;
}
@Override
protected List<InlineMenuItem> getHeaderMenuItems() {
return listInlineMenuHelper.createRowActions(true);
}
};
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return listInlineMenuHelper.createRowActions(false);
}
@Override
protected void newObjectPerformed(AjaxRequestTarget target) {
navigateToNext(PageService.class);
}
};
servicePanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_SERVICE_BOX_CSS_CLASSES);
servicePanel.setOutputMarkupId(true);
mainForm.add(servicePanel);
}
Aggregations