|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.tree.DefaultMutableTreeNode
com.threerings.swing.PrefsTreeNode
public class PrefsTreeNode
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).
| Field Summary | |
|---|---|
protected boolean |
_expanded
Whether or not this node is expanded in the tree. |
protected Object |
_value
The value of this node, if it is a leaf. |
protected static String |
EMPTY_NAME
Our replacement for the empty name. |
protected static String |
EXPANDED
The name of the expanded property. |
protected static String |
SLASH_REPLACEMENT
Replacement for slashes, which are not allowed in names. |
| Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
|---|
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
| 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. |
protected static String |
decode(String name)
Decodes the supplied name encoded with encode(java.lang.String). |
protected static String |
encode(String name)
Encodes the supplied name, making it safe for use as a Preferences name. |
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. |
protected String |
getName()
Returns the (encoded) name of this node. |
protected String |
getNodeName()
Returns the name of the node relative to the preferences. |
protected Preferences |
getPreferenceNode(Preferences prefs)
Returns the preference node corresponding to this node. |
Object |
getValue()
Returns a reference to the decoded value of this node. |
protected boolean |
haveChildNamed(String name)
Determines whether the node has a child with the given name. |
protected void |
insertSorted(PrefsTreeNode child)
Inserts the specified node in sorted order. |
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 java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Object _value
protected boolean _expanded
protected static final String EXPANDED
protected static final String EMPTY_NAME
protected static final String SLASH_REPLACEMENT
| Constructor Detail |
|---|
public PrefsTreeNode(Preferences prefs)
public PrefsTreeNode(String name,
Object value)
public PrefsTreeNode()
| Method Detail |
|---|
public Object getValue()
public PrefsTreeNode getChild(String name)
public void setExpanded(JTree tree,
Preferences prefs,
boolean expanded)
public String findNameForChild(String base)
public void addToPreferences(Preferences prefs)
public void removeFromPreferences(Preferences prefs)
public int getInsertionIndex(PrefsTreeNode child)
public void expandPaths(JTree tree)
_expanded field.
public void writeFields(Exporter out)
throws IOException
IOException
public void readFields(Importer in)
throws IOException
IOExceptionprotected boolean haveChildNamed(String name)
protected Preferences getPreferenceNode(Preferences prefs)
protected String getNodeName()
protected String getName()
protected void insertSorted(PrefsTreeNode child)
protected static String encode(String name)
Preferences name.
protected static String decode(String name)
encode(java.lang.String).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||