Example usage for java.beans PropertyChangeListener propertyChange

List of usage examples for java.beans PropertyChangeListener propertyChange

Introduction

In this page you can find the example usage for java.beans PropertyChangeListener propertyChange.

Prototype


void propertyChange(PropertyChangeEvent evt);

Source Link

Document

This method gets called when a bound property is changed.

Usage

From source file:org.geopublishing.geopublisher.AtlasConfigEditable.java

/**
 * Informs all registered {@link PropertyChangeListener}s about a change in
 * the {@link AtlasConfigEditable}. Also informs all listeners of MapPool
 * and DataPool.// w w  w.j  a  v a2s. co  m
 */
public void fireChangeEvents() {
    PropertyChangeEvent pce = new PropertyChangeEvent(this, "change", false, true);

    for (PropertyChangeListener pcl : listeners) {
        if (pcl != null)
            pcl.propertyChange(pce);
    }

    getMapPool().fireChangeEvents(this, EventTypes.unknown, null);
    getDataPool().fireChangeEvents(org.geopublishing.atlasViewer.dp.DataPool.EventTypes.unknown);
}

From source file:org.jcurl.core.api.PropertyChangeSupport.java

public void firePropertyChange(final PropertyChangeEvent event) {
    // log.debug(event);
    validateNamedProperty(event.getPropertyName());
    {// w  ww  .j  a v  a  2s  .  c om
        final Object a = event.getOldValue();
        final Object b = event.getNewValue();
        if (a != null && a.equals(b) || a == null && b == null)
            return;
    }
    // validated that an event must be thrown; now throw it.
    synchronized (listenerMap) {
        // First gets the list of listeners and stores them in strong
        // references by copying them into a new set.
        final Set<PropertyChangeListener> targets = new HashSet<PropertyChangeListener>(
                listenerMap.get(ALL_PROPERTIES));
        targets.addAll(listenerMap.get(event.getPropertyName()));
        for (final PropertyChangeListener element : targets)
            element.propertyChange(event);
    }
}

From source file:org.jcurl.core.helpers.PropertyChangeSupport.java

/**
 * Fire a property change event to all of the listeners.
 * <p>/*from w ww  . jav  a2 s .c  om*/
 * This method is called by all the fire methods to perform the firing of
 * the events.
 * </p>
 * <p>
 * The firing will go to the listeners that are registered for the specific
 * property as well as general purpose listeners.
 * </p>
 * <p>
 * If the old and new values for the event are the same, by the
 * <tt>equals()</tt> method, the event will not be fired.
 * </p>
 * 
 * @param event
 *            The event to fire to the listeners.
 */
public void firePropertyChange(final PropertyChangeEvent event) {
    validateNamedProperty(event.getPropertyName());
    {
        final Object a = event.getOldValue();
        final Object b = event.getNewValue();
        if (a != null && a.equals(b) || a == null && b == null)
            return;
    }
    // if (event.getOldValue() == null) {
    // if (event.getOldValue() == null) {
    // return;
    // }
    // } else if (event.getOldValue().equals(event.getNewValue())) {
    // return;
    // }
    // validated that an event must be thrown; now throw it.
    synchronized (listenerMap) {
        // First gets the list of listeners and stores them in strong
        // references by copying them into a new set.
        final Set<PropertyChangeListener> targets = new HashSet<PropertyChangeListener>(
                listenerMap.get(ALL_PROPERTIES));
        targets.addAll(listenerMap.get(event.getPropertyName()));
        for (final PropertyChangeListener element : targets)
            element.propertyChange(event);
    }
}

From source file:org.kuali.kfs.module.tem.document.TravelDocumentBase.java

/**
 * Notify listeners that an event occurred
 *
 * @param event the {@link PropertyChangeEvent}
 *//*from w  ww .j  a  v  a2 s  .com*/
protected void notifyChangeListeners(final PropertyChangeEvent event) {
    for (final PropertyChangeListener listener : getPropertyChangeListeners()) {
        listener.propertyChange(event);
    }
}

From source file:org.opennms.netmgt.poller.remote.support.ScanReportPollerFrontEnd.java

private void firePropertyChange(final String propertyName, final Object oldValue, final Object newValue) {
    if (nullSafeEquals(oldValue, newValue)) {
        // no change no event
        return;//from  ww w  .  j av  a2s . c o  m

    }
    final PropertyChangeEvent event = new PropertyChangeEvent(this, propertyName, oldValue, newValue);

    for (final PropertyChangeListener listener : m_propertyChangeListeners) {
        listener.propertyChange(event);
    }
}

From source file:org.polymap.core.data.ui.featuretable.FeatureTableViewer.java

protected void firePropChange(final String name, Object oldValue, final Object newValue) {
    final PropertyChangeEvent ev = new PropertyChangeEvent(this, name, oldValue, newValue);

    Display display = getTable().getDisplay();
    display.asyncExec(new Runnable() {
        public void run() {
            if (getTable().isDisposed()) {
                return;
            }/*  w  w  w  .  ja va  2s .c om*/
            //                if (PROP_CONTENT_SIZE.equals( name ) ) {
            //                    getTable().setForeground( Graphics.getColor( 0x70, 0x70, 0x80 ) );
            //                }
            for (PropertyChangeListener l : listeners.getListeners()) {
                l.propertyChange(ev);
            }
        }
    });
}

From source file:org.polymap.core.mapeditor.tooling.edit.BaseLayerEditorTool.java

protected void fireEvent(BaseLayerEditorTool tool, String name, Object newValue) {
    PropertyChangeEvent ev = new PropertyChangeEvent(tool, name, null, newValue);
    for (PropertyChangeListener l : listeners) {
        try {//from   w w w . ja va2  s. c  o m
            l.propertyChange(ev);
        } catch (Exception e) {
            log.warn(e, e);
        }
    }
    for (PropertyChangeListener l : sessionTools().listeners) {
        try {
            l.propertyChange(ev);
        } catch (Exception e) {
            log.warn(e, e);
        }
    }
}

From source file:org.springframework.binding.value.support.AbstractValueModel.java

/**
 * Notifies all listeners that have registered interest for
 * notification on this event type. This method does not check if there is any change
 * between the old and new value unlike the various fireValueChanged() methods.
 */// w  w w  .  j a v a 2  s.c o  m
protected void fireValueChangeEvent(Object oldValue, Object newValue) {
    if (logger.isDebugEnabled()) {
        logger.debug("Firing value changed event. Old value='" + oldValue + "' new value='" + newValue + "'");
    }
    final PropertyChangeListener[] propertyChangeListeners = getPropertyChangeListeners(VALUE_PROPERTY);
    if (propertyChangeListeners.length > 0) {
        final Object listenerToSkip = listenerToSkipHolder.get();
        final PropertyChangeEvent propertyChangeEvent = new PropertyChangeEvent(this, VALUE_PROPERTY, oldValue,
                newValue);
        for (int i = 0; i < propertyChangeListeners.length; i++) {
            PropertyChangeListener listener = propertyChangeListeners[i];
            if (listener != listenerToSkip) {
                listener.propertyChange(propertyChangeEvent);
            }
        }
    }
}