Search in sources :

Example 1 with ObjectListPanel

use of com.evolveum.midpoint.gui.api.component.ObjectListPanel in project midpoint by Evolveum.

the class PageAttorneySelection method initLayout.

private void initLayout() {
    Form mainForm = new MidpointForm(ID_MAIN_FORM);
    add(mainForm);
    ObjectListPanel<UserType> table = new ObjectListPanel<>(ID_TABLE, UserType.class, Collections.emptyList()) {

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.PAGE_USER_SELECTION;
        }

        @Override
        protected IColumn<SelectableBean<UserType>, String> createCheckboxColumn() {
            return null;
        }

        @Override
        protected IColumn<SelectableBean<UserType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
            return new ObjectNameColumn<>(createStringResource("ObjectType.name")) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target, IModel<SelectableBean<UserType>> rowModel) {
                    UserType object = rowModel.getObject().getValue();
                    selectUserPerformed(object.getOid());
                }
            };
        }

        @Override
        protected List<IColumn<SelectableBean<UserType>, String>> createDefaultColumns() {
            List<IColumn<SelectableBean<UserType>, String>> columns = new ArrayList<>();
            columns.add(createNameColumn(null, null, null, null));
            columns.addAll(PageAttorneySelection.this.initColumns());
            return columns;
        }

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            return null;
        }

        @Override
        protected ISelectableDataProvider<UserType, SelectableBean<UserType>> createProvider() {
            return createSelectableBeanObjectDataProvider(() -> getAttorneySelectionQuery(), null);
        }
    };
    table.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_USER_BOX_CSS_CLASSES);
    table.setOutputMarkupId(true);
    mainForm.add(table);
}
Also used : IModel(org.apache.wicket.model.IModel) GuiObjectColumnType(com.evolveum.midpoint.xml.ns._public.common.common_3.GuiObjectColumnType) ObjectNameColumn(com.evolveum.midpoint.web.component.data.column.ObjectNameColumn) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) ArrayList(java.util.ArrayList) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) ObjectListPanel(com.evolveum.midpoint.gui.api.component.ObjectListPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ExpressionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Aggregations

ObjectListPanel (com.evolveum.midpoint.gui.api.component.ObjectListPanel)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 ObjectNameColumn (com.evolveum.midpoint.web.component.data.column.ObjectNameColumn)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)1 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)1 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)1 ExpressionType (com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType)1 GuiObjectColumnType (com.evolveum.midpoint.xml.ns._public.common.common_3.GuiObjectColumnType)1 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1 ArrayList (java.util.ArrayList)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)1 Form (org.apache.wicket.markup.html.form.Form)1 IModel (org.apache.wicket.model.IModel)1