com.threerings.swing
Class PrefsTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by com.threerings.swing.PrefsTreeNode
All Implemented Interfaces:
Exportable, Serializable, Cloneable, MutableTreeNode, TreeNode

public class PrefsTreeNode
extends DefaultMutableTreeNode
implements Exportable

A node in a PrefsTree. Nodes are either internal nodes with null values (representing Preferences nodes) or leaf nodes with non-null values (representing properties set in the parent Preferences node).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
EMPTY_ENUMERATION
 
Constructor Summary
PrefsTreeNode()
          No-arg constructor for deserialization.
PrefsTreeNode(Preferences prefs)
          Creates a new preferences node from the supplied preferences.
PrefsTreeNode(String name, Object value)
          Creates a new preferences node.
 
Method Summary
 void addToPreferences(Preferences prefs)
          Adds the contents of this node to the supplied preferences.
 void expandPaths(JTree tree)
          Expands paths according to the _expanded field.
 String findNameForChild(String base)
          Finds a unique name for a new child node derived from the supplied base.
 PrefsTreeNode getChild(String name)
          Returns the child with the supplied name, if it exists.
 int getInsertionIndex(PrefsTreeNode child)
          Returns the index at which the specified child should be inserted.
 Object getValue()
          Returns a reference to the decoded value of this node.
 void readFields(Importer in)
          Custom field read method.
 void removeFromPreferences(Preferences prefs)
          Removes the contents of this node from the supplied preferences.
 void setExpanded(JTree tree, Preferences prefs, boolean expanded)
          Sets whether or not this node is expanded in the tree.
 void writeFields(Exporter out)
          Custom field write method.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrefsTreeNode

public PrefsTreeNode(Preferences prefs)
Creates a new preferences node from the supplied preferences.


PrefsTreeNode

public PrefsTreeNode(String name,
                     Object value)
Creates a new preferences node.


PrefsTreeNode

public PrefsTreeNode()
No-arg constructor for deserialization.

Method Detail

getValue

public Object getValue()
Returns a reference to the decoded value of this node.


getChild

public PrefsTreeNode getChild(String name)
Returns the child with the supplied name, if it exists.


setExpanded

public void setExpanded(JTree tree,
                        Preferences prefs,
                        boolean expanded)
Sets whether or not this node is expanded in the tree.


findNameForChild

public String findNameForChild(String base)
Finds a unique name for a new child node derived from the supplied base.


addToPreferences

public void addToPreferences(Preferences prefs)
Adds the contents of this node to the supplied preferences.


removeFromPreferences

public void removeFromPreferences(Preferences prefs)
Removes the contents of this node from the supplied preferences.


getInsertionIndex

public int getInsertionIndex(PrefsTreeNode child)
Returns the index at which the specified child should be inserted.


expandPaths

public void expandPaths(JTree tree)
Expands paths according to the _expanded field.


writeFields

public void writeFields(Exporter out)
                 throws IOException
Custom field write method.

Throws:
IOException

readFields

public void readFields(Importer in)
                throws IOException
Custom field read method.

Throws:
IOException


Copyright © 2011. All Rights Reserved.