/** * 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); }
protected void setDirty() { if (dirty != null) { return; // already set } dirty = Boolean.TRUE; if (parent != null) { parent.setDirty(); } }