List of usage examples for javax.swing.tree TreePath TreePath
public TreePath(Object lastPathComponent)
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.model.ReportingQueryStatementTreeModel.java
/** * Insert node into.//from w w w . j a v a2s. c om * * @param childElement the child element * @param parentElement the parent element * @param insertPosition the insert position */ public void insertNodeInto(QueryExpression childElement, QueryExpression parentElement, int insertPosition) { parentElement.addChildExpression(childElement); TreePath path = new TreePath(getPathToRoot(parentElement)); modelSupport.fireChildAdded(path, insertPosition, childElement); }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.model.ReportingQueryStatementTreeModel.java
/** * Adds the child to parent./* w w w . j a v a2 s . co m*/ * * @param childElement the child element * @param parentElement the parent element */ public void addChildToParent(QueryExpression childElement, QueryExpression parentElement) { parentElement.addChildExpression(childElement); TreePath path = new TreePath(getPathToRoot(parentElement)); // get index of child in parent's children int insertPosition = getIndexOfChild(parentElement, childElement); modelSupport.fireChildAdded(path, insertPosition, childElement); }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.model.ReportingQueryStatementTreeModel.java
/** * Removes the node from parent./* w ww .jav a2 s .co m*/ * * @param element the element */ public void removeNodeFromParent(QueryExpression element) { QueryExpression parent = element.getParentExpression(); int index = 0; List<QueryExpression> children = new ArrayList<QueryExpression>(parent.getContainedExpressions()); for (int i = 0; i < children.size(); i++) { QueryExpression child = children.get(i); if (child.equals(element)) { index = i; modelSupport.fireChildRemoved(new TreePath(getPathToRoot(parent)), index, element); break; } } }
From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.model.ReportingQueryStatementTreeModel.java
/** * Sets the value at./*from www. j a v a 2 s.co m*/ * * @param value the value * @param node the node */ public void setValueAt(Object value, Object node) { if (node instanceof QueryExpression) { QueryExpression element = (QueryExpression) node; modelSupport.firePathChanged(new TreePath(getPathToRoot(element))); } }
From source file:view.CertificatePropertiesDialog.java
private void expandTree(JTree tree) { TreeNode root = (TreeNode) tree.getModel().getRoot(); expandAll(tree, new TreePath(root)); }