Search in sources :

Example 66 with IColumn

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

the class AuditLogViewerPanel method initLayout.

private void initLayout() {
    ContainerableListPanel<AuditEventRecordType, SelectableBean<AuditEventRecordType>> auditLogViewerTable = new ContainerableListPanel<>(ID_AUDIT_LOG_VIEWER_TABLE, AuditEventRecordType.class) {

        @Override
        protected List<IColumn<SelectableBean<AuditEventRecordType>, String>> createDefaultColumns() {
            return AuditLogViewerPanel.this.createColumns();
        }

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

        @Override
        protected IColumn<SelectableBean<AuditEventRecordType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
            return AuditLogViewerPanel.this.createNameColumn();
        }

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

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

        @Override
        protected Search createSearch(Class<AuditEventRecordType> type) {
            // TODO: use storage?
            AuditLogStorage storage = (AuditLogStorage) getPageStorage();
            Search search = SearchFactory.createContainerSearch(new ContainerTypeSearchItem(new SearchValue(type, "")), AuditEventRecordType.F_TIMESTAMP, getPageBase(), true);
            DateSearchItem timestampItem = (DateSearchItem) search.findPropertySearchItem(AuditEventRecordType.F_TIMESTAMP);
            if (timestampItem != null && timestampItem.getFromDate() == null && timestampItem.getToDate() == null && !isCollectionViewPanelForWidget()) {
                Date todayDate = Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant());
                timestampItem.setFromDate(MiscUtil.asXMLGregorianCalendar(todayDate));
            }
            return search;
        }

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

        @Override
        protected String getStorageKey() {
            String collectionNameValue = null;
            if (isCollectionViewPanelForCompiledView()) {
                StringValue collectionName = getCollectionNameParameterValue();
                collectionNameValue = collectionName != null ? collectionName.toString() : "";
            }
            return getAuditStorageKey(collectionNameValue);
        }

        @Override
        protected ISelectableDataProvider createProvider() {
            PageStorage pageStorage = getPageStorage();
            SelectableBeanContainerDataProvider<AuditEventRecordType> provider = new SelectableBeanContainerDataProvider<AuditEventRecordType>(AuditLogViewerPanel.this, getSearchModel(), null, false) {

                @Override
                protected PageStorage getPageStorage() {
                    return pageStorage;
                }

                @Override
                protected Integer countObjects(Class<? extends AuditEventRecordType> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> currentOptions, Task task, OperationResult result) throws CommonException {
                    return getPageBase().getModelAuditService().countObjects(query, currentOptions, task, result);
                }

                @Override
                protected List<AuditEventRecordType> searchObjects(Class<? extends AuditEventRecordType> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult result) throws CommonException {
                    return getPageBase().getModelAuditService().searchObjects(query, options, task, result);
                }

                @NotNull
                @Override
                protected List<ObjectOrdering> createObjectOrderings(SortParam<String> sortParam) {
                    if (sortParam != null && sortParam.getProperty() != null) {
                        OrderDirection order = sortParam.isAscending() ? OrderDirection.ASCENDING : OrderDirection.DESCENDING;
                        return Collections.singletonList(getPrismContext().queryFactory().createOrdering(ItemPath.create(new QName(AuditEventRecordType.COMPLEX_TYPE.getNamespaceURI(), sortParam.getProperty())), order));
                    } else {
                        return Collections.emptyList();
                    }
                }

                @Override
                protected ObjectQuery getCustomizeContentQuery() {
                    return AuditLogViewerPanel.this.getCustomizeContentQuery();
                }
            };
            provider.setSort(AuditEventRecordType.F_TIMESTAMP.getLocalPart(), SortOrder.DESCENDING);
            return provider;
        }

        @Override
        protected AuditEventRecordType getRowRealValue(SelectableBean<AuditEventRecordType> rowModelObject) {
            if (rowModelObject == null) {
                return null;
            }
            return rowModelObject.getValue();
        }

        @Override
        protected List<Component> createToolbarButtonsList(String idButton) {
            List<Component> buttonsList = new ArrayList<>();
            CsvDownloadButtonPanel exportDataLink = new CsvDownloadButtonPanel(idButton) {

                private static final long serialVersionUID = 1L;

                @Override
                protected String getFilename() {
                    return "AuditLogViewer_" + createStringResource("MainObjectListPanel.exportFileName").getString();
                }

                @Override
                protected DataTable<?, ?> getDataTable() {
                    return getTable().getDataTable();
                }
            };
            exportDataLink.add(new VisibleEnableBehaviour() {

                private static final long serialVersionUID = 1L;

                @Override
                public boolean isVisible() {
                    return WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_CSV_EXPORT_ACTION_URI);
                }
            });
            buttonsList.add(exportDataLink);
            AjaxCompositedIconButton createReport = new AjaxCompositedIconButton(idButton, WebComponentUtil.createCreateReportIcon(), getPageBase().createStringResource("MainObjectListPanel.createReport")) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    createReportPerformed(target);
                }
            };
            createReport.add(AttributeAppender.append("class", "btn btn-default btn-sm btn-margin-right"));
            buttonsList.add(createReport);
            return buttonsList;
        }
    };
    auditLogViewerTable.setOutputMarkupId(true);
    add(auditLogViewerTable);
}
Also used : AjaxCompositedIconButton(com.evolveum.midpoint.gui.impl.component.AjaxCompositedIconButton) Task(com.evolveum.midpoint.task.api.Task) GuiObjectColumnType(com.evolveum.midpoint.xml.ns._public.common.common_3.GuiObjectColumnType) AuditLogStorage(com.evolveum.midpoint.web.session.AuditLogStorage) ContainerableListPanel(com.evolveum.midpoint.gui.impl.component.ContainerableListPanel) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) SortParam(org.apache.wicket.extensions.markup.html.repeater.util.SortParam) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) StringValue(org.apache.wicket.util.string.StringValue) Component(org.apache.wicket.Component) OrderDirection(com.evolveum.midpoint.prism.query.OrderDirection) PageStorage(com.evolveum.midpoint.web.session.PageStorage) IModel(org.apache.wicket.model.IModel) QName(javax.xml.namespace.QName) ObjectOrdering(com.evolveum.midpoint.prism.query.ObjectOrdering) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) LocalDate(java.time.LocalDate) CsvDownloadButtonPanel(com.evolveum.midpoint.gui.api.component.button.CsvDownloadButtonPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) AuditEventRecordType(com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType) SelectableBeanContainerDataProvider(com.evolveum.midpoint.web.component.data.SelectableBeanContainerDataProvider) ExpressionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 67 with IColumn

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

the class AuditLogViewerPanel method createColumns.

protected List<IColumn<SelectableBean<AuditEventRecordType>, String>> createColumns() {
    List<IColumn<SelectableBean<AuditEventRecordType>, String>> columns = new ArrayList<>();
    LinkColumn<SelectableBean<AuditEventRecordType>> initiatorRefColumn = new LinkColumn<>(createStringResource("AuditEventRecordType.initiatorRef"), SelectableBeanImpl.F_VALUE + "." + AuditEventRecordType.F_INITIATOR_REF.getLocalPart()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected IModel<String> createLinkModel(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
            return new ReadOnlyModel<>(() -> {
                AuditEventRecordType auditEventRecordType = unwrapModel(rowModel);
                if (auditEventRecordType == null) {
                    return null;
                }
                return WebModelServiceUtils.resolveReferenceName(auditEventRecordType.getInitiatorRef(), getPageBase(), true);
            });
        }

        @Override
        public void onClick(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
            AuditEventRecordType auditEventRecordType = unwrapModel(rowModel);
            dispatchToObjectDetailsPage(auditEventRecordType.getInitiatorRef(), getPageBase(), false);
        }

        @Override
        public boolean isEnabled(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
            return unwrapModel(rowModel) != null;
        }
    };
    columns.add(initiatorRefColumn);
    if (!isObjectHistoryPanel()) {
        IColumn<SelectableBean<AuditEventRecordType>, String> eventStageColumn = new PropertyColumn<>(createStringResource("PageAuditLogViewer.eventStageLabel"), AuditEventRecordType.F_EVENT_STAGE.getLocalPart(), SelectableBeanImpl.F_VALUE + "." + AuditEventRecordType.F_EVENT_STAGE.getLocalPart()) {

            private static final long serialVersionUID = 1L;

            @Override
            public IModel<String> getDataModel(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
                AuditEventRecordType record = unwrapModel(rowModel);
                if (record == null) {
                    return new Model<>();
                }
                return WebComponentUtil.createLocalizedModelForEnum(record.getEventStage(), AuditLogViewerPanel.this);
            }
        };
        columns.add(eventStageColumn);
    }
    IColumn<SelectableBean<AuditEventRecordType>, String> eventTypeColumn = new PropertyColumn<>(createStringResource("PageAuditLogViewer.eventTypeLabel"), AuditEventRecordType.F_EVENT_TYPE.getLocalPart(), SelectableBeanImpl.F_VALUE + "." + AuditEventRecordType.F_EVENT_TYPE.getLocalPart()) {

        private static final long serialVersionUID = 1L;

        @Override
        public IModel<String> getDataModel(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
            AuditEventRecordType record = unwrapModel(rowModel);
            if (record == null) {
                return Model.of();
            }
            return WebComponentUtil.createLocalizedModelForEnum(record.getEventType(), AuditLogViewerPanel.this);
        }
    };
    columns.add(eventTypeColumn);
    if (!isObjectHistoryPanel()) {
        LinkColumn<SelectableBean<AuditEventRecordType>> targetRefColumn = new LinkColumn<>(createStringResource("AuditEventRecordType.targetRef"), SelectableBeanImpl.F_VALUE + "." + AuditEventRecordType.F_TARGET_REF.getLocalPart()) {

            private static final long serialVersionUID = 1L;

            @Override
            protected IModel<String> createLinkModel(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
                return new ReadOnlyModel<>(() -> {
                    AuditEventRecordType auditEventRecordType = unwrapModel(rowModel);
                    if (auditEventRecordType == null) {
                        return null;
                    }
                    return WebModelServiceUtils.resolveReferenceName(auditEventRecordType.getTargetRef(), getPageBase(), true);
                });
            }

            @Override
            public boolean isEnabled(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
                return unwrapModel(rowModel) != null && !AuditEventTypeType.DELETE_OBJECT.equals(unwrapModel(rowModel).getEventType());
            }

            @Override
            public void onClick(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
                AuditEventRecordType auditEventRecordType = unwrapModel(rowModel);
                dispatchToObjectDetailsPage(auditEventRecordType.getTargetRef(), getPageBase(), false);
            }
        };
        columns.add(targetRefColumn);
    }
    if (!isObjectHistoryPanel()) {
        LinkColumn<SelectableBean<AuditEventRecordType>> targetOwnerRefColumn = new LinkColumn<>(createStringResource("AuditEventRecordType.targetOwnerRef"), SelectableBeanImpl.F_VALUE + "." + AuditEventRecordType.F_TARGET_OWNER_REF.getLocalPart()) {

            private static final long serialVersionUID = 1L;

            @Override
            protected IModel<String> createLinkModel(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
                return new ReadOnlyModel<>(() -> {
                    AuditEventRecordType auditEventRecordType = unwrapModel(rowModel);
                    if (auditEventRecordType == null) {
                        return null;
                    }
                    return WebModelServiceUtils.resolveReferenceName(auditEventRecordType.getTargetOwnerRef(), getPageBase(), true);
                });
            }

            @Override
            public void onClick(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
                AuditEventRecordType auditEventRecordType = unwrapModel(rowModel);
                dispatchToObjectDetailsPage(auditEventRecordType.getTargetOwnerRef(), getPageBase(), false);
            }

            @Override
            public boolean isEnabled(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
                return unwrapModel(rowModel) != null;
            }
        };
        columns.add(targetOwnerRefColumn);
    }
    IColumn<SelectableBean<AuditEventRecordType>, String> channelColumn = new PropertyColumn<>(createStringResource("AuditEventRecordType.channel"), AuditEventRecordType.F_CHANNEL.getLocalPart(), SelectableBeanImpl.F_VALUE + "." + AuditEventRecordType.F_CHANNEL.getLocalPart()) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<AuditEventRecordType>>> item, String componentId, IModel<SelectableBean<AuditEventRecordType>> rowModel) {
            IModel<String> channelModel = new ReadOnlyModel<String>(() -> {
                AuditEventRecordType auditEventRecordType = unwrapModel(rowModel);
                if (auditEventRecordType == null) {
                    // TODO might we return null?
                    return "";
                }
                String channel = auditEventRecordType.getChannel();
                for (GuiChannel chan : GuiChannel.values()) {
                    if (chan.getUri().equals(channel)) {
                        // WebComponentUtil.createLocalizedModelForEnum(chan, AuditLogViewerPanel.this);
                        return getPageBase().createStringResource(chan).getString();
                    }
                }
                return "";
            });
            // if (channelValue != null) {
            // item.add(new Label(componentId, WebComponentUtil.createLocalizedModelForEnum(channelValue, AuditLogViewerPanel.this)));
            // } else {
            // item.add(new Label(componentId, ""));
            // }
            item.add(new Label(componentId, channelModel));
            item.add(new AttributeModifier("style", new Model<>("width: 10%;")));
        }
    };
    columns.add(channelColumn);
    IColumn<SelectableBean<AuditEventRecordType>, String> outcomeColumn = new PropertyColumn<>(createStringResource("PageAuditLogViewer.outcomeLabel"), AuditEventRecordType.F_OUTCOME.getLocalPart(), SelectableBeanImpl.F_VALUE + "." + AuditEventRecordType.F_OUTCOME.getLocalPart()) {

        private static final long serialVersionUID = 1L;

        @Override
        public IModel<String> getDataModel(IModel<SelectableBean<AuditEventRecordType>> rowModel) {
            AuditEventRecordType record = unwrapModel(rowModel);
            if (record == null) {
                return null;
            }
            return WebComponentUtil.createLocalizedModelForEnum(record.getOutcome(), AuditLogViewerPanel.this);
        }
    };
    columns.add(outcomeColumn);
    return columns;
}
Also used : IModel(org.apache.wicket.model.IModel) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) Label(org.apache.wicket.markup.html.basic.Label) GuiChannel(com.evolveum.midpoint.gui.impl.GuiChannel) AttributeModifier(org.apache.wicket.AttributeModifier) LinkColumn(com.evolveum.midpoint.web.component.data.column.LinkColumn) Item(org.apache.wicket.markup.repeater.Item) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) AuditEventRecordType(com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) IModel(org.apache.wicket.model.IModel) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) Model(org.apache.wicket.model.Model)

Example 68 with IColumn

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

the class ResourceContentPanel method initColumns.

private List<IColumn<SelectableBean<ShadowType>, String>> initColumns() {
    List<ColumnTypeDto<String>> columnDefs = Arrays.asList(new ColumnTypeDto<>("ShadowType.synchronizationSituation", SelectableBeanImpl.F_VALUE + ".synchronizationSituation", ShadowType.F_SYNCHRONIZATION_SITUATION.getLocalPart()), new ColumnTypeDto<>("ShadowType.intent", SelectableBeanImpl.F_VALUE + ".intent", ShadowType.F_INTENT.getLocalPart()));
    List<IColumn<SelectableBean<ShadowType>, String>> columns = new ArrayList<>();
    IColumn<SelectableBean<ShadowType>, String> identifiersColumn = new AbstractColumn<>(createStringResource("pageContentAccounts.identifiers")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ShadowType>>> cellItem, String componentId, IModel<SelectableBean<ShadowType>> rowModel) {
            SelectableBean<ShadowType> dto = rowModel.getObject();
            RepeatingView repeater = new RepeatingView(componentId);
            ShadowType value = dto.getValue();
            if (value != null) {
                for (ResourceAttribute<?> attr : ShadowUtil.getAllIdentifiers(value)) {
                    repeater.add(new Label(repeater.newChildId(), attr.getElementName().getLocalPart() + ": " + attr.getRealValue()));
                }
            }
            cellItem.add(repeater);
        }
    };
    columns.add(identifiersColumn);
    columns.addAll(ColumnUtils.createColumns(columnDefs));
    ObjectLinkColumn<SelectableBean<ShadowType>> ownerColumn = new ObjectLinkColumn<>(createStringResource("pageContentAccounts.owner")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected IModel<FocusType> createLinkModel(final IModel<SelectableBean<ShadowType>> rowModel) {
            return new IModel<>() {

                private static final long serialVersionUID = 1L;

                @Override
                public FocusType getObject() {
                    return loadShadowOwner(rowModel);
                }
            };
        }

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ShadowType>> rowModel, ObjectType targetObjectType) {
            ownerDetailsPerformed((FocusType) targetObjectType);
        }
    };
    columns.add(ownerColumn);
    columns.add(new AbstractColumn<>(createStringResource("PageAccounts.accounts.pendingOperations")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ShadowType>>> cellItem, String componentId, IModel<SelectableBean<ShadowType>> rowModel) {
            cellItem.add(new PendingOperationPanel(componentId, new PropertyModel<>(rowModel, SelectableBeanImpl.F_VALUE + "." + ShadowType.F_PENDING_OPERATION.getLocalPart())));
        }
    });
    return columns;
}
Also used : RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) Label(org.apache.wicket.markup.html.basic.Label) ColumnTypeDto(com.evolveum.midpoint.web.component.data.column.ColumnTypeDto) PendingOperationPanel(com.evolveum.midpoint.gui.api.component.PendingOperationPanel) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) Item(org.apache.wicket.markup.repeater.Item) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) IModel(org.apache.wicket.model.IModel) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectLinkColumn(com.evolveum.midpoint.web.component.data.column.ObjectLinkColumn) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)

Example 69 with IColumn

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

the class PageObjectCollections method initLayout.

private void initLayout() {
    Form mainForm = new MidpointForm(ID_MAIN_FORM);
    add(mainForm);
    MainObjectListPanel<ObjectCollectionType> table = new MainObjectListPanel<ObjectCollectionType>(ID_TABLE, ObjectCollectionType.class) {

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

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            List<InlineMenuItem> menu = new ArrayList<>();
            menu.add(createDeleteInlineMenu());
            return menu;
        }

        @Override
        protected List<IColumn<SelectableBean<ObjectCollectionType>, String>> createDefaultColumns() {
            return ColumnUtils.getDefaultObjectColumns();
        }

        @Override
        protected String getNothingSelectedMessage() {
            return getString("pageObjectCollections.message.nothingSelected");
        }

        @Override
        protected String getConfirmMessageKeyForSingleObject() {
            return "pageObjectCollections.message.confirmationMessageForMultipleObject";
        }

        @Override
        protected String getConfirmMessageKeyForMultiObject() {
            return "pageObjectCollections.message.confirmationMessageForSingleObject";
        }
    };
    table.setOutputMarkupId(true);
    mainForm.add(table);
}
Also used : UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ArrayList(java.util.ArrayList) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ObjectCollectionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectCollectionType)

Example 70 with IColumn

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

the class ReportMainPanel method createColumnsForColumns.

private List<IColumn<PrismContainerValueWrapper<GuiObjectColumnType>, String>> createColumnsForColumns(PageAdminObjectDetails<ReportType> parentPage) {
    PrismContainerWrapperModel<ReportType, GuiObjectColumnType> containerModel = PrismContainerWrapperModel.fromContainerWrapper(getObjectModel(), ItemPath.create(ReportType.F_OBJECT_COLLECTION, ObjectCollectionReportEngineConfigurationType.F_VIEW, GuiObjectListViewType.F_COLUMN));
    List<IColumn<PrismContainerValueWrapper<GuiObjectColumnType>, String>> columns = new ArrayList<>();
    columns.add(new PrismPropertyWrapperColumn<GuiObjectColumnType, String>(containerModel, GuiObjectColumnType.F_NAME, AbstractItemWrapperColumn.ColumnType.VALUE, parentPage) {

        @Override
        public String getCssClass() {
            return "col-sm-3 col-md-2";
        }
    });
    columns.add(new PrismPropertyWrapperColumn<GuiObjectColumnType, String>(containerModel, GuiObjectColumnType.F_PATH, AbstractItemWrapperColumn.ColumnType.VALUE, parentPage) {

        @Override
        public String getCssClass() {
            return "col-md-3";
        }
    });
    PrismContainerDefinition<Containerable> def = containerModel.getObject().getComplexTypeDefinition().findContainerDefinition(GuiObjectColumnType.F_DISPLAY);
    columns.add(new PrismPropertyWrapperColumn(Model.of(def), DisplayType.F_LABEL, AbstractItemWrapperColumn.ColumnType.VALUE, parentPage) {

        @Override
        public IModel<?> getDataModel(IModel rowModel) {
            return PrismPropertyWrapperModel.fromContainerValueWrapper(rowModel, ItemPath.create(GuiObjectColumnType.F_DISPLAY, DisplayType.F_LABEL));
        }
    });
    return columns;
}
Also used : IModel(org.apache.wicket.model.IModel) PrismPropertyWrapperColumn(com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn) ArrayList(java.util.ArrayList) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) Containerable(com.evolveum.midpoint.prism.Containerable)

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