|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.tree.DefaultMutableTreeNode
com.threerings.config.swing.ConfigTreeNode
public class ConfigTreeNode
A node in the config tree.
| Field Summary | |
|---|---|
protected HashMap<String,ConfigTreeNode> |
_childrenByName
The children of this node, mapped by (partial) name. |
protected ManagedConfig |
_config
The configuration contained in this node, if any. |
protected int |
_count
The number of copies of this node. |
protected boolean |
_expanded
Whether or not this node is expanded in the tree. |
protected static String |
SLASH_REPLACEMENT
Because we use slashes as name delimiters, any slashes in the name must be replaced. |
| Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
|---|
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
| Constructor Summary | |
|---|---|
ConfigTreeNode()
No-arg constructor for deserialization. |
|
ConfigTreeNode(String partialName,
ManagedConfig config)
Creates a new node with the specified partial name. |
|
| Method Summary | |
|---|---|
void |
addConfigs(ConfigGroup<ManagedConfig> group)
Adds all configurations under this node to the supplied group. |
ConfigTreeNode |
clone()
|
protected static String |
decode(String name)
Decodes a name encoded with encode(java.lang.String). |
int |
decrementCount()
Decrements the count for this node. |
protected static String |
encode(String name)
Encodes a partial name for use in a path name. |
void |
expandPaths(JTree tree)
Expands paths according to the _expanded field. |
void |
expandPaths(JTree tree,
int depth)
Expands all paths up to the specified depth. |
String |
findNameForChild(String base)
Finds an unused name for a child of this node from the specified base. |
ManagedConfig |
getConfig()
Returns the configuration contained in this node, or null for none. |
void |
getConfigs(List<ManagedConfig> configs)
Puts all of the configurations under this node into the supplied list. |
void |
getConfigs(List<ManagedConfig> configs,
boolean immediate)
Puts all of the configurations under this node into the supplied list. |
int |
getInsertionIndex(ConfigTreeNode child)
Returns the index at which the specified node should be inserted to maintain the sort order. |
Tuple<ConfigTreeNode,ConfigTreeNode> |
getInsertionPoint(ManagedConfig config,
String name)
Finds the insertion point (existing parent and new child) for the specified configuration. |
String |
getName()
Returns the full name of this node. |
ConfigTreeNode |
getNode(String name)
Finds and returns the node with the specified name (or null if it can't be
found). |
void |
incrementCount()
Increments the count for this node. |
void |
insert(MutableTreeNode child,
int index)
|
void |
insertConfig(ManagedConfig config,
String name)
Inserts the given configuration under this node, creating any required intermediate nodes. |
void |
readFields(Importer in)
Reads the exportable fields of the object. |
void |
remove(int index)
|
void |
removeConfigs(ConfigGroup<ManagedConfig> group)
Removes all configurations under this node from the supplied group. |
void |
setExpanded(boolean expanded)
Sets whether or not this node is expanded in the tree. |
boolean |
verifyConfigClass(Class<?> clazz)
Verifies that if this node contains any actual configurations, they're instances of the supplied class. |
void |
writeFields(Exporter out)
Writes the exportable fields of the object. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ManagedConfig _config
protected int _count
protected boolean _expanded
protected transient HashMap<String,ConfigTreeNode> _childrenByName
protected static final String SLASH_REPLACEMENT
| Constructor Detail |
|---|
public ConfigTreeNode(String partialName,
ManagedConfig config)
config - the configuration for this node, or null if this is a
folder node.public ConfigTreeNode()
| Method Detail |
|---|
public String getName()
public ManagedConfig getConfig()
null for none.
public void incrementCount()
public int decrementCount()
public void setExpanded(boolean expanded)
public Tuple<ConfigTreeNode,ConfigTreeNode> getInsertionPoint(ManagedConfig config,
String name)
public void insertConfig(ManagedConfig config,
String name)
public void addConfigs(ConfigGroup<ManagedConfig> group)
public void removeConfigs(ConfigGroup<ManagedConfig> group)
public void getConfigs(List<ManagedConfig> configs)
public void getConfigs(List<ManagedConfig> configs,
boolean immediate)
public ConfigTreeNode getNode(String name)
null if it can't be
found).
public boolean verifyConfigClass(Class<?> clazz)
public String findNameForChild(String base)
public int getInsertionIndex(ConfigTreeNode child)
public void expandPaths(JTree tree)
_expanded field.
public void expandPaths(JTree tree,
int depth)
public void writeFields(Exporter out)
throws IOException
IOException
public void readFields(Importer in)
throws IOException
IOException
public void insert(MutableTreeNode child,
int index)
insert in interface MutableTreeNodeinsert in class DefaultMutableTreeNodepublic void remove(int index)
remove in interface MutableTreeNoderemove in class DefaultMutableTreeNodepublic ConfigTreeNode clone()
clone in class DefaultMutableTreeNodeprotected static String encode(String 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 | ||||||||