Search in sources :

Example 1 with ItemWrapper

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

the class AssignmentsDetailsPanel method createConditionTab.

private PanelTab createConditionTab() {
    return new PanelTab(createStringResource("AssignmentType.condition")) {

        @Override
        public WebMarkupContainer createPanel(String panelId) {
            return new SingleContainerPanel<>(panelId, PrismContainerWrapperModel.fromContainerValueWrapper(getModel(), AssignmentType.F_CONDITION), MappingType.COMPLEX_TYPE) {

                @Override
                protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
                    ItemPath assignmentConditionExpressionPath = ItemPath.create(AssignmentHolderType.F_ASSIGNMENT, AssignmentType.F_CONDITION, MappingType.F_EXPRESSION);
                    ItemPath inducementConditionExpressionPath = ItemPath.create(AbstractRoleType.F_INDUCEMENT, AssignmentType.F_CONDITION, MappingType.F_EXPRESSION);
                    ItemPath itemPath = itemWrapper.getPath();
                    if (itemPath.namedSegmentsOnly().equivalent(assignmentConditionExpressionPath) || itemPath.namedSegmentsOnly().equivalent(inducementConditionExpressionPath)) {
                        return ItemVisibility.AUTO;
                    } else {
                        return ItemVisibility.HIDDEN;
                    }
                }
            };
        }
    };
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) ItemWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper) SingleContainerPanel(com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 2 with ItemWrapper

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

the class AssignmentConstructionPanel method initLayout.

private void initLayout() {
    SingleContainerPanel<ConstructionType> baseConstructionPanel = new SingleContainerPanel<>(ID_BASIC, getModel(), ConstructionType.COMPLEX_TYPE) {

        @Override
        protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
            ItemPath itemPath = itemWrapper.getPath();
            if (isAssociation(itemPath)) {
                return ItemVisibility.HIDDEN;
            }
            if (isAttributePath(itemPath)) {
                return ItemVisibility.HIDDEN;
            }
            if (ConstructionType.F_KIND.equivalent(itemPath.lastName())) {
                return ItemVisibility.HIDDEN;
            }
            if (ConstructionType.F_INTENT.equivalent(itemPath.lastName())) {
                return ItemVisibility.HIDDEN;
            }
            if (ConstructionType.F_RESOURCE_REF.equivalent(itemPath.lastName())) {
                return ItemVisibility.HIDDEN;
            }
            return ItemVisibility.AUTO;
        }
    };
    add(baseConstructionPanel);
    ResourceAttributePanel attrsPanel = new ResourceAttributePanel(ID_ATTRIBUTES, PrismContainerWrapperModel.fromContainerWrapper(getModel(), ConstructionType.F_ATTRIBUTE), null);
    add(attrsPanel);
}
Also used : ItemWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper) ResourceAttributePanel(com.evolveum.midpoint.gui.impl.prism.panel.ResourceAttributePanel) SingleContainerPanel(com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 3 with ItemWrapper

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

the class ResourceSchemaHandlingPanel 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("ResourceSchemaHandlingPanel.tab.attributes")) {

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

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

                @Override
                protected IModel<String> createHeaderModel() {
                    return new ReadOnlyModel<>(() -> loadHeaderModel(getModelObject()));
                }

                @Override
                protected IModel<List<String>> getDescriptionLabelsModel() {
                    return new ReadOnlyModel<>(() -> loadDescriptionModel(getModelObject()));
                }
            };
        }
    };
}
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) DisplayNamePanel(com.evolveum.midpoint.gui.api.component.DisplayNamePanel) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) ResourceAttributePanel(com.evolveum.midpoint.gui.impl.prism.panel.ResourceAttributePanel) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with ItemWrapper

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

the class LoggingContentPanel method initLayout.

@Override
protected void initLayout() {
    SingleContainerPanel panel = new SingleContainerPanel(ID_MAIN_PANEL, PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), ItemPath.create(SystemConfigurationType.F_LOGGING)), LoggingConfigurationType.COMPLEX_TYPE) {

        @Override
        protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
            ItemPath path = itemWrapper.getPath();
            if (path == null || path.isEmpty()) {
                return ItemVisibility.AUTO;
            }
            QName name;
            if (path.size() == 1) {
                name = path.firstToQName();
            } else {
                name = path.rest().firstToQName();
            }
            boolean hide = LoggingConfigurationType.F_CLASS_LOGGER.equals(name) || LoggingConfigurationType.F_SUB_SYSTEM_LOGGER.equals(name) || LoggingConfigurationType.F_APPENDER.equals(name);
            return hide ? ItemVisibility.HIDDEN : ItemVisibility.AUTO;
        }
    };
    add(panel);
}
Also used : ItemWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper) QName(javax.xml.namespace.QName) SingleContainerPanel(com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 5 with ItemWrapper

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

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