public boolean isParentOf(NodeDescriptor eachNode) {
   NodeDescriptor eachParent = eachNode.getParentDescriptor();
   while (eachParent != null) {
     if (eachParent == this) return true;
     eachParent = eachParent.getParentDescriptor();
   }
   return false;
 }
 public boolean isAncestorOrSelf(NodeDescriptor selectedNode) {
   NodeDescriptor node = selectedNode;
   while (node != null) {
     if (equals(node)) return true;
     node = node.getParentDescriptor();
   }
   return false;
 }
 public static Object extractUserObject(DefaultMutableTreeNode node) {
   Object userObject = node.getUserObject();
   Object element = null;
   if (userObject instanceof AbstractTreeNode) {
     AbstractTreeNode descriptor = (AbstractTreeNode) userObject;
     element = descriptor.getValue();
   } else if (userObject instanceof NodeDescriptor) {
     NodeDescriptor descriptor = (NodeDescriptor) userObject;
     element = descriptor.getElement();
     if (element instanceof AbstractTreeNode) {
       element = ((AbstractTreeNode) element).getValue();
     }
   } else if (userObject != null) {
     element = userObject;
   }
   return element;
 }
 @Override
 public void applyFrom(NodeDescriptor desc) {
   if (desc instanceof PresentableNodeDescriptor) {
     PresentableNodeDescriptor pnd = (PresentableNodeDescriptor) desc;
     apply(pnd.getPresentation());
   } else {
     super.applyFrom(desc);
   }
 }