Search in sources :

Example 1 with PendingOperationPanel

use of com.evolveum.midpoint.gui.api.component.PendingOperationPanel in project midpoint by Evolveum.

the class ResourceContentPanel method initColumns.

private List<IColumn<SelectableBean<ShadowType>, String>> initColumns() {
    List<ColumnTypeDto<String>> columnDefs = Arrays.asList(new ColumnTypeDto<>("ShadowType.synchronizationSituation", SelectableBeanImpl.F_VALUE + ".synchronizationSituation", ShadowType.F_SYNCHRONIZATION_SITUATION.getLocalPart()), new ColumnTypeDto<>("ShadowType.intent", SelectableBeanImpl.F_VALUE + ".intent", ShadowType.F_INTENT.getLocalPart()));
    List<IColumn<SelectableBean<ShadowType>, String>> columns = new ArrayList<>();
    IColumn<SelectableBean<ShadowType>, String> identifiersColumn = new AbstractColumn<>(createStringResource("pageContentAccounts.identifiers")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ShadowType>>> cellItem, String componentId, IModel<SelectableBean<ShadowType>> rowModel) {
            SelectableBean<ShadowType> dto = rowModel.getObject();
            RepeatingView repeater = new RepeatingView(componentId);
            ShadowType value = dto.getValue();
            if (value != null) {
                for (ResourceAttribute<?> attr : ShadowUtil.getAllIdentifiers(value)) {
                    repeater.add(new Label(repeater.newChildId(), attr.getElementName().getLocalPart() + ": " + attr.getRealValue()));
                }
            }
            cellItem.add(repeater);
        }
    };
    columns.add(identifiersColumn);
    columns.addAll(ColumnUtils.createColumns(columnDefs));
    ObjectLinkColumn<SelectableBean<ShadowType>> ownerColumn = new ObjectLinkColumn<>(createStringResource("pageContentAccounts.owner")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected IModel<FocusType> createLinkModel(final IModel<SelectableBean<ShadowType>> rowModel) {
            return new IModel<>() {

                private static final long serialVersionUID = 1L;

                @Override
                public FocusType getObject() {
                    return loadShadowOwner(rowModel);
                }
            };
        }

        @Override
        public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ShadowType>> rowModel, ObjectType targetObjectType) {
            ownerDetailsPerformed((FocusType) targetObjectType);
        }
    };
    columns.add(ownerColumn);
    columns.add(new AbstractColumn<>(createStringResource("PageAccounts.accounts.pendingOperations")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<SelectableBean<ShadowType>>> cellItem, String componentId, IModel<SelectableBean<ShadowType>> rowModel) {
            cellItem.add(new PendingOperationPanel(componentId, new PropertyModel<>(rowModel, SelectableBeanImpl.F_VALUE + "." + ShadowType.F_PENDING_OPERATION.getLocalPart())));
        }
    });
    return columns;
}
Also used : RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) Label(org.apache.wicket.markup.html.basic.Label) ColumnTypeDto(com.evolveum.midpoint.web.component.data.column.ColumnTypeDto) PendingOperationPanel(com.evolveum.midpoint.gui.api.component.PendingOperationPanel) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) Item(org.apache.wicket.markup.repeater.Item) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) IModel(org.apache.wicket.model.IModel) AbstractColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectLinkColumn(com.evolveum.midpoint.web.component.data.column.ObjectLinkColumn) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)

Example 2 with PendingOperationPanel

use of com.evolveum.midpoint.gui.api.component.PendingOperationPanel in project midpoint by Evolveum.

the class ProjectionDisplayNamePanel method initLayout.

private void initLayout() {
    WebMarkupContainer pendingOperationContainer = new WebMarkupContainer(ID_PENDING_OPERATION_CONTAINER);
    List<PendingOperationType> pendingOperations = getModelObject().getPendingOperation();
    if (pendingOperations != null && !pendingOperations.isEmpty()) {
        pendingOperationContainer.add(new PendingOperationPanel(ID_PENDING_OPERATION, (IModel<List<PendingOperationType>>) () -> pendingOperations));
    } else {
        pendingOperationContainer.add(new WebMarkupContainer(ID_PENDING_OPERATION));
        pendingOperationContainer.add(new VisibleEnableBehaviour() {

            @Override
            public boolean isVisible() {
                return false;
            }
        });
    }
    add(pendingOperationContainer);
}
Also used : PendingOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType) IModel(org.apache.wicket.model.IModel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) PendingOperationPanel(com.evolveum.midpoint.gui.api.component.PendingOperationPanel)

Example 3 with PendingOperationPanel

use of com.evolveum.midpoint.gui.api.component.PendingOperationPanel in project midpoint by Evolveum.

the class FocusProjectionsPanel method initBasicColumns.

private List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> initBasicColumns() {
    IModel<PrismContainerDefinition<ShadowType>> shadowDef = Model.of(getShadowDefinition());
    List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> columns = new ArrayList<>();
    columns.add(new CheckBoxHeaderColumn<>());
    columns.add(new CompositedIconColumn<>(Model.of("")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected CompositedIcon getCompositedIcon(IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
            if (rowModel == null || rowModel.getObject() == null || rowModel.getObject().getRealValue() == null) {
                return new CompositedIconBuilder().build();
            }
            ShadowType shadow = createShadowType(rowModel);
            return WebComponentUtil.createAccountIcon(shadow, getPageBase(), true);
        }
    });
    columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_NAME, ColumnType.LINK, getPageBase()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
            getMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
            target.add(getPageBase().getFeedbackPanel());
        }
    });
    columns.add(new PrismReferenceWrapperColumn<>(shadowDef, ShadowType.F_RESOURCE_REF, ColumnType.STRING, getPageBase()));
    columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_OBJECT_CLASS, ColumnType.STRING, getPageBase()));
    columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_KIND, ColumnType.STRING, getPageBase()) {

        @Override
        public String getCssClass() {
            return "col-xs-1";
        }
    });
    columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_INTENT, ColumnType.STRING, getPageBase()) {

        @Override
        public String getCssClass() {
            return "col-xs-1";
        }
    });
    columns.add(new PrismContainerWrapperColumn<>(shadowDef, ShadowType.F_PENDING_OPERATION, getPageBase()) {

        @Override
        public String getCssClass() {
            return "col-xs-2";
        }

        @Override
        protected <IW extends ItemWrapper> Component createColumnPanel(String componentId, IModel<IW> rowModel) {
            IW object = rowModel.getObject();
            if (object == null) {
                return new WebMarkupContainer(componentId);
            }
            List<PrismValueWrapper<PendingOperationType>> values = object.getValues();
            List<PendingOperationType> pendingOperations = values.stream().map(operation -> operation.getRealValue()).collect(Collectors.toList());
            return new PendingOperationPanel(componentId, Model.ofList(pendingOperations));
        }
    });
    return columns;
}
Also used : ArrayList(java.util.ArrayList) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) PendingOperationPanel(com.evolveum.midpoint.gui.api.component.PendingOperationPanel) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) List(java.util.List) ArrayList(java.util.ArrayList) Component(org.apache.wicket.Component) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) CompositedIcon(com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon)

Example 4 with PendingOperationPanel

use of com.evolveum.midpoint.gui.api.component.PendingOperationPanel in project midpoint by Evolveum.

the class FocusProjectionsTabPanel method initBasicColumns.

private List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> initBasicColumns() {
    IModel<PrismContainerDefinition<ShadowType>> shadowDef = Model.of(getShadowDefinition());
    List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> columns = new ArrayList<>();
    columns.add(new CheckBoxHeaderColumn<>());
    columns.add(new CompositedIconColumn<PrismContainerValueWrapper<ShadowType>>(Model.of("")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected CompositedIcon getCompositedIcon(IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
            if (rowModel == null || rowModel.getObject() == null || rowModel.getObject().getRealValue() == null) {
                return new CompositedIconBuilder().build();
            }
            ShadowType shadow = createShadowType(rowModel);
            return WebComponentUtil.createAccountIcon(shadow, getPageBase(), true);
        }
    });
    columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_NAME, ColumnType.LINK, getPageBase()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ShadowType>> rowModel) {
            getMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
            target.add(getFeedbackPanel());
        }
    });
    columns.add(new PrismReferenceWrapperColumn<>(shadowDef, ShadowType.F_RESOURCE_REF, ColumnType.STRING, getPageBase()));
    columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_OBJECT_CLASS, ColumnType.STRING, getPageBase()));
    columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_KIND, ColumnType.STRING, getPageBase()) {

        @Override
        public String getCssClass() {
            return "col-xs-1";
        }
    });
    columns.add(new PrismPropertyWrapperColumn<ShadowType, String>(shadowDef, ShadowType.F_INTENT, ColumnType.STRING, getPageBase()) {

        @Override
        public String getCssClass() {
            return "col-xs-1";
        }
    });
    columns.add(new PrismContainerWrapperColumn<ShadowType>(shadowDef, ShadowType.F_PENDING_OPERATION, getPageBase()) {

        @Override
        public String getCssClass() {
            return "col-xs-2";
        }

        @Override
        protected <IW extends ItemWrapper> Component createColumnPanel(String componentId, IModel<IW> rowModel) {
            IW object = rowModel.getObject();
            if (object == null) {
                return new WebMarkupContainer(componentId);
            }
            List<PrismValueWrapper<PendingOperationType>> values = object.getValues();
            List<PendingOperationType> pendingOperations = new ArrayList<>();
            values.forEach(value -> pendingOperations.add(value.getRealValue()));
            return new PendingOperationPanel(componentId, (IModel<List<PendingOperationType>>) () -> pendingOperations);
        }
    });
    columns.add(new InlineMenuButtonColumn(createShadowMenu(), getPageBase()) {

        @Override
        public String getCssClass() {
            return "col-xs-1";
        }
    });
    return columns;
}
Also used : Arrays(java.util.Arrays) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PrismContainerWrapperColumn(com.evolveum.midpoint.gui.impl.component.data.column.PrismContainerWrapperColumn) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ResourceSchemaFactory(com.evolveum.midpoint.schema.processor.ResourceSchemaFactory) DisplayableValue(com.evolveum.midpoint.util.DisplayableValue) ItemStatus(com.evolveum.midpoint.gui.api.prism.ItemStatus) ShadowPanel(com.evolveum.midpoint.gui.impl.prism.panel.ShadowPanel) WebModelServiceUtils(com.evolveum.midpoint.gui.api.util.WebModelServiceUtils) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) IModel(org.apache.wicket.model.IModel) PrismReferenceWrapperColumn(com.evolveum.midpoint.gui.impl.component.data.column.PrismReferenceWrapperColumn) com.evolveum.midpoint.prism(com.evolveum.midpoint.prism) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) Label(org.apache.wicket.markup.html.basic.Label) PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) ListItem(org.apache.wicket.markup.html.list.ListItem) WrapperContext(com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext) CompositedIcon(com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon) ConfirmationPanel(com.evolveum.midpoint.web.component.dialog.ConfirmationPanel) Model(org.apache.wicket.model.Model) Component(org.apache.wicket.Component) ProjectionsListProvider(com.evolveum.midpoint.web.component.util.ProjectionsListProvider) WebComponentUtil(com.evolveum.midpoint.gui.api.util.WebComponentUtil) Task(com.evolveum.midpoint.task.api.Task) SessionStorage(com.evolveum.midpoint.web.session.SessionStorage) PageAdminFocus(com.evolveum.midpoint.web.page.admin.PageAdminFocus) MultivalueContainerListPanelWithDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel) List(java.util.List) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction) DeleteConfirmationPanel(com.evolveum.midpoint.web.component.dialog.DeleteConfirmationPanel) PropertyModel(org.apache.wicket.model.PropertyModel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) MultivalueContainerDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerDetailsPanel) PrismObjectWrapperFactory(com.evolveum.midpoint.gui.api.factory.wrapper.PrismObjectWrapperFactory) QName(javax.xml.namespace.QName) PendingOperationPanel(com.evolveum.midpoint.gui.api.component.PendingOperationPanel) NotNull(org.jetbrains.annotations.NotNull) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) DisplayNamePanel(com.evolveum.midpoint.gui.api.component.DisplayNamePanel) com.evolveum.midpoint.xml.ns._public.common.common_3(com.evolveum.midpoint.xml.ns._public.common.common_3) com.evolveum.midpoint.web.component.search(com.evolveum.midpoint.web.component.search) SchemaConstants(com.evolveum.midpoint.schema.constants.SchemaConstants) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) BooleanUtils(org.apache.commons.lang3.BooleanUtils) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) Trace(com.evolveum.midpoint.util.logging.Trace) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) ArrayList(java.util.ArrayList) GuiStyleConstants(com.evolveum.midpoint.gui.api.GuiStyleConstants) PageStorage(com.evolveum.midpoint.web.session.PageStorage) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) TableId(com.evolveum.midpoint.web.session.UserProfileStorage.TableId) InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) Popupable(com.evolveum.midpoint.web.component.dialog.Popupable) ProjectionDisplayNamePanel(com.evolveum.midpoint.gui.impl.component.ProjectionDisplayNamePanel) PrismPropertyWrapperColumn(com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn) UserDtoStatus(com.evolveum.midpoint.web.page.admin.users.dto.UserDtoStatus) ResourceObjectTypeDefinition(com.evolveum.midpoint.schema.processor.ResourceObjectTypeDefinition) ColumnType(com.evolveum.midpoint.gui.impl.component.data.column.AbstractItemWrapperColumn.ColumnType) LoggingUtils(com.evolveum.midpoint.util.logging.LoggingUtils) ISelectableDataProvider(com.evolveum.midpoint.web.component.data.ISelectableDataProvider) Validate(org.apache.commons.lang3.Validate) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation) com.evolveum.midpoint.gui.api.prism.wrapper(com.evolveum.midpoint.gui.api.prism.wrapper) ResourceSchema(com.evolveum.midpoint.schema.processor.ResourceSchema) CompositedIconColumn(com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconColumn) ObjectBrowserPanel(com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel) TraceManager(com.evolveum.midpoint.util.logging.TraceManager) ArrayList(java.util.ArrayList) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) PendingOperationPanel(com.evolveum.midpoint.gui.api.component.PendingOperationPanel) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) List(java.util.List) ArrayList(java.util.ArrayList) Component(org.apache.wicket.Component) IModel(org.apache.wicket.model.IModel) InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) CompositedIcon(com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon)

Aggregations

PendingOperationPanel (com.evolveum.midpoint.gui.api.component.PendingOperationPanel)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 IModel (org.apache.wicket.model.IModel)3 CompositedIcon (com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon)2 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Component (org.apache.wicket.Component)2 GuiStyleConstants (com.evolveum.midpoint.gui.api.GuiStyleConstants)1 DisplayNamePanel (com.evolveum.midpoint.gui.api.component.DisplayNamePanel)1 ObjectBrowserPanel (com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel)1 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)1 PrismObjectWrapperFactory (com.evolveum.midpoint.gui.api.factory.wrapper.PrismObjectWrapperFactory)1 WrapperContext (com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext)1 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)1 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)1 ItemStatus (com.evolveum.midpoint.gui.api.prism.ItemStatus)1