Search in sources :

Example 1 with ContainersPopupDto

use of com.evolveum.midpoint.gui.impl.prism.panel.component.ContainersPopupDto in project midpoint by Evolveum.

the class PrismValueMetadataPanel method createMetadataListModel.

private ReadOnlyModel<List<ContainersPopupDto>> createMetadataListModel() {
    return new ReadOnlyModel<>(() -> {
        ValueMetadataWrapperImpl metadataWrapper = getValueMetadata();
        List<PrismContainerDefinition<? extends Containerable>> childContainers;
        try {
            childContainers = metadataWrapper != null ? metadataWrapper.getChildContainers() : Collections.emptyList();
        } catch (SchemaException e) {
            LOGGER.error("Cannot get child containers: {}", e.getMessage(), e);
            childContainers = Collections.emptyList();
        }
        List<ContainersPopupDto> navigation = childContainers.stream().map(c -> new ContainersPopupDto(false, c)).collect(Collectors.toList());
        List<? extends ItemDefinition> childNonContainers = metadataWrapper != null ? metadataWrapper.getChildNonContainers() : Collections.emptyList();
        if (!childNonContainers.isEmpty()) {
            navigation.add(new ContainersPopupDto(false, metadataWrapper));
        }
        return navigation;
    });
}
Also used : VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) ContainersPopupDto(com.evolveum.midpoint.gui.impl.prism.panel.component.ContainersPopupDto) ItemDefinition(com.evolveum.midpoint.prism.ItemDefinition) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Trace(com.evolveum.midpoint.util.logging.Trace) ItemVisibility(com.evolveum.midpoint.web.component.prism.ItemVisibility) QNameUtil(com.evolveum.midpoint.util.QNameUtil) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) PrismContainerDefinition(com.evolveum.midpoint.prism.PrismContainerDefinition) IModel(org.apache.wicket.model.IModel) Containerable(com.evolveum.midpoint.prism.Containerable) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper) ListView(org.apache.wicket.markup.html.list.ListView) ValueMetadataWrapperImpl(com.evolveum.midpoint.gui.impl.prism.wrapper.ValueMetadataWrapperImpl) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) ListItem(org.apache.wicket.markup.html.list.ListItem) ValueMetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.ValueMetadataType) Collectors(java.util.stream.Collectors) LoggingUtils(com.evolveum.midpoint.util.logging.LoggingUtils) List(java.util.List) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) BasePanel(com.evolveum.midpoint.gui.api.component.BasePanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ItemWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper) ProvenanceMetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProvenanceMetadataType) Collections(java.util.Collections) TraceManager(com.evolveum.midpoint.util.logging.TraceManager) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ValueMetadataWrapperImpl(com.evolveum.midpoint.gui.impl.prism.wrapper.ValueMetadataWrapperImpl) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) PrismContainerDefinition(com.evolveum.midpoint.prism.PrismContainerDefinition) ContainersPopupDto(com.evolveum.midpoint.gui.impl.prism.panel.component.ContainersPopupDto) Containerable(com.evolveum.midpoint.prism.Containerable)

Example 2 with ContainersPopupDto

use of com.evolveum.midpoint.gui.impl.prism.panel.component.ContainersPopupDto in project midpoint by Evolveum.

the class PrismValueMetadataPanel method createMetadataNavigationPanel.

private void createMetadataNavigationPanel() {
    WebMarkupContainer metadataNavigation = new WebMarkupContainer(ID_METADATA_NAVIGATION);
    add(metadataNavigation);
    metadataNavigation.setOutputMarkupId(true);
    ListView<ContainersPopupDto> metadataList = new ListView<ContainersPopupDto>(ID_METADATA_LIST, createMetadataListModel()) {

        @Override
        protected void populateItem(ListItem<ContainersPopupDto> listItem) {
            AjaxButton showMetadataDetails = new AjaxButton(ID_METADATA_QNAME, createStringResource(listItem.getModelObject().getItemName())) {

                @Override
                public void onClick(AjaxRequestTarget ajaxRequestTarget) {
                    ContainersPopupDto ccontainerToShow = listItem.getModelObject();
                    ccontainerToShow.setSelected(true);
                    setContainersToShow(ccontainerToShow, ajaxRequestTarget);
                }
            };
            showMetadataDetails.add(AttributeAppender.replace("class", createButtonClassModel(listItem)));
            showMetadataDetails.setOutputMarkupId(true);
            showMetadataDetails.setOutputMarkupPlaceholderTag(true);
            listItem.setOutputMarkupId(true);
            listItem.add(showMetadataDetails);
        }
    };
    metadataNavigation.add(metadataList);
    ReadOnlyModel<String> activeTab = new ReadOnlyModel<>(() -> {
        if (getValueMetadata() != null && isAnyMetadataSelected()) {
            return "contains-active-tab";
        }
        return "";
    });
    metadataNavigation.add(AttributeAppender.replace("class", activeTab));
    metadataList.setOutputMarkupId(true);
    metadataList.setOutputMarkupPlaceholderTag(true);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) ListView(org.apache.wicket.markup.html.list.ListView) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) ContainersPopupDto(com.evolveum.midpoint.gui.impl.prism.panel.component.ContainersPopupDto) ListItem(org.apache.wicket.markup.html.list.ListItem) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)2 ContainersPopupDto (com.evolveum.midpoint.gui.impl.prism.panel.component.ContainersPopupDto)2 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 ListItem (org.apache.wicket.markup.html.list.ListItem)2 ListView (org.apache.wicket.markup.html.list.ListView)2 BasePanel (com.evolveum.midpoint.gui.api.component.BasePanel)1 ItemWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper)1 PrismContainerValueWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)1 PrismContainerWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper)1 ValueMetadataWrapperImpl (com.evolveum.midpoint.gui.impl.prism.wrapper.ValueMetadataWrapperImpl)1 Containerable (com.evolveum.midpoint.prism.Containerable)1 ItemDefinition (com.evolveum.midpoint.prism.ItemDefinition)1 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)1 QNameUtil (com.evolveum.midpoint.util.QNameUtil)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 LoggingUtils (com.evolveum.midpoint.util.logging.LoggingUtils)1 Trace (com.evolveum.midpoint.util.logging.Trace)1 TraceManager (com.evolveum.midpoint.util.logging.TraceManager)1