Search in sources :

Example 1 with ItemVisibility

use of com.evolveum.midpoint.web.component.prism.ItemVisibility 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 2 with ItemVisibility

use of com.evolveum.midpoint.web.component.prism.ItemVisibility in project midpoint by Evolveum.

the class ReportCollectionParameterPanel method createDetailsPanelForParameter.

private MultivalueContainerDetailsPanel<SearchFilterParameterType> createDetailsPanelForParameter(ListItem<PrismContainerValueWrapper<SearchFilterParameterType>> item) {
    return new MultivalueContainerDetailsPanel<>(MultivalueContainerListPanelWithDetailsPanel.ID_ITEM_DETAILS, 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 3 with ItemVisibility

use of com.evolveum.midpoint.web.component.prism.ItemVisibility 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 4 with ItemVisibility

use of com.evolveum.midpoint.web.component.prism.ItemVisibility in project midpoint by Evolveum.

the class EngineReportTabPanel method initLayout.

@Override
protected void initLayout() {
    RepeatingView panel = new RepeatingView(ID_PANEL);
    add(panel);
    if (hasDefinition(ReportType.F_DASHBOARD)) {
        panel.add(new SingleContainerPanel(panel.newChildId(), PrismContainerWrapperModel.fromContainerWrapper(getModel(), ItemPath.create(ReportType.F_DASHBOARD)), DashboardReportEngineConfigurationType.COMPLEX_TYPE) {

            @Override
            protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
                if (!ItemPath.create(ReportType.F_DASHBOARD, DashboardReportEngineConfigurationType.F_DASHBOARD_REF).equivalent(itemWrapper.getPath()) && !ItemPath.create(ReportType.F_DASHBOARD, DashboardReportEngineConfigurationType.F_SHOW_ONLY_WIDGETS_TABLE).equivalent(itemWrapper.getPath())) {
                    return ItemVisibility.HIDDEN;
                }
                return super.getVisibility(itemWrapper);
            }
        });
    }
    if (hasDefinition(ReportType.F_OBJECT_COLLECTION)) {
        panel.add(new SingleContainerPanel(panel.newChildId(), PrismContainerWrapperModel.fromContainerWrapper(getModel(), ItemPath.create(ReportType.F_OBJECT_COLLECTION)), ObjectCollectionReportEngineConfigurationType.COMPLEX_TYPE) {

            @Override
            protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
                if (!ItemPath.create(ReportType.F_OBJECT_COLLECTION, ObjectCollectionReportEngineConfigurationType.F_CONDITION).equivalent(itemWrapper.getPath()) && !ItemPath.create(ReportType.F_OBJECT_COLLECTION, ObjectCollectionReportEngineConfigurationType.F_USE_ONLY_REPORT_VIEW).equivalent(itemWrapper.getPath())) {
                    return ItemVisibility.HIDDEN;
                }
                return super.getVisibility(itemWrapper);
            }
        });
    }
}
Also used : RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) ItemVisibility(com.evolveum.midpoint.web.component.prism.ItemVisibility) SingleContainerPanel(com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel)

Example 5 with ItemVisibility

use of com.evolveum.midpoint.web.component.prism.ItemVisibility in project midpoint by Evolveum.

the class PageObjectTemplate method getTabs.

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

        private static final long serialVersionUID = 1L;

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

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

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

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new SingleContainerPanel<IterationSpecificationType>(panelId, createModel(getObjectModel(), ObjectTemplateType.F_ITERATION_SPECIFICATION), IterationSpecificationType.COMPLEX_TYPE);
        }
    });
    tabs.add(new PanelTab(createStringResource("pageObjectTemplate.item.title")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ObjectTemplateItemPanel(panelId, PrismContainerWrapperModel.fromContainerWrapper(getObjectModel(), ObjectTemplateType.F_ITEM));
        }
    });
    tabs.add(new PanelTab(createStringResource("pageObjectTemplate.mapping.title")) {

        private static final long serialVersionUID = 1L;

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new ListMappingPanel(panelId, PrismContainerWrapperModel.fromContainerWrapper(getObjectModel(), ObjectTemplateType.F_MAPPING));
        }
    });
    return tabs;
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) ListMappingPanel(com.evolveum.midpoint.gui.impl.prism.panel.ListMappingPanel) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) ObjectTemplateItemPanel(com.evolveum.midpoint.gui.impl.prism.panel.ObjectTemplateItemPanel) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ItemVisibility(com.evolveum.midpoint.web.component.prism.ItemVisibility)

Aggregations

ItemVisibility (com.evolveum.midpoint.web.component.prism.ItemVisibility)7 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)5 ItemWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper)5 ArrayList (java.util.ArrayList)5 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)5 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 SingleContainerPanel (com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel)3 QName (javax.xml.namespace.QName)3 DisplayNamePanel (com.evolveum.midpoint.gui.api.component.DisplayNamePanel)2 MultivalueContainerDetailsPanel (com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel)2 ItemEditabilityHandler (com.evolveum.midpoint.gui.api.prism.wrapper.ItemEditabilityHandler)1 PrismContainerWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper)1 WebComponentUtil (com.evolveum.midpoint.gui.api.util.WebComponentUtil)1 AbstractObjectMainPanel (com.evolveum.midpoint.gui.impl.page.admin.AbstractObjectMainPanel)1 TaskDetailsModel (com.evolveum.midpoint.gui.impl.page.admin.task.TaskDetailsModel)1 ListMappingPanel (com.evolveum.midpoint.gui.impl.prism.panel.ListMappingPanel)1 ObjectTemplateItemPanel (com.evolveum.midpoint.gui.impl.prism.panel.ObjectTemplateItemPanel)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 PanelDisplay (com.evolveum.midpoint.web.application.PanelDisplay)1 PanelInstance (com.evolveum.midpoint.web.application.PanelInstance)1