Xj3D 2.0 VRML/X3D Code API

org.web3d.x3d.sai
Interface X3DProtoDeclaration

All Known Subinterfaces:
X3DExternProtoDeclaration
All Known Implementing Classes:
SAIExternProtoDeclaration, SAIProtoDeclaration

public interface X3DProtoDeclaration

The representation of a PROTO declaration.

This is the representation of the declaration, not of a runtime node. For this reason you cannot access the internals, nor can you work with the individual field values. You can, however, perform basic introspection tasks such as looking at the available field definitions and seeing the basic node type.

Version:
$Revision: 1.2 $
Author:
Justin Couch

Method Summary
 X3DProtoInstance createInstance()
          Create an instance of this proto that may be used at runtime.
 void dispose()
          Dispose of this node's resources.
 X3DFieldDefinition[] getFieldDefinitions()
          Get the list of fields that this node contains.
 int[] getNodeType()
          Fetch the type of this proto.
 java.lang.String getProtoName()
          Get the type of this node.
 

Method Detail

getProtoName

java.lang.String getProtoName()
                              throws InvalidNodeException
Get the type of this node. The string returned should be the name of the VRML node or the name of the proto instance this node represents.

Returns:
The type of this node.
Throws:
InvalidNodeException - The node has had it's resources disposed of

getNodeType

int[] getNodeType()
                  throws InvalidNodeException
Fetch the type of this proto. The proto's type is defined by the first child node in the body, in accordance with the X3D specification.

The types values are provided in the array of values. There is no specific order of the returned types. It is expected that most node types, which only descend from a single parent type would return an array of length 1.

Returns:
The primary type(s) of this node
Throws:
InvalidNodeException - The node has had it's resources disposed of

getFieldDefinitions

X3DFieldDefinition[] getFieldDefinitions()
                                         throws InvalidNodeException
Get the list of fields that this node contains. This will return one definition for each field regardless of whether it is eventIn/Out, exposedField or field access type.

Returns:
The definitions for all fields of this node
Throws:
InvalidNodeException - The node has had it's resources disposed of

createInstance

X3DProtoInstance createInstance()
                                throws InvalidNodeException
Create an instance of this proto that may be used at runtime.

Returns:
An instance of this proto to work with
Throws:
InvalidNodeException - The node has had it's resources disposed of

dispose

void dispose()
             throws InvalidNodeException
Dispose of this node's resources. This is used to indicate to the browser that the java side of the application does not require the resources represented by this node. The browser is now free to do what it likes with the node.

This in no way implies that the browser is to remove this node from the scene graph, only that the java code is no longer interested in this particular node through this reference.

Once this method has been called, any further calls to methods of this instance of the class is shall generate an InvalidNodeException.

Throws:
InvalidNodeException - The node is no longer valid and can't be disposed of again.

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium