|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvrml.eai.Node
public abstract class Node
Reference to a VRML node.
The Node object represents nodes of the 3D scene in your
code. You use it to get access to the fields of the node.
You can either create new node objects by calling
Browser.createVrmlFromString(java.lang.String)
, or you can get
references to named nodes in the scene by calling
Browser.getNode(java.lang.String)
, or you can get nodes from
EventOutSFNode
or EventOutMFNode
slots. When you are finished with a node, you should call its
dispose()
method.
The following example demonstrates how to get a reference to a "Group" node called "root" (defined as "DEF root Group {}" in the scene), and how to get a reference to its "addChildren" MFNode event-in slot:
vrml.eai.Browser browser = ...; vrml.eai.Node group = browser.getNode("root"); vrml.eai.field.EventInMFNode addChildren = (vrml.eai.field.EventInMFNode)group.getEventIn("addChildren"); ... group.dispose();
Constructor Summary | |
---|---|
protected |
Node()
Default constructor. |
Method Summary | |
---|---|
abstract void |
dispose()
Releases all resources held by this node object. |
void |
finalize()
Destructor. |
abstract EventIn |
getEventIn(java.lang.String name)
Gets an event-in slot of the node. |
abstract EventOut |
getEventOut(java.lang.String name)
Gets an event-out slot of the node. |
abstract java.lang.String |
getType()
Returns the type of the node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Node()
Browser.createVrmlFromString(java.lang.String)
or
Browser.getNode(java.lang.String)
to get instances of the Node class, or get
nodes from EventOutSFNode
or
EventOutMFNode
slots.
Method Detail |
---|
public abstract java.lang.String getType() throws InvalidNodeException
The following example prints the type of a node to the console:
vrml.eai.Node node = browser.getNode(...); System.out.println("node.Type = \"" + node.getType() + '"');
InvalidNodeException
- when the node has already been disposed.public abstract EventIn getEventIn(java.lang.String name) throws InvalidEventInException, InvalidNodeException
EventIn
object. You
have to cast that object to the concrete type of the field.
The following example demonstrates how to get a reference to the "addChildren" field of a "Group" node:
vrml.eai.Node group = browser.getNode(...); vrml.eai.field.EventInMFNode addChildren = (vrml.eai.field.EventInMFNode)group.getEventIn("addChildren");
name
- The name of the event-in slot.
InvalidEventInException
- when an event-in slot with the
specified name does not exist in the node.
InvalidNodeException
- when the node has already been disposed.public abstract EventOut getEventOut(java.lang.String name) throws InvalidEventOutException, InvalidNodeException
EventOut
object. You
have to cast that object to the concrete type of the field.
The following example demonstrates how to get a reference to the "isActive" field of a "TouchSensor" node:
vrml.eai.Node touchSensor = browser.getNode(...); vrml.eai.field.EventOutSFBool isActive = (vrml.eai.field.EventOutSFBool)touchSensor.getEventOut("isActive");
name
- The name of the event-out slot.
InvalidEventOutException
- when an event-out slot with the
specified name does not exist in the node.
InvalidNodeException
- when the node has already been disposed.public abstract void dispose() throws InvalidNodeException
InvalidNodeException
. This method does not remove the
node from the scene - it just removes the connection between
the EAI node object and the node in the 3D scene.
InvalidNodeException
- when the node has already been disposed.public void finalize()
dispose()
method.
finalize
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |