Search in sources :

Example 51 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class MyAssignmentsPanel method initLayout.

private void initLayout() {
    List<IColumn<AssignmentItemDto, String>> columns = new ArrayList<>();
    columns.add(new IconColumn<AssignmentItemDto>(null) {

        private static final long serialVersionUID = 1L;

        @Override
        protected DisplayType getIconDisplayType(IModel<AssignmentItemDto> rowModel) {
            AssignmentItemDto item = rowModel.getObject();
            String iconClass = "";
            if (item.getType() == null) {
                iconClass = OperationResultStatusPresentationProperties.FATAL_ERROR.getIcon() + " fa-lg";
            } else {
                iconClass = item.getType().getIconCssClass();
            }
            return GuiDisplayTypeUtil.createDisplayType(iconClass, "", AssignmentsUtil.createAssignmentIconTitleModel(MyAssignmentsPanel.this, rowModel.getObject().getType()).getObject());
        }
    });
    columns.add(new AbstractColumn<AssignmentItemDto, String>(createStringResource("MyAssignmentsPanel.assignment.displayName")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<AssignmentItemDto>> cellItem, String componentId, final IModel<AssignmentItemDto> rowModel) {
            AssignmentHeaderPanel panel = new AssignmentHeaderPanel(componentId, rowModel);
            panel.add(new AttributeModifier("class", "dash-assignment-header"));
            cellItem.add(panel);
        }
    });
    ISortableDataProvider provider = new ListDataProvider(this, getModel());
    TablePanel accountsTable = new TablePanel<>(ID_ASSIGNMETNS_TABLE, provider, columns);
    accountsTable.setShowPaging(false);
    add(accountsTable);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) AssignmentHeaderPanel(com.evolveum.midpoint.web.component.assignment.AssignmentHeaderPanel) DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) AttributeModifier(org.apache.wicket.AttributeModifier) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) AssignmentItemDto(com.evolveum.midpoint.web.page.admin.home.dto.AssignmentItemDto) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 52 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class FocusProjectionsTabPanel method initLayout.

private void initLayout() {
    IModel<Integer> deadShadows = new ReadOnlyModel<>(() -> countDeadShadows());
    Label label = new Label(ID_DEAD_SHADOWS, deadShadows);
    label.add(new VisibleBehaviour(() -> deadShadows.getObject() > 0));
    add(label);
    MultivalueContainerListPanelWithDetailsPanel<ShadowType> multivalueContainerListPanel = new MultivalueContainerListPanelWithDetailsPanel<ShadowType>(ID_SHADOW_TABLE, ShadowType.class) {

        private static final long serialVersionUID = 1L;

        @Override
        protected ISelectableDataProvider<ShadowType, PrismContainerValueWrapper<ShadowType>> createProvider() {
            return new ProjectionsListProvider(FocusProjectionsTabPanel.this, getSearchModel(), loadShadowModel()) {

                @Override
                protected PageStorage getPageStorage() {
                    PageStorage storage = getSession().getSessionStorage().getPageStorageMap().get(SessionStorage.KEY_FOCUS_PROJECTION_TABLE);
                    if (storage == null) {
                        storage = getSession().getSessionStorage().initPageStorage(SessionStorage.KEY_FOCUS_PROJECTION_TABLE);
                    }
                    return storage;
                }
            };
        }

        @Override
        protected void newItemPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation) {
            List<QName> supportedTypes = new ArrayList<>(1);
            supportedTypes.add(ResourceType.COMPLEX_TYPE);
            PageBase pageBase = FocusProjectionsTabPanel.this.getPageBase();
            ObjectBrowserPanel<ResourceType> resourceSelectionPanel = new ObjectBrowserPanel<ResourceType>(pageBase.getMainPopupBodyId(), ResourceType.class, supportedTypes, true, pageBase) {

                private static final long serialVersionUID = 1L;

                @Override
                protected void addPerformed(AjaxRequestTarget target, QName type, List<ResourceType> selected) {
                    FocusProjectionsTabPanel.this.addSelectedAccountPerformed(target, selected);
                }
            };
            resourceSelectionPanel.setOutputMarkupId(true);
            pageBase.showMainPopup(resourceSelectionPanel, target);
        }

        @Override
        protected boolean isCreateNewObjectVisible() {
            PrismObjectDefinition<F> def = getObjectWrapper().getObject().getDefinition();
            PrismReferenceDefinition ref = def.findReferenceDefinition(UserType.F_LINK_REF);
            return (ref.canRead() && ref.canAdd());
        }

        @Override
        protected IModel<PrismContainerWrapper<ShadowType>> getContainerModel() {
            return null;
        }

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

        @Override
        protected List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> createDefaultColumns() {
            return initBasicColumns();
        }

        @Override
        public void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ShadowType>> rowModel, List<PrismContainerValueWrapper<ShadowType>> listItems) {
            loadShadowIfNeeded(rowModel, target);
            if (listItems != null) {
                listItems.forEach(value -> {
                    if (((ShadowWrapper) value.getParent()).isLoadWithNoFetch()) {
                        ((PageAdminFocus) getPage()).loadFullShadow((PrismObjectValueWrapper) value, target);
                    }
                });
            }
            super.editItemPerformed(target, rowModel, listItems);
        }

        @Override
        protected Search createSearch(Class<ShadowType> type) {
            Search search = super.createSearch(type);
            PropertySearchItem<Boolean> defaultDeadItem = search.findPropertySearchItem(ShadowType.F_DEAD);
            if (defaultDeadItem != null) {
                defaultDeadItem.setVisible(false);
            }
            addDeadSearchItem(search);
            return search;
        }

        @Override
        protected List<SearchItemDefinition> initSearchableItems(PrismContainerDefinition<ShadowType> containerDef) {
            List<SearchItemDefinition> defs = new ArrayList<>();
            SearchFactory.addSearchRefDef(containerDef, ShadowType.F_RESOURCE_REF, defs, AreaCategoryType.ADMINISTRATION, getPageBase());
            SearchFactory.addSearchPropertyDef(containerDef, ShadowType.F_NAME, defs);
            SearchFactory.addSearchPropertyDef(containerDef, ShadowType.F_INTENT, defs);
            SearchFactory.addSearchPropertyDef(containerDef, ShadowType.F_KIND, defs);
            return defs;
        }

        @Override
        protected MultivalueContainerDetailsPanel<ShadowType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<ShadowType>> item) {
            return FocusProjectionsTabPanel.this.getMultivalueContainerDetailsPanel(item);
        }
    };
    add(multivalueContainerListPanel);
    setOutputMarkupId(true);
}
Also used : PageAdminFocus(com.evolveum.midpoint.web.page.admin.PageAdminFocus) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) Label(org.apache.wicket.markup.html.basic.Label) ArrayList(java.util.ArrayList) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) ProjectionsListProvider(com.evolveum.midpoint.web.component.util.ProjectionsListProvider) List(java.util.List) ArrayList(java.util.ArrayList) PageStorage(com.evolveum.midpoint.web.session.PageStorage) IModel(org.apache.wicket.model.IModel) QName(javax.xml.namespace.QName) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ObjectBrowserPanel(com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel) MultivalueContainerListPanelWithDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 53 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class FocusTriggersTabPanel method initLayout.

private void initLayout() {
    PrismContainerWrapperModel<F, TriggerType> triggersModel = PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), FocusType.F_TRIGGER);
    MultivalueContainerListPanel<TriggerType> multivalueContainerListPanel = new MultivalueContainerListPanel<TriggerType>(ID_TRIGGERS_PANEL, TriggerType.class) {

        private static final long serialVersionUID = 1L;

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

        @Override
        protected IModel<PrismContainerWrapper<TriggerType>> getContainerModel() {
            return triggersModel;
        }

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

        @Override
        protected String getStorageKey() {
            return SessionStorage.KEY_TRIGGERS_TAB;
        }

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

        @Override
        protected List<IColumn<PrismContainerValueWrapper<TriggerType>, String>> createDefaultColumns() {
            return createTriggersColumns();
        }

        @Override
        protected void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<TriggerType>> rowModel, List<PrismContainerValueWrapper<TriggerType>> listItems) {
        }
    };
    multivalueContainerListPanel.add(new VisibleBehaviour(() -> triggersModel != null && triggersModel.getObject() != null));
    add(multivalueContainerListPanel);
    setOutputMarkupId(true);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) IModel(org.apache.wicket.model.IModel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) MultivalueContainerListPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanel) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) ArrayList(java.util.ArrayList) List(java.util.List)

Example 54 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class TaskErrorsTabPanel method initColumnsOld.

private List<IColumn<TaskErrorSelectableBeanImplOld<ObjectType>, String>> initColumnsOld() {
    List<IColumn<TaskErrorSelectableBeanImplOld<ObjectType>, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.taskErros.objectName"), TaskErrorSelectableBeanImplOld.F_OBJECT_REF_NAME) {

        @Override
        public String getSortProperty() {
            return "name";
        }
    });
    columns.add(new AbstractColumn<>(createStringResource("pageTaskEdit.taskErros.timestamp"), TaskErrorSelectableBeanImplOld.F_ERROR_TIMESTAMP) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<TaskErrorSelectableBeanImplOld<ObjectType>>> cellItem, String componentId, IModel<TaskErrorSelectableBeanImplOld<ObjectType>> rowModel) {
            Label label = new Label(componentId, (IModel<String>) () -> WebComponentUtil.getShortDateTimeFormattedValue(rowModel.getObject().getErrorTimestamp(), getPageBase()));
            cellItem.add(label);
        }
    });
    columns.add(new EnumPropertyColumn<>(createStringResource("pageTaskEdit.taskErros.status"), TaskErrorSelectableBeanImplOld.F_STATUS));
    columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.taskErros.message"), TaskErrorSelectableBeanImplOld.F_MESSAGE));
    columns.add(new EnumPropertyColumn<>(createStringResource("pageTaskEdit.taskErros.recordType"), TaskErrorSelectableBeanImplOld.F_RECORD_TYPE));
    columns.add(new AjaxLinkColumn<>(createStringResource("pageTaskEdit.taskErros.realOwner"), TaskErrorSelectableBeanImplOld.F_REAL_OWNER_DESCRIPTION) {

        @Override
        public void onClick(AjaxRequestTarget target, IModel<TaskErrorSelectableBeanImplOld<ObjectType>> rowModel) {
            TaskErrorSelectableBeanImplOld<ObjectType> object = rowModel.getObject();
            PrismObject<ObjectType> realOwner = object.getRealOwner();
            WebComponentUtil.dispatchToObjectDetailsPage(realOwner.getCompileTimeClass(), realOwner.getOid(), TaskErrorsTabPanel.this, false);
        }
    });
    return columns;
}
Also used : IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) PrismObject(com.evolveum.midpoint.prism.PrismObject) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) TaskErrorSelectableBeanImplOld(com.evolveum.midpoint.web.page.admin.server.dto.TaskErrorSelectableBeanImplOld)

Example 55 with IColumn

use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.

the class ResourceSchemaHandlingTabPanel method initLayout.

private void initLayout() {
    MidpointForm<?> form = new MidpointForm<>(ID_FORM);
    add(form);
    MultivalueContainerListPanelWithDetailsPanel<ResourceObjectTypeDefinitionType> objectTypesPanel = new MultivalueContainerListPanelWithDetailsPanel<>(ID_TABLE, ResourceObjectTypeDefinitionType.class) {

        @Override
        protected MultivalueContainerDetailsPanel<ResourceObjectTypeDefinitionType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> item) {
            return createMultivalueContainerDetailsPanel(ID_ITEM_DETAILS, item.getModel());
        }

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

        @Override
        protected IModel<PrismContainerWrapper<ResourceObjectTypeDefinitionType>> getContainerModel() {
            return PrismContainerWrapperModel.fromContainerWrapper(ResourceSchemaHandlingTabPanel.this.getModel(), SchemaHandlingType.F_OBJECT_TYPE);
        }

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

        @Override
        protected List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> createDefaultColumns() {
            List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> columns = new ArrayList<>();
            columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_KIND, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_INTENT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DEFAULT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DESCRIPTION, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            List<InlineMenuItem> menuActionsList = getMultivalueContainerListPanel().getDefaultMenuActions();
            columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {

                private static final long serialVersionUID = 1L;

                @Override
                public String getCssClass() {
                    return " col-md-1 ";
                }
            });
            return columns;
        }
    };
    form.add(objectTypesPanel);
}
Also used : InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) ArrayList(java.util.ArrayList) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) ResourceObjectTypeDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDefinitionType) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) MultivalueContainerListPanelWithDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ListItem(org.apache.wicket.markup.html.list.ListItem)

Aggregations

IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)131 ArrayList (java.util.ArrayList)80 IModel (org.apache.wicket.model.IModel)73 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)69 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)43 Label (org.apache.wicket.markup.html.basic.Label)43 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)37 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)36 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)31 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)31 Model (org.apache.wicket.model.Model)22 Item (org.apache.wicket.markup.repeater.Item)19 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)18 List (java.util.List)18 Component (org.apache.wicket.Component)18 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)17 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)17 PropertyModel (org.apache.wicket.model.PropertyModel)15 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)14 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)13