Search in sources :

Example 71 with InlineMenuItem

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

the class AbstractRoleMemberPanel method createMemberRecomputeInlineMenuItems.

protected List<InlineMenuItem> createMemberRecomputeInlineMenuItems() {
    List<InlineMenuItem> recomputeMenuItems = new ArrayList<>();
    recomputeMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.recomputeMembersSelected"), false, new HeaderMenuAction(this) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            recomputeMembersPerformed(QueryScope.SELECTED, target);
        }
    }));
    recomputeMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.recomputeMembersAllDirect"), false, new HeaderMenuAction(this) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            recomputeMembersPerformed(QueryScope.ALL_DIRECT, target);
        }
    }));
    recomputeMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.recomputeMembersAll"), false, new HeaderMenuAction(this) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            recomputeMembersPerformed(QueryScope.ALL, target);
        }
    }));
    return recomputeMenuItems;
}
Also used : HeaderMenuAction(com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ArrayList(java.util.ArrayList) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 72 with InlineMenuItem

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

the class AbstractRoleMemberPanel method createRemoveMemberInlineMenuItems.

protected List<InlineMenuItem> createRemoveMemberInlineMenuItems() {
    List<InlineMenuItem> removeMenuItems = new ArrayList<>();
    removeMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.unassignMembersSelected"), false, new HeaderMenuAction(this) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            removeMembersPerformed(QueryScope.SELECTED, target);
        }
    }));
    removeMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.unassignMembersAll"), false, new HeaderMenuAction(this) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            removeMembersPerformed(QueryScope.ALL, target);
        }
    }));
    return removeMenuItems;
}
Also used : HeaderMenuAction(com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ArrayList(java.util.ArrayList) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 73 with InlineMenuItem

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

the class TreeTablePanel method createTreeChildrenMenu.

private List<InlineMenuItem> createTreeChildrenMenu(OrgType org) {
    List<InlineMenuItem> items = new ArrayList<>();
    try {
        boolean allowModify = org == null || parentPage.getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_MODIFY_ACTION_URL, AuthorizationPhaseType.REQUEST, org.asPrismObject(), null, null, null);
        boolean allowRead = org == null || parentPage.getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_READ_ACTION_URL, AuthorizationPhaseType.REQUEST, org.asPrismObject(), null, null, null);
        InlineMenuItem item;
        if (allowModify) {
            item = new InlineMenuItem(createStringResource("TreeTablePanel.move"), new ColumnMenuAction<SelectableBean<OrgType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    moveRootPerformed(getRowModel().getObject(), target);
                }
            });
            items.add(item);
            item = new InlineMenuItem(createStringResource("TreeTablePanel.makeRoot"), new ColumnMenuAction<SelectableBean<OrgType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    makeRootPerformed(getRowModel().getObject(), target);
                }
            });
            items.add(item);
        }
        boolean allowDelete = org == null || parentPage.getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_DELETE_ACTION_URL, AuthorizationPhaseType.REQUEST, org.asPrismObject(), null, null, null);
        if (allowDelete) {
            item = new InlineMenuItem(createStringResource("TreeTablePanel.delete"), new ColumnMenuAction<SelectableBean<OrgType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deleteNodePerformed(getRowModel().getObject(), target);
                }
            });
            items.add(item);
        }
        if (allowModify) {
            item = new InlineMenuItem(createStringResource("TreeTablePanel.recompute"), new ColumnMenuAction<SelectableBean<OrgType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    recomputeRootPerformed(getRowModel().getObject(), target);
                }
            });
            items.add(item);
            item = new InlineMenuItem(createStringResource("TreeTablePanel.edit"), Model.of(allowModify), Model.of(allowModify), new ColumnMenuAction<SelectableBean<OrgType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    editRootPerformed(getRowModel().getObject(), target);
                }
            });
            items.add(item);
        } else if (allowRead) {
            item = new InlineMenuItem(createStringResource("TreeTablePanel.viewDetails"), Model.of(allowRead), Model.of(allowRead), new ColumnMenuAction<SelectableBean<OrgType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    editRootPerformed(getRowModel().getObject(), target);
                }
            });
            items.add(item);
        }
        boolean allowAddNew = parentPage.getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_ADD_ACTION_URL, AuthorizationPhaseType.REQUEST, (new OrgType(parentPage.getPrismContext())).asPrismObject(), null, null, null);
        if (allowModify && allowAddNew) {
            item = new InlineMenuItem(createStringResource("TreeTablePanel.createChild"), new ColumnMenuAction<SelectableBean<OrgType>>() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    try {
                        initObjectForAdd(ObjectTypeUtil.createObjectRef(getRowModel().getObject().getValue()), OrgType.COMPLEX_TYPE, null, target);
                    } catch (SchemaException e) {
                        throw new SystemException(e.getMessage(), e);
                    }
                }
            });
            items.add(item);
        }
    } catch (SchemaException ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Failed to check menu items authorizations", ex);
    }
    return items;
}
Also used : ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)

Example 74 with InlineMenuItem

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

the class AbstractRoleMemberPanel method createMembersHeaderInlineMenu.

protected List<InlineMenuItem> createMembersHeaderInlineMenu() {
    List<InlineMenuItem> headerMenuItems = new ArrayList<>();
    headerMenuItems.addAll(createNewMemberInlineMenuItems());
    headerMenuItems.add(new InlineMenuItem());
    headerMenuItems.addAll(createRemoveMemberInlineMenuItems());
    headerMenuItems.addAll(createMemberRecomputeInlineMenuItems());
    return headerMenuItems;
}
Also used : ArrayList(java.util.ArrayList) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 75 with InlineMenuItem

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

the class ObjectListPanel method initProvider.

protected BaseSortableDataProvider<SelectableBean<O>> initProvider() {
    Set<O> selectedObjectsSet = selectedObjects == null ? null : new HashSet<O>(selectedObjects);
    SelectableBeanObjectDataProvider<O> provider = new SelectableBeanObjectDataProvider<O>(parentPage, type, selectedObjectsSet) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) {
            String storageKey = getStorageKey();
            if (StringUtils.isNotEmpty(storageKey)) {
                PageStorage storage = getPageStorage(storageKey);
                if (storage != null) {
                    storage.setPaging(paging);
                }
            }
        }

        @Override
        public SelectableBean<O> createDataObjectWrapper(O obj) {
            SelectableBean<O> bean = super.createDataObjectWrapper(obj);
            List<InlineMenuItem> inlineMenu = createInlineMenu();
            if (inlineMenu != null) {
                bean.getMenuItems().addAll(inlineMenu);
            }
            return bean;
        }
    };
    if (options == null) {
        if (ResourceType.class.equals(type)) {
            options = SelectorOptions.createCollection(GetOperationOptions.createNoFetch());
        }
    } else {
        if (ResourceType.class.equals(type)) {
            GetOperationOptions root = SelectorOptions.findRootOptions(options);
            root.setNoFetch(Boolean.TRUE);
        }
        provider.setOptions(options);
    }
    provider.setQuery(getQuery());
    return provider;
}
Also used : SelectableBeanObjectDataProvider(com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) ObjectPaging(com.evolveum.midpoint.prism.query.ObjectPaging) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) PageStorage(com.evolveum.midpoint.web.session.PageStorage)

Aggregations

InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)114 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)82 ArrayList (java.util.ArrayList)68 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)47 InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)43 IModel (org.apache.wicket.model.IModel)41 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)35 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)30 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)26 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)25 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)24 ColumnMenuAction (com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)19 Label (org.apache.wicket.markup.html.basic.Label)18 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)17 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)15 Form (org.apache.wicket.markup.html.form.Form)15 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)13 HeaderMenuAction (com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction)13 ListItem (org.apache.wicket.markup.html.list.ListItem)12 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)11