Search in sources :

Example 16 with SelectableBeanImpl

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

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

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

the class OrgUnitAddDeletePopup method initColumns.

private List<IColumn<SelectableBeanImpl<ObjectType>, String>> initColumns() {
    List<IColumn<SelectableBeanImpl<ObjectType>, String>> columns = new ArrayList<>();
    IColumn column = new CheckBoxHeaderColumn<OrgType>();
    columns.add(column);
    column = new AjaxLinkColumn<SelectableBeanImpl<OrgType>>(createStringResource("orgUnitAddDeletePopup.column.name"), getSortableProperty(), "value.name") {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBeanImpl<OrgType>> rowModel) {
            OrgType org = rowModel.getObject().getValue();
            chooseOperationPerformed(target, org);
        }
    };
    columns.add(column);
    return columns;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) ArrayList(java.util.ArrayList)

Aggregations

SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)18 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)14 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)12 ArrayList (java.util.ArrayList)12 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)9 InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)9 IModel (org.apache.wicket.model.IModel)9 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)8 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)7 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)6 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)5 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)5 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)4 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)3 ColumnMenuAction (com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)3 List (java.util.List)3 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)2 AjaxLinkPanel (com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel)2