Search in sources :

Example 6 with CompositedIcon

use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon 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)

Example 7 with CompositedIcon

use of com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon in project midpoint by Evolveum.

the class AjaxCompositedIconSubmitButton method onComponentTagBody.

@Override
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
    StringBuilder sb = new StringBuilder();
    CompositedIcon icon = this.icon;
    if (icon.hasBasicIcon()) {
        sb.append("<i class=\"").append(icon.getBasicIcon() != null ? icon.getBasicIcon().trim() : "").append("\"");
        if (icon.hasBasicIconHtmlColor()) {
            sb.append(" style=\"color: " + icon.getBasicIconHtmlColor() + ";\"");
        }
        sb.append("></i> ");
        if (titleAsLabel) {
            sb.append("<span class=\"operationalButtonLabel\">").append(title.getObject()).append("</span>");
        }
    }
    if (icon.hasLayerIcons()) {
        for (LayerIcon entry : icon.getLayerIcons()) {
            if (entry == null) {
                continue;
            }
            if (StringUtils.isNotEmpty(entry.getIconType().getCssClass())) {
                sb.append("<i class=\"").append(entry.getIconType().getCssClass()).append("\"");
                if (StringUtils.isNotEmpty(entry.getIconType().getColor())) {
                    sb.append(" style=\"color: ").append(entry.getIconType().getColor()).append(";\"");
                }
                sb.append(">").append(entry.hasLabel() ? entry.getLabelModel().getObject() : "").append("</i> ");
            }
        }
    }
    replaceComponentTagBody(markupStream, openTag, sb.toString());
}
Also used : CompositedIcon(com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon) LayerIcon(com.evolveum.midpoint.gui.impl.component.icon.LayerIcon)

Aggregations

CompositedIcon (com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon)7 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)5 ArrayList (java.util.ArrayList)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 PendingOperationPanel (com.evolveum.midpoint.gui.api.component.PendingOperationPanel)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 LayerIcon (com.evolveum.midpoint.gui.impl.component.icon.LayerIcon)2 AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 List (java.util.List)2 Component (org.apache.wicket.Component)2 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)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 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)1