Пример #1
0
 /**
  * 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);
 }
Пример #2
0
 public void delete() {
   parent.getChildren().remove(this);
   parent.checkConsistency(parent);
   setDirty();
 }