Package jmri.jmrit.catalog
Class DefaultCatalogTreeManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.beans.VetoableChangeSupport
-
- jmri.managers.AbstractManager<CatalogTree>
-
- jmri.jmrit.catalog.DefaultCatalogTreeManager
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.beans.VetoableChangeListener
,java.util.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 class jmri.beans.VetoableChangeSupport
vetoableChangeSupport
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
Fields inherited from interface jmri.CatalogTreeManager
IMAGE_FILTER, SCRIPT_FILTER, SOUND_FILTER
-
Fields 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, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, STRINGIOS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
-
-
Constructor Summary
Constructors Constructor Description DefaultCatalogTreeManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CatalogTree
createNewCatalogTree(java.lang.String systemName, java.lang.String userName)
Create a CatalogTree.java.lang.String
getBeanTypeHandled(boolean plural)
Get the user-readable name of the type of NamedBean handled by this manager.CatalogTree
getBySystemName(java.lang.String key)
Locate an existing instance based on a system name.CatalogTree
getByUserName(java.lang.String key)
Locate an existing instance based on a user name.CatalogTree
getCatalogTree(java.lang.String name)
Locate via user name, then system name if needed.java.lang.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(java.lang.String systemName, java.lang.String userName)
Provide CatalogTree by UserName, then SystemName, then creates if not found.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 typeLetter-
Methods inherited from class jmri.managers.AbstractManager
addDataListener, checkNumeric, createSystemName, deleteBean, deregister, dispose, fireDataListenersAdded, fireDataListenersRemoved, fireVetoableChange, getAutoSystemName, getBySystemName, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanSet, getObjectCount, getOuterBean, 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, getBeanTypeHandled, getEntryToolTip, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanSet, getObjectCount, getSubSystemNamePrefix, getSystemNamePrefix, getSystemPrefix, isValidSystemNameFormat, makeSystemName, makeSystemName, makeSystemName, register, removeDataListener, setDataListenerMute, 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 Detail
-
DefaultCatalogTreeManager
public DefaultCatalogTreeManager()
-
-
Method Detail
-
registerSelf
protected void 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
public int 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
public char typeLetter()
Bogus typeLetter- Specified by:
typeLetter
in interfaceManager<CatalogTree>
- Returns:
- The type letter for a specific implementation
-
getCatalogTree
@CheckForNull public CatalogTree getCatalogTree(@Nonnull java.lang.String name)
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
@CheckForNull public CatalogTree getBySystemName(@Nonnull java.lang.String key)
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
@CheckForNull public CatalogTree getByUserName(@Nonnull java.lang.String key)
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
@Nonnull public CatalogTree newCatalogTree(@Nonnull java.lang.String systemName, java.lang.String userName) throws java.lang.IllegalArgumentException
Provide CatalogTree by UserName, then SystemName, then creates if not found. 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)
- Throws:
java.lang.IllegalArgumentException
- if unable to create.
-
createNewCatalogTree
@Nonnull protected CatalogTree createNewCatalogTree(@Nonnull java.lang.String systemName, java.lang.String userName) throws java.lang.IllegalArgumentException
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
- Throws:
java.lang.IllegalArgumentException
- if unable to create
-
getBeanTypeHandled
@Nonnull public java.lang.String getBeanTypeHandled(boolean plural)
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
public java.lang.Class<CatalogTree> 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
public void storeImageIndex()
- Specified by:
storeImageIndex
in interfaceCatalogTreeManager
-
loadImageIndex
public void loadImageIndex()
Load the index file, one time per session.- Specified by:
loadImageIndex
in interfaceCatalogTreeManager
-
isIndexChanged
public boolean isIndexChanged()
- Specified by:
isIndexChanged
in interfaceCatalogTreeManager
-
isIndexLoaded
public boolean isIndexLoaded()
- Specified by:
isIndexLoaded
in interfaceCatalogTreeManager
-
indexChanged
public final void indexChanged(boolean changed)
- Specified by:
indexChanged
in interfaceCatalogTreeManager
-
-