Search in sources :

Example 6 with DisplayType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType in project midpoint by Evolveum.

the class CompositedButtonPanel method initLayout.

private void initLayout() {
    WebMarkupContainer buttonContainer = new WebMarkupContainer(ID_COMPOSITED_BUTTON);
    add(buttonContainer);
    CompositedIconPanel compositedIconPanel = new CompositedIconPanel(ID_COMPOSITED_ICON, new PropertyModel<>(getModel(), CompositedIconButtonDto.F_COMPOSITED_ICON));
    buttonContainer.add(compositedIconPanel);
    Label label = new Label(ID_LABEL, new ReadOnlyModel<>(() -> {
        DisplayType displayType = getModelObject().getAdditionalButtonDisplayType();
        return WebComponentUtil.getTranslatedPolyString(displayType.getLabel());
    }));
    buttonContainer.add(label);
    buttonContainer.add(AttributeAppender.append("title", new ReadOnlyModel<>(() -> {
        DisplayType displayType = getModelObject().getAdditionalButtonDisplayType();
        return WebComponentUtil.getTranslatedPolyString(displayType.getTooltip());
    })));
    buttonContainer.add(new TooltipBehavior());
    buttonContainer.add(new AjaxEventBehavior("click") {

        @Override
        protected void onEvent(AjaxRequestTarget target) {
            onButtonClicked(target, getModelObject());
        }

        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            attributes.setPreventDefault(true);
            super.updateAjaxAttributes(attributes);
        }
    });
// Label description = new Label(ID_DESCRIPTION, new ReadOnlyModel<>(() -> {
// DisplayType displayType = getModelObject().getAdditionalButtonDisplayType();
// return WebComponentUtil.getTranslatedPolyString(displayType.getTooltip());
// }));
// buttonContainer.add(description);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxRequestAttributes(org.apache.wicket.ajax.attributes.AjaxRequestAttributes) CompositedIconPanel(com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconPanel) TooltipBehavior(com.evolveum.midpoint.web.util.TooltipBehavior) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) AjaxEventBehavior(org.apache.wicket.ajax.AjaxEventBehavior) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 7 with DisplayType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType in project midpoint by Evolveum.

the class BasicMultivalueContainerListPanel method createNewButtonDescription.

@Override
protected List<CompositedIconButtonDto> createNewButtonDescription() {
    String title = getPageBase().createStringResource("PageAdminObjectDetails.title.new", getContainerNameForNewButton()).getString();
    DisplayType defaultButtonDisplayType = GuiDisplayTypeUtil.createDisplayType("fa fa-plus", "green", title);
    CompositedIconButtonDto defaultButton = new CompositedIconButtonDto();
    CompositedIconBuilder builder = new CompositedIconBuilder();
    builder.setBasicIcon(WebComponentUtil.getIconCssClass(defaultButtonDisplayType), IconCssStyle.IN_ROW_STYLE).appendColorHtmlValue(WebComponentUtil.getIconColor(defaultButtonDisplayType));
    defaultButton.setAdditionalButtonDisplayType(defaultButtonDisplayType);
    defaultButton.setCompositedIcon(builder.build());
    return Collections.singletonList(defaultButton);
}
Also used : DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) CompositedIconButtonDto(com.evolveum.midpoint.web.component.CompositedIconButtonDto) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)

Example 8 with DisplayType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType in project midpoint by Evolveum.

the class DashboardWidgetDto method createIconCssClass.

private String createIconCssClass(DashboardWidget dashboardWidget) {
    if (dashboardWidget == null) {
        return DEFAULT_ICON;
    }
    DisplayType displayType = dashboardWidget.getDisplay();
    if (displayType == null) {
        return DEFAULT_ICON;
    }
    IconType icon = displayType.getIcon();
    if (icon == null) {
        return DEFAULT_ICON;
    }
    String cssClass = icon.getCssClass();
    if (StringUtils.isNoneBlank(cssClass)) {
        return cssClass;
    }
    return DEFAULT_ICON;
}
Also used : DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) IconType(com.evolveum.midpoint.xml.ns._public.common.common_3.IconType)

Example 9 with DisplayType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType in project midpoint by Evolveum.

the class DashboardWidgetDto method createMessage.

private String createMessage(DashboardWidget dashboardWidget) {
    if (dashboardWidget == null) {
        return null;
    }
    DisplayType displayType = dashboardWidget.getDisplay();
    if (displayType != null && displayType.getLabel() != null) {
        // TODO translate?
        return displayType.getLabel().getOrig();
    }
    DashboardWidgetType dashboardWidgetType = dashboardWidget.getWidget();
    if (dashboardWidgetType == null) {
        return null;
    }
    return dashboardWidgetType.getIdentifier();
}
Also used : DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) DashboardWidgetType(com.evolveum.midpoint.xml.ns._public.common.common_3.DashboardWidgetType)

Example 10 with DisplayType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType in project midpoint by Evolveum.

the class PasswordPolicyValidationPanel method initLayout.

private void initLayout() {
    IModel<DisplayType> displayModel = (IModel) () -> {
        if (!Boolean.TRUE.equals(isAfterInitialization.getObject())) {
            return null;
        }
        String status = "fa-fw " + GuiStyleConstants.CLASS_OP_RESULT_STATUS_ICON_SUCCESS_COLORED + " fa-lg";
        String titleKey = "PasswordPolicyValidationPanel.valid";
        for (StringLimitationResult limitation : getModelObject()) {
            if (!limitation.isSuccess()) {
                status = "fa-fw " + GuiStyleConstants.CLASS_OP_RESULT_STATUS_ICON_FATAL_ERROR_COLORED + " fa-lg";
                titleKey = "PasswordPolicyValidationPanel.invalid";
            }
        }
        return GuiDisplayTypeUtil.createDisplayType(status, "", getPageBase().createStringResource(titleKey).getString());
    };
    ImagePanel resultIcon = new ImagePanel(ID_RESULT_ICON, displayModel);
    resultIcon.setOutputMarkupId(true);
    add(resultIcon);
    ImagePanel infoPanel = new ImagePanel(ID_INFO_ICON, Model.of(GuiDisplayTypeUtil.createDisplayType("fa fa-info-circle")));
    add(infoPanel);
    PasswordLimitationsPanel validationPanel = new PasswordLimitationsPanel(ID_POLICY_VALIDATION_POPOVER, getModel());
    validationPanel.setOutputMarkupId(true);
    add(validationPanel);
}
Also used : IModel(org.apache.wicket.model.IModel) DisplayType(com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType) StringLimitationResult(com.evolveum.midpoint.model.api.validator.StringLimitationResult) PasswordLimitationsPanel(com.evolveum.midpoint.gui.api.component.password.PasswordLimitationsPanel)

Aggregations

DisplayType (com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType)18 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)6 Label (org.apache.wicket.markup.html.basic.Label)5 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)4 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)4 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)4 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)4 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)3 TooltipBehavior (com.evolveum.midpoint.web.util.TooltipBehavior)3 IModel (org.apache.wicket.model.IModel)3 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 CompositedIconPanel (com.evolveum.midpoint.gui.impl.component.data.column.CompositedIconPanel)2 StringLimitationResult (com.evolveum.midpoint.model.api.validator.StringLimitationResult)2 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 CompositedIconButtonDto (com.evolveum.midpoint.web.component.CompositedIconButtonDto)2 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)2 ImagePanel (com.evolveum.midpoint.web.component.data.column.ImagePanel)2 EnableBehaviour (com.evolveum.midpoint.web.component.util.EnableBehaviour)2 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)2