jmri.jmrit.catalog
Class AbstractCatalogTree

Show UML class diagram
java.lang.Object
  extended by javax.swing.tree.DefaultTreeModel
      extended by jmri.jmrit.catalog.AbstractCatalogTree
All Implemented Interfaces:
Serializable, TreeModel, CatalogTree, NamedBean
Direct Known Subclasses:
CatalogTreeFS, CatalogTreeIndex

public abstract class AbstractCatalogTree
extends DefaultTreeModel
implements CatalogTree

TreeModel used by CatalogPanel to create a tree of resources.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface jmri.CatalogTree
FILESYS, IMAGE, NOFILTER, SCRIPT, SOUND, XML
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Constructor Summary
AbstractCatalogTree(String sysname)
           
AbstractCatalogTree(String sysname, String username)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Request a call-back when a bound property changes.
 void dispose()
          Deactivate this object, so that it releases as many resources as possible and no longer effects others.
 String getComment()
          Get associated comment text.
 String getDisplayName()
           
 int getNumPropertyChangeListeners()
          Number of current listeners.
 int getState()
          Provide generic access to internal state.
 String getSystemName()
          Get a system-specific name.
 String getUserName()
           
 void insertNodes(String pathToRoot)
          Starting point to recursively add nodes to the tree by scanning a file directory
abstract  void insertNodes(String pName, String pPath, CatalogTreeNode pParent)
          Recursively add nodes to the tree
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a request for a call-back when a bound property changes.
 void setComment(String comment)
          Set associated comment text.
 void setState(int s)
          Provide generic access to internal state.
 void setUserName(String s)
           
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.NamedBean
getProperty, getPropertyKeys, setProperty
 
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
 

Constructor Detail

AbstractCatalogTree

public AbstractCatalogTree(String sysname,
                           String username)

AbstractCatalogTree

public AbstractCatalogTree(String sysname)
Method Detail

insertNodes

public abstract void insertNodes(String pName,
                                 String pPath,
                                 CatalogTreeNode pParent)
Recursively add nodes to the tree

Specified by:
insertNodes in interface CatalogTree
Parameters:
pName - Name of the resource to be scanned; this is only used for the human-readable tree
pPath - Path to this resource, including the pName part
pParent - Node for the parent of the resource to be scanned, e.g. where in the tree to insert it.

insertNodes

public void insertNodes(String pathToRoot)
Starting point to recursively add nodes to the tree by scanning a file directory

Specified by:
insertNodes in interface CatalogTree
Parameters:
pathToRoot - Path to Directory to be scanned

getComment

public String getComment()
Get associated comment text.

Specified by:
getComment in interface NamedBean

setComment

public void setComment(String comment)
Set associated comment text.

Comments can be any valid text.

Specified by:
setComment in interface NamedBean
Parameters:
comment - Null means no comment associated.

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface NamedBean

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Description copied from interface: NamedBean
Request a call-back when a bound property changes. Bound properties are the known state, commanded state, user and system names.

Specified by:
addPropertyChangeListener in interface NamedBean

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Description copied from interface: NamedBean
Remove a request for a call-back when a bound property changes.

Specified by:
removePropertyChangeListener in interface NamedBean

getNumPropertyChangeListeners

public int getNumPropertyChangeListeners()
Number of current listeners. May return -1 if the information is not available for some reason.

Specified by:
getNumPropertyChangeListeners in interface NamedBean

getSystemName

public String getSystemName()
Description copied from interface: NamedBean
Get a system-specific name. This encodes the hardware addressing information.

Specified by:
getSystemName in interface NamedBean

getUserName

public String getUserName()
Specified by:
getUserName in interface NamedBean

setUserName

public void setUserName(String s)
Specified by:
setUserName in interface NamedBean

dispose

public void dispose()
Description copied from interface: NamedBean
Deactivate this object, so that it releases as many resources as possible and no longer effects others.

For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.

It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.

Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained.

Specified by:
dispose in interface NamedBean

getState

public int getState()
Description copied from interface: NamedBean
Provide generic access to internal state.

This generally shouldn't be used by Java code; use the class-specific form instead. (E.g. getCommandedState in Turnout) This provided to make Jython script access easier to read.

Specified by:
getState in interface NamedBean

setState

public void setState(int s)
              throws JmriException
Description copied from interface: NamedBean
Provide generic access to internal state.

This generally shouldn't be used by Java code; use the class-specific form instead. (E.g. setCommandedState in Turnout) This provided to make Jython script access easier to read.

Specified by:
setState in interface NamedBean
Throws:
JmriException - general error when cant do the needed operation


Copyright © 1997 - 2010 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