Search in sources :

Example 46 with InlineMenuItemAction

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction 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);
}
Also used : MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) IModel(org.apache.wicket.model.IModel) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) 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) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 47 with InlineMenuItemAction

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

the class InternalsLoggedInUsersPanel method initInlineMenu.

private List<InlineMenuItem> initInlineMenu() {
    List<InlineMenuItem> menuItems = new ArrayList<>();
    menuItems.add(new ButtonInlineMenuItem(createStringResource("InternalsLoggedInUsers.refresh")) {

        private static final long serialVersionUID = 1L;

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

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

                @Override
                public void onClick(AjaxRequestTarget target) {
                    if (getRowModel() == null) {
                        terminateSessions(target, null);
                    } else {
                        SelectableBean<F> rowDto = getRowModel().getObject();
                        terminateSessions(target, rowDto.getValue());
                    }
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return true;
        }
    });
    return menuItems;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ArrayList(java.util.ArrayList) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) 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 48 with InlineMenuItemAction

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

the class PageCertCampaigns method createInlineMenu.

@NotNull
private List<InlineMenuItem> createInlineMenu() {
    List<InlineMenuItem> items = new ArrayList<>();
    items.add(new InlineMenuItem(createStringResource("PageCertCampaigns.menu.startSelected")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new HeaderMenuAction(PageCertCampaigns.this) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    startSelectedCampaignsPerformed(target);
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return true;
        }
    });
    items.add(new InlineMenuItem(createStringResource("PageCertCampaigns.menu.closeSelected")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new HeaderMenuAction(PageCertCampaigns.this) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    closeSelectedCampaignsConfirmation(target);
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return true;
        }
    });
    items.add(new InlineMenuItem(createStringResource("PageCertCampaigns.menu.reiterateSelected")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new HeaderMenuAction(PageCertCampaigns.this) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    reiterateSelectedCampaignsConfirmation(target);
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return true;
        }
    });
    items.add(new InlineMenuItem(createStringResource("PageCertCampaigns.menu.deleteSelected")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new HeaderMenuAction(PageCertCampaigns.this) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deleteSelectedCampaignsConfirmation(target);
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return true;
        }
    });
    return items;
}
Also used : HeaderMenuAction(com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ArrayList(java.util.ArrayList) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) NotNull(org.jetbrains.annotations.NotNull)

Example 49 with InlineMenuItemAction

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

the class PageCases method createActions.

private List<InlineMenuItem> createActions() {
    List<InlineMenuItem> menu = new ArrayList<>();
    menu.add(new ButtonInlineMenuItem(createStringResource("pageCases.button.stopProcess")) {

        private static final long serialVersionUID = 1L;

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

                @Override
                public void onClick(AjaxRequestTarget target) {
                    if (getRowModel() == null && warnIfNoCaseSelected(target)) {
                        return;
                    }
                    if (getRowModel() == null) {
                        stopCaseProcessConfirmed(target);
                    } else {
                        stopCaseProcessConfirmed(target, Collections.singletonList(getRowModel().getObject().getValue()));
                    }
                }
            };
        }

        @Override
        public IModel<Boolean> getEnabled() {
            IModel<SelectableBeanImpl<CaseType>> rowModel = ((ColumnMenuAction<SelectableBeanImpl<CaseType>>) getAction()).getRowModel();
            if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getValue() != null) {
                return Model.of(!CaseTypeUtil.isClosed(rowModel.getObject().getValue()));
            } else {
                return super.getEnabled();
            }
        }

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

        @Override
        public IModel<String> getConfirmationMessageModel() {
            return getTablePanel().getSelectedObjectsCount() > 0 ? createStringResource("pageCases.button.stopProcess.multiple.confirmationMessage", getTablePanel().getSelectedObjectsCount()) : createStringResource("pageCases.button.stopProcess.confirmationMessage");
        }
    });
    menu.add(new ButtonInlineMenuItem(createStringResource("pageCases.button.delete")) {

        private static final long serialVersionUID = 1L;

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

                @Override
                public void onClick(AjaxRequestTarget target) {
                    if (getRowModel() == null && warnIfNoCaseSelected(target)) {
                        return;
                    }
                    if (getRowModel() == null) {
                        deleteCaseObjectsConfirmed(target);
                    } else {
                        deleteCaseObjectsConfirmed(target, Collections.singletonList(getRowModel().getObject().getValue()));
                    }
                }
            };
        }

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

        @Override
        public IModel<Boolean> getEnabled() {
            IModel<SelectableBeanImpl<CaseType>> rowModel = ((ColumnMenuAction<SelectableBeanImpl<CaseType>>) getAction()).getRowModel();
            if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getValue() != null) {
                return Model.of(!CaseTypeUtil.isClosed(rowModel.getObject().getValue()));
            } else {
                return super.getEnabled();
            }
        }

        @Override
        public IModel<String> getConfirmationMessageModel() {
            return getTablePanel().getSelectedObjectsCount() > 0 ? createStringResource("pageCases.button.delete.multiple.confirmationMessage", getTablePanel().getSelectedObjectsCount()) : createStringResource("pageCases.button.delete.confirmationMessage");
        }
    });
    return menu;
}
Also used : IModel(org.apache.wicket.model.IModel) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) 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 50 with InlineMenuItemAction

use of com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction 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(CaseTypeUtil.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;
}
Also used : IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) CaseWorkItemType(com.evolveum.midpoint.xml.ns._public.common.common_3.CaseWorkItemType) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) 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) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Aggregations

InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)50 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)49 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)44 ArrayList (java.util.ArrayList)34 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)29 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)29 IModel (org.apache.wicket.model.IModel)21 ColumnMenuAction (com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)14 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)12 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)9 ListItem (org.apache.wicket.markup.html.list.ListItem)8 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)7 List (java.util.List)6 QName (javax.xml.namespace.QName)6 DropdownButtonDto (com.evolveum.midpoint.gui.api.component.button.DropdownButtonDto)5 DropdownButtonPanel (com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel)5 PrismContainerValueWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)5 HeaderMenuAction (com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction)5 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 ObjectBrowserPanel (com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel)4