package textbender.g.beans; // Copyright 2006, Michael Allan. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Textbender Software"), to deal in the Textbender Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Textbender Software, and to permit persons to whom the Textbender Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Textbender Software. THE TEXTBENDER SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE TEXTBENDER SOFTWARE OR THE USE OR OTHER DEALINGS IN THE TEXTBENDER SOFTWARE. import java.beans.*; /** Auto-dispatch property change event, for asynchronous dispatch. * An alternative to wrapping each event in a separately constructed Runnable, * this approach is (presumeably) less offensive to the garbage collector. *

* Thread safe if the provided instance of PropertyChangeSupport sPC is thread safe. * Serializable, at loss of auto-dispatch capability (sPC not serialized). *

*/ public final class PropertyChangeEventAD extends PropertyChangeEvent implements Runnable { private static final long serialVersionUID = 0L; /** Constructs a PropertyChangeEventAD * * @param sPC property change support, * to whose listener list the event will be dispatched */ public PropertyChangeEventAD( Object source, String propertyName, Object oldValue, Object newValue, PropertyChangeSupport sPC ) { super( source, propertyName, oldValue, newValue ); if( sPC == null ) throw new NullPointerException(); propertyChangeSupport = sPC; } // - R u n n a b l e ------------------------------------------------------------------ /** Dispatches this event to the listener list. */ public void run() { propertyChangeSupport.firePropertyChange( PropertyChangeEventAD.this ); } //// P r i v a t e /////////////////////////////////////////////////////////////////////// private final transient PropertyChangeSupport propertyChangeSupport; }