Search in sources :

Example 1 with CompositedIcon

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

the class AjaxCompositedIconButton method onComponentTagBody.

@Override
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
    StringBuilder sb = new StringBuilder();
    CompositedIcon icon = this.icon;
    if (icon == null) {
        icon = buttonModel.getObject().getCompositedIcon();
    }
    if (icon.hasBasicIcon()) {
        sb.append("<i class=\"").append(icon.getBasicIcon()).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)

Example 2 with CompositedIcon

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

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

the class AssignmentPopup method createCompositedButtonForAssignmentRelation.

private CompositedIconButtonDto createCompositedButtonForAssignmentRelation(AssignmentObjectRelation relation) {
    CompositedIconButtonDto buttonDto = new CompositedIconButtonDto();
    buttonDto.setAssignmentObjectRelation(relation);
    DisplayType additionalButtonDisplayType = GuiDisplayTypeUtil.getAssignmentObjectRelationDisplayType(getPageBase(), relation, "AssignmentPanel.newAssignmentTitle");
    // isInducement() ? "AssignmentPanel.newInducementTitle" : "AssignmentPanel.newAssignmentTitle");
    buttonDto.setAdditionalButtonDisplayType(additionalButtonDisplayType);
    CompositedIconBuilder builder = WebComponentUtil.getAssignmentRelationIconBuilder(getPageBase(), relation, additionalButtonDisplayType.getIcon(), WebComponentUtil.createIconType(GuiStyleConstants.EVO_ASSIGNMENT_ICON, "green"));
    CompositedIcon icon = null;
    if (builder != null) {
        icon = builder.build();
    }
    buttonDto.setCompositedIcon(icon);
    return buttonDto;
}
Also used : CompositedIconButtonDto(com.evolveum.midpoint.web.component.CompositedIconButtonDto) CompositedIcon(com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)

Example 4 with CompositedIcon

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

the class ChooseMemberPopup method getAssignButtonDescription.

private List<CompositedIconButtonDto> getAssignButtonDescription() {
    List<CompositedIconButtonDto> additionalAssignmentButtons = new ArrayList<>();
    List<AssignmentObjectRelation> assignmentObjectRelations = WebComponentUtil.divideAssignmentRelationsByAllValues(loadMemberRelationsList());
    if (assignmentObjectRelations != null) {
        assignmentObjectRelations.forEach(relation -> {
            DisplayType additionalDispayType = GuiDisplayTypeUtil.getAssignmentObjectRelationDisplayType(ChooseMemberPopup.this.getPageBase(), relation, "abstractRoleMemberPanel.menu.assignMember");
            CompositedIconBuilder builder = WebComponentUtil.getAssignmentRelationIconBuilder(ChooseMemberPopup.this.getPageBase(), relation, additionalDispayType.getIcon(), WebComponentUtil.createIconType(GuiStyleConstants.EVO_ASSIGNMENT_ICON, "green"));
            CompositedIcon icon = builder.build();
            CompositedIconButtonDto buttonDto = createCompositedIconButtonDto(additionalDispayType, relation, icon);
            additionalAssignmentButtons.add(buttonDto);
        });
    }
    additionalAssignmentButtons.add(createCompositedIconButtonDto(getAssignMemberButtonDisplayType(), null, null));
    return additionalAssignmentButtons;
}
Also used : ArrayList(java.util.ArrayList) CompositedIcon(com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Example 5 with CompositedIcon

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

the class ColumnResultPanel method initLayout.

private void initLayout() {
    LoadableModel<CompositedIcon> compositedIcon = new LoadableModel<CompositedIcon>() {

        @Override
        protected CompositedIcon load() {
            OperationResult result = getModelObject();
            if (result == null) {
                return null;
            }
            String basicIconCssClass;
            String title;
            if (result.isEmpty()) {
                DisplayType displayType = getDisplayForEmptyResult();
                if (displayType == null || displayType.getIcon() == null || displayType.getIcon().getCssClass() == null) {
                    return null;
                }
                basicIconCssClass = displayType.getIcon().getCssClass();
                title = WebComponentUtil.getTranslatedPolyString(displayType.getTooltip());
            } else {
                OperationResultStatusPresentationProperties statusProperties = OperationResultStatusPresentationProperties.parseOperationalResultStatus(result.getStatus());
                basicIconCssClass = statusProperties.getIcon() + " fa-lg";
                title = getPageBase().createStringResource(statusProperties.getStatusLabelKey()).getString();
            }
            CompositedIconBuilder builder = new CompositedIconBuilder();
            String additionalCssClass = "";
            Throwable cause = RepoCommonUtils.getResultExceptionIfExists(getModelObject());
            if (OperationResultStatus.IN_PROGRESS.equals(result.getStatus()) && (cause instanceof CommunicationException) && isProjectionResult()) {
                IconType icon = new IconType();
                icon.setCssClass("fa fa-info-circle " + GuiStyleConstants.BLUE_COLOR);
                builder.appendLayerIcon(icon, LayeredIconCssStyle.BOTTOM_RIGHT_STYLE);
                builder.setTitle(getPageBase().createStringResource("ColumnResultPanel.message.communicationFail").getString());
                additionalCssClass = "change-password-icon-result-center";
            } else {
                builder.setTitle(title);
            }
            builder.setBasicIcon(basicIconCssClass, IconCssStyle.IN_ROW_STYLE, additionalCssClass);
            return builder.build();
        }
    };
    CompositedIconPanel iconPanel = new CompositedIconPanel(ID_RESULT_ICON, compositedIcon);
    iconPanel.setOutputMarkupId(true);
    add(iconPanel);
    AjaxButton showErrorDetailsButton = new AjaxButton(ID_DETAILS_BUTTON) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            getPageBase().showResult(ColumnResultPanel.this.getModelObject());
            target.add(getPageBase().getFeedbackPanel());
        }
    };
    showErrorDetailsButton.setOutputMarkupId(true);
    showErrorDetailsButton.add(AttributeAppender.append("title", getPageBase().createStringResource("ColumnResultPanel.showDetails")));
    showErrorDetailsButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModelObject() != null && RepoCommonUtils.getResultExceptionIfExists(getModelObject()) != null;
        }
    });
    add(showErrorDetailsButton);
}
Also used : DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) OperationResultStatusPresentationProperties(com.evolveum.midpoint.web.page.admin.server.dto.OperationResultStatusPresentationProperties) IconType(com.evolveum.midpoint.xml.ns._public.common.common_3.IconType) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) CompositedIconPanel(com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconPanel) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) CompositedIcon(com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

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