Beispiel #1
0
 /*
  * @see org.primordion.xholon.base.IXholon#swapNode(org.primordion.xholon.base.IXholon)
  */
 public void swapNode(XholonTreeNode otherNode) {
   XholonTreeNode thisParent = parent;
   XholonTreeNode otherParent = otherNode.getParentNode();
   XholonTreeNode thisNextSibling = nextSibling;
   XholonTreeNode otherNextSibling = otherNode.getNextSibling();
   if (thisParent != otherParent) { // no change if both have same parent
     removeChild();
     otherNode.removeChild();
     // insert this node
     if (otherNextSibling == null) {
       appendChild(otherParent);
     } else {
       insertBefore(otherNextSibling);
     }
     // insert other node
     if (thisNextSibling == null) {
       otherNode.appendChild(thisParent);
     } else {
       otherNode.insertBefore(thisNextSibling);
     }
   }
 }