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 addField(final FormField field) {
   FormTree.Node node = viewModel.getFormTree().getRootField(field.getId());
   FormFieldWidget widget =
       widgetFactory.createWidget(
           viewModel,
           node,
           new ValueUpdater() {
             @Override
             public void update(Object value) {
               onFieldUpdated(field, value);
             }
           });
   FieldContainer container = containerFactory.createContainer(field, widget);
   containers.put(field.getId(), container);
   panel.add(container);
 }
 private void onFieldUpdated(FormField field, Object newValue) {
   if (!Objects.equals(workingInstance.get(field.getId()), newValue)) {
     workingInstance.set(field.getId(), newValue);
     validate(field);
   }
 }