org.openide.nodes
Class DefaultHandle

java.lang.Object
  |
  +--org.openide.nodes.DefaultHandle
All Implemented Interfaces:
Node.Handle, Serializable

public final class DefaultHandle
extends Object
implements Node.Handle

Simple implementation of Node.Handle. When created by createHandle(org.openide.nodes.Node) it looks for the parent of the node and stores the node's name. When getNode() is then called, it tries to restore the parent and then to walk down to the child.

Note that if most nodes use DefaultHandle, this may walk up to the root recursively. Otherwise, some other sort of handle may provide the termination case.

See Also:
Serialized Form

Fields inherited from interface org.openide.nodes.Node.Handle
serialVersionUID
 
Method Summary
static DefaultHandle createHandle(Node node)
          Create a handle for a given node.
 Node getNode()
          Find the node.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getNode

public Node getNode()
             throws IOException
Find the node.
Specified by:
getNode in interface Node.Handle
Returns:
the found node
Throws:
IOException - if the parent cannot be recreated
NodeNotFoundException - if the path is not valid (exception may be examined for details)

createHandle

public static DefaultHandle createHandle(Node node)
Create a handle for a given node. A handle cannot be created under these circumstances:
  1. The node has no name.
  2. The node has no parent.
  3. The parent has no handle.
  4. The parent is incapable of finding its child by the supplied name.
Parameters:
node - the node to create a handler for
Returns:
the handler, or null if a handle cannot be created

toString

public String toString()
Overrides:
toString in class Object


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.