use of com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem in project midpoint by Evolveum.
the class MultivalueContainerListPanel method getDefaultMenuActions.
public List<InlineMenuItem> getDefaultMenuActions() {
List<InlineMenuItem> menuItems = new ArrayList<>();
menuItems.add(new ButtonInlineMenuItem(createStringResource("pageAdminFocus.button.delete")) {
private static final long serialVersionUID = 1L;
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_DELETE_MENU_ITEM);
}
@Override
public InlineMenuItemAction initAction() {
return 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 createEditColumnAction();
}
});
return menuItems;
}
use of com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem in project midpoint by Evolveum.
the class InlineMenuButtonColumn method getPanel.
private Component getPanel(String componentId, IModel<T> rowModel, int numberOfButtons, boolean isHeaderPanel) {
List<InlineMenuItem> filteredMenuItems = new ArrayList<>();
for (InlineMenuItem menuItem : menuItems) {
if (isHeaderPanel && !menuItem.isHeaderMenuItem()) {
continue;
}
if (rowModel != null && menuItem.getAction() != null && menuItem.getAction() instanceof ColumnMenuAction) {
((ColumnMenuAction) menuItem.getAction()).setRowModel(rowModel);
}
if (menuItem.getVisibilityChecker() != null && !menuItem.getVisibilityChecker().isVisible(rowModel, isHeaderPanel)) {
continue;
}
filteredMenuItems.add(menuItem);
}
List<ButtonInlineMenuItem> buttonMenuItems = new ArrayList<>();
menuItems.forEach(menuItem -> {
if (menuItem instanceof ButtonInlineMenuItem) {
if (isHeaderPanel && !menuItem.isHeaderMenuItem() || !menuItem.getVisible().getObject()) {
return;
}
if (menuItem.getVisibilityChecker() != null && !menuItem.getVisibilityChecker().isVisible(rowModel, isHeaderPanel)) {
return;
}
buttonMenuItems.add((ButtonInlineMenuItem) menuItem);
}
});
if (filteredMenuItems.isEmpty()) {
// this is hack, TODO: cleanup and refactor soif there aren't any inline (row) actions, nothing is displayed
return new Label(componentId);
}
return new MenuMultiButtonPanel<T>(componentId, rowModel, buttonMenuItems.size(), Model.ofList(filteredMenuItems)) {
private static final long serialVersionUID = 1L;
@Override
protected Component createButton(int index, String componentId, IModel<T> model) {
CompositedIconBuilder builder = getIconCompositedBuilder(index, buttonMenuItems);
AjaxCompositedIconButton btn = new AjaxCompositedIconButton(componentId, builder.build(), Model.of(getButtonTitle(index, buttonMenuItems))) {
@Override
public void onClick(AjaxRequestTarget target) {
setRowModelToButtonAction(rowModel, buttonMenuItems);
buttonMenuItemClickPerformed(index, buttonMenuItems, target);
}
};
btn.add(AttributeAppender.append("class", " btn btn-default btn-xs"));
btn.add(new EnableBehaviour(() -> isButtonMenuItemEnabled(model)));
return btn;
}
@Override
protected void onBeforeClickMenuItem(AjaxRequestTarget target, InlineMenuItemAction action, IModel<InlineMenuItem> item) {
if (action instanceof ColumnMenuAction) {
if (!isHeaderPanel) {
((ColumnMenuAction) action).setRowModel(rowModel);
} else {
((ColumnMenuAction) action).setRowModel(null);
}
}
}
};
}
use of com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem in project midpoint by Evolveum.
the class PageCertDefinitions method createInlineMenu.
private List<InlineMenuItem> createInlineMenu() {
List<InlineMenuItem> menu = new ArrayList<>();
menu.add(new ButtonInlineMenuItem(createStringResource("PageCertDefinitions.button.createCampaign")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBean<AccessCertificationDefinitionType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AccessCertificationDefinitionType campaign = getRowModel().getObject().getValue();
createCampaignPerformed(target, campaign);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_START_MENU_ITEM);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
menu.add(new ButtonInlineMenuItem(createStringResource("PageCertDefinitions.button.showCampaigns")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<AccessCertificationDefinitionType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AccessCertificationDefinitionType campaign = getRowModel().getObject().getValue();
showCampaignsPerformed(target, campaign);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-files-o");
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
menu.add(new ButtonInlineMenuItem(createStringResource("PageCertDefinitions.button.deleteDefinition")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<AccessCertificationDefinitionType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
AccessCertificationDefinitionType campaign = getRowModel().getObject().getValue();
deleteConfirmation(target, campaign);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_DELETE_MENU_ITEM);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
return menu;
}
use of com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem in project midpoint by Evolveum.
the class CaseWorkItemsPanel method createRowActions.
protected List<InlineMenuItem> createRowActions() {
List<InlineMenuItem> menu = new ArrayList<>();
menu.add(new ButtonInlineMenuItem(createStringResource("pageWorkItem.button.reject")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
workItemActionPerformed(getRowModel(), false, 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(!CaseTypeUtil.isClosed(CaseTypeUtil.getCase(workItem)));
} else {
return super.getEnabled();
}
}
@Override
public IModel<String> getConfirmationMessageModel() {
return createStringResource("CaseWorkItemsPanel.confirmWorkItemsRejectAction");
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_ICON_NO_OBJECTS);
}
@Override
public IModel<Boolean> getVisible() {
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(!CaseTypeUtil.isCorrelationCase(CaseTypeUtil.getCase(workItem)));
} else {
return super.getVisible();
}
}
});
menu.add(new ButtonInlineMenuItem(createStringResource("pageWorkItem.button.approve")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
workItemActionPerformed(getRowModel(), true, target);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_ICON_ACTIVATION_ACTIVE);
}
@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(!CaseTypeUtil.isClosed(CaseTypeUtil.getCase(workItem)));
} else {
return super.getEnabled();
}
}
@Override
public IModel<String> getConfirmationMessageModel() {
return createStringResource("CaseWorkItemsPanel.confirmWorkItemsApproveAction");
}
@Override
public IModel<Boolean> getVisible() {
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(!CaseTypeUtil.isCorrelationCase(CaseTypeUtil.getCase(workItem)));
} else {
return super.getVisible();
}
}
});
return menu;
}
use of com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem in project midpoint by Evolveum.
the class NotificationConfigTabPanel method getMenuActions.
private List<InlineMenuItem> getMenuActions() {
List<InlineMenuItem> menuItems = new ArrayList<>();
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 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 createEditColumnAction();
}
});
return menuItems;
}
Aggregations