Search in sources :

Example 11 with ItemWrapper

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

the class ShadowPanel method initLayout.

private void initLayout() {
    try {
        if (config != null) {
            SingleContainerPanel attributesContainer = new SingleContainerPanel(ID_ATTRIBUTES, getModel(), config) {

                @Override
                protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
                    return checkShadowContainerVisibility(itemWrapper, ShadowPanel.this.getModel());
                }
            };
            add(attributesContainer);
        } else {
            ItemPanelSettingsBuilder attributesSettingsBuilder = new ItemPanelSettingsBuilder().visibilityHandler(itemWrapper -> checkShadowContainerVisibility(itemWrapper, getModel()));
            Panel attributesPanel = getPageBase().initItemPanel(ID_ATTRIBUTES, ShadowAttributesType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(getModel(), ShadowType.F_ATTRIBUTES), attributesSettingsBuilder.build());
            add(attributesPanel);
        }
        ItemPanelSettingsBuilder associationBuilder = new ItemPanelSettingsBuilder().visibilityHandler(itemWrapper -> checkShadowContainerVisibility(itemWrapper, getModel()));
        Panel associationsPanel = getPageBase().initItemPanel(ID_ASSOCIATIONS, ShadowAssociationType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(getModel(), ShadowType.F_ASSOCIATION), associationBuilder.build());
        associationsPanel.add(new VisibleBehaviour(() -> checkAssociationsVisibility()));
        add(associationsPanel);
        ItemPanelSettingsBuilder activationBuilder = new ItemPanelSettingsBuilder().visibilityHandler(itemWrapper -> checkShadowContainerVisibility(itemWrapper, getModel()));
        Panel activationPanel = getPageBase().initItemPanel(ID_ACTIVATION, ActivationType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(getModel(), ShadowType.F_ACTIVATION), activationBuilder.build());
        activationPanel.add(new VisibleBehaviour(() -> isActivationSupported()));
        add(activationPanel);
        ItemPanelSettingsBuilder passwordSettingsBuilder = new ItemPanelSettingsBuilder().visibilityHandler(itemWrapper -> checkShadowContainerVisibility(itemWrapper, getModel()));
        Panel passwordPanel = getPageBase().initItemPanel(ID_PASSWORD, PasswordType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(getModel(), ItemPath.create(ShadowType.F_CREDENTIALS, CredentialsType.F_PASSWORD)), passwordSettingsBuilder.build());
        passwordPanel.add(new VisibleBehaviour(() -> isCredentialsSupported()));
        add(passwordPanel);
    } catch (SchemaException e) {
        getSession().error("Cannot create panels for shadow, reason: " + e.getMessage());
        LOGGER.trace("Cannot create panels for shadow, reason: {}", e.getMessage(), e);
    }
}
Also used : ItemWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper) Panel(org.apache.wicket.markup.html.panel.Panel) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour)

Example 12 with ItemWrapper

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

the class ReportMainPanel method getTabs.

private List<ITab> getTabs(PageAdminObjectDetails<ReportType> parentPage) {
    List<ITab> tabs = new ArrayList<>();
    tabs.add(new PanelTab(parentPage.createStringResource("pageReport.basic.title")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ObjectBasicPanel<ReportType>(panelId, getObjectModel()) {

                @Override
                protected QName getType() {
                    return ReportType.COMPLEX_TYPE;
                }

                @Override
                protected ItemVisibility getBasicTabVisibility(ItemWrapper<?, ?> itemWrapper) {
                    if (itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ReportType.F_LIFECYCLE_STATE)) || itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ReportType.F_DIAGNOSTIC_INFORMATION)) || itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ReportType.F_DEFAULT_SCRIPT_CONFIGURATION)) || itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ReportType.F_POST_REPORT_SCRIPT))) {
                        return ItemVisibility.HIDDEN;
                    }
                    return ItemVisibility.AUTO;
                }
            };
        }
    });
    tabs.add(new PanelTab(parentPage.createStringResource("pageReport.engine.title")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new EngineReportTabPanel(panelId, getObjectModel());
        }

        @Override
        public boolean isVisible() {
            return hasDefinitionFor(ReportType.F_OBJECT_COLLECTION) || hasDefinitionFor(ReportType.F_DASHBOARD);
        }
    });
    tabs.addAll(createTabsForCollectionReports(parentPage));
    tabs.addAll(createTabsForDashboardReports(parentPage));
    tabs.add(new PanelTab(parentPage.createStringResource("pageReport.export.title")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            PrismContainerWrapperModel<ReportType, Containerable> model = PrismContainerWrapperModel.fromContainerWrapper(getObjectModel(), ReportType.F_FILE_FORMAT);
            return new SingleContainerPanel(panelId, model, FileFormatConfigurationType.COMPLEX_TYPE) {

                @Override
                protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
                    if (itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ReportType.F_FILE_FORMAT, FileFormatConfigurationType.F_HTML))) {
                        return ItemVisibility.HIDDEN;
                    }
                    return ItemVisibility.AUTO;
                }
            };
        }
    });
    return tabs;
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) SingleContainerPanel(com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel) 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) ItemVisibility(com.evolveum.midpoint.web.component.prism.ItemVisibility) PrismContainerWrapperModel(com.evolveum.midpoint.web.model.PrismContainerWrapperModel)

Example 13 with ItemWrapper

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

the class ReportMainPanel method createDetailsPanelForParameter.

private MultivalueContainerDetailsPanel<SearchFilterParameterType> createDetailsPanelForParameter(String panelId, ListItem<PrismContainerValueWrapper<SearchFilterParameterType>> item) {
    return new MultivalueContainerDetailsPanel<>(panelId, item.getModel(), true) {

        @Override
        protected DisplayNamePanel<SearchFilterParameterType> createDisplayNamePanel(String displayNamePanelId) {
            return new DisplayNamePanel<>(displayNamePanelId, new ItemRealValueModel<>(getModel())) {

                @Override
                protected IModel<String> createHeaderModel() {
                    return () -> {
                        SearchFilterParameterType parameter = getModelObject();
                        String name = parameter.getName();
                        if (parameter.getDisplay() != null && parameter.getDisplay().getLabel() != null) {
                            name = WebComponentUtil.getTranslatedPolyString(parameter.getDisplay().getLabel());
                        }
                        return name;
                    };
                }

                @Override
                protected String createImageModel() {
                    return "fa fa-sliders";
                }
            };
        }

        @Override
        protected ItemVisibility getBasicTabVisibity(ItemWrapper<?, ?> itemWrapper) {
            if (ItemPath.create(itemWrapper.getParent().getPath(), SearchFilterParameterType.F_DISPLAY).equivalent(itemWrapper.getPath())) {
                return ItemVisibility.HIDDEN;
            }
            return super.getBasicTabVisibity(itemWrapper);
        }

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

                @Override
                public WebMarkupContainer createPanel(String panelId) {
                    return new SingleContainerPanel<>(panelId, PrismContainerWrapperModel.fromContainerValueWrapper(getModel(), SearchFilterParameterType.F_DISPLAY), DisplayType.COMPLEX_TYPE) {

                        @Override
                        protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
                            if (ItemPath.create(itemWrapper.getParent().getPath(), DisplayType.F_LABEL).equivalent(itemWrapper.getPath()) || ItemPath.create(itemWrapper.getParent().getPath(), DisplayType.F_HELP).equivalent(itemWrapper.getPath())) {
                                return super.getVisibility(itemWrapper);
                            }
                            return ItemVisibility.HIDDEN;
                        }
                    };
                }
            });
            return tabs;
        }
    };
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) MultivalueContainerDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel) 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) DisplayNamePanel(com.evolveum.midpoint.gui.api.component.DisplayNamePanel) ItemVisibility(com.evolveum.midpoint.web.component.prism.ItemVisibility)

Example 14 with ItemWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper 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)

Example 15 with ItemWrapper

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

the class PageObjectCollection method getTabs.

private List<ITab> getTabs() {
    List<ITab> tabs = new ArrayList<>();
    tabs.add(new PanelTab(createStringResource("pageObjectCollection.basic.title")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ObjectBasicPanel<ObjectCollectionType>(panelId, getObjectModel()) {

                @Override
                protected QName getType() {
                    return ObjectCollectionType.COMPLEX_TYPE;
                }

                @Override
                protected ItemVisibility getBasicTabVisibility(ItemWrapper<?, ?> itemWrapper) {
                    if (itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ObjectCollectionType.F_SUBTYPE)) || itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ObjectCollectionType.F_DIAGNOSTIC_INFORMATION)) || itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ObjectCollectionType.F_LIFECYCLE_STATE))) {
                        return ItemVisibility.HIDDEN;
                    }
                    return ItemVisibility.AUTO;
                }
            };
        }
    });
    tabs.add(new PanelTab(createStringResource("pageObjectCollection.baseCollection.title")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new SingleContainerPanel<CollectionRefSpecificationType>(panelId, createModel(getObjectModel(), ObjectCollectionType.F_BASE_COLLECTION), CollectionRefSpecificationType.COMPLEX_TYPE) {

                @Override
                protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
                    if (ItemPath.create(ObjectCollectionType.F_BASE_COLLECTION, CollectionRefSpecificationType.F_BASE_COLLECTION_REF).isSuperPathOrEquivalent(itemWrapper.getPath())) {
                        return ItemVisibility.HIDDEN;
                    }
                    return ItemVisibility.AUTO;
                }
            };
        }
    });
    tabs.add(new PanelTab(createStringResource("pageObjectCollection.defaultView.title")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return createContainerPanel(panelId, getObjectModel(), ObjectCollectionType.F_DEFAULT_VIEW, GuiObjectListViewType.COMPLEX_TYPE);
        }
    });
    tabs.add(new PanelTab(createStringResource("pageObjectCollection.domain.title")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return createContainerPanel(panelId, getObjectModel(), ObjectCollectionType.F_DOMAIN, CollectionRefSpecificationType.COMPLEX_TYPE);
        }
    });
    tabs.add(new PanelTab(createStringResource("pageObjectCollection.option.title")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return createContainerPanel(panelId, getObjectModel(), ObjectCollectionType.F_GET_OPTIONS, SelectorQualifiedGetOptionsType.COMPLEX_TYPE);
        }
    });
    return tabs;
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) QName(javax.xml.namespace.QName) 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) ItemVisibility(com.evolveum.midpoint.web.component.prism.ItemVisibility)

Aggregations

ItemWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper)23 ArrayList (java.util.ArrayList)9 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)8 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)7 SingleContainerPanel (com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel)7 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)6 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)6 DisplayNamePanel (com.evolveum.midpoint.gui.api.component.DisplayNamePanel)5 MultivalueContainerDetailsPanel (com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel)5 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)5 ItemVisibility (com.evolveum.midpoint.web.component.prism.ItemVisibility)5 QName (javax.xml.namespace.QName)5 PrismContainerWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper)4 List (java.util.List)4 IModel (org.apache.wicket.model.IModel)4 ResourceAttributePanel (com.evolveum.midpoint.gui.impl.prism.panel.ResourceAttributePanel)3 WrapperContext (com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext)2 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)2 PrismContainerValueWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)2 Task (com.evolveum.midpoint.task.api.Task)2