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
,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 of
BeanInterface
with a complete
implementation of PropertyChangeSupport
.
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 SwingPropertyChangeSupport
propertyChangeSupport
Provide aPropertyChangeSupport
helper. -
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
addPropertyChangeListener(PropertyChangeListener listener)
Add aPropertyChangeListener
to the listener list.void
addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Add aPropertyChangeListener
for a specific property.void
fireIndexedPropertyChange(String propertyName, int index, boolean oldValue, boolean newValue)
Fire an indexed property change.void
fireIndexedPropertyChange(String propertyName, int index, int oldValue, int newValue)
Fire an indexed property change.void
fireIndexedPropertyChange(String propertyName, int index, Object oldValue, Object newValue)
Fire an indexed property change.void
firePropertyChange(PropertyChangeEvent event)
Fire a property change.void
firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
Fire a property change.void
firePropertyChange(String propertyName, int oldValue, int newValue)
Fire a property change.void
firePropertyChange(String propertyName, Object oldValue, Object newValue)
Fire a property change.PropertyChangeListener[]
getPropertyChangeListeners()
Get allPropertyChangeListener
s currently attached to this object.PropertyChangeListener[]
getPropertyChangeListeners(String propertyName)
Get allPropertyChangeListener
s currently listening to changes to the specified property.boolean
isNotifyOnEDT()
Is this Bean assuring that all property change listeners will be notified on the EDT?void
removePropertyChangeListener(PropertyChangeListener listener)
Remove the specified listener from this object.void
removePropertyChangeListener(String propertyName, 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 Details
-
propertyChangeSupport
Provide aPropertyChangeSupport
helper.
-
-
Constructor Details
-
Bean
protected Bean()Create a bean that notifies property change listeners on the thread the event was generated on. -
Bean
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 Details
-
addPropertyChangeListener
Add aPropertyChangeListener
to the listener list.- Specified by:
addPropertyChangeListener
in interfacePropertyChangeProvider
- Parameters:
listener
- The PropertyChangeListener to be added
-
addPropertyChangeListener
Add aPropertyChangeListener
for a specific property.- Specified by:
addPropertyChangeListener
in interfacePropertyChangeProvider
- Parameters:
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener to be added
-
fireIndexedPropertyChange
public void fireIndexedPropertyChange(String propertyName, int index, boolean oldValue, boolean newValue)Fire an indexed property change. Despite being public due to limitations in Java 8, this method should only be called by the subclasses of implementing classes, as this will become a protected class when JMRI requires Java 11 or newer.- Specified by:
fireIndexedPropertyChange
in 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
Fire an indexed property change. Despite being public due to limitations in Java 8, this method should only be called by the subclasses of implementing classes, as this will become a protected class when JMRI requires Java 11 or newer.- Specified by:
fireIndexedPropertyChange
in 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(String propertyName, int index, Object oldValue, Object newValue)Fire an indexed property change. Despite being public due to limitations in Java 8, this method should only be called by the subclasses of implementing classes, as this will become a protected class when JMRI requires Java 11 or newer.- Specified by:
fireIndexedPropertyChange
in 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
Fire a property change. Despite being public due to limitations in Java 8, this method should only be called by the subclasses of implementing classes, as this will become a protected class when JMRI requires Java 11 or newer.- Specified by:
firePropertyChange
in 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
Fire a property change. Despite being public due to limitations in Java 8, this method should only be called by the subclasses of implementing classes, as this will become a protected class when JMRI requires Java 11 or newer.- Specified by:
firePropertyChange
in interfacePropertyChangeFirer
- Parameters:
event
- the PropertyChangeEvent to be fired
-
firePropertyChange
Fire a property change. Despite being public due to limitations in Java 8, this method should only be called by the subclasses of implementing classes, as this will become a protected class when JMRI requires Java 11 or newer.- Specified by:
firePropertyChange
in 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
Fire a property change. Despite being public due to limitations in Java 8, this method should only be called by the subclasses of implementing classes, as this will become a protected class when JMRI requires Java 11 or newer.- Specified by:
firePropertyChange
in 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
Get allPropertyChangeListener
s currently attached to this object.- Specified by:
getPropertyChangeListeners
in interfacePropertyChangeProvider
- Returns:
- An array of PropertyChangeListeners.
-
getPropertyChangeListeners
Get allPropertyChangeListener
s currently listening to changes to the specified property.- Specified by:
getPropertyChangeListeners
in interfacePropertyChangeProvider
- Parameters:
propertyName
- the name of the property of interest- Returns:
- an array of PropertyChangeListeners
-
removePropertyChangeListener
Remove the specified listener from this object.- Specified by:
removePropertyChangeListener
in interfacePropertyChangeProvider
- Parameters:
listener
- ThePropertyChangeListener
to remove.
-
removePropertyChangeListener
Remove the specified listener of the specified property from this object.- Specified by:
removePropertyChangeListener
in interfacePropertyChangeProvider
- Parameters:
propertyName
- The name of the property to stop listening to.listener
- ThePropertyChangeListener
to remove.
-
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)
-