Search in sources :

Example 1 with AbstractPageObjectDetails

use of com.evolveum.midpoint.gui.impl.page.admin.AbstractPageObjectDetails in project midpoint by Evolveum.

the class ResourceAttributePanel method customEditItemPerformed.

// private void manageMappings(boolean outbound) {
// if (outbound) {
// collectionOutbounds();
// }
// PrismContainerWrapper<ResourceAttributeDefinitionType> resourceAttributeDefinition = getModelObject();
// 
// }
// 
// private void collectionOutbounds() {
// PrismContainerWrapper<ResourceAttributeDefinitionType> resourceAttributeDef = getModelObject();
// 
// for (PrismContainerValueWrapper<ResourceAttributeDefinitionType> resourceAttributeDefVal : resourceAttributeDef.getValues()) {
// ResourceAttributeDefinitionType resourceAttrRealValue = resourceAttributeDefVal.getRealValue();
// if (resourceAttributeDef == null) {
// continue;
// }
// MappingType mappingType = resourceAttrRealValue.getOutbound();
// if (mappingType == null) {
// continue;
// }
// 
// }
// }
@Override
protected boolean customEditItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceAttributeDefinitionType>> rowModel, List<PrismContainerValueWrapper<ResourceAttributeDefinitionType>> listItems) {
    if (getConfig() == null) {
        return false;
    }
    AbstractPageObjectDetails parent = findParent(AbstractPageObjectDetails.class);
    if (parent == null) {
        return false;
    }
    ContainerPanelConfigurationType detailsPanel = new ContainerPanelConfigurationType(getPrismContext());
    detailsPanel.setPanelType("attributeDefinitionDetails");
    PrismContainerValueWrapper<ResourceAttributeDefinitionType> attrDef;
    if (rowModel != null) {
        attrDef = rowModel.getObject();
    } else {
        attrDef = listItems.iterator().next();
    }
    // VirtualContainersSpecificationType virtualContainer = new VirtualContainersSpecificationType(getPrismContext());
    detailsPanel.setPath(new ItemPathType(attrDef.getPath()));
    // detailsPanel.getContainer().add(virtualContainer);
    detailsPanel.setIdentifier("attributeDefinitionDetails");
    DisplayType displayType = new DisplayType();
    displayType.setLabel(new PolyStringType(attrDef.getDisplayName()));
    IconType icon = new IconType();
    icon.setCssClass("fa fa-navicon");
    displayType.setIcon(icon);
    detailsPanel.setDisplay(displayType);
    getPageBase().getSessionStorage().setObjectDetailsStorage("details" + parent.getType().getSimpleName(), detailsPanel);
    ResourceAttributePanel.this.getConfig().getPanel().add(detailsPanel);
    target.add(parent);
    parent.replacePanel(detailsPanel, target);
    return true;
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) AbstractPageObjectDetails(com.evolveum.midpoint.gui.impl.page.admin.AbstractPageObjectDetails)

Example 2 with AbstractPageObjectDetails

use of com.evolveum.midpoint.gui.impl.page.admin.AbstractPageObjectDetails in project midpoint by Evolveum.

the class ResourceSchemaHandlingPanel method initLayout.

protected void initLayout() {
    MidpointForm<?> form = new MidpointForm<>(ID_FORM);
    add(form);
    MultivalueContainerListPanelWithDetailsPanel<ResourceObjectTypeDefinitionType> objectTypesPanel = new MultivalueContainerListPanelWithDetailsPanel<>(ID_TABLE, ResourceObjectTypeDefinitionType.class) {

        @Override
        protected MultivalueContainerDetailsPanel<ResourceObjectTypeDefinitionType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> item) {
            return createMultivalueContainerDetailsPanel(ID_ITEM_DETAILS, item.getModel());
        }

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

        @Override
        protected IModel<PrismContainerWrapper<ResourceObjectTypeDefinitionType>> getContainerModel() {
            return PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), ItemPath.create(ResourceType.F_SCHEMA_HANDLING, SchemaHandlingType.F_OBJECT_TYPE));
        }

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

        @Override
        protected List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> createDefaultColumns() {
            List<IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String>> columns = new ArrayList<>();
            // columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_KIND, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_INTENT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DEFAULT, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            columns.add(new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DESCRIPTION, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
            List<InlineMenuItem> menuActionsList = getMultivalueContainerListPanel().getDefaultMenuActions();
            columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {

                private static final long serialVersionUID = 1L;

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

        @Override
        protected IColumn<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
            return new PrismPropertyWrapperColumn<>(getContainerModel(), ResourceObjectTypeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.LINK, getPageBase()) {

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

        @Override
        public void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> rowModel, List<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> listItems) {
            AbstractPageObjectDetails parent = findParent(AbstractPageObjectDetails.class);
            if (parent == null) {
                super.editItemPerformed(target, rowModel, listItems);
                return;
            }
            ContainerPanelConfigurationType detailsPanel = new ContainerPanelConfigurationType(getPrismContext());
            detailsPanel.setPanelType("schemaHandlingDetails");
            PrismContainerValueWrapper<ResourceObjectTypeDefinitionType> objectTypeDef;
            if (rowModel != null) {
                objectTypeDef = rowModel.getObject();
            } else {
                objectTypeDef = listItems.iterator().next();
            }
            // VirtualContainersSpecificationType virtualContainer = new VirtualContainersSpecificationType(getPrismContext());
            detailsPanel.setPath(new ItemPathType(objectTypeDef.getPath()));
            // detailsPanel.getContainer().add(virtualContainer);
            detailsPanel.setIdentifier("schemaHandlingDetails");
            DisplayType displayType = new DisplayType();
            displayType.setLabel(getObjectTypeDisplayName(objectTypeDef.getNewValue().asContainerable()));
            detailsPanel.setDisplay(displayType);
            getPageBase().getSessionStorage().setObjectDetailsStorage("details" + parent.getType().getSimpleName(), detailsPanel);
            ResourceSchemaHandlingPanel.this.getPanelConfiguration().getPanel().add(detailsPanel);
            target.add(parent);
            parent.replacePanel(detailsPanel, target);
        // super.editItemPerformed(target, rowModel, listItems);
        }
    };
    form.add(objectTypesPanel);
}
Also used : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) ArrayList(java.util.ArrayList) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ArrayList(java.util.ArrayList) List(java.util.List) 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) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) AbstractPageObjectDetails(com.evolveum.midpoint.gui.impl.page.admin.AbstractPageObjectDetails) 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) ListItem(org.apache.wicket.markup.html.list.ListItem) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Aggregations

AbstractPageObjectDetails (com.evolveum.midpoint.gui.impl.page.admin.AbstractPageObjectDetails)2 ItemPathType (com.evolveum.prism.xml.ns._public.types_3.ItemPathType)2 PrismContainerValueWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)1 PrismContainerWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper)1 MultivalueContainerListPanelWithDetailsPanel (com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel)1 PrismPropertyWrapperColumn (com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 InlineMenuButtonColumn (com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)1 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)1 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)1 ListItem (org.apache.wicket.markup.html.list.ListItem)1 IModel (org.apache.wicket.model.IModel)1