Package jmri.beans
Class VetoableChangeSupport
java.lang.Object
jmri.beans.PropertyChangeSupport
jmri.beans.VetoableChangeSupport
- All Implemented Interfaces:
PropertyChangeFirer,PropertyChangeProvider,VetoableChangeFirer,VetoableChangeProvider
- Direct Known Subclasses:
AbstractManager,AbstractProxyManager,EntryExitPairs
@ThreadSafe
public class VetoableChangeSupport
extends PropertyChangeSupport
implements VetoableChangeProvider, VetoableChangeFirer
Implementation of
PropertyChangeSupport and
VetoableChangeSupport that can be extended by classes that
would normally need to implement the methods of PropertyChangeSupport and
VetoableChangeSupport independently.
This class is designed to support retrofitting an existing class with the
PropertyChangeProvider, PropertyChangeFirer, VetoableChangeProvider, and
VetoableChangeFirer interfaces without introducing the complexity of the
other implementations of PropertyChangeProvider in this package. When
designing new classes, it would be preferable to subclass
ArbitraryBean, Bean, or ConstrainedBean depending on
the design requirements of the new class.
This class is thread safe.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final VetoableChangeSupportProvide aVetoableChangeSupporthelper.Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd aVetoableChangeListenerto the listener list.voidaddVetoableChangeListener(String propertyName, VetoableChangeListener listener) Add aVetoableChangeListenerfor a specific property.voidFire a property change.voidfireVetoableChange(String propertyName, boolean oldValue, boolean newValue) Fire a property change.voidfireVetoableChange(String propertyName, int oldValue, int newValue) Fire a property change.voidfireVetoableChange(String propertyName, Object oldValue, Object newValue) Fire a property change.Get allVetoableChangeListeners currently attached to this object.getVetoableChangeListeners(String propertyName) Get allVetoableChangeListeners currently listening to changes to the specified property.voidRemove the specified listener from this object.voidremoveVetoableChangeListener(String propertyName, VetoableChangeListener listener) Remove the specified listener of the specified property from this object.Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
vetoableChangeSupport
Provide aVetoableChangeSupporthelper.
-
-
Constructor Details
-
VetoableChangeSupport
public VetoableChangeSupport()
-
-
Method Details
-
addVetoableChangeListener
Add aVetoableChangeListenerto the listener list.- Specified by:
addVetoableChangeListenerin interfaceVetoableChangeProvider- Parameters:
listener- The VetoableChangeListener to be added
-
addVetoableChangeListener
public void addVetoableChangeListener(@CheckForNull String propertyName, @CheckForNull VetoableChangeListener listener) Add aVetoableChangeListenerfor a specific property.- Specified by:
addVetoableChangeListenerin interfaceVetoableChangeProvider- Parameters:
propertyName- The name of the property to listen on.listener- The VetoableChangeListener to be added
-
getVetoableChangeListeners
Get allVetoableChangeListeners currently attached to this object.- Specified by:
getVetoableChangeListenersin interfaceVetoableChangeProvider- Returns:
- An array of VetoableChangeListeners.
-
getVetoableChangeListeners
Get allVetoableChangeListeners currently listening to changes to the specified property.- Specified by:
getVetoableChangeListenersin interfaceVetoableChangeProvider- Parameters:
propertyName- The name of the property of interest- Returns:
- An array of VetoableChangeListeners.
-
removeVetoableChangeListener
Remove the specified listener from this object.- Specified by:
removeVetoableChangeListenerin interfaceVetoableChangeProvider- Parameters:
listener- TheVetoableChangeListenerto remove.
-
removeVetoableChangeListener
public void removeVetoableChangeListener(@CheckForNull String propertyName, @CheckForNull VetoableChangeListener listener) Remove the specified listener of the specified property from this object.- Specified by:
removeVetoableChangeListenerin interfaceVetoableChangeProvider- Parameters:
propertyName- The name of the property to stop listening to.listener- TheVetoableChangeListenerto remove.
-
fireVetoableChange
public void fireVetoableChange(String propertyName, boolean oldValue, boolean newValue) throws PropertyVetoException Fire a property change.- Specified by:
fireVetoableChangein interfaceVetoableChangeFirer- Parameters:
propertyName- the programmatic name of the property that was changedoldValue- the old value of the propertynewValue- the new value of the property- Throws:
PropertyVetoException- if one of listeners vetoes the property update
-
fireVetoableChange
Fire a property change.- Specified by:
fireVetoableChangein interfaceVetoableChangeFirer- Parameters:
event- the PropertyChangeEvent to be fired- Throws:
PropertyVetoException- if one of listeners vetoes the property update
-
fireVetoableChange
public void fireVetoableChange(String propertyName, int oldValue, int newValue) throws PropertyVetoException Fire a property change.- Specified by:
fireVetoableChangein interfaceVetoableChangeFirer- Parameters:
propertyName- the programmatic name of the property that was changedoldValue- the old value of the propertynewValue- the new value of the property- Throws:
PropertyVetoException- if one of listeners vetoes the property update
-
fireVetoableChange
public void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws PropertyVetoException Fire a property change.- Specified by:
fireVetoableChangein interfaceVetoableChangeFirer- Parameters:
propertyName- the programmatic name of the property that was changedoldValue- the old value of the propertynewValue- the new value of the property- Throws:
PropertyVetoException- if one of listeners vetoes the property update
-