/** * Causes an {@link SmallStepNodeComponent#update() on all * nodes that have changed.<br> * <br> * When all updates are done relayouts the View. * * @see #relayout() */ @Override protected void nodesChanged(TreeModelEvent event) { boolean relayout = false; Object[] children = event.getChildren(); if (children == null) { // if the children are null and the path only contains one element // this element is the root node. if (event.getPath().length == 1) { SmallStepProofNode proofNode = (SmallStepProofNode) event.getPath()[0]; SmallStepNodeComponent nodeComponent = (SmallStepNodeComponent) proofNode.getUserObject(); if (nodeComponent != null) { nodeComponent.update(); relayout = true; } } } else { for (int i = 0; i < children.length; i++) { if (children[i] instanceof ProofNode) { SmallStepProofNode proofNode = (SmallStepProofNode) children[i]; SmallStepNodeComponent nodeComponent = (SmallStepNodeComponent) proofNode.getUserObject(); if (nodeComponent != null) { nodeComponent.update(); relayout = true; } } } } if (relayout) { relayout(); } }
@Override public void treeNodesChanged(TreeModelEvent e) { if (adjusting) { return; } adjusting = true; TreePath parent = e.getTreePath(); Object[] children = e.getChildren(); DefaultTreeModel model = (DefaultTreeModel) e.getSource(); DefaultMutableTreeNode node; CheckBoxNode c; // = (CheckBoxNode)node.getUserObject(); if (children != null && children.length == 1) { node = (DefaultMutableTreeNode) children[0]; c = (CheckBoxNode) node.getUserObject(); onCheckboxStatusChanged(node); DefaultMutableTreeNode n = (DefaultMutableTreeNode) parent.getLastPathComponent(); while (n != null) { updateParentUserObject(n); DefaultMutableTreeNode tmp = (DefaultMutableTreeNode) n.getParent(); if (tmp == null) { break; } else { n = tmp; } } model.nodeChanged(n); } else { node = (DefaultMutableTreeNode) model.getRoot(); c = (CheckBoxNode) node.getUserObject(); } updateAllChildrenUserObject(node, c.status); model.nodeChanged(node); adjusting = false; }
public void treeNodesChanged(TreeModelEvent e) { DefaultMutableTreeNode node; node = (DefaultMutableTreeNode) (e.getTreePath().getLastPathComponent()); int index = e.getChildIndices()[0]; node = (DefaultMutableTreeNode) (node.getChildAt(index)); System.out.println("The user has finished editing the node."); System.out.println("New value: " + node.getUserObject()); }
@Override public void treeNodesInserted(TreeModelEvent e) { Category c = (Category) e.getTreePath().getLastPathComponent(); dispatchEvent(MenuToolbar.SYNCUPLOAD, c); final TreePath path = e.getTreePath(); SwingUtilities.invokeLater( new Runnable() { public void run() { mainFrame.tree.expandPath(path); // tree.setSelectionPath(path); } }); }
@Override public void treeNodesInserted(TreeModelEvent e) { if (isExpanded) { return; } isExpanded = true; subjectExplorer.expandPath(e.getTreePath()); }
/** * DOCUMENT ME! * * @param e DOCUMENT ME! */ public void treeNodesRemoved(TreeModelEvent e) { Object[] inserts = e.getChildren(); for (int i = 0; i < inserts.length; i++) { Variable var = (Variable) ((SimpleTreeNode) inserts[i]).getUserObject(); this.vm.undeclareVariable(var.getVariableName()); } }
@Override public void treeNodesRemoved(TreeModelEvent e) { for (Object t : e.getChildren()) { if (((FileSystemEntry) t).isLoadingNode) { loadingNodeCount--; } } }
public void treeNodesChanged(TreeModelEvent e) { DefaultMutableTreeNode node; node = (DefaultMutableTreeNode) (e.getTreePath().getLastPathComponent()); /* * If the event lists children, then the changed * node is the child of the node we've already * gotten. Otherwise, the changed node and the * specified node are the same. */ int index = e.getChildIndices()[0]; node = (DefaultMutableTreeNode) (node.getChildAt(index)); System.out.println("The user has finished editing the node."); System.out.println("New value: " + node.getUserObject()); }
public TreeModelEvent refactorEvent(TreeModelEvent event) { if (visibleNodes != null) { List<Object> children = new ArrayList<Object>(event.getChildren().length); List<Integer> indicieList = new ArrayList<Integer>(event.getChildIndices().length); for (Object node : event.getChildren()) { visibleNodes.add(node); } Object parent = event.getTreePath().getLastPathComponent(); for (Object node : event.getChildren()) { children.add(node); indicieList.add(getIndexOfChild(parent, node)); } int[] indicies = new int[indicieList.size()]; for (int i = 0; i < indicies.length; i++) { indicies[i] = indicieList.get(i); } event = new TreeModelEvent( event.getSource(), event.getTreePath(), indicies, children.toArray(new Object[0])); } return event; }
public void treeStructureChanged(TreeModelEvent event) { if (!isVisible(event.getTreePath().getLastPathComponent())) { return; } for (TreeModelListener listener : listeners) { listener.treeStructureChanged(event); } }
/** Just saves the node that has been inserted. */ @Override protected void nodesInserted(TreeModelEvent event) { Object[] children = event.getChildren(); if (children != null) { this.jumpNode = (ProofNode) children[0]; } else { this.jumpNode = null; } }
public void treeNodesInserted(TreeModelEvent event) { if (!isVisible(event.getTreePath().getLastPathComponent())) { return; } event = refactorEvent(event); for (TreeModelListener listener : listeners) { listener.treeNodesInserted(event); } }
/** * Removes all userobjects from the nodes that will be removed by the {@link SmallStepProofModel} * later. */ @Override protected void nodesRemoved(TreeModelEvent event) { Object[] children = event.getChildren(); if (children == null) { return; } for (int i = 0; i < children.length; i++) { if (children[i] instanceof ProofNode) { SmallStepProofNode proofNode = (SmallStepProofNode) children[i]; SmallStepNodeComponent nodeComponent = (SmallStepNodeComponent) proofNode.getUserObject(); if (nodeComponent != null) { remove(nodeComponent); proofNode.setUserObject(null); } } } }
/** * Handles the event of a node changing. * * @param event the TreeModelEvent */ @Override public void treeNodesChanged(TreeModelEvent event) { /* at this point the TreeModel has already called setUserObject on the node; * get the value set by that function call and rename the task to that. */ /* there may be several changed nodes; loop through all of them */ for (Object obj : event.getChildren()) { /* must be node */ if (!(obj instanceof Task)) continue; /* the node's userObject must be set to a String */ Task node = (Task) obj; if (!(node.getUserObject() instanceof String)) continue; /* TODO error? */ /* rename */ this.rename(node, (String) node.getUserObject()); } }
@Override public void treeStructureChanged(TreeModelEvent e) { Category c = (Category) e.getTreePath().getLastPathComponent(); dispatchEvent(MenuToolbar.SYNCUPLOAD, c.parent); }
@Override public void treeStructureChanged(TreeModelEvent event) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) event.getTreePath().getLastPathComponent(); if (node.getUserObject() instanceof PeakList) rebuildPeakListSelector(); }