private void syncWithEditor() { ContentPanel selectedContentPanel = tabbedPane.getSelectedCodePanel(); if (selectedContentPanel == null) { return; } JNode node = selectedContentPanel.getNode(); if (node.getParent() == null && treeRoot != null) { // node not register in tree node = treeRoot.searchClassInTree(node); if (node == null) { LOG.error("Class not found in tree"); return; } } TreeNode[] pathNodes = treeModel.getPathToRoot(node); if (pathNodes == null) { return; } TreePath path = new TreePath(pathNodes); tree.setSelectionPath(path); tree.makeVisible(path); tree.scrollPathToVisible(path); tree.requestFocus(); }
/** * <p>Returns the CategoryPath to the specified CategoryNode</p> * * @param CategoryNode The target CategoryNode * @returns CategoryPath */ public TreePath getTreePathToRoot(CategoryNode node) { if (node == null) { return null; } return (new TreePath(getPathToRoot(node))); }
/** * Build GIF animator for tree node. * @param tree Tree containing GIF node * @param node Node with a GIF to animate */ public ImageObserverAnimated(JTree tree, TreeNode node) { this.tree = tree; this.treeModel = (DefaultTreeModel) tree.getModel(); this.node = node; this.path = new TreePath(this.treeModel.getPathToRoot(this.node)); }
public void setParentSelection(CategoryNode node, boolean selected) { TreeNode[] nodes = getPathToRoot(node); int len = nodes.length; CategoryNode parent; // i = 0 gives root node, i=len-1 gives this node // skip the root node for (int i = 1; i < len; i++) { parent = (CategoryNode) nodes[i]; if (parent.isSelected() != selected) { parent.setSelected(selected); nodeChanged(parent); } } notifyActionListeners(); }
public void addLogRecord(LogRecord lr) { CategoryPath path = new CategoryPath(lr.getCategory()); addCategory(path); // create category path if it is new CategoryNode node = getCategoryNode(path); node.addRecord(); // update category node if (_renderFatal && lr.isFatal()) { TreeNode[] nodes = getPathToRoot(node); int len = nodes.length; CategoryNode parent; // i = 0 gives root node // skip node and root, loop through "parents" in between for (int i = 1; i < len - 1; i++) { parent = (CategoryNode) nodes[i]; parent.setHasFatalChildren(true); nodeChanged(parent); } node.setHasFatalRecords(true); nodeChanged(node); } }
/** * <p>Returns the CategoryPath to the specified CategoryNode</p> * * @param node The target CategoryNode * @return CategoryPath */ public TreePath getTreePathToRoot(CategoryNode node) { if (node == null) { return null; } return (new TreePath(getPathToRoot(node))); }
/** * <p>Returns the CategoryPath to the specified CategoryNode</p> * * @param node The target CategoryNode * @return CategoryPath */ public TreePath getTreePathToRoot(CategoryNode node) { if (node == null) { return null; } return (new TreePath(getPathToRoot(node))); }
/** * <p>Returns the CategoryPath to the specified CategoryNode</p> * * @param node The target CategoryNode * @return CategoryPath */ public TreePath getTreePathToRoot(CategoryNode node) { if (node == null) { return null; } return (new TreePath(getPathToRoot(node))); }
/** * <p>Returns the CategoryPath to the specified CategoryNode</p> * * @param node The target CategoryNode * @return CategoryPath */ public TreePath getTreePathToRoot(CategoryNode node) { if (node == null) { return null; } return (new TreePath(getPathToRoot(node))); }
/** * <p>Returns the CategoryPath to the specified CategoryNode</p> * * @param node The target CategoryNode * @return CategoryPath */ public TreePath getTreePathToRoot(CategoryNode node) { if (node == null) { return null; } return (new TreePath(getPathToRoot(node))); }
/** * Returns the node path. * @return path */ final TreePath path() { final DefaultTreeModel model = (DefaultTreeModel) view.tree.getModel(); return new TreePath(model.getPathToRoot(this)); }
/** * Returns the node path. * @return path */ final TreePath path() { final DefaultTreeModel model = (DefaultTreeModel) view.tree.getModel(); return new TreePath(model.getPathToRoot(this)); }
private void selectNode(DefaultMutableTreeNode toSel) { TreeNode[] pathToRoot = ((DefaultTreeModel) _pnlPrefs.treBookmarks.getModel()).getPathToRoot(toSel); _pnlPrefs.treBookmarks.setSelectionPath(new TreePath(pathToRoot)); }
public TreePath getTreePath(DefaultMutableTreeNode node) { ResourceBundle.getBundle("javax.help.resources.Constants", Locale.getDefault()); //$NON-NLS-1$ return new TreePath(((DefaultTreeModel) getModel()).getPathToRoot(node)); }
public void scrollNodeToVisible(TreeNode node) { if(node == null) return; tree.scrollPathToVisible(new TreePath(jTreeModel.getPathToRoot(node))); treeGraphView.scrollNodeToVisible(node); }
void setSelectedPackage( String pack ) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)nodeForPackage.get(pack); if ( node == null ) return; TreePath tp = new TreePath(treeModel.getPathToRoot( node )); setSelectionPath( tp ); setClist( pack ); scrollPathToVisible( tp ); }
public void selectNode(String shortURL) { if(tocModel == null) return; DefaultMutableTreeNode node = (DefaultMutableTreeNode)nodes.get(shortURL); if(node == null) return; TreePath path = new TreePath(tocModel.getPathToRoot(node)); toc.expandPath(path); toc.setSelectionPath(path); toc.scrollPathToVisible(path); } //}}}
public void selectNode(TreeNode node) { TreePath path = new TreePath(jTreeModel.getPathToRoot(node)); tree.scrollPathToVisible(path); tree.setSelectionPath(path); treeGraphView.highlightNode(node); }
public void treeExpanded(TreeExpansionEvent event) { PdfTree tree = (PdfTree) event.getSource(); DefaultMutableTreeNode node = ((DefaultMutableTreeNode) event.getPath().getLastPathComponent()); if ( node.getChildCount() == 1 ) { TreeNode child = node.getChildAt(0); tree.selectNode((PdfObjectTreeNode) child); tree.expandPath(new TreePath(((DefaultTreeModel) tree.getModel() ).getPathToRoot(child))); } }
public void setParentSelection(CategoryNode node, boolean selected) { TreeNode[] nodes = getPathToRoot(node); int len = nodes.length; CategoryNode parent; // i = 0 gives root node, i=len-1 gives this node // skip the root node for (int i = 1; i < len; i++) { parent = (CategoryNode) nodes[i]; if (parent.isSelected() != selected) { parent.setSelected(selected); nodeChanged(parent); } } notifyActionListeners(); }