use of com.evolveum.midpoint.gui.api.component.TypedAssignablePanel in project midpoint by Evolveum.
the class AssignmentTablePanel method createAssignmentMenu.
protected List<InlineMenuItem> createAssignmentMenu() {
List<InlineMenuItem> items = new ArrayList<>();
InlineMenuItem item;
if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ASSIGN_ACTION_URL)) {
item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.assign"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
TypedAssignablePanel panel = new TypedAssignablePanel(getPageBase().getMainPopupBodyId(), RoleType.class, true, getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, List selected) {
super.addPerformed(target, selected);
addSelectedAssignablePerformed(target, selected, getPageBase().getMainPopup().getId());
reloadMainFormButtons(target);
}
};
panel.setOutputMarkupId(true);
getPageBase().showMainPopup(panel, target);
}
});
items.add(item);
item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.assignOrg"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
int count = WebModelServiceUtils.countObjects(OrgType.class, null, getPageBase());
if (count > 0) {
OrgTreeAssignablePanel orgTreePanel = new OrgTreeAssignablePanel(getPageBase().getMainPopupBodyId(), true, getPageBase()) {
private static final long serialVersionUID = 1L;
@Override
protected void assignSelectedOrgPerformed(List<OrgType> selectedOrgs, AjaxRequestTarget target) {
// TODO Auto-generated method stub
addSelectedAssignablePerformed(target, (List) selectedOrgs, getPageBase().getMainPopup().getId());
reloadMainFormButtons(target);
}
};
orgTreePanel.setOutputMarkupId(true);
getPageBase().showMainPopup(orgTreePanel, target);
} else {
warn(createStringResource("AssignmentTablePanel.menu.assignOrg.noorgs").getString());
target.add(getPageBase().getFeedbackPanel());
}
}
});
items.add(item);
items.add(new InlineMenuItem());
}
if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_UNASSIGN_ACTION_URL)) {
item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.unassign"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AssignmentTablePanel.this.deleteAssignmentPerformed(target);
}
});
items.add(item);
}
item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.showAllAssignments"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
showAllAssignments(target);
}
});
items.add(item);
return items;
}
Aggregations