@Override public boolean hasChildren(T object) { return !treeModel.isLeaf(object); }
if(childNode.toString().equals("parameters") && model.isLeaf(childNode)) if(childNode.toString().equals("description") && model.isLeaf(childNode)) Object childNode = model.getChild(node, i); if(childNode.toString().equals("parameters") && model.isLeaf(childNode)) if(childNode.toString().equals("description") && model.isLeaf(childNode))
@Override public boolean isLeaf(Object node) { return delegateModel.isLeaf(node); }
@Override public boolean isLeaf(Object node) { return treeModel.isLeaf(node); }
/** * * @param node * node * @return boolean */ public final boolean isLeaf(Object node) { return getTreeModel().isLeaf(node); }
/** * * @param node * @return boolean */ public final boolean isLeaf(Object node) { return getTreeModel().isLeaf(node); }
@Override public void mouseClicked(final MouseEvent e) { if (!e.isPopupTrigger() && e.getClickCount() == 2) { if (tree.getModel().isLeaf(tree.getSelectionPath().getLastPathComponent())) { runScripts(); } } }
public static boolean hasOnlyLeafs(JTree tree, Object node) { TreeModel model = tree.getModel(); for (int i = 0; i < model.getChildCount(node); i++) { if (!model.isLeaf(model.getChild(node, i))) { return false; } } return true; }
private JLabel getRenderer(Object node) { Component renderer = tree.getCellRenderer() .getTreeCellRendererComponent(tree, node, false, false, tree.getModel().isLeaf(node), 0, false); if (renderer instanceof JLabel) return (JLabel) renderer; return null; }
/** * {@inheritDoc} */ @Override public boolean isLeaf() { return tree.getModel().isLeaf(getValue()); }
/** * {@inheritDoc} */ @Override public boolean isLeaf() { return tree.getModel().isLeaf(getValue()); }
/** * {@inheritDoc} */ @Override public boolean isLeaf() { return tree.getModel().isLeaf(getValue()); }
/** * {@inheritDoc} */ @Override public boolean isLeaf() { return tree.getModel().isLeaf(getValue()); }
/** * {@inheritDoc} */ @Override public boolean isLeaf() { return tree.getModel().isLeaf(getValue()); }
protected void getExpandedPaths(final HelpfulJTree tree, final TreeModel model, final MutableTreeNode node, final HashSet<Path> set) { assert SwingUtilities.isEventDispatchThread(); final int count = model.getChildCount(node); for (int i = 0; i < count; i++) { final DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(node, i); final Path p = (Path) child.getUserObject(); if (tree.isExpanded(child.getPath())) { set.add(p); } if (!model.isLeaf(child)) getExpandedPaths(tree, model, child, set); } }
protected void setExpandedPaths(final HelpfulJTree tree, final TreeModel model, final MutableTreeNode node, final HashSet<Path> set, final Path justAdded) { assert SwingUtilities.isEventDispatchThread(); final int count = model.getChildCount(node); for (int i = 0; i < count; i++) { final DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(node, i); final Path p = (Path) child.getUserObject(); if (set.contains(p) || ((justAdded != null) && (justAdded == p))) { tree.setExpanded(child.getPath(), true); } if (!model.isLeaf(child)) setExpandedPaths(tree, model, child, set, justAdded); } }
static public boolean expandNode(final DNDTree tree, final DefaultMutableTreeNode node) { final TreeModel tree_model = tree.getModel(); if (tree_model.isLeaf(node)) return false; tree.expandPath(new TreePath(node.getPath())); tree.updateUILater(); return true; }
static public void expandAllNodes(final JTree tree, final TreePath path) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); final TreeModel tree_model = tree.getModel(); if (tree_model.isLeaf(node)) return; tree.expandPath(path); final int n_children = tree_model.getChildCount(node); for (int i=0; i<n_children; i++) { expandAllNodes(tree, path.pathByAddingChild(tree_model.getChild(node, i))); } }
private void getLeaves(Object node, TreeModel model, Set<OpendapLeaf> result) { for (int i = 0; i < model.getChildCount(node); i++) { if (model.isLeaf(model.getChild(node, i))) { final DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) (model.getChild(node, i)); if (CatalogTreeUtils.isDapNode(childNode) || CatalogTreeUtils.isFileNode(childNode)) { result.add((OpendapLeaf) childNode.getUserObject()); } } else { getLeaves(model.getChild(node, i), model, result); } } }
private Component getNodeComponent(Object node, TreePath treePath) { int row = tree.getRowForPath(treePath); boolean isLeaf = tree.getModel().isLeaf(node); boolean hasFocus = tree.getLeadSelectionRow() == row; boolean isSelected = tree.isRowSelected(row); boolean isExpanded = tree.isExpanded(row); TreeCellRenderer cellRenderer = tree.getCellRenderer(); return cellRenderer.getTreeCellRendererComponent(tree, node, isSelected, isExpanded, isLeaf, row, hasFocus); }