Java Code Examples for javax.swing.tree.TreePath#toString()
The following examples show how to use
javax.swing.tree.TreePath#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultTreeCheckingModel.java From importer-exporter with Apache License 2.0 | 6 votes |
/** * Convenience method for getting a string that describes the tree * starting at path. * * @param path the treepath root of the tree */ private String toString(TreePath path) { String checkString = "n"; String greyString = "n"; String enableString = "n"; if (isPathChecked(path)) { checkString = "y"; } if (isPathEnabled(path)) { enableString = "y"; } if (isPathGreyed(path)) { greyString = "y"; } String description = "Path checked: " + checkString + " greyed: " + greyString + " enabled: " + enableString + " Name: " + path.toString() + "\n"; for (TreePath childPath : getChildrenPath(path)) { description += toString(childPath); } return description; }
Example 2
Source File: ObjectTree.java From bigtable-sql with Apache License 2.0 | 4 votes |
/** * Restore the expansion state of the tree starting at the passed node. * The passed node is always expanded. * * @param node Node to restore expansion state from. * * @throws IllegalArgumentException * Thrown if null ObjectTreeNode passed. */ private void restoreExpansionState(ObjectTreeNode node, Map<String, Object> previouslySelectedTreePathNames, List<TreePath> selectedTreePaths) { if (node == null) { throw new IllegalArgumentException("ObjectTreeNode == null"); } final TreePath nodePath = new TreePath(node.getPath()); if (matchKeyPrefix(previouslySelectedTreePathNames, node, nodePath.toString())) { selectedTreePaths.add(nodePath); } try { _startExpandInThread = false; expandPath(nodePath); } finally { _startExpandInThread = true; } // Go through each child of the parent and see if it was previously // expanded. If it was recursively call this method in order to expand // the child. @SuppressWarnings("unchecked") Enumeration<ObjectTreeNode> childEnumeration = (Enumeration<ObjectTreeNode>) node.children(); Iterator<ObjectTreeNode> it = new EnumerationIterator<ObjectTreeNode>(childEnumeration); while (it.hasNext()) { final ObjectTreeNode child = it.next(); final TreePath childPath = new TreePath(child.getPath()); final String childPathName = childPath.toString(); if (matchKeyPrefix(previouslySelectedTreePathNames, child, childPathName)) { selectedTreePaths.add(childPath); } if (_expandedPathNames.containsKey(childPathName)) { restoreExpansionState(child, previouslySelectedTreePathNames, selectedTreePaths); } } }
Example 3
Source File: JTreeOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Constructor. * * @param path a nonexistent path. */ public NoSuchPathException(TreePath path) { super("No such path as \"" + path.toString() + "\"", getSource()); }