private boolean areTreePathsVisible(TreePath[] treePaths) { for (int i = 0; i < treePaths.length; i++) { if (!tree.isVisible(treePaths[i])) { return false; } } return true; }
private static void expandAll(JTree tree, TreePath parent) { TreeNode node = (TreeNode) parent.getLastPathComponent(); if (node.isLeaf() && tree.isVisible(parent) == false) { tree.makeVisible(parent); } else { for (Enumeration en = node.children(); en.hasMoreElements();) { TreeNode child = (TreeNode) en.nextElement(); expandAll(tree, parent.pathByAddingChild(child)); } } }
/** Indicates if the object is currently visible. @param object The object. @return true if the object is visible; false otherwise. **/ public boolean isVisible (VNode object) { if (object == null) throw new NullPointerException ("object"); TreePath path = getPath (object); if (path != null) { //@B0A //@B0A - Swing 1.1 bug. JTree.isVisible() returns true // when the node isn't in the tree. if (tree_.getPathBounds(model_.getPath(object)) == null) //@B0A { //@B0A return false; //@B0A } //@B0A return tree_.isVisible (path); } //@B0A else return false; }
/** * Returns the {@code String} representation of the given {@code Component}, which should be a {@code JTree} (or * subclass). * * @param c the given {@code Component}. * @return the {@code String} representation of the given {@code JTree}. */ @Override @Nonnull protected String doFormat(@Nonnull Component c) { JTree tree = (JTree) c; String format = "%s[name=%s, selectionCount=%d, selectionPaths=%s, selectionMode=%s, enabled=%b, visible=%b, showing=%b"; return String.format(format, getRealClassName(c), quote(tree.getName()), tree.getSelectionCount(), Arrays.format(selectionPaths(tree)), selectionMode(tree), tree.isEnabled(), tree.isVisible(), tree.isShowing()); }
if (path == null || !this.tree.isVisible()) { return false;
if (oldTree.isVisible(new TreePath(oldNode.getPath()))){ newTree.makeVisible(new TreePath(newNode.getPath()));