List of usage examples for javax.swing JTree isVisible
public boolean isVisible(TreePath path)
From source file:Main.java
public static void visitAllExpandedNodes(JTree tree, TreePath parent) { if (!tree.isVisible(parent)) { return;/*from ww w.j av a 2 s.c o m*/ } TreeNode node = (TreeNode) parent.getLastPathComponent(); System.out.println(node); if (node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements();) { TreeNode n = (TreeNode) e.nextElement(); TreePath path = parent.pathByAddingChild(n); visitAllExpandedNodes(tree, path); } } }
From source file:Main.java
public void getPaths(JTree tree, TreePath parent, boolean expanded, List<TreePath> list) { if (expanded && !tree.isVisible(parent)) { return;//from w w w . ja v a 2 s . c o m } list.add(parent); TreeNode node = (TreeNode) parent.getLastPathComponent(); if (node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements();) { TreeNode n = (TreeNode) e.nextElement(); TreePath path = parent.pathByAddingChild(n); getPaths(tree, path, expanded, list); } } }
From source file:it.unibas.spicygui.controllo.datasource.operators.CreaWidgetAlberi.java
private void scansioneAlbero(JTree albero, Component source, Component target, boolean sourceFlag) { //VEcchio codice che mette widget solo per le foglie // for (int i = 0; i < listaFoglie.size(); i++) { // int tmp = (Integer) listaFoglie.get(i); for (int i = 0; i < albero.getRowCount(); i++) { TreePath treePath = albero.getPathForRow(i); if (treePath != null && albero.isVisible(treePath)) { if (logger.isTraceEnabled()) { logger.trace("punto trovato: " + albero.getPathBounds(treePath).getLocation()); }//from w w w. j a va2 s. c om Point convertedPoint = SwingUtilities.convertPoint(source, albero.getPathBounds(treePath).getLocation(), target); createWidget(convertedPoint, albero, treePath, sourceFlag); if (logger.isTraceEnabled()) { logger.trace("punto convertito: " + convertedPoint); } } } contatore = -1; listaFoglie = new ArrayList(); }