示例#1
0
 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();
   }
 }
示例#2
0
  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();
    }
  }