/** * Move this item to a new parent, or to a new name, or both * * @param newParent */ public void move(DirectoryNode newParent, String newName) { DirectoryNode oldParent = this.getParent(); if (oldParent != newParent) { this.setParent(newParent); if (oldParent.members != null) { oldParent.members.remove(this); } newParent.getChildren().add(this); setDirty(); newParent.setDirty(); oldParent.setDirty(); } if (!newName.equals(name)) { setName(newName); } parent.checkConsistency(this); }
public void delete() { parent.getChildren().remove(this); parent.checkConsistency(parent); setDirty(); }