Search in sources :

Example 1 with IInputComponentValidationLabelBluePrint

use of org.jowidgets.api.widgets.blueprint.IInputComponentValidationLabelBluePrint in project jo-client-platform by jo-source.

the class BeanSelectionDialogDefaults method initialize.

@Override
public void initialize(final IBeanSelectionDialogBluePrint<?> bluePrint) {
    bluePrint.setContentScrolled(false);
    bluePrint.setContentBorder();
    bluePrint.setMissingInputHint("Bitte wählen Sie einen Datensatz aus");
    bluePrint.setDefaultButtonPolicy(InputDialogDefaultButtonPolicy.DISABLED);
    final IInputComponentValidationLabelBluePrint validationLabelBp = BPF.inputComponentValidationLabel();
    validationLabelBp.setInitialValidationDecorator(new IDecorator<IValidationResult>() {

        @Override
        public IValidationResult decorate(final IValidationResult original) {
            if (!original.isValid()) {
                return original;
            }
            return null;
        }
    });
}
Also used : IValidationResult(org.jowidgets.validation.IValidationResult) IInputComponentValidationLabelBluePrint(org.jowidgets.api.widgets.blueprint.IInputComponentValidationLabelBluePrint)

Example 2 with IInputComponentValidationLabelBluePrint

use of org.jowidgets.api.widgets.blueprint.IInputComponentValidationLabelBluePrint in project jo-client-platform by jo-source.

the class BeanFormDefaults method initialize.

@Override
public void initialize(final IBeanFormBluePrint<?> bluePrint) {
    bluePrint.setAutoResetValidation(true);
    bluePrint.setCreateModeForegroundColor(Colors.GREEN);
    bluePrint.setModifiedForegroundColor(Colors.STRONG);
    bluePrint.setScrollbarsAllowed(true);
    final IInputComponentValidationLabelBluePrint editModeValidationLabel = BPF.inputComponentValidationLabel();
    final IDecorator<IValidationResult> editModeValidationDecorator = new IDecorator<IValidationResult>() {

        @Override
        public IValidationResult decorate(final IValidationResult original) {
            if (original != null) {
                final IValidationMessage worstFirst = original.getWorstFirst();
                if (worstFirst != null && worstFirst.getType().equalOrWorse(MessageType.WARNING)) {
                    return original;
                }
            }
            return null;
        }
    };
    editModeValidationLabel.setInitialValidationDecorator(editModeValidationDecorator);
    editModeValidationLabel.setUnmodifiedValidationDecorator(editModeValidationDecorator);
    editModeValidationLabel.setEmptyIcon(IconsSmall.OK_GREYED);
    bluePrint.setEditModeValidationLabel(editModeValidationLabel);
    final IInputComponentValidationLabelBluePrint createModeValidationLabel = BPF.inputComponentValidationLabel();
    final IDecorator<IValidationResult> createModeValidationDecorator = new IDecorator<IValidationResult>() {

        @Override
        public IValidationResult decorate(final IValidationResult original) {
            if (original != null) {
                final IValidationMessage worstFirst = original.getWorstFirst();
                if (worstFirst != null && worstFirst.getType().equalOrWorse(MessageType.WARNING)) {
                    return original;
                }
            }
            return null;
        }
    };
    createModeValidationLabel.setInitialValidationDecorator(createModeValidationDecorator);
    createModeValidationLabel.setUnmodifiedValidationDecorator(createModeValidationDecorator);
    bluePrint.setCreateModeValidationLabel(createModeValidationLabel);
    bluePrint.setCreateModeInputHint(Messages.getString("BeanFormDefaults.fill_out_mandatory_fields"));
    bluePrint.setMandatoryBackgroundColor(CapColors.MANDATORY_BACKGROUND);
    bluePrint.setMandatoryLabelDecorator(new IDecorator<String>() {

        @Override
        public String decorate(final String original) {
            if (original != null) {
                return original + "*";
            }
            return null;
        }
    });
    bluePrint.setPropertyValidationLabel(BPF.validationResultLabel().setShowValidationMessage(false));
}
Also used : IValidationMessage(org.jowidgets.validation.IValidationMessage) IValidationResult(org.jowidgets.validation.IValidationResult) IInputComponentValidationLabelBluePrint(org.jowidgets.api.widgets.blueprint.IInputComponentValidationLabelBluePrint) IDecorator(org.jowidgets.util.IDecorator)

Aggregations

IInputComponentValidationLabelBluePrint (org.jowidgets.api.widgets.blueprint.IInputComponentValidationLabelBluePrint)2 IValidationResult (org.jowidgets.validation.IValidationResult)2 IDecorator (org.jowidgets.util.IDecorator)1 IValidationMessage (org.jowidgets.validation.IValidationMessage)1