Search in sources :

Example 6 with PrismContainerWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper in project midpoint by Evolveum.

the class SingleContainerPanel method initLayout.

private void initLayout() {
    try {
        ItemPanelSettingsBuilder builder = new ItemPanelSettingsBuilder().visibilityHandler(wrapper -> getVisibility(wrapper)).editabilityHandler(getEditabilityHandler()).mandatoryHandler(getMandatoryHandler());
        if (config == null) {
            Panel panel = getPageBase().initItemPanel(ID_CONTAINER, getTypeName(), getModel(), builder.build());
            add(panel);
        } else {
            RepeatingView view = new RepeatingView(ID_CONTAINER);
            List<VirtualContainersSpecificationType> virtualContainers = config.getContainer();
            for (VirtualContainersSpecificationType virtualContainer : virtualContainers) {
                if (!WebComponentUtil.getElementVisibility(virtualContainer.getVisibility())) {
                    continue;
                }
                IModel<PrismContainerWrapper<C>> virtualContainerModel = createVirtualContainerModel(virtualContainer);
                if (virtualContainerModel == null) {
                    continue;
                }
                ItemPanelSettings settings = builder.build();
                Panel virtualPanel = new PrismContainerPanel<>(view.newChildId(), virtualContainerModel, settings);
                view.add(virtualPanel);
            }
            QName typeName = getTypeName();
            if (typeName != null) {
                Panel panel = getPageBase().initItemPanel(view.newChildId(), typeName, getModel(), builder.build());
                view.add(panel);
            }
            add(view);
        }
    } catch (SchemaException e) {
        LOGGER.error("Cannot create panel for {}, {}", getTypeName(), e.getMessage(), e);
        // TODO opertion result? localization?
        getSession().error("Cannot create panel for " + getTypeName());
    }
}
Also used : Panel(org.apache.wicket.markup.html.panel.Panel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) QName(javax.xml.namespace.QName) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) VirtualContainersSpecificationType(com.evolveum.midpoint.xml.ns._public.common.common_3.VirtualContainersSpecificationType)

Example 7 with PrismContainerWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper in project midpoint by Evolveum.

the class ListMappingPanel method initLayout.

private void initLayout() {
    MultivalueContainerListPanelWithDetailsPanel<MappingType> table = new MultivalueContainerListPanelWithDetailsPanel<MappingType>(ID_TABLE, MappingType.class) {

        @Override
        protected MultivalueContainerDetailsPanel<MappingType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<MappingType>> item) {
            return new MultivalueContainerDetailsPanel<>(MultivalueContainerListPanelWithDetailsPanel.ID_ITEM_DETAILS, item.getModel(), true) {

                @Override
                protected DisplayNamePanel<MappingType> createDisplayNamePanel(String displayNamePanelId) {
                    ItemRealValueModel<MappingType> displayNameModel = new ItemRealValueModel<>(item.getModel());
                    return new DisplayNamePanel<>(displayNamePanelId, displayNameModel) {

                        @Override
                        protected IModel<String> createHeaderModel() {
                            IModel<String> headerModel = super.createHeaderModel();
                            if (StringUtils.isEmpty(headerModel.getObject())) {
                                return getPageBase().createStringResource("feedbackMessagePanel.message.undefined");
                            }
                            return headerModel;
                        }
                    };
                }

                @Override
                protected ItemVisibility getBasicTabVisibity(ItemWrapper<?, ?> itemWrapper) {
                    if (itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, MappingType.F_METADATA_MAPPING))) {
                        return ItemVisibility.HIDDEN;
                    }
                    return ItemVisibility.AUTO;
                }
            };
        }

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

        @Override
        protected IModel<PrismContainerWrapper<MappingType>> getContainerModel() {
            return ListMappingPanel.this.getModel();
        }

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

        @Override
        protected List<IColumn<PrismContainerValueWrapper<MappingType>, String>> createDefaultColumns() {
            List<IColumn<PrismContainerValueWrapper<MappingType>, String>> columns = new ArrayList<>();
            columns.add(new PrismPropertyWrapperColumn<>(ListMappingPanel.this.getModel(), MappingType.F_DESCRIPTION, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            columns.add(new PrismPropertyWrapperColumn<>(ListMappingPanel.this.getModel(), MappingType.F_ENABLED, AbstractItemWrapperColumn.ColumnType.VALUE, getPageBase()));
            columns.add(new AbstractColumn<>(createStringResource("ListMappingPanel.mappingDescription")) {

                @Override
                public void populateItem(Item<ICellPopulator<PrismContainerValueWrapper<MappingType>>> cellItem, String componentId, IModel<PrismContainerValueWrapper<MappingType>> rowModel) {
                    cellItem.add(new Label(componentId, WebComponentUtil.createMappingDescription(rowModel)));
                }
            });
            List<InlineMenuItem> items = new ArrayList<>();
            InlineMenuItem item = new InlineMenuItem(createStringResource("pageAdminFocus.button.delete")) {

                private static final long serialVersionUID = 1L;

                @Override
                public InlineMenuItemAction initAction() {
                    return new ColumnMenuAction() {

                        private static final long serialVersionUID = 1L;

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            deleteItemPerformed(target, getPerformedSelectedItems(getRowModel()));
                        }
                    };
                }
            };
            items.add(item);
            item = new ButtonInlineMenuItem(createStringResource("PageBase.button.edit")) {

                private static final long serialVersionUID = 1L;

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

                @Override
                public InlineMenuItemAction initAction() {
                    return new ColumnMenuAction() {

                        private static final long serialVersionUID = 1L;

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            editItemPerformed(target, getRowModel(), getSelectedItems());
                            target.add(getFeedbackPanel());
                        }
                    };
                }
            };
            items.add(item);
            columns.add(new InlineMenuButtonColumn(items, getPageBase()) {

                @Override
                public String getCssClass() {
                    return "col-xs-1";
                }
            });
            return columns;
        }

        @Override
        protected IColumn<PrismContainerValueWrapper<MappingType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
            return new PrismPropertyWrapperColumn<>(ListMappingPanel.this.getModel(), MappingType.F_NAME, AbstractItemWrapperColumn.ColumnType.LINK, getPageBase()) {

                @Override
                protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<MappingType>> model) {
                    itemDetailsPerformed(target, model);
                }
            };
        }

        @Override
        protected IColumn<PrismContainerValueWrapper<MappingType>, String> createCheckboxColumn() {
            return new CheckBoxHeaderColumn<>();
        }

        @Override
        protected PrismContainerDefinition<MappingType> getTypeDefinitionForSearch() {
            return getPrismContext().getSchemaRegistry().findContainerDefinitionByType(MappingType.COMPLEX_TYPE);
        }
    };
    add(table);
}
Also used : MultivalueContainerDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) ItemWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) DisplayNamePanel(com.evolveum.midpoint.gui.api.component.DisplayNamePanel) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) 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) IModel(org.apache.wicket.model.IModel) PrismPropertyWrapperColumn(com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn) InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) ItemRealValueModel(com.evolveum.midpoint.gui.impl.factory.panel.ItemRealValueModel) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) MultivalueContainerListPanelWithDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) ListItem(org.apache.wicket.markup.html.list.ListItem) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 8 with PrismContainerWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper in project midpoint by Evolveum.

the class AssignmentsDetailsPanel method getConstructionAssociationPanel.

private PanelTab getConstructionAssociationPanel() {
    return new PanelTab(createStringResource("AssignmentPanel.inducedEntitlements")) {

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            IModel<PrismContainerWrapper<ConstructionType>> constructionModel = PrismContainerWrapperModel.fromContainerValueWrapper(getModel(), AssignmentType.F_CONSTRUCTION);
            ConstructionAssociationPanel constructionDetailsPanel = new ConstructionAssociationPanel(panelId, constructionModel);
            constructionDetailsPanel.setOutputMarkupId(true);
            return constructionDetailsPanel;
        }
    };
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) ConstructionAssociationPanel(com.evolveum.midpoint.web.component.assignment.ConstructionAssociationPanel) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper)

Example 9 with PrismContainerWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper in project midpoint by Evolveum.

the class ReportMainPanel method createObjectListForColumns.

private WebMarkupContainer createObjectListForColumns(String panelId, PageAdminObjectDetails<ReportType> parentPage) {
    return new BasicMultivalueContainerListPanel<>(panelId, GuiObjectColumnType.class) {

        @Override
        protected MultivalueContainerDetailsPanel<GuiObjectColumnType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<GuiObjectColumnType>> item) {
            return createDetailsPanelForColumn(ID_ITEM_DETAILS, item);
        }

        @Override
        protected String getContainerNameForNewButton() {
            return getPageBase().createStringResource("GuiObjectListViewType.column").getString();
        }

        @Override
        protected IModel<PrismContainerWrapper<GuiObjectColumnType>> getContainerModel() {
            return PrismContainerWrapperModel.fromContainerWrapper(ReportMainPanel.this.getObjectModel(), ItemPath.create(ReportType.F_OBJECT_COLLECTION, ObjectCollectionReportEngineConfigurationType.F_VIEW, GuiObjectListViewType.F_COLUMN));
        }

        @Override
        protected Component createHeader(String headerId) {
            Label label = new Label(headerId, getPageBase().createStringResource("EngineReportTabPanel.columns"));
            label.add(AttributeAppender.append("style", "padding-bottom:10px; font-size: 16px; font-weight: 600; color: #3c8dbc;"));
            return label;
        }

        @Override
        protected List<IColumn<PrismContainerValueWrapper<GuiObjectColumnType>, String>> createDefaultColumns() {
            return createColumnsForColumns(parentPage);
        }
    };
}
Also used : BasicMultivalueContainerListPanel(com.evolveum.midpoint.gui.impl.component.BasicMultivalueContainerListPanel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) Label(org.apache.wicket.markup.html.basic.Label) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 10 with PrismContainerWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper in project midpoint by Evolveum.

the class ResourceSchemaHandlingTabPanel method createMultivalueContainerDetailsPanel.

private MultivalueContainerDetailsPanel<ResourceObjectTypeDefinitionType> createMultivalueContainerDetailsPanel(String panelId, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> model) {
    return new MultivalueContainerDetailsPanel<>(panelId, model, true) {

        @Override
        protected ItemVisibility getBasicTabVisibity(ItemWrapper<?, ?> itemWrapper) {
            if (itemWrapper instanceof PrismContainerWrapper) {
                return ItemVisibility.HIDDEN;
            }
            return ItemVisibility.AUTO;
        }

        @Override
        @NotNull
        protected List<ITab> createTabs() {
            List<ITab> tabs = new ArrayList<>();
            tabs.add(new PanelTab(createStringResource("Attributes")) {

                @Override
                public WebMarkupContainer createPanel(String panelId) {
                    return new ResourceAttributePanel(panelId, PrismContainerWrapperModel.fromContainerValueWrapper(getModel(), ResourceObjectTypeDefinitionType.F_ATTRIBUTE), null);
                }
            });
            return tabs;
        }

        @Override
        protected DisplayNamePanel<ResourceObjectTypeDefinitionType> createDisplayNamePanel(String displayNamePanelId) {
            return new DisplayNamePanel<>(displayNamePanelId, new ItemRealValueModel<>(getModel()));
        }
    };
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) MultivalueContainerDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) ArrayList(java.util.ArrayList) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ItemWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper) ResourceObjectTypeDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDefinitionType) DisplayNamePanel(com.evolveum.midpoint.gui.api.component.DisplayNamePanel) ResourceAttributePanel(com.evolveum.midpoint.gui.impl.prism.panel.ResourceAttributePanel)

Aggregations

PrismContainerWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper)20 ArrayList (java.util.ArrayList)11 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)9 List (java.util.List)8 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)8 IModel (org.apache.wicket.model.IModel)8 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)7 ListItem (org.apache.wicket.markup.html.list.ListItem)7 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)6 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)6 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)5 MultivalueContainerListPanelWithDetailsPanel (com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel)5 DisplayNamePanel (com.evolveum.midpoint.gui.api.component.DisplayNamePanel)4 ItemWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper)4 PrismContainerValueWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)4 MultivalueContainerDetailsPanel (com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel)4 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)4 MultivalueContainerListPanel (com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanel)3 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)3 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3