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 ofPropertyChangeSupport
andVetoableChangeSupport
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
, orConstrainedBean
depending on the design requirements of the new class.This class is thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.beans.VetoableChangeSupport
vetoableChangeSupport
Provide aVetoableChangeSupport
helper.-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description VetoableChangeSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Add aVetoableChangeListener
to the listener list.void
addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener listener)
Add aVetoableChangeListener
for a specific property.void
fireVetoableChange(java.beans.PropertyChangeEvent event)
Fire a property change.void
fireVetoableChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
Fire a property change.void
fireVetoableChange(java.lang.String propertyName, int oldValue, int newValue)
Fire a property change.void
fireVetoableChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
Fire a property change.java.beans.VetoableChangeListener[]
getVetoableChangeListeners()
Get allVetoableChangeListener
s currently attached to this object.java.beans.VetoableChangeListener[]
getVetoableChangeListeners(java.lang.String propertyName)
Get allVetoableChangeListener
s currently listening to changes to the specified property.void
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Remove the specified listener from this object.void
removeVetoableChangeListener(java.lang.String propertyName, java.beans.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 Detail
-
vetoableChangeSupport
protected final java.beans.VetoableChangeSupport vetoableChangeSupport
Provide aVetoableChangeSupport
helper.
-
-
Constructor Detail
-
VetoableChangeSupport
public VetoableChangeSupport()
-
-
Method Detail
-
addVetoableChangeListener
public void addVetoableChangeListener(@CheckForNull java.beans.VetoableChangeListener listener)
Add aVetoableChangeListener
to the listener list.- Specified by:
addVetoableChangeListener
in interfaceVetoableChangeProvider
- Parameters:
listener
- The VetoableChangeListener to be added
-
addVetoableChangeListener
public void addVetoableChangeListener(@CheckForNull java.lang.String propertyName, @CheckForNull java.beans.VetoableChangeListener listener)
Add aVetoableChangeListener
for a specific property.- Specified by:
addVetoableChangeListener
in interfaceVetoableChangeProvider
- Parameters:
propertyName
- The name of the property to listen on.listener
- The VetoableChangeListener to be added
-
getVetoableChangeListeners
public java.beans.VetoableChangeListener[] getVetoableChangeListeners()
Get allVetoableChangeListener
s currently attached to this object.- Specified by:
getVetoableChangeListeners
in interfaceVetoableChangeProvider
- Returns:
- An array of VetoableChangeListeners.
-
getVetoableChangeListeners
public java.beans.VetoableChangeListener[] getVetoableChangeListeners(java.lang.String propertyName)
Get allVetoableChangeListener
s currently listening to changes to the specified property.- Specified by:
getVetoableChangeListeners
in interfaceVetoableChangeProvider
- Parameters:
propertyName
- The name of the property of interest- Returns:
- An array of VetoableChangeListeners.
-
removeVetoableChangeListener
public void removeVetoableChangeListener(@CheckForNull java.beans.VetoableChangeListener listener)
Remove the specified listener from this object.- Specified by:
removeVetoableChangeListener
in interfaceVetoableChangeProvider
- Parameters:
listener
- TheVetoableChangeListener
to remove.
-
removeVetoableChangeListener
public void removeVetoableChangeListener(@CheckForNull java.lang.String propertyName, @CheckForNull java.beans.VetoableChangeListener listener)
Remove the specified listener of the specified property from this object.- Specified by:
removeVetoableChangeListener
in interfaceVetoableChangeProvider
- Parameters:
propertyName
- The name of the property to stop listening to.listener
- TheVetoableChangeListener
to remove.
-
fireVetoableChange
public void fireVetoableChange(java.lang.String propertyName, boolean oldValue, boolean newValue) throws java.beans.PropertyVetoException
Fire a property change.- Specified by:
fireVetoableChange
in 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:
java.beans.PropertyVetoException
- if one of listeners vetoes the property update
-
fireVetoableChange
public void fireVetoableChange(java.beans.PropertyChangeEvent event) throws java.beans.PropertyVetoException
Fire a property change.- Specified by:
fireVetoableChange
in interfaceVetoableChangeFirer
- Parameters:
event
- the PropertyChangeEvent to be fired- Throws:
java.beans.PropertyVetoException
- if one of listeners vetoes the property update
-
fireVetoableChange
public void fireVetoableChange(java.lang.String propertyName, int oldValue, int newValue) throws java.beans.PropertyVetoException
Fire a property change.- Specified by:
fireVetoableChange
in 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:
java.beans.PropertyVetoException
- if one of listeners vetoes the property update
-
fireVetoableChange
public void fireVetoableChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue) throws java.beans.PropertyVetoException
Fire a property change.- Specified by:
fireVetoableChange
in 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:
java.beans.PropertyVetoException
- if one of listeners vetoes the property update
-
-