use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction in project midpoint by Evolveum.
the class OrgTreePanel method createTreeMenuInternal.
private List<InlineMenuItem> createTreeMenuInternal() {
List<InlineMenuItem> items = new ArrayList<>();
InlineMenuItem item = new InlineMenuItem(createStringResource("TreeTablePanel.collapseAll"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
collapseAllPerformed(target);
}
});
items.add(item);
item = new InlineMenuItem(createStringResource("TreeTablePanel.expandAll"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
expandAllPerformed(target);
}
});
items.add(item);
List<InlineMenuItem> additionalActions = createTreeMenu();
if (additionalActions != null) {
items.addAll(additionalActions);
}
return items;
}
use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction 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);
}
Aggregations