private void validate(FormField field) { String value = (String) workingInstance.get(field.getId()); FieldContainer container = containers.get(field.getId()); if (field.isRequired() && Strings.isNullOrEmpty(value)) { container.setInvalid(I18N.CONSTANTS.requiredFieldMessage()); } else { container.setValid(); } }
private void setValue(FormInstance instance) { this.instance = instance; this.workingInstance = viewModel.getInstance().copy(); for (Map.Entry<Cuid, FieldContainer> entry : containers.entrySet()) { FieldContainer container = entry.getValue(); FormFieldWidget fieldWidget = container.getFieldWidget(); fieldWidget.setValue(workingInstance.get(entry.getKey())); container.setValid(); } }