Ejemplo n.º 1
0
  /** Removes all listeners from the bound fields and unbinds properties. */
  public void unbind() {
    // wrap in array list to avoid CME
    for (Field<?> field : new ArrayList<Field<?>>(getFields())) {
      field.removeValueChangeListener(this);
      if (field instanceof TextChangeNotifier) {
        final TextChangeNotifier abstractTextField = (TextChangeNotifier) field;
        abstractTextField.removeTextChangeListener(this);
      }

      unbind(field);
    }
    fieldsWithInitiallyDisabledValidation.clear();
  }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
 private void removeTextListener(final AbstractField<?> field) {
   if (!(field instanceof TextChangeNotifier)) {
     return;
   }
   for (final Object listener : field.getListeners(TextChangeEvent.class)) {
     if (listener instanceof ChangeListener) {
       ((TextChangeNotifier) field).removeTextChangeListener((ChangeListener) listener);
     }
   }
 }
Ejemplo n.º 4
0
  protected void addComponentListeners() {
    for (final AbstractField<?> field : allComponents) {
      if (field instanceof TextChangeNotifier) {
        ((TextChangeNotifier) field).addTextChangeListener(new ChangeListener(field));
      }

      if (field instanceof Table) {
        ((Table) field).addItemSetChangeListener(new ChangeListener(field));
      }
      field.addValueChangeListener(new ChangeListener(field));
    }
  }