コード例 #1
0
 /**
  * Makes all fields "immediate" to trigger eager validation
  *
  * @param listener a listener that will be notified when a field in the group has been modified
  * @return the MBeanFieldGroup that can be used for further modifications or e.g. commit if
  *     buffered
  */
 public MBeanFieldGroup<T> withEagerValidation(FieldGroupListener<T> listener) {
   this.listener = listener;
   for (Field<?> field : getFields()) {
     ((AbstractComponent) field).setImmediate(true);
     field.addValueChangeListener(this);
     if (field instanceof EagerValidateable) {
       EagerValidateable ev = (EagerValidateable) field;
       ev.setEagerValidation(true);
     }
     if (field instanceof TextChangeNotifier) {
       final TextChangeNotifier abstractTextField = (TextChangeNotifier) field;
       abstractTextField.addTextChangeListener(this);
     }
   }
   return this;
 }
コード例 #2
0
  private DocumentFormImpl newForm() {
    recordForm =
        new DocumentFormImpl(recordVO) {
          @Override
          protected void saveButtonClick(RecordVO viewObject) throws ValidationException {
            presenter.saveButtonClicked();
          }

          @Override
          protected void cancelButtonClick(RecordVO viewObject) {
            presenter.cancelButtonClicked();
          }

          @Override
          public void reload() {
            recordForm = newForm();
            AddEditDocumentViewImpl.this.replaceComponent(this, recordForm);
          }

          @Override
          public void commit() {
            for (Field<?> field : fieldGroup.getFields()) {
              try {
                field.commit();
              } catch (SourceException | InvalidValueException e) {
              }
            }
          }
        };

    for (final Field<?> field : recordForm.getFields()) {
      if (field instanceof CustomDocumentField) {
        field.addValueChangeListener(
            new ValueChangeListener() {
              @Override
              public void valueChange(ValueChangeEvent event) {
                presenter.customFieldValueChanged((CustomDocumentField<?>) field);
              }
            });
      }
    }

    return recordForm;
  }
コード例 #3
0
ファイル: FieldQuery.java プロジェクト: jdahlstrom/vquery
 public FieldQuery<F> addValueChangeListener(ValueChangeListener listener) {
   for (Field<?> f : this) {
     f.addValueChangeListener(listener);
   }
   return createQuery();
 }