Search in sources :

Example 1 with PasswordLimitationsPanel

use of com.evolveum.midpoint.gui.api.component.password.PasswordLimitationsPanel 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

PasswordLimitationsPanel (com.evolveum.midpoint.gui.api.component.password.PasswordLimitationsPanel)1 StringLimitationResult (com.evolveum.midpoint.model.api.validator.StringLimitationResult)1 DisplayType (com.evolveum.midpoint.xml.ns._public.common.common_3.DisplayType)1 IModel (org.apache.wicket.model.IModel)1