use of com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem in project midpoint by Evolveum.
the class PageWorkItemsClaimable method createRowActions.
@Override
protected List<InlineMenuItem> createRowActions() {
List<InlineMenuItem> menu = new ArrayList<>();
menu.add(new ButtonInlineMenuItem(createStringResource("pageWorkItem.button.claim")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
claimWorkItemPerformed(getRowModel(), target);
}
};
}
@Override
public IModel<Boolean> getEnabled() {
IModel<PrismContainerValueWrapper<CaseWorkItemType>> rowModel = ((ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>) getAction()).getRowModel();
if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getRealValue() != null) {
CaseWorkItemType workItem = rowModel.getObject().getRealValue();
return Model.of(CaseWorkItemUtil.isCaseWorkItemNotClosed(workItem));
} else {
return super.getEnabled();
}
}
@Override
public IModel<String> getConfirmationMessageModel() {
return createStringResource("CaseWorkItemsPanel.confirmWorkItemsClaimAction");
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_ICON_CLAIM);
}
});
return menu;
}
use of com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem in project midpoint by Evolveum.
the class UserPersonasPanel method initLayout.
protected void initLayout() {
MainObjectListPanel<UserType> userListPanel = new MainObjectListPanel<UserType>(ID_PERSONAS_TABLE, UserType.class, null) {
private static final long serialVersionUID = 1L;
@Override
protected IColumn<SelectableBean<UserType>, String> createCheckboxColumn() {
return null;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
List<InlineMenuItem> menuItems = new ArrayList<>();
menuItems.add(new ButtonInlineMenuItem(createStringResource("AssignmentPanel.viewTargetObject")) {
private static final long serialVersionUID = 1L;
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_NAVIGATE_ARROW);
}
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<UserType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBean<UserType> personaRefSelectableBean = getRowModel().getObject();
UserType personaRefObj = personaRefSelectableBean.getValue();
ObjectReferenceType ort = new ObjectReferenceType();
ort.setOid(personaRefObj.getOid());
ort.setType(WebComponentUtil.classToQName(UserPersonasPanel.this.getPrismContext(), personaRefObj.getClass()));
WebComponentUtil.dispatchToObjectDetailsPage(ort, UserPersonasPanel.this, false);
}
};
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
return menuItems;
}
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, UserType object) {
}
@Override
protected boolean isCreateNewObjectEnabled() {
return false;
}
@Override
protected ISelectableDataProvider<UserType, SelectableBean<UserType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> getFocusPersonasQuery(), null);
}
// @Override
// protected ObjectQuery getCustomizeContentQuery() {
//
// }
@Override
protected boolean isObjectDetailsEnabled(IModel<SelectableBean<UserType>> rowModel) {
return false;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return null;
}
@Override
protected boolean enableSavePageSize() {
return false;
}
};
userListPanel.setOutputMarkupId(true);
add(userListPanel);
}
use of com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem in project midpoint by Evolveum.
the class ObjectTemplateItemPanel method createAdditionalColumns.
@Override
protected List<IColumn<PrismContainerValueWrapper<ObjectTemplateItemDefinitionType>, String>> createAdditionalColumns() {
List<IColumn<PrismContainerValueWrapper<ObjectTemplateItemDefinitionType>, String>> columns = new ArrayList<>();
columns.add(new AbstractColumn<>(createStringResource("ObjectTemplateItemDefinitionType.mapping")) {
@Override
public void populateItem(Item<ICellPopulator<PrismContainerValueWrapper<ObjectTemplateItemDefinitionType>>> cellItem, String componentId, IModel<PrismContainerValueWrapper<ObjectTemplateItemDefinitionType>> rowModel) {
IModel<PrismContainerWrapper<MappingType>> mappingModel = PrismContainerWrapperModel.fromContainerValueWrapper(rowModel, ObjectTemplateItemDefinitionType.F_MAPPING);
cellItem.add(new MappingColumnPanel(componentId, mappingModel));
}
});
List<InlineMenuItem> items = new ArrayList<>();
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) {
getMultivalueContainerListPanel().deleteItemPerformed(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().getSelectedItems());
target.add(getMultivalueContainerListPanel().getFeedbackPanel());
}
};
}
};
items.add(item);
columns.add(new InlineMenuButtonColumn(items, getPageBase()) {
@Override
public String getCssClass() {
return "col-xs-1";
}
});
return columns;
}
use of com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem in project midpoint by Evolveum.
the class FocusPersonasTabPanel method initLayout.
private void initLayout() {
MainObjectListPanel<F> userListPanel = new MainObjectListPanel<F>(ID_PERSONAS_TABLE, (Class<F>) FocusType.class, null) {
private static final long serialVersionUID = 1L;
@Override
protected IColumn<SelectableBean<F>, String> createCheckboxColumn() {
return null;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
List<InlineMenuItem> menuItems = new ArrayList<>();
menuItems.add(new ButtonInlineMenuItem(createStringResource("AssignmentPanel.viewTargetObject")) {
private static final long serialVersionUID = 1L;
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_NAVIGATE_ARROW);
}
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<F>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBean<F> personaRefSelectableBean = getRowModel().getObject();
F personaRefObj = personaRefSelectableBean.getValue();
ObjectReferenceType ort = new ObjectReferenceType();
ort.setOid(personaRefObj.getOid());
ort.setType(WebComponentUtil.classToQName(FocusPersonasTabPanel.this.getPrismContext(), personaRefObj.getClass()));
WebComponentUtil.dispatchToObjectDetailsPage(ort, FocusPersonasTabPanel.this, false);
}
};
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
return menuItems;
}
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, F object) {
}
@Override
protected boolean isCreateNewObjectEnabled() {
return false;
}
@Override
protected ISelectableDataProvider<F, SelectableBean<F>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> getFocusPersonasQuery(), null);
}
// @Override
// protected ObjectQuery getCustomizeContentQuery() {
//
// }
@Override
protected boolean isObjectDetailsEnabled(IModel<SelectableBean<F>> rowModel) {
return false;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return null;
}
@Override
protected boolean enableSavePageSize() {
return false;
}
};
userListPanel.setOutputMarkupId(true);
add(userListPanel);
}
use of com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem in project midpoint by Evolveum.
the class AssignmentPanel method getAssignmentMenuActions.
private <AH extends FocusType> List<InlineMenuItem> getAssignmentMenuActions() {
List<InlineMenuItem> menuItems = new ArrayList<>();
PrismObject<AH> obj = getMultivalueContainerListPanel().getFocusObject();
try {
boolean isUnassignAuthorized = getParentPage().isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_UNASSIGN_ACTION_URI, AuthorizationPhaseType.REQUEST, obj, null, null, null);
if (isUnassignAuthorized) {
menuItems.add(new ButtonInlineMenuItem(getAssignmentsLimitReachedUnassignTitleModel()) {
private static final long serialVersionUID = 1L;
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_DELETE_MENU_ITEM);
}
@Override
public InlineMenuItemAction initAction() {
return getMultivalueContainerListPanel().createDeleteColumnAction();
}
});
}
} catch (Exception ex) {
LOGGER.error("Couldn't check unassign authorization for the object: {}, {}", obj.getName(), ex.getLocalizedMessage());
if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_ASSIGN_ACTION_URI)) {
menuItems.add(new ButtonInlineMenuItem(createStringResource("PageBase.button.unassign")) {
private static final long serialVersionUID = 1L;
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_DELETE_MENU_ITEM);
}
@Override
public InlineMenuItemAction initAction() {
return getMultivalueContainerListPanel().createDeleteColumnAction();
}
});
}
}
menuItems.add(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 getMultivalueContainerListPanel().createEditColumnAction();
}
});
ButtonInlineMenuItem menu = new ButtonInlineMenuItem(createStringResource("AssignmentPanel.viewTargetObject")) {
private static final long serialVersionUID = 1L;
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_NAVIGATE_ARROW);
}
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<PrismContainerValueWrapper<AssignmentType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
PrismContainerValueWrapper<AssignmentType> assignmentContainer = getRowModel().getObject();
PrismReferenceWrapper<ObjectReferenceType> targetRef;
try {
targetRef = assignmentContainer.findReference(ItemPath.create(AssignmentType.F_TARGET_REF));
} catch (SchemaException e) {
getSession().error("Couldn't show details page. More information provided in log.");
LOGGER.error("Couldn't show details page, no targetRef reference wrapper found: {}", e.getMessage(), e);
target.add(getPageBase().getFeedbackPanel());
return;
}
if (targetRef != null && targetRef.getValues() != null && targetRef.getValues().size() > 0) {
PrismReferenceValueWrapperImpl<ObjectReferenceType> refWrapper = targetRef.getValues().get(0);
if (!StringUtils.isEmpty(refWrapper.getNewValue().getOid())) {
Class<? extends ObjectType> targetClass = ObjectTypes.getObjectTypeFromTypeQName(refWrapper.getRealValue().getType()).getClassDefinition();
WebComponentUtil.dispatchToObjectDetailsPage(targetClass, refWrapper.getNewValue().getOid(), AssignmentPanel.this, false);
}
}
}
};
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
};
menu.setVisibilityChecker((InlineMenuItem.VisibilityChecker) (rowModel, isHeader) -> {
PrismContainerValueWrapper<AssignmentType> assignment = (PrismContainerValueWrapper<AssignmentType>) rowModel.getObject();
if (assignment == null) {
return false;
}
PrismReferenceWrapper<Referencable> target = null;
try {
target = assignment.findReference(AssignmentType.F_TARGET_REF);
} catch (Exception e) {
LOGGER.error("Couldn't find targetRef in assignment");
}
return target != null && !target.isEmpty();
});
menuItems.add(menu);
return menuItems;
}
Aggregations