jmri.jmrix.jinput
Class TreeModel

Show UML class diagram
java.lang.Object
  extended by javax.swing.tree.DefaultTreeModel
      extended by jmri.jmrix.jinput.TreeModel
All Implemented Interfaces:
Serializable, TreeModel

public final class TreeModel
extends DefaultTreeModel

TreeModel represents the USB controllers and components

Accessed via the instance() member, as we expect to have only one of these models talking to the USB subsystem.

The tree has three levels below the uninteresting root:

  1. USB controller
  2. Components (input, axis)

jinput requires that there be only one of these for a given USB system in a given JVM so we use a pseudo-singlet "instance" approach Class is final because it starts a survey thread, which runs while constructor is still active.

See Also:
Serialized Form

Nested Class Summary
(package private)  class TreeModel.Report
          Carry a single event to the Swing thread for processing
(package private)  class TreeModel.Runner
           
 
Field Summary
(package private)  net.java.games.input.Controller[] ca
           
(package private)  DefaultMutableTreeNode dRoot
           
(package private) static org.slf4j.Logger log
           
(package private)  PropertyChangeSupport pcs
           
 
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, listenerList, root
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 net.java.games.input.Controller[] controllers()
           
(package private)  DefaultMutableTreeNode insertNode(DefaultMutableTreeNode pChild, DefaultMutableTreeNode pParent)
          Add a node to the tree if it doesn't already exist
static TreeModel instance()
          Provide access to the model.
(package private)  void loadSystem()
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dRoot

DefaultMutableTreeNode dRoot

ca

net.java.games.input.Controller[] ca

pcs

PropertyChangeSupport pcs

log

static org.slf4j.Logger log
Method Detail

insertNode

DefaultMutableTreeNode insertNode(DefaultMutableTreeNode pChild,
                                  DefaultMutableTreeNode pParent)
Add a node to the tree if it doesn't already exist

Parameters:
pChild - Node to possibly be inserted; relies on equals() to avoid duplicates
pParent - Node for the parent of the resource to be scanned, e.g. where in the tree to insert it.
Returns:
node, regardless of whether needed or not

instance

public static TreeModel instance()
Provide access to the model. There's only one, because access to the USB subsystem is required


controllers

public net.java.games.input.Controller[] controllers()

loadSystem

void loadSystem()

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)


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