Example usage for java.beans PropertyChangeSupport PropertyChangeSupport

List of usage examples for java.beans PropertyChangeSupport PropertyChangeSupport

Introduction

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

Prototype

public PropertyChangeSupport(Object sourceBean) 

Source Link

Document

Constructs a PropertyChangeSupport object.

Usage

From source file:edu.ku.brc.specify.datamodel.DataModelObjBase.java

/**
 * Notifies all attached {@link PropertyChangeListener}s of a {@link PropertyChangeEvent}.
 * See {@link PropertyChangeSupport}.firePropertyChange(String,int,int).
 * //from   w w  w .j av  a  2 s.  c o  m
 * @param propertyName the name of the bound property that changed
 * @param oldValue the old value of the property
 * @param newValue the new value of the property
 */
public void firePropertyChange(String propertyName, int oldValue, int newValue) {
    if (changes == null) {
        changes = new PropertyChangeSupport(this);
    }
    changes.firePropertyChange(propertyName, oldValue, newValue);
}

From source file:edu.ku.brc.specify.datamodel.DataModelObjBase.java

/**
 * Notifies all attached {@link PropertyChangeListener}s of a {@link PropertyChangeEvent}.
 * See {@link PropertyChangeSupport}.firePropertyChange(String,Object,Object).
 * //from   w w w.j a v  a2 s . c o  m
 * @param propertyName the name of the bound property that changed
 * @param oldValue the old value of the property
 * @param newValue the new value of the property
 */
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
    if (changes == null) {
        changes = new PropertyChangeSupport(this);
    }
    changes.firePropertyChange(propertyName, oldValue, newValue);
}

From source file:edu.ku.brc.specify.datamodel.DataModelObjBase.java

@Override
public void removePropertyChangeListener(PropertyChangeListener listener) {
    if (changes == null) {
        changes = new PropertyChangeSupport(this);
    }// www . ja va  2  s .c o  m
    changes.removePropertyChangeListener(listener);
}

From source file:edu.ku.brc.specify.datamodel.DataModelObjBase.java

@Override
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
    if (changes == null) {
        changes = new PropertyChangeSupport(this);
    }/*from   w ww .ja v  a 2s  .  c om*/
    changes.removePropertyChangeListener(propertyName, listener);
}

From source file:com.interface21.beans.BeanWrapperImpl.java

/**
 * Disabling event propagation improves performance.
 * @param flag whether event propagation should be enabled
 *///from   w  ww .  ja v  a  2s  .  c  om
public void setEventPropagationEnabled(boolean flag) {
    this.eventPropagationEnabled = flag;
    // Lazily initialize support for events if not already initialized
    if (eventPropagationEnabled && (vetoableChangeSupport == null || propertyChangeSupport == null)) {
        vetoableChangeSupport = new VetoableChangeSupport(object);
        propertyChangeSupport = new PropertyChangeSupport(object);
    }
}

From source file:com.rockhoppertech.music.midi.js.MIDITrack.java

/**
 * Serializaiton method./*ww w.j ava2s .  c  om*/
 * 
 * @param in
 *            the input stream
 * @throws IOException
 *             if something went wrong
 * @throws ClassNotFoundException
 *             if the class is not found
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    // our "pseudo-constructor"
    in.defaultReadObject();
    // now we are a "live" object again
    this.changes = new PropertyChangeSupport(this);
    this.midiStringParser = new MIDIStringParser();
}

From source file:net.sourceforge.vulcan.dto.BaseDto.java

public BaseDto copy() {
    try {//w  w w .ja v  a  2s.c o  m
        final BaseDto dto = (BaseDto) super.clone();
        dto.propertyChangeSupport = new PropertyChangeSupport(dto);
        return dto;
    } catch (CloneNotSupportedException e) {
        throw new RuntimeException("The world is flat.", e);
    }
}

From source file:org.apache.beehive.controls.runtime.bean.ControlBean.java

/**
 * This protected version is only available to concrete subclasses that expose bound
 * property support.   This method is synchronized to enable lazy instantiation, in
 * the belief that it is a bigger win to avoid allocating when there are no listeners
 * than it is to introduce synchronization overhead on access.
 *///from   ww  w  . java2s.  c o m
synchronized protected PropertyChangeSupport getPropertyChangeSupport() {
    if (_changeSupport == null)
        _changeSupport = new PropertyChangeSupport(this);

    return _changeSupport;
}

From source file:org.apache.bsf.BSFManager.java

public BSFManager() {
    pcs = new PropertyChangeSupport(this);
}

From source file:org.apache.cayenne.modeler.util.CayenneController.java

/**
 * Adds a listener for property change events.
 *//*from   ww  w  . j a va2  s .  c o  m*/
public void addPropertyChangeListener(String expression, PropertyChangeListener listener) {

    if (propertyChangeSupport == null) {
        propertyChangeSupport = new PropertyChangeSupport(this);
    }

    propertyChangeSupport.addPropertyChangeListener(expression, listener);
}