Class DefaultAudioSourceManager
- All Implemented Interfaces:
AudioManager,AudioSourceManager,PropertyChangeProvider,SilenceablePropertyChangeProvider,VetoableChangeProvider,Manager<Audio>
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.Manager
Manager.ManagerDataEvent<E extends NamedBean>, Manager.ManagerDataListener<E extends NamedBean>, Manager.NameValidity -
Field Summary
Fields inherited from interface jmri.AudioManager
MAX_BUFFERS, MAX_LISTENERS, MAX_SOURCESFields inherited from interface jmri.Manager
ANALOGIOS, AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, CTCDATA, ENTRYEXIT, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXNG_ANALOG_ACTIONS, LOGIXNG_ANALOG_EXPRESSIONS, LOGIXNG_CONDITIONALNGS, LOGIXNG_DIGITAL_ACTIONS, LOGIXNG_DIGITAL_BOOLEAN_ACTIONS, LOGIXNG_DIGITAL_EXPRESSIONS, LOGIXNG_GLOBAL_VARIABLES, LOGIXNG_MODULES, LOGIXNG_STRING_ACTIONS, LOGIXNG_STRING_EXPRESSIONS, LOGIXNG_TABLES, LOGIXNGS, LOGIXS, MEMORIES, METERFRAMES, METERS, OBLOCKS, PANELFILES, PROPERTY_BEANS, PROPERTY_CAN_DELETE, PROPERTY_DISPLAY_LIST_NAME, PROPERTY_DO_DELETE, PROPERTY_DO_NOT_DELETE, PROPERTY_LENGTH, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, STRINGIOS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister aManager.ManagerDataListenerto hear about adding or removing items from the list of NamedBeans.voidAdd aPropertyChangeListenerto the listener list.voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener) Add aPropertyChangeListenerfor a specific property.voidAdd aVetoableChangeListenerto the listener list.voidaddVetoableChangeListener(String propertyName, VetoableChangeListener listener) Add aVetoableChangeListenerfor a specific property.voidcleanup()Perform any clean-up operationsvoiddeleteBean(Audio n, String property) Method for a UI to delete a bean.voidderegister(Audio n) Forget a NamedBean Object created outside the manager.voiddispose()Free resources when no longer used.Returns the currently active AudioFactory object.Get an existing Audio or return null if it doesn't exists.getBeanTypeHandled(boolean plural) Get the user-readable name of the type of NamedBean handled by this manager.getBySystemName(String systemName) Get the Audio with the given system name or return null if no instance already exists.getByUserName(String userName) Get the Audio with the given user name or return null if no instance already exists.getMemo()Get the system connection for this manager.getNamedBean(String name) Locate an existing instance based on a name.Get the class of NamedBean supported by this Manager.Provide an unmodifiable SortedSet of NamedBeans in system-name order.getNamedBeanSet(char subType) Get the specified Audio sub-type NamedBeans.intGet the count of managed objects.Get allPropertyChangeListeners currently attached to this object.getPropertyChangeListeners(String propertyName) Get allPropertyChangeListeners currently listening to changes to the specified property.Provide access to the system prefix string.Get allVetoableChangeListeners currently attached to this object.getVetoableChangeListeners(String propertyName) Get allVetoableChangeListeners currently listening to changes to the specified property.intDetermine the order that types should be written when storing panel files.voidinit()Perform any initialisation operationsbooleanDetermine if this AudioManager is initialisedReturn an Audio with the specified system and user names.provideAudio(String name) Get the Audio with the user name, then system name if needed; if that fails, create a new Audio.voidRemember a NamedBean Object created outside the manager.voidUnregister a previously-addedManager.ManagerDataListener.voidRemove the specified listener from this object.voidremovePropertyChangeListener(String propertyName, PropertyChangeListener listener) Remove the specified listener of the specified property from this object.voidRemove the specified listener from this object.voidremoveVetoableChangeListener(String propertyName, VetoableChangeListener listener) Remove the specified listener of the specified property from this object.voidsetPropertyChangesSilenced(String propertyName, boolean silenced) Suppress sendingPropertyChangeEvents for the named property.charMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.Manager
getBeanTypeHandled, getEntryToolTip, getKnownBeanProperties, getSubSystemNamePrefix, getSystemNamePrefix, isValidSystemNameFormat, makeSystemName, makeSystemName, makeSystemName, setDataListenerMute, validateBadCharsInSystemNameFormat, validateIntegerSystemNameFormat, validateNmraAccessorySystemNameFormat, validateSystemNameFormat, validateSystemNameFormat, validateSystemNameFormatOnlyNumeric, validateSystemNamePrefix, validateTrimmedMin1NumberSystemNameFormat, validateTrimmedSystemNameFormat, validateUppercaseTrimmedSystemNameFormat, validSystemNameFormat
-
Constructor Details
-
DefaultAudioSourceManager
public DefaultAudioSourceManager()
-
-
Method Details
-
provideAudio
Get the Audio with the user name, then system name if needed; if that fails, create a new Audio. If the name is a valid system name, it will be used for the new Audio. Otherwise, the makeSystemName method will attempt to turn it into a valid system name.- Specified by:
provideAudioin interfaceAudioManager- Parameters:
name- User name or system name to match, or which can be promoted to system name- Returns:
- Never null under normal circumstances
- Throws:
AudioException- if error occurs during creation
-
getAudio
Get an existing Audio or return null if it doesn't exists. Locates via user name, then system name if needed.- Specified by:
getAudioin interfaceAudioManager- Parameters:
name- User name or system name to match- Returns:
- null if no match found
-
getBySystemName
Get the Audio with the given system name or return null if no instance already exists.- Specified by:
getBySystemNamein interfaceAudioManager- Specified by:
getBySystemNamein interfaceManager<Audio>- Parameters:
systemName- Audio object system name (such as IAS1 or IAB4)- Returns:
- requested Audio object or null if none exists
-
getByUserName
Get the Audio with the given user name or return null if no instance already exists.- Specified by:
getByUserNamein interfaceAudioManager- Specified by:
getByUserNamein interfaceManager<Audio>- Parameters:
userName- Audio object user name- Returns:
- requested Audio object or null if none exists
-
newAudio
Return an Audio with the specified system and user names. Note that two calls with the same arguments will get the same instance; there is only one Audio object representing a given physical Audio and therefore only one with a specific system or user name.This will always return a valid object reference; a new object will be created if necessary. In that case:
- If a null reference is given for user name, no user name will be associated with the Audio object created; a valid system name must be provided
- If both names are provided, the system name defines the hardware access of the desired Audio, and the user address is associated with it. The system name must be valid.
- Specified by:
newAudioin interfaceAudioManager- Parameters:
systemName- Audio object system name (such as IAS1 or IAB4)userName- Audio object user name- Returns:
- requested Audio object (never null)
- Throws:
AudioException- if error occurs during creation
-
getActiveAudioFactory
Returns the currently active AudioFactory object.An Audio factory is responsible for the creation of implementation specific audio objects.
- Specified by:
getActiveAudioFactoryin interfaceAudioManager- Returns:
- current active AudioFactory object
-
getNamedBeanSet
Get the specified Audio sub-type NamedBeans.- Specified by:
getNamedBeanSetin interfaceAudioManager- Parameters:
subType- sub-type to retrieve- Returns:
- Unmodifiable access to a SortedSet of NamedBeans for the specified Audio sub-type .
-
init
Perform any initialisation operations- Specified by:
initin interfaceAudioManager
-
cleanup
Perform any clean-up operations- Specified by:
cleanupin interfaceAudioManager
-
isInitialised
Determine if this AudioManager is initialised- Specified by:
isInitialisedin interfaceAudioManager- Returns:
- true if initialised
-
getMemo
Get the system connection for this manager. -
getSystemPrefix
Provide access to the system prefix string. This was previously called the "System letter"- Specified by:
getSystemPrefixin interfaceManager<Audio>- Returns:
- the system prefix
-
typeLetter
- Specified by:
typeLetterin interfaceManager<Audio>- Returns:
- The type letter for a specific implementation
-
getNamedBeanClass
Get the class of NamedBean supported by this Manager. This should be the generic class used in the Manager's class declaration.- Specified by:
getNamedBeanClassin interfaceManager<Audio>- Returns:
- the class supported by this Manager.
-
dispose
Free resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected. -
getObjectCount
Get the count of managed objects.- Specified by:
getObjectCountin interfaceManager<Audio>- Returns:
- the number of managed objects
-
getNamedBeanSet
Provide an unmodifiable SortedSet of NamedBeans in system-name order.Note: This is the fastest of the accessors, and is the only long-term form.
Note: This is a live set; the contents are kept up to date
Note that this method only returns audio sources.
- Specified by:
getNamedBeanSetin interfaceManager<Audio>- Returns:
- Unmodifiable access to a SortedSet of NamedBeans
-
getNamedBean
Locate an existing instance based on a name.- Specified by:
getNamedBeanin interfaceManager<Audio>- Parameters:
name- User Name or System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
deleteBean
Method for a UI to delete a bean.The UI should first request a "CanDelete", this will return a list of locations (and descriptions) where the bean is in use via throwing a VetoException, then if that comes back clear, or the user agrees with the actions, then a "DoDelete" can be called which inform the listeners to delete the bean, then it will be deregistered and disposed of.
If a property name of "DoNotDelete" is thrown back in the VetoException then the delete process should be aborted.
- Specified by:
deleteBeanin interfaceManager<Audio>- Parameters:
n- The NamedBean to be deletedproperty- The programmatic name of the request. "CanDelete" will enquire with all listeners if the item can be deleted. "DoDelete" tells the listener to delete the item- Throws:
PropertyVetoException- If the recipients wishes the delete to be aborted (see above)
-
register
Remember a NamedBean Object created outside the manager.The non-system-specific SignalHeadManagers use this method extensively.
-
deregister
Forget a NamedBean Object created outside the manager.The non-system-specific RouteManager uses this method.
- Specified by:
deregisterin interfaceManager<Audio>- Parameters:
n- the bean
-
getXMLOrder
Determine the order that types should be written when storing panel files. Uses one of the constants defined in this class.Yes, that's an overly-centralized methodology, but it works for now.
- Specified by:
getXMLOrderin interfaceManager<Audio>- Returns:
- write order for this Manager; larger is later.
-
getBeanTypeHandled
Get the user-readable name of the type of NamedBean handled by this manager.For instance, in the code where we are dealing with just a bean and a message that needs to be passed to the user or in a log.
- Specified by:
getBeanTypeHandledin interfaceManager<Audio>- Parameters:
plural- true to return plural form of the type; false to return singular form- Returns:
- a string of the bean type that the manager handles, eg Turnout, Sensor etc
-
addDataListener
Register aManager.ManagerDataListenerto hear about adding or removing items from the list of NamedBeans.- Specified by:
addDataListenerin interfaceManager<Audio>- Parameters:
e- the data listener to add
-
removeDataListener
Unregister a previously-addedManager.ManagerDataListener.- Specified by:
removeDataListenerin interfaceManager<Audio>- Parameters:
e- the data listener to remove- See Also:
-
setPropertyChangesSilenced
Suppress sendingPropertyChangeEvents for the named property.Stopping the suppression of sending change events may send a PropertyChangeEvent if the property changed while silenced, but otherwise should not fire a PropertyChangeEvent.
- Specified by:
setPropertyChangesSilencedin interfaceSilenceablePropertyChangeProvider- Parameters:
propertyName- the name of the property to mutesilenced- true if events are to be suppressed; false otherwise
-
addPropertyChangeListener
Add aPropertyChangeListenerto the listener list.- Specified by:
addPropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
listener- The PropertyChangeListener to be added
-
addPropertyChangeListener
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
-
getPropertyChangeListeners
Get allPropertyChangeListeners currently attached to this object.- Specified by:
getPropertyChangeListenersin interfacePropertyChangeProvider- Returns:
- An array of PropertyChangeListeners.
-
getPropertyChangeListeners
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
Remove the specified listener from this object.- Specified by:
removePropertyChangeListenerin interfacePropertyChangeProvider- Parameters:
listener- ThePropertyChangeListenerto remove.
-
removePropertyChangeListener
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.
-
addVetoableChangeListener
Add aVetoableChangeListenerto the listener list.- Specified by:
addVetoableChangeListenerin interfaceVetoableChangeProvider- Parameters:
listener- The VetoableChangeListener to be added
-
addVetoableChangeListener
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
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.
-