Package jmri.beans
Class Bean
- java.lang.Object
-
- jmri.beans.UnboundBean
-
- jmri.beans.Bean
-
- All Implemented Interfaces:
BeanInterface,PropertyChangeFirer,PropertyChangeProvider
- Direct Known Subclasses:
AbstractPreferencesManager,AbstractServerPreferences,ArbitraryBean,ConstrainedBean,DefaultShutDownManager,DefaultSystemConnectionMemo,DispatcherActiveTrainManager,EcosLocoAddress,EditorManager,FileUtilSupport,GuiLafPreferencesManager,IssueReport,JmriUserPreferencesManager,JsonConsistManager,JsonServerPreferences,LayoutTrackExpectedState,NamedBeanExpectedValue,Pool,PreferencesBean,ProfileManager,RosterGroup,SignalSpeedMap,StartupActionModelUtil,SystemConnectionMemoManager,SystemConsolePreferencesManager
public abstract class Bean extends UnboundBean implements PropertyChangeFirer, PropertyChangeProvider
Generic implementation ofBeanInterfacewith a complete implementation ofPropertyChangeSupport.See the PropertyChangeSupport documentation for complete documentation of those methods.
This class is thread safe.
- See Also:
PropertyChangeSupport
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.event.SwingPropertyChangeSupportpropertyChangeSupportProvide aPropertyChangeSupporthelper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Add aPropertyChangeListenerto the listener list.voidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Add aPropertyChangeListenerfor a specific property.voidfireIndexedPropertyChange(java.lang.String propertyName, int index, boolean oldValue, boolean newValue)Fire an indexed property change.voidfireIndexedPropertyChange(java.lang.String propertyName, int index, int oldValue, int newValue)Fire an indexed property change.voidfireIndexedPropertyChange(java.lang.String propertyName, int index, java.lang.Object oldValue, java.lang.Object newValue)Fire an indexed property change.voidfirePropertyChange(java.beans.PropertyChangeEvent event)Fire a property change.voidfirePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)Fire a property change.voidfirePropertyChange(java.lang.String propertyName, int oldValue, int newValue)Fire a property change.voidfirePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)Fire a property change.java.beans.PropertyChangeListener[]getPropertyChangeListeners()Get allPropertyChangeListeners currently attached to this object.java.beans.PropertyChangeListener[]getPropertyChangeListeners(java.lang.String propertyName)Get allPropertyChangeListeners currently listening to changes to the specified property.booleanisNotifyOnEDT()Is this Bean assuring that all property change listeners will be notified on the EDT?voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Remove the specified listener from this object.voidremovePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Remove the specified listener of the specified property from this object.-
Methods inherited from class jmri.beans.UnboundBean
getIndexedProperty, getProperty, getPropertyNames, hasIndexedProperty, hasProperty, setIndexedProperty, setProperty
-
-
-
-
Field Detail
-
propertyChangeSupport
protected final javax.swing.event.SwingPropertyChangeSupport propertyChangeSupport
Provide aPropertyChangeSupporthelper.
-
-
Constructor Detail
-
Bean
protected Bean()
Create a bean that notifies property change listeners on the thread the event was generated on.
-
Bean
protected Bean(boolean notifyOnEDT)
Create a bean.- Parameters:
notifyOnEDT- true to notify property change listeners on the EDT; false to notify listeners on the thread the event was generated on (which may or may not be the EDT)
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add aPropertyChangeListenerto the listener list.- Specified by:
addPropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
listener- The PropertyChangeListener to be added
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
Add aPropertyChangeListenerfor a specific property.- Specified by:
addPropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
propertyName- The name of the property to listen on.listener- The PropertyChangeListener to be added
-
fireIndexedPropertyChange
public void fireIndexedPropertyChange(java.lang.String propertyName, int index, boolean oldValue, boolean newValue)
Fire an indexed property change.- Specified by:
fireIndexedPropertyChangein interfacePropertyChangeFirer- Parameters:
propertyName- the programmatic name of the property that was changedindex- the index of the property element that was changedoldValue- the old value of the propertynewValue- the new value of the property
-
fireIndexedPropertyChange
public void fireIndexedPropertyChange(java.lang.String propertyName, int index, int oldValue, int newValue)
Fire an indexed property change.- Specified by:
fireIndexedPropertyChangein interfacePropertyChangeFirer- Parameters:
propertyName- the programmatic name of the property that was changedindex- the index of the property element that was changedoldValue- the old value of the propertynewValue- the new value of the property
-
fireIndexedPropertyChange
public void fireIndexedPropertyChange(java.lang.String propertyName, int index, java.lang.Object oldValue, java.lang.Object newValue)
Fire an indexed property change.- Specified by:
fireIndexedPropertyChangein interfacePropertyChangeFirer- Parameters:
propertyName- the programmatic name of the property that was changedindex- the index of the property element that was changedoldValue- the old value of the propertynewValue- the new value of the property
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
Fire a property change.- Specified by:
firePropertyChangein interfacePropertyChangeFirer- Parameters:
propertyName- the programmatic name of the property that was changedoldValue- the old value of the propertynewValue- the new value of the property
-
firePropertyChange
public void firePropertyChange(java.beans.PropertyChangeEvent event)
Fire a property change.- Specified by:
firePropertyChangein interfacePropertyChangeFirer- Parameters:
event- the PropertyChangeEvent to be fired
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
Fire a property change.- Specified by:
firePropertyChangein interfacePropertyChangeFirer- Parameters:
propertyName- the programmatic name of the property that was changedoldValue- the old value of the propertynewValue- the new value of the property
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
Fire a property change.- Specified by:
firePropertyChangein interfacePropertyChangeFirer- Parameters:
propertyName- the programmatic name of the property that was changedoldValue- the old value of the propertynewValue- the new value of the property
-
getPropertyChangeListeners
public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
Get allPropertyChangeListeners currently attached to this object.- Specified by:
getPropertyChangeListenersin interfacePropertyChangeProvider- Returns:
- An array of PropertyChangeListeners.
-
getPropertyChangeListeners
public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
Get allPropertyChangeListeners currently listening to changes to the specified property.- Specified by:
getPropertyChangeListenersin interfacePropertyChangeProvider- Parameters:
propertyName- the name of the property of interest- Returns:
- an array of PropertyChangeListeners
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove the specified listener from this object.- Specified by:
removePropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
listener- ThePropertyChangeListenerto remove.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
Remove the specified listener of the specified property from this object.- Specified by:
removePropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
propertyName- The name of the property to stop listening to.listener- ThePropertyChangeListenerto remove.
-
isNotifyOnEDT
public boolean isNotifyOnEDT()
Is this Bean assuring that all property change listeners will be notified on the EDT?- Returns:
- true if notifying listeners of events on the EDT; false if notifying listeners on the thread that the event was generated on (which may or may not be the EDT)
-
-