use of org.jowidgets.util.IDecorator 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));
}
Aggregations