public void run() { Controller controller = Controller.getController(); try { String ST_OPENING_FILE = controller.getMsgString("ST_OPENING_FILE"); controller.setStatusMessage(ST_OPENING_FILE); try { Thread.sleep(10); } catch (Exception e) { e.printStackTrace(); } controller.setWaitCursors(); TreeGrowXMLReader xUtil = new TreeGrowXMLReader(m_FileName, true); controller.setEditableContributors(new Vector(xUtil.getEditableContributors())); xUtil.gatherContent(); String treeString = xUtil.getTreeStructure(); ArrayList actualNodes = new ArrayList(); ArrayList terminalChildrenNodes = new ArrayList(); Iterator it = xUtil.getNodeList().iterator(); while (it.hasNext()) { Node node = (Node) it.next(); if (treeString.indexOf("" + node.getId()) != -1) { actualNodes.add(node); } else { terminalChildrenNodes.add(node); } } Tree tree = xUtil.getTree(); controller.openTreeEditor(tree); controller.getTree().setImages(xUtil.getImageList()); if (prevUploadId != -1) { controller.setUploadId(prevUploadId); } controller.setDefaultCursors(); controller.getTreeEditor().setToolbarEnabled(); it = tree.getNodeList().iterator(); while (it.hasNext()) { Node node = (Node) it.next(); TreePanel.getTreePanel().setNodeComplete(node); } it = tree.getImages().iterator(); while (it.hasNext()) { NodeImage img = (NodeImage) it.next(); img.initializeThumbnail(); } controller.setDownloadComplete(true); } catch (Exception error) { error.printStackTrace(); controller.setDefaultCursors(); } }
/** Collapse node - reassign parent child relationships as needed */ public void redo() { Node parent = node.getParent(); if (nodeToCollapse == null) { parent.setChildrenChanged(true); parent.removeChild(node); return; } if (nodeToCollapse == parent) { // Node otherChild = parent.getChildAtIndex(1 - parent.indexOfChild(node)); parentIndex = oldGrandParent.indexOfChild(parent); oldGrandParent.removeChild(parent); int tempIndex = parentIndex; Iterator it = parent.getChildren().iterator(); while (it.hasNext()) { Node ch = (Node) it.next(); if (ch != node) { oldGrandParent.addToChildren(tempIndex++, ch); } } oldGrandParent.setChildrenChanged(true); } else { // nodeToCollapse is the other child parent.removeChild(node); parent.removeChild(nodeToCollapse); Iterator it = nodeToCollapse.getChildren().iterator(); while (it.hasNext()) { Node ch = (Node) it.next(); parent.addToChildren(ch); } parent.setChildrenChanged(true); parent.setChildCountOnServer(parent.getChildren().size()); } NodeGraveyard.getGraveyard().addNode(nodeToCollapse); }