Exemplo n.º 1
0
  /**
   * Fire a property change event to each listener.
   *
   * @param bean Bean being edited.
   * @param propName Name of the property.
   * @param oldValue Old value.
   * @param newValue New value.
   */
  protected void firePropertyChange(
      Object bean, String propName, Object oldValue, Object newValue) {

    PropertyChangeEvent e = new PropertyChangeEvent(bean, propName, oldValue, newValue);

    Iterator it = _changeListeners.iterator();
    while (it.hasNext()) {
      PropertyChangeListener l = (PropertyChangeListener) it.next();
      l.propertyChange(e);
    }
  }
  /**
   * Fire an existing PropertyChangeEvent to any registered listeners. No event is fired if the
   * given event's old and new values are equal and non-null.
   *
   * @param evt The PropertyChangeEvent object.
   */
  public void firePropertyChange(PropertyChangeEvent evt) {
    Object oldValue = evt.getOldValue();
    Object newValue = evt.getNewValue();
    String propertyName = evt.getPropertyName();
    if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
      return;
    }

    if (listeners != null) {
      Object[] list = listeners.getListenersInternal();
      for (int i = 0; i < list.length; i++) {
        PropertyChangeListener target = (PropertyChangeListener) list[i];
        target.propertyChange(evt);
      }
    }

    if (children != null && propertyName != null) {
      PropertyChangeSupport child = null;
      child = (PropertyChangeSupport) children.get(propertyName);
      if (child != null) {
        child.firePropertyChange(evt);
      }
    }
  }
Exemplo n.º 3
0
 public void notifyPropertyChangeListeners(PropertyChangeEvent event) {
   for (PropertyChangeListener listener : listeners) {
     listener.propertyChange(event);
   }
 }