Package jmri.jmrit.catalog
Class DefaultCatalogTreeManager
- All Implemented Interfaces:
PropertyChangeListener
,VetoableChangeListener
,EventListener
,PropertyChangeFirer
,PropertyChangeProvider
,SilenceablePropertyChangeProvider
,VetoableChangeFirer
,VetoableChangeProvider
,CatalogTreeManager
,Manager<CatalogTree>
public class DefaultCatalogTreeManager extends AbstractManager<CatalogTree> implements CatalogTreeManager
Provide the concrete implementation for the Internal CatalogTree Manager.
Control of the systemName is internal so the more casual approach like that of SignalHeadManager is used rather than the ProxyManager style.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultCatalogTreeManager.Initializer
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 class jmri.managers.AbstractManager
_beans, _tsys, _tuser, memo, silenceableProperties, silencedProperties
Fields inherited from interface jmri.Manager
ANALOGIOS, AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, CTCDATA, deprecatedManagerLogger, ENTRYEXIT, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXNG_ANALOG_ACTIONS, LOGIXNG_ANALOG_EXPRESSIONS, LOGIXNG_CONDITIONALNGS, LOGIXNG_DIGITAL_ACTIONS, LOGIXNG_DIGITAL_BOOLEAN_ACTIONS, LOGIXNG_DIGITAL_EXPRESSIONS, LOGIXNG_STRING_ACTIONS, LOGIXNG_STRING_EXPRESSIONS, LOGIXNG_TABLES, LOGIXNGS, LOGIXS, MEMORIES, METERFRAMES, METERS, OBLOCKS, PANELFILES, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, STRINGIOS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
-
Constructor Summary
Constructors Constructor Description DefaultCatalogTreeManager()
-
Method Summary
Modifier and Type Method Description protected CatalogTree
createNewCatalogTree(String systemName, String userName)
Create a CatalogTree.String
getBeanTypeHandled(boolean plural)
Get the user-readable name of the type of NamedBean handled by this manager.CatalogTree
getBySystemName(String key)
Locate an existing instance based on a system name.CatalogTree
getByUserName(String key)
Locate an existing instance based on a user name.CatalogTree
getCatalogTree(String name)
Locate via user name, then system name if needed.Class<CatalogTree>
getNamedBeanClass()
Get the class of NamedBean supported by this Manager.int
getXMLOrder()
Determine the order that types should be written when storing panel files.void
indexChanged(boolean changed)
boolean
isIndexChanged()
boolean
isIndexLoaded()
void
loadImageIndex()
Load the index file, one time per session.CatalogTree
newCatalogTree(String systemName, String userName)
Get a CatalogTree instance with the specified system and user names.protected void
registerSelf()
Override parent method to not register this object to be stored automatically as part of the general storage mechanism.void
storeImageIndex()
char
typeLetter()
Bogus typeLetterMethods inherited from class jmri.managers.AbstractManager
addDataListener, checkNumeric, createSystemName, deleteBean, deregister, dispose, fireDataListenersAdded, fireDataListenersRemoved, fireVetoableChange, getAutoSystemName, getBySystemName, getIncrement, getIncrementFromExistingNumber, getInstanceBySystemName, getInstanceByUserName, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanList, getNamedBeanSet, getNextValidAddress, getNextValidAddress, getObjectCount, getSystemNameList, getSystemPrefix, handleUserNameUniqueness, makeSystemName, propertyChange, register, registerUserName, removeDataListener, setDataListenerMute, setPropertyChangesSilenced, updateAutoNumber, validSystemNameFormat, vetoableChange
Methods inherited from class jmri.beans.VetoableChangeSupport
addVetoableChangeListener, addVetoableChangeListener, fireVetoableChange, fireVetoableChange, fireVetoableChange, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jmri.Manager
addDataListener, deleteBean, deregister, dispose, getBeanBySystemName, getBeanByUserName, getBeanTypeHandled, getEntryToolTip, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanList, getNamedBeanSet, getObjectCount, getSubSystemNamePrefix, getSystemNameList, getSystemNamePrefix, getSystemPrefix, isValidSystemNameFormat, makeSystemName, makeSystemName, makeSystemName, register, removeDataListener, setDataListenerMute, setPropertyChangesMuted, validateBadCharsInSystemNameFormat, validateIntegerSystemNameFormat, validateNmraAccessorySystemNameFormat, validateSystemNameFormat, validateSystemNameFormat, validateSystemNameFormatOnlyNumeric, validateSystemNamePrefix, validateTrimmedMin1NumberSystemNameFormat, validateTrimmedSystemNameFormat, validateUppercaseTrimmedSystemNameFormat, validSystemNameFormat
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from interface jmri.beans.SilenceablePropertyChangeProvider
setPropertyChangesSilenced
Methods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Constructor Details
-
Method Details
-
registerSelf
Override parent method to not register this object to be stored automatically as part of the general storage mechanism.- Overrides:
registerSelf
in classAbstractManager<CatalogTree>
-
getXMLOrder
Description copied from interface:Manager
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:
getXMLOrder
in interfaceManager<CatalogTree>
- Returns:
- write order for this Manager; larger is later.
-
typeLetter
Bogus typeLetter- Specified by:
typeLetter
in interfaceManager<CatalogTree>
- Returns:
- The type letter for a specific implementation
-
getCatalogTree
Description copied from interface:CatalogTreeManager
Locate via user name, then system name if needed. If that fails, return null- Specified by:
getCatalogTree
in interfaceCatalogTreeManager
- Parameters:
name
- CatalogTree object to locate- Returns:
- null if no match found
-
getBySystemName
Description copied from class:AbstractManager
Locate an existing instance based on a system name.- Specified by:
getBySystemName
in interfaceCatalogTreeManager
- Specified by:
getBySystemName
in interfaceManager<CatalogTree>
- Overrides:
getBySystemName
in classAbstractManager<CatalogTree>
- Parameters:
key
- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getByUserName
Description copied from class:AbstractManager
Locate an existing instance based on a user name.- Specified by:
getByUserName
in interfaceCatalogTreeManager
- Specified by:
getByUserName
in interfaceManager<CatalogTree>
- Overrides:
getByUserName
in classAbstractManager<CatalogTree>
- Parameters:
key
- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
newCatalogTree
Get a CatalogTree instance with the specified system and user names. Note that two calls with the same arguments will get the same instance; there is only one CatalogTree object representing a given physical CatalogTree 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 CatalogTree object created; a valid system name must be provided
- If both names are provided, the system name defines the hardware access of the desired CatalogTree, and the user address is associated with it. The system name must be valid.
- Specified by:
newCatalogTree
in interfaceCatalogTreeManager
- Parameters:
systemName
- system name for new CatalogTreeuserName
- user name for new CatalogTree- Returns:
- requested CatalogTree object (never null)
-
createNewCatalogTree
Create a CatalogTree.Naming convention is:
IF... - filter for image files from the file system SF... - filter for sound files from the file system TF... - filter for script files from the file system NF... - no filter for files from the file system IX... - index for image files stored in XML config file SX... - index for sound files stored in XML config file TX... - index for script files stored in XML config file NX... - index for files stored in XML config file
- Parameters:
systemName
- system name for catalog tree, never null/emptyuserName
- user name for catalog tree- Returns:
- the new catalog tree or null if unable to create
-
getBeanTypeHandled
Description copied from interface:Manager
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:
getBeanTypeHandled
in interfaceManager<CatalogTree>
- 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
-
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:
getNamedBeanClass
in interfaceManager<CatalogTree>
- Returns:
- the class supported by this Manager.
-
storeImageIndex
- Specified by:
storeImageIndex
in interfaceCatalogTreeManager
-
loadImageIndex
Load the index file, one time per session.- Specified by:
loadImageIndex
in interfaceCatalogTreeManager
-
isIndexChanged
- Specified by:
isIndexChanged
in interfaceCatalogTreeManager
-
isIndexLoaded
- Specified by:
isIndexLoaded
in interfaceCatalogTreeManager
-
indexChanged
- Specified by:
indexChanged
in interfaceCatalogTreeManager
-