Package jmri.jmrix.jinput
Class TreeModel
- java.lang.Object
-
- javax.swing.tree.DefaultTreeModel
-
- jmri.jmrix.jinput.TreeModel
-
- All Implemented Interfaces:
java.io.Serializable
,javax.swing.tree.TreeModel
public final class TreeModel extends javax.swing.tree.DefaultTreeModel
TreeModel represents the USB controllers and componentsAccessed 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:
- USB controller
- 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
Nested Classes Modifier and Type Class Description (package private) class
TreeModel.Report
Carry a single event to the Swing thread for processing(package private) class
TreeModel.Runner
-
Field Summary
Fields Modifier and Type Field Description (package private) net.java.games.input.Controller[]
ca
(package private) javax.swing.tree.DefaultMutableTreeNode
dRoot
(package private) java.beans.PropertyChangeSupport
pcs
(package private) TreeModel.Runner
runner
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(java.beans.PropertyChangeListener l)
net.java.games.input.Controller[]
controllers()
static TreeModel
instance()
Provide access to the model.(package private) boolean
loadSystem()
void
removePropertyChangeListener(java.beans.PropertyChangeListener l)
void
terminateThreads()
-
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
-
-
-
-
Field Detail
-
runner
TreeModel.Runner runner
-
dRoot
javax.swing.tree.DefaultMutableTreeNode dRoot
-
ca
net.java.games.input.Controller[] ca
-
pcs
java.beans.PropertyChangeSupport pcs
-
-
Method Detail
-
instance
public static TreeModel instance()
Provide access to the model. There's only one, because access to the USB subsystem is required.- Returns:
- the default instance of the TreeModel; creating it if necessary
-
terminateThreads
public void terminateThreads() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
controllers
public net.java.games.input.Controller[] controllers()
-
loadSystem
boolean loadSystem()
- Returns:
- true for success
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
-
-