Class 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 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

      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  
      • Fields inherited from class javax.swing.tree.DefaultTreeModel

        asksAllowsChildren, listenerList, root
    • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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