Search in sources :

Example 11 with InlineMenuItemAction

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction in project midpoint by Evolveum.

the class PageValuePolicies method createInlineMenu.

private List<InlineMenuItem> createInlineMenu() {
    List<InlineMenuItem> menu = new ArrayList<>();
    menu.add(new ButtonInlineMenuItem(createStringResource("pageValuePolicies.button.delete")) {

        private static final long serialVersionUID = 1L;

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

        @Override
        public InlineMenuItemAction initAction() {
            return null;
        }
    });
    return menu;
}
Also used : ArrayList(java.util.ArrayList) 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) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 12 with InlineMenuItemAction

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction in project midpoint by Evolveum.

the class ExecuteChangeOptionsPanel method createTracingOptionsPanel.

private void createTracingOptionsPanel() {
    List<InlineMenuItem> items = new ArrayList<>();
    items.add(new InlineMenuItem(createStringResource("Tracing")) {

        @Override
        public InlineMenuItemAction initAction() {
            return null;
        }
    });
    DropdownButtonDto model = new DropdownButtonDto(null, GuiStyleConstants.CLASS_TRACING_BUTTON_ICON, "Tracing", items);
    DropdownButtonPanel dropdownButtonPanel = new DropdownButtonPanel(ID_TRACING, model) {

        @Override
        protected void populateMenuItem(String componentId, ListItem<InlineMenuItem> menuItem) {
            menuItem.add(createTracingRadioChoicesFragment(componentId));
        }

        @Override
        protected String getSpecialButtonClass() {
            return "btn-sm btn-default btn-margin-right";
        }

        @Override
        protected String getSpecialDropdownMenuClass() {
            return "execute-options radio";
        }

        @Override
        protected String getSpecialLabelClass() {
            return "execute-options-label";
        }
    };
    add(dropdownButtonPanel);
    dropdownButtonPanel.setOutputMarkupId(true);
    dropdownButtonPanel.add(new VisibleBehaviour(this::isTracingEnabled));
}
Also used : VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) ArrayList(java.util.ArrayList) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) DropdownButtonDto(com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ListItem(org.apache.wicket.markup.html.list.ListItem) DropdownButtonPanel(com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel)

Example 13 with InlineMenuItemAction

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction in project midpoint by Evolveum.

the class AbstractAssignmentTypePanel method getAssignmentMenuActions.

private List<InlineMenuItem> getAssignmentMenuActions() {
    List<InlineMenuItem> menuItems = new ArrayList<>();
    ButtonInlineMenuItem unassignMenuItem = createUnassignAction();
    if (unassignMenuItem != null) {
        menuItems.add(unassignMenuItem);
    }
    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 AbstractAssignmentTypePanel.this.createEditColumnAction();
        }
    });
    ButtonInlineMenuItem viewTargetObjectMenuItem = createViewTargetObjectAction();
    menuItems.add(viewTargetObjectMenuItem);
    return menuItems;
}
Also used : ArrayList(java.util.ArrayList) 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) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 14 with InlineMenuItemAction

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction in project midpoint by Evolveum.

the class MenuMultiButtonPanel method initLayout.

private void initLayout() {
    DropdownButtonPanel inlineMenu = new DropdownButtonPanel(ID_INLINE_MENU_PANEL, new DropdownButtonDto(null, null, null, menuItemsModel.getObject())) {

        private static final long serialVersionUID = 1L;

        @Override
        protected String getSpecialButtonClass() {
            return "btn-xs btn-default";
        }

        @Override
        protected void onBeforeClickMenuItem(AjaxRequestTarget target, InlineMenuItemAction action, IModel<InlineMenuItem> item) {
            MenuMultiButtonPanel.this.onBeforeClickMenuItem(target, action, item);
        }
    };
    add(inlineMenu);
    inlineMenu.add(new VisibleBehaviour(() -> {
        List<InlineMenuItem> menuItems = menuItemsModel.getObject();
        for (InlineMenuItem menuItem : menuItems) {
            if (!(menuItem instanceof ButtonInlineMenuItem)) {
                return true;
            }
        }
        return false;
    }));
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) DropdownButtonDto(com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) List(java.util.List) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) DropdownButtonPanel(com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 15 with InlineMenuItemAction

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction 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_ADMIN_ASSIGN_ACTION_URI)) {
        item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.assign")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new InlineMenuItemAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        TypedAssignablePanel panel = new TypedAssignablePanel(getPageBase().getMainPopupBodyId(), RoleType.class) {

                            private static final long serialVersionUID = 1L;

                            @Override
                            protected void addPerformed(AjaxRequestTarget target, List selected, QName relation, ShadowKindType kind, String intent) {
                                super.addPerformed(target, selected, relation, kind, intent);
                                addSelectedAssignablePerformed(target, selected, relation, getPageBase().getMainPopup().getId());
                                reloadMainFormButtons(target);
                            }
                        };
                        panel.setOutputMarkupId(true);
                        getPageBase().showMainPopup(panel, target);
                    }
                };
            }
        };
        items.add(item);
        item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.assignOrg")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return 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) {

                                private static final long serialVersionUID = 1L;

                                @Override
                                protected void assignSelectedOrgPerformed(List<OrgType> selectedOrgs, AjaxRequestTarget target) {
                                    // TODO Auto-generated method stub
                                    addSelectedAssignablePerformed(target, (List) selectedOrgs, WebComponentUtil.getDefaultRelationOrFail(), 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);
    }
    if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_UNASSIGN_ACTION_URI)) {
        item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.unassign")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new InlineMenuItemAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        AssignmentTablePanel.this.deleteAssignmentPerformed(target, null);
                    }
                };
            }
        };
        items.add(item);
    }
    if (isShowAllAssignmentsVisible()) {
        item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.showAllAssignments")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new InlineMenuItemAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        showAllAssignments(target);
                    }
                };
            }
        };
        items.add(item);
    }
    return items;
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) TypedAssignablePanel(com.evolveum.midpoint.gui.api.component.TypedAssignablePanel) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ArrayList(java.util.ArrayList) List(java.util.List) OrgTreeAssignablePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel)

Aggregations

InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)44 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)43 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)39 ArrayList (java.util.ArrayList)32 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)28 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)26 IModel (org.apache.wicket.model.IModel)19 ColumnMenuAction (com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)11 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)10 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)8 List (java.util.List)6 ListItem (org.apache.wicket.markup.html.list.ListItem)6 PrismContainerValueWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)5 HeaderMenuAction (com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction)5 QName (javax.xml.namespace.QName)5 DropdownButtonDto (com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto)4 DropdownButtonPanel (com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel)4 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)4 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)4 Label (org.apache.wicket.markup.html.basic.Label)4