Search in sources :

Example 66 with SelectableBean

use of com.evolveum.midpoint.web.component.util.SelectableBean 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 67 with SelectableBean

use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.

the class SearchPropertiesConfigPanel method getTableColumns.

private List<IColumn<SelectableBean<ValueSearchFilterItem>, String>> getTableColumns() {
    List<IColumn<SelectableBean<ValueSearchFilterItem>, String>> columns = new ArrayList<>();
    CheckBoxHeaderColumn<SelectableBean<ValueSearchFilterItem>> checkboxColumn = new CheckBoxHeaderColumn<>();
    columns.add(checkboxColumn);
    IColumn<SelectableBean<ValueSearchFilterItem>, String> propertyColumn = new PropertyColumn<SelectableBean<ValueSearchFilterItem>, String>(getPageBase().createStringResource("SearchPropertiesConfigPanel.table.column.property"), "value." + ValueSearchFilterItem.F_PROPERTY_NAME) {

        private static final long serialVersionUID = 1L;

        @Override
        public String getCssClass() {
            return getColumnStyleClass();
        }
    };
    columns.add(propertyColumn);
    IColumn<SelectableBean<ValueSearchFilterItem>, String> valueColumn = new AbstractColumn<SelectableBean<ValueSearchFilterItem>, String>(getPageBase().createStringResource("SearchPropertiesConfigPanel.table.column.value")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ValueSearchFilterItem>>> item, String id, IModel<SelectableBean<ValueSearchFilterItem>> rowModel) {
            item.add(new SwitchablePropertyValuePanel(id, rowModel));
        }

        @Override
        public String getCssClass() {
            return "max-width-column";
        }
    };
    columns.add(valueColumn);
    IColumn<SelectableBean<ValueSearchFilterItem>, String> filterColumn = new AbstractColumn<SelectableBean<ValueSearchFilterItem>, String>(getPageBase().createStringResource("SearchPropertiesConfigPanel.table.column.filter")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ValueSearchFilterItem>>> item, String id, IModel<SelectableBean<ValueSearchFilterItem>> rowModel) {
            List<ValueSearchFilterItem.FilterName> availableFilterNames = rowModel.getObject().getValue().getAvailableFilterNameList();
            DropDownChoicePanel<ValueSearchFilterItem.FilterName> filterPanel = WebComponentUtil.createEnumPanel(id, Model.ofList(availableFilterNames), new PropertyModel<>(rowModel, "value." + ValueSearchFilterItem.F_FILTER_TYPE_NAME), SearchPropertiesConfigPanel.this, false, getPageBase().createStringResource("SearchPropertiesConfigPanel.selectFilter").getString());
            filterPanel.setOutputMarkupId(true);
            filterPanel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
            filterPanel.getBaseFormComponent().add(new EnableBehaviour(() -> availableFilterNames.size() > 1));
            item.add(filterPanel);
        }

        @Override
        public String getCssClass() {
            return getColumnStyleClass();
        }
    };
    columns.add(filterColumn);
    IColumn<SelectableBean<ValueSearchFilterItem>, String> matchingRuleColumn = new AbstractColumn<SelectableBean<ValueSearchFilterItem>, String>(getPageBase().createStringResource("SearchPropertiesConfigPanel.table.column.matchingRule")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ValueSearchFilterItem>>> item, String id, IModel<SelectableBean<ValueSearchFilterItem>> rowModel) {
            DropDownChoicePanel<ValueSearchFilterItem.MatchingRule> matchingRulePanel = WebComponentUtil.createEnumPanel(id, Model.ofList(rowModel.getObject().getValue().getAvailableMatchingRuleList()), new PropertyModel<>(rowModel, "value." + ValueSearchFilterItem.F_MATCHING_RULE), SearchPropertiesConfigPanel.this, true, getPageBase().createStringResource("SearchPropertiesConfigPanel.selectMatchingRule").getString());
            matchingRulePanel.setOutputMarkupId(true);
            matchingRulePanel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
            item.add(matchingRulePanel);
        }

        @Override
        public String getCssClass() {
            return getColumnStyleClass();
        }
    };
    columns.add(matchingRuleColumn);
    CheckBoxColumn<SelectableBean<ValueSearchFilterItem>> negationColumn = new CheckBoxColumn<SelectableBean<ValueSearchFilterItem>>(getPageBase().createStringResource("SearchPropertiesConfigPanel.table.column.applyNegotiation"), "value." + ValueSearchFilterItem.F_APPLY_NEGATION) {

        private static final long serialVersionUID = 1L;

        @Override
        public String getCssClass() {
            return "min-width-column";
        }
    };
    columns.add(negationColumn);
    InlineMenuButtonColumn<SelectableBean<ValueSearchFilterItem>> actionsColumn = new InlineMenuButtonColumn<SelectableBean<ValueSearchFilterItem>>(getTableMenuItems(), getPageBase()) {

        private static final long serialVersionUID = 1L;

        @Override
        public String getCssClass() {
            return "min-width-column";
        }
    };
    columns.add(actionsColumn);
    return columns;
}
Also used : PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) Item(org.apache.wicket.markup.repeater.Item) ValueSearchFilterItem(com.evolveum.midpoint.web.component.search.filter.ValueSearchFilterItem) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) EnableBehaviour(com.evolveum.midpoint.web.component.util.EnableBehaviour) IModel(org.apache.wicket.model.IModel) InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) CheckBoxColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxColumn) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ValueSearchFilterItem(com.evolveum.midpoint.web.component.search.filter.ValueSearchFilterItem)

Example 68 with SelectableBean

use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.

the class FocusPersonasTabPanel method initLayout.

private void initLayout() {
    MainObjectListPanel<F> userListPanel = new MainObjectListPanel<F>(ID_PERSONAS_TABLE, (Class<F>) FocusType.class, null) {

        private static final long serialVersionUID = 1L;

        @Override
        protected IColumn<SelectableBean<F>, 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<F>>() {

                        private static final long serialVersionUID = 1L;

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            SelectableBean<F> personaRefSelectableBean = getRowModel().getObject();
                            F personaRefObj = personaRefSelectableBean.getValue();
                            ObjectReferenceType ort = new ObjectReferenceType();
                            ort.setOid(personaRefObj.getOid());
                            ort.setType(WebComponentUtil.classToQName(FocusPersonasTabPanel.this.getPrismContext(), personaRefObj.getClass()));
                            WebComponentUtil.dispatchToObjectDetailsPage(ort, FocusPersonasTabPanel.this, false);
                        }
                    };
                }

                @Override
                public boolean isHeaderMenuItem() {
                    return false;
                }
            });
            return menuItems;
        }

        @Override
        protected void objectDetailsPerformed(AjaxRequestTarget target, F object) {
        }

        @Override
        protected boolean isCreateNewObjectEnabled() {
            return false;
        }

        @Override
        protected ISelectableDataProvider<F, SelectableBean<F>> createProvider() {
            return createSelectableBeanObjectDataProvider(() -> getFocusPersonasQuery(), null);
        }

        // @Override
        // protected ObjectQuery getCustomizeContentQuery() {
        // 
        // }
        @Override
        protected boolean isObjectDetailsEnabled(IModel<SelectableBean<F>> 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) FocusType(com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType) 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) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 69 with SelectableBean

use of com.evolveum.midpoint.web.component.util.SelectableBean 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)

Example 70 with SelectableBean

use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.

the class PageUsers method createRowActions.

private List<InlineMenuItem> createRowActions() {
    List<InlineMenuItem> menu = new ArrayList<>();
    ButtonInlineMenuItem enableItem = new ButtonInlineMenuItem(createStringResource("pageUsers.menu.enable")) {

        private static final long serialVersionUID = 1L;

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

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

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

        @Override
        public IModel<String> getConfirmationMessageModel() {
            String actionName = createStringResource("pageUsers.message.enableAction").getString();
            return getTable().getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
        }
    };
    enableItem.setVisibilityChecker(FocusListInlineMenuHelper::isObjectDisabled);
    menu.add(enableItem);
    ButtonInlineMenuItem disableItem = new ButtonInlineMenuItem(createStringResource("pageUsers.menu.disable")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

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

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            CompositedIconBuilder builder = getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_OBJECT_USER_ICON);
            builder.appendLayerIcon(WebComponentUtil.createIconType(GuiStyleConstants.CLASS_BAN), IconCssStyle.BOTTOM_RIGHT_STYLE);
            return builder;
        }

        @Override
        public IModel<String> getConfirmationMessageModel() {
            String actionName = createStringResource("pageUsers.message.disableAction").getString();
            return getTable().getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
        }
    };
    disableItem.setVisibilityChecker(FocusListInlineMenuHelper::isObjectEnabled);
    menu.add(disableItem);
    menu.add(new ButtonInlineMenuItem(createStringResource("pageUsers.menu.reconcile")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

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

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

        @Override
        public IModel<String> getConfirmationMessageModel() {
            String actionName = createStringResource("pageUsers.message.reconcileAction").getString();
            return getTable().getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
        }
    });
    menu.add(new InlineMenuItem(createStringResource("pageUsers.menu.unlock")) {

        private static final long serialVersionUID = 1L;

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

                private static final long serialVersionUID = 1L;

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

        @Override
        public IModel<String> getConfirmationMessageModel() {
            String actionName = createStringResource("pageUsers.message.unlockAction").getString();
            return getTable().getConfirmationMessageModel((ColumnMenuAction) getAction(), actionName);
        }
    });
    menu.add(getTable().createDeleteInlineMenu());
    menu.add(new InlineMenuItem(createStringResource("pageUsers.menu.merge")) {

        private static final long serialVersionUID = 1L;

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

                @Override
                public void onClick(AjaxRequestTarget target) {
                    OperationResult result = new OperationResult(OPERATION_LOAD_MERGE_CONFIGURATION);
                    List<MergeConfigurationType> mergeConfiguration;
                    try {
                        mergeConfiguration = getModelInteractionService().getMergeConfiguration(result);
                    } catch (ObjectNotFoundException | SchemaException ex) {
                        LOGGER.error("Couldn't load merge configuration: {}", ex.getLocalizedMessage());
                        result.recomputeStatus();
                        getFeedbackMessages().error(PageUsers.this, ex.getLocalizedMessage());
                        target.add(getFeedbackPanel());
                        return;
                    }
                    if (mergeConfiguration == null || mergeConfiguration.size() == 0) {
                        getFeedbackMessages().warn(PageUsers.this, createStringResource("PageUsers.noMergeConfigurationMessage").getString());
                        target.add(getFeedbackPanel());
                        return;
                    }
                    if (getRowModel() == null) {
                        mergePerformed(target, null);
                    } else {
                        SelectableBean<UserType> rowDto = getRowModel().getObject();
                        mergePerformed(target, rowDto.getValue());
                    }
                }
            };
        }

        @Override
        public boolean isHeaderMenuItem() {
            return false;
        }
    });
    return menu;
}
Also used : IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) 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) ArrayList(java.util.ArrayList) List(java.util.List) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) FocusListInlineMenuHelper(com.evolveum.midpoint.web.component.util.FocusListInlineMenuHelper)

Aggregations

SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)73 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)39 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)37 IModel (org.apache.wicket.model.IModel)37 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)32 ArrayList (java.util.ArrayList)31 Label (org.apache.wicket.markup.html.basic.Label)22 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)16 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)16 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)15 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)14 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)12 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)12 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)12 Item (org.apache.wicket.markup.repeater.Item)11 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)9 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)8 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)8 List (java.util.List)8 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)7