Search in sources :

Example 16 with ColumnMenuAction

use of com.evolveum.midpoint.web.component.data.column.ColumnMenuAction in project midpoint by Evolveum.

the class PageReports method createInlineMenu.

private List<InlineMenuItem> createInlineMenu() {
    List<InlineMenuItem> menu = new ArrayList<>();
    ButtonInlineMenuItem runButton = new ButtonInlineMenuItem(createStringResource("PageReports.button.run")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    ReportType report = getRowModel().getObject().getValue();
                    com.evolveum.midpoint.web.page.admin.reports.PageReport.runReportPerformed(target, report.asPrismObject(), PageReports.this);
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_START_MENU_ITEM);
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    };
    runButton.setVisibilityChecker((rowModel, isHeader) -> !isImportReport((IModel<SelectableBean<ReportType>>) rowModel));
    menu.add(runButton);
    ButtonInlineMenuItem importButton = new ButtonInlineMenuItem(createStringResource("PageReports.button.import")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    ReportType report = getRowModel().getObject().getValue();
                    com.evolveum.midpoint.web.page.admin.reports.PageReport.importReportPerformed(target, report.asPrismObject(), PageReports.this);
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_UPLOAD);
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    };
    importButton.setVisibilityChecker((rowModel, isHeader) -> isImportReport((IModel<SelectableBean<ReportType>>) rowModel));
    menu.add(importButton);
    menu.add(new ButtonInlineMenuItem(createStringResource("PageReports.button.configure")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    ReportType reportObject = getRowModel().getObject().getValue();
                    configurePerformed(target, reportObject);
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_EDIT_MENU_ITEM);
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    });
    menu.add(new ButtonInlineMenuItem(createStringResource("PageReports.button.showOutput")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    ReportType reportObject = getRowModel().getObject().getValue();
                    PageParameters pageParameters = new PageParameters();
                    pageParameters.add(OnePageParameterEncoder.PARAMETER, reportObject.getOid());
                    navigateToNext(PageCreatedReports.class, pageParameters);
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder("fa fa-files-o");
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    });
    return menu;
}
Also used : IModel(org.apache.wicket.model.IModel) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) ArrayList(java.util.ArrayList) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 17 with ColumnMenuAction

use of com.evolveum.midpoint.web.component.data.column.ColumnMenuAction in project midpoint by Evolveum.

the class PageOrgs method initLayout.

protected void initLayout() {
    Form mainForm = new MidpointForm(ID_MAIN_FORM);
    add(mainForm);
    MainObjectListPanel<OrgType> table = new MainObjectListPanel<OrgType>(ID_TABLE, OrgType.class, getQueryOptions()) {

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.TABLE_ORGS;
        }

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            FocusListInlineMenuHelper<OrgType> listInlineMenuHelper = new FocusListInlineMenuHelper<OrgType>(OrgType.class, PageOrgs.this, this) {

                private static final long serialVersionUID = 1L;

                protected boolean isShowConfirmationDialog(ColumnMenuAction action) {
                    return PageOrgs.this.isShowConfirmationDialog(action);
                }

                protected IModel<String> getConfirmationMessageModel(ColumnMenuAction action, String actionName) {
                    return PageOrgs.this.getConfirmationMessageModel(action, actionName);
                }
            };
            return listInlineMenuHelper.createRowActions(getType());
        }

        @Override
        protected List<IColumn<SelectableBean<OrgType>, String>> createDefaultColumns() {
            return ColumnUtils.getDefaultOrgColumns(getPageBase());
        }

        @Override
        protected List<ItemPath> getFixedSearchItems() {
            List<ItemPath> fixedSearchItems = new ArrayList<>();
            fixedSearchItems.add(ObjectType.F_NAME);
            fixedSearchItems.add(AbstractRoleType.F_DISPLAY_NAME);
            fixedSearchItems.add(OrgType.F_PARENT_ORG_REF);
            return fixedSearchItems;
        }
    };
    table.setOutputMarkupId(true);
    mainForm.add(table);
}
Also used : MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) ArrayList(java.util.ArrayList) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction) FocusListInlineMenuHelper(com.evolveum.midpoint.web.component.util.FocusListInlineMenuHelper) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 18 with ColumnMenuAction

use of com.evolveum.midpoint.web.component.data.column.ColumnMenuAction 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;
}
Also used : MappingType(com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType) ObjectTemplateMappingType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateMappingType) IModel(org.apache.wicket.model.IModel) InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) ArrayList(java.util.ArrayList) ObjectTemplateItemDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateItemDefinitionType) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) MappingColumnPanel(com.evolveum.midpoint.gui.impl.component.MappingColumnPanel) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 19 with ColumnMenuAction

use of com.evolveum.midpoint.web.component.data.column.ColumnMenuAction 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;
}
Also used : PrismContainerWrapperModel(com.evolveum.midpoint.web.model.PrismContainerWrapperModel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PrismContainerWrapperColumn(com.evolveum.midpoint.gui.impl.component.data.column.PrismContainerWrapperColumn) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) AuthorizationConstants(com.evolveum.midpoint.security.api.AuthorizationConstants) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) AssignmentCandidatesSpecification(com.evolveum.midpoint.model.api.AssignmentCandidatesSpecification) StringUtils(org.apache.commons.lang3.StringUtils) AjaxLinkColumn(com.evolveum.midpoint.web.component.data.column.AjaxLinkColumn) QNameUtil(com.evolveum.midpoint.util.QNameUtil) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) WebModelServiceUtils(com.evolveum.midpoint.gui.api.util.WebModelServiceUtils) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) IModel(org.apache.wicket.model.IModel) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper) Search(com.evolveum.midpoint.web.component.search.Search) com.evolveum.midpoint.prism(com.evolveum.midpoint.prism) Label(org.apache.wicket.markup.html.basic.Label) AjaxIconButton(com.evolveum.midpoint.web.component.AjaxIconButton) ValueStatus(com.evolveum.midpoint.web.component.prism.ValueStatus) ListItem(org.apache.wicket.markup.html.list.ListItem) Collection(java.util.Collection) CompositedIcon(com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon) SearchFactory(com.evolveum.midpoint.web.component.search.SearchFactory) Model(org.apache.wicket.model.Model) Component(org.apache.wicket.Component) WebComponentUtil(com.evolveum.midpoint.gui.api.util.WebComponentUtil) Task(com.evolveum.midpoint.task.api.Task) SessionStorage(com.evolveum.midpoint.web.session.SessionStorage) MultivalueContainerListPanelWithDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel) List(java.util.List) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) AssignmentListProvider(com.evolveum.midpoint.web.component.util.AssignmentListProvider) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction) PropertyModel(org.apache.wicket.model.PropertyModel) Item(org.apache.wicket.markup.repeater.Item) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) MultivalueContainerDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel) AssignmentPopup(com.evolveum.midpoint.gui.api.component.AssignmentPopup) SearchItemDefinition(com.evolveum.midpoint.web.component.search.SearchItemDefinition) QName(javax.xml.namespace.QName) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) NotNull(org.jetbrains.annotations.NotNull) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) PrismReferenceValueWrapperImpl(com.evolveum.midpoint.gui.impl.prism.wrapper.PrismReferenceValueWrapperImpl) AssignmentPopupDto(com.evolveum.midpoint.gui.api.component.AssignmentPopupDto) GuiDisplayTypeUtil(com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil) RefFilter(com.evolveum.midpoint.prism.query.RefFilter) com.evolveum.midpoint.xml.ns._public.common.common_3(com.evolveum.midpoint.xml.ns._public.common.common_3) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) IconCssStyle(com.evolveum.midpoint.gui.impl.component.icon.IconCssStyle) Trace(com.evolveum.midpoint.util.logging.Trace) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) GuiStyleConstants(com.evolveum.midpoint.gui.api.GuiStyleConstants) PageStorage(com.evolveum.midpoint.web.session.PageStorage) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) PrismReferenceWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismReferenceWrapper) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation) PrismObjectWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper) AssignmentsDetailsPanel(com.evolveum.midpoint.gui.impl.component.AssignmentsDetailsPanel) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) CompositedIconColumn(com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconColumn) Collections(java.util.Collections) TraceManager(com.evolveum.midpoint.util.logging.TraceManager) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ArrayList(java.util.ArrayList) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) PrismReferenceWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismReferenceWrapper) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 20 with ColumnMenuAction

use of com.evolveum.midpoint.web.component.data.column.ColumnMenuAction in project midpoint by Evolveum.

the class PageNodes method createNodesInlineMenu.

private List<InlineMenuItem> createNodesInlineMenu() {
    List<InlineMenuItem> items = new ArrayList<>();
    items.add(new ButtonInlineMenuItem(createStringResource("pageTasks.button.startScheduler")) {

        private static final long serialVersionUID = 1L;

        @Override
        public ColumnMenuAction<SelectableBean<NodeType>> initAction() {
            return new ColumnMenuAction<SelectableBean<NodeType>>() {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    startSchedulersPerformed(target, getRowModel());
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_START_MENU_ITEM);
        }

        @SuppressWarnings("unchecked")
        @Override
        public IModel<String> getConfirmationMessageModel() {
            String actionName = createStringResource("pageTasks.message.startSchedulerAction").getString();
            return PageNodes.this.getNodeConfirmationMessageModel((ColumnMenuAction<SelectableBean<NodeType>>) getAction(), actionName);
        }
    });
    items.add(new ButtonInlineMenuItem(createStringResource("pageTasks.button.stopScheduler")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBean<NodeType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    stopSchedulersPerformed(target, getRowModel());
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_STOP_MENU_ITEM);
        }

        @SuppressWarnings({ "unchecked" })
        @Override
        public IModel<String> getConfirmationMessageModel() {
            String actionName = createStringResource("pageTasks.message.stopSchedulerAction").getString();
            return PageNodes.this.getNodeConfirmationMessageModel((ColumnMenuAction<SelectableBean<NodeType>>) getAction(), actionName);
        }
    });
    items.add(new InlineMenuItem(createStringResource("pageTasks.button.stopSchedulerAndTasks")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBean<NodeType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    stopSchedulersAndTasksPerformed(target, getRowModel());
                }
            };
        }

        @SuppressWarnings("unchecked")
        @Override
        public IModel<String> getConfirmationMessageModel() {
            String actionName = createStringResource("pageTasks.message.stopSchedulerTasksAction").getString();
            return PageNodes.this.getNodeConfirmationMessageModel((ColumnMenuAction<SelectableBean<NodeType>>) getAction(), actionName);
        }
    });
    items.add(new InlineMenuItem(createStringResource("pageTasks.button.deleteNode")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<SelectableBean<NodeType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deleteNodesPerformed(target, getRowModel());
                }
            };
        }

        @SuppressWarnings("unchecked")
        @Override
        public IModel<String> getConfirmationMessageModel() {
            String actionName = createStringResource("pageTasks.message.deleteAction").getString();
            return PageNodes.this.getNodeConfirmationMessageModel((ColumnMenuAction<SelectableBean<NodeType>>) getAction(), actionName);
        }
    });
    return items;
}
Also used : IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Aggregations

ColumnMenuAction (com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)21 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)19 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)18 ArrayList (java.util.ArrayList)15 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)12 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)11 InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)11 IModel (org.apache.wicket.model.IModel)11 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)6 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)5 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)4 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)4 Form (org.apache.wicket.markup.html.form.Form)4 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)3 PrismContainerValueWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)3 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)3 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)3 Model (org.apache.wicket.model.Model)3 GuiStyleConstants (com.evolveum.midpoint.gui.api.GuiStyleConstants)2 BasePanel (com.evolveum.midpoint.gui.api.component.BasePanel)2