public void clearAllElements() { // this deletion code was copied from an old version of LWComponent deletion code // todo: probably should sync this up with whatever the menu action does. Iterator li = getAllDescendents().iterator(); while (li.hasNext()) { LWComponent c = (LWComponent) li.next(); LWContainer parent = c.getParent(); if (parent == null) { // System.out.println("DELETE: " + c + " skipping: null parent (already deleted)"); } else if (c.isDeleted()) { // System.out.println("DELETE: " + c + " skipping (already deleted)"); } else if (parent.isDeleted()) { // after prior check, this case should be impossible now // System.out.println("DELETE: " + c + " skipping (parent already deleted)"); // parent will // call deleteChildPermanently } else if (parent.isSelected()) { // if parent selected, it will delete it's children // System.out.println("DELETE: " + c + " skipping - parent selected & will be deleting"); } else { parent.deleteChildPermanently(c); } } }
public boolean nodeAlreadyPresent(LWComponent node) { if (DEBUG_LOCAL) { System.out.println("nodeAlreadyPresent -- getParent() " + node.getParent()); } // also need to check if parent *will* be visible // if(! (node.getParent() instanceof LWMap ) ) if (!node.atTopLevel()) return true; if (node == null) { return false; } // if(node.getParent() instanceof LWNode && (LWNode.isImageNode((LWNode)(node.getParent()))) ) // return true; // Iterator<LWComponent> i = this.getAllDescendents(ChildKind.PROPER).iterator(); // Iterator<LWComponent> i = this. getChildList().iterator(); for (LWComponent c : getAllDescendents(ChildKind.PROPER)) { if (Util.getMergeProperty(node) != null && Util.getMergeProperty(c) != null) { if (Util.getMergeProperty(node).equals(Util.getMergeProperty(c))) { if (DEBUG_LOCAL) { System.out.println( "LWMergeMap - returning true in nodeAlreadyPresent - for (node,c) (" + Util.getMergeProperty(node) + "," + Util.getMergeProperty(c) + ")"); } // TODO: not sure why this code is here and what it is doing. should be refactored. String sourceLabel = node.getLabel(); if (sourceLabel == null) sourceLabel = ""; edu.tufts.vue.metadata.VueMetadataElement vme = new edu.tufts.vue.metadata.VueMetadataElement(); vme.setType(edu.tufts.vue.metadata.VueMetadataElement.OTHER); vme.setObject("source: " + node.getMap().getLabel() + "," + sourceLabel); c.getMetadataList().getMetadata().add(vme); return true; } } } return false; }