/** Get the TreePathSupport object which manages path expansion for this * Outline. */ TreePathSupport getTreePathSupport () { OutlineModel mdl = getOutlineModel(); if (mdl != null) { return mdl.getTreePathSupport(); } else { return null; } }
public void addTreeExpansionListener( TreeExpansionListener l ) { TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport(); if( tps != null ) tps.addTreeExpansionListener(l); }
public void removeTreeExpansionListener( TreeExpansionListener l ) { TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport(); if( tps != null ) tps.removeTreeExpansionListener(l); }
private void expandNode(DefaultMutableTreeNode treeNode, boolean recursive, int level) { if (treeNode.getAllowsChildren()) { if (treeNode.getChildCount() == 0) { TreePath path = new TreePath(treeNode.getPath()); mdl.getTreePathSupport().expandPath(path); } if (recursive && level <= MAX_LEVELS_TO_EXPAND) { for (int childIndex = 0; childIndex < treeNode.getChildCount(); childIndex++) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) treeNode.getChildAt(childIndex); expandNode(child, recursive, level + 1); } } } }
private void expandNode(DefaultMutableTreeNode treeNode, boolean recursive, int level) { if (treeNode.getAllowsChildren()) { if (treeNode.getChildCount() == 0) { TreePath path = new TreePath(treeNode.getPath()); mdl.getTreePathSupport().expandPath(path); } if (recursive && level <= MAX_LEVELS_TO_EXPAND) { for (int childIndex = 0; childIndex < treeNode.getChildCount(); childIndex++) { DefaultMutableTreeNode child = (DefaultMutableTreeNode) treeNode.getChildAt(childIndex); expandNode(child, recursive, level + 1); } } } }
mdl.getTreePathSupport().addTreeWillExpandListener(expandingTreeListener);
mdl.getTreePathSupport().addTreeWillExpandListener(expandingTreeListener);