Beispiel #1
0
  public void unbind() {
    if (bound) {
      bound = false;

      unbindModels();

      onUnbind();

      dirty.setDelegate(provider.dirty());
      handlerRegistry.dispose();
      binder.dispose();
      validationBinder.dispose();
      validationTree.dispose();
    }
  }
Beispiel #2
0
  private <E> void addValidationHandler(final Field<E> field) {
    final HasValidation validator = getValidator(field);
    if (validator != null && field instanceof HasValueChangeHandlers) {
      @SuppressWarnings("unchecked")
      HandlerRegistration handlerRegistration =
          ((HasValueChangeHandlers<E>) field)
              .addValueChangeHandler(
                  new ValueChangeHandler<E>() {
                    @Override
                    public void onValueChange(ValueChangeEvent<E> event) {
                      validator.validate();
                    }
                  });

      handlerRegistry.add(handlerRegistration);

      // TODO: listen to conditions of validation, then re-validate().
      // But how?
    }
  }