jmri.jmrit.catalog
Class DefaultCatalogTreeManager

java.lang.Object
  extended by jmri.managers.AbstractManager
      extended by jmri.jmrit.catalog.DefaultCatalogTreeManager
All Implemented Interfaces:
PropertyChangeListener, EventListener, CatalogTreeManager, Manager

public class DefaultCatalogTreeManager
extends AbstractManager
implements CatalogTreeManager

Provide the concrete implementation for the Internal CatalogTree Manager.

Control of the systemName is internal so the more casual approach of SignalHeadManager is used rather than the ProxyManager style.

Author:
Pete Cressman Copyright (C) 2009

Field Summary
 
Fields inherited from class jmri.managers.AbstractManager
_tsys, _tuser
 
Fields inherited from interface jmri.CatalogTreeManager
IMAGE_FILTER, SCRIPT_FILTER, SOUND_FILTER
 
Fields inherited from interface jmri.Manager
AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXS, MEMORIES, OBLOCKS, PANELFILES, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
 
Constructor Summary
DefaultCatalogTreeManager()
           
 
Method Summary
protected  CatalogTree createNewCatalogTree(String systemName, String userName)
          Create a CatalogTree.
 CatalogTree getBySystemName(String key)
          Locate an instance based on a system name.
 CatalogTree getByUserName(String key)
          Locate an instance based on a user name.
 CatalogTree getCatalogTree(String name)
          Locate via user name, then system name if needed.
 String getSystemPrefix()
          This is a bogus systemPrefix.
 int getXMLOrder()
           
static DefaultCatalogTreeManager instance()
           
 CatalogTree newCatalogTree(String sysName, String userName)
          Return an 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.
 char typeLetter()
          Bogus typeLetter
 
Methods inherited from class jmri.managers.AbstractManager
addPropertyChangeListener, deregister, dispose, firePropertyChange, getBeanBySystemName, getInstanceBySystemName, getInstanceByUserName, getSystemNameArray, getSystemNameList, makeSystemName, propertyChange, register, removePropertyChangeListener, systemLetter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.CatalogTreeManager
getSystemNameList
 
Methods inherited from interface jmri.Manager
addPropertyChangeListener, deregister, dispose, getBeanBySystemName, getSystemNameArray, makeSystemName, register, removePropertyChangeListener, systemLetter
 

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 class AbstractManager

getXMLOrder

public int getXMLOrder()
Specified by:
getXMLOrder in interface Manager
Specified by:
getXMLOrder in class AbstractManager

getSystemPrefix

public String getSystemPrefix()
This is a bogus systemPrefix. Naming is enforced in method createNewCatalogTree below.

Specified by:
getSystemPrefix in interface Manager

typeLetter

public char typeLetter()
Bogus typeLetter

Specified by:
typeLetter in interface Manager
Returns:
The type letter for a specific implementation

getCatalogTree

public CatalogTree getCatalogTree(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 interface CatalogTreeManager
Returns:
null if no match found

getBySystemName

public CatalogTree getBySystemName(String key)
Description copied from interface: CatalogTreeManager
Locate an instance based on a system name. Returns null if no instance already exists.

Specified by:
getBySystemName in interface CatalogTreeManager
Returns:
requested CatalogTree object or null if none exists

getByUserName

public CatalogTree getByUserName(String key)
Description copied from interface: CatalogTreeManager
Locate an instance based on a user name. Returns null if no instance already exists.

Specified by:
getByUserName in interface CatalogTreeManager
Returns:
requested CatalogTree object or null if none exists

newCatalogTree

public CatalogTree newCatalogTree(String sysName,
                                  String userName)
Description copied from interface: CatalogTreeManager
Return an 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:

Note that it is possible to make an inconsistent request if both addresses are provided, but the given values are associated with different objects. This is a problem, and we don't have a good solution except to issue warnings. This will mostly happen if you're creating CatalogTree objects when you should be looking them up.

Specified by:
newCatalogTree in interface CatalogTreeManager
Returns:
requested CatalogTree object (never null)

createNewCatalogTree

protected CatalogTree createNewCatalogTree(String systemName,
                                           String userName)
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
 


instance

public static DefaultCatalogTreeManager instance()


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads