Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.scripting.external.sai
Class SAIExternProtoDeclaration

java.lang.Object
  extended by org.web3d.vrml.scripting.external.sai.SAIExternProtoDeclaration
All Implemented Interfaces:
X3DExternProtoDeclaration, X3DProtoDeclaration

public class SAIExternProtoDeclaration
extends java.lang.Object
implements X3DExternProtoDeclaration

Wrapper class for external PROTO declaration data.


Constructor Summary
SAIExternProtoDeclaration(SAINodeFactory factory, VRMLExternProtoDeclare externProto, BasicScene scene)
           
 
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 getLoadState()
          Check to see if the underlying definition has been loaded yet.
 int[] getNodeType()
          Fetch the type of this proto.
 java.lang.String getProtoName()
          Get the type of this node.
 java.lang.String[] getURLs()
          Get the URLs used to describe this external prototype.
 void loadNow()
          Ask the browser to load the defintion now.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAIExternProtoDeclaration

public SAIExternProtoDeclaration(SAINodeFactory factory,
                                 VRMLExternProtoDeclare externProto,
                                 BasicScene scene)
Method Detail

getLoadState

public int getLoadState()
Description copied from interface: X3DExternProtoDeclaration
Check to see if the underlying definition has been loaded yet. There are 4 load states - not loaded, in-progress, failed and complete. If an externproto is never used in the containing scene then the browser may never even attempt to load it. This is the not-loaded state. A user may force the browser to load the defintion through the loadNow() method later on.

Specified by:
getLoadState in interface X3DExternProtoDeclaration
Returns:
The current load state
See Also:
X3DExternProtoDeclaration.getLoadState()

loadNow

public void loadNow()
Description copied from interface: X3DExternProtoDeclaration
Ask the browser to load the defintion now. If the load state is already in progress, failed or completed, then this request will be ignored.

Specified by:
loadNow in interface X3DExternProtoDeclaration
See Also:
X3DExternProtoDeclaration.loadNow()

getURLs

public java.lang.String[] getURLs()
Description copied from interface: X3DExternProtoDeclaration
Get the URLs used to describe this external prototype. If no URLs are defined in the file, this will return null.

Specified by:
getURLs in interface X3DExternProtoDeclaration
Returns:
The URLs used to describe this node's contents
See Also:
X3DExternProtoDeclaration.getURLs()

getProtoName

public java.lang.String getProtoName()
                              throws InvalidNodeException
Description copied from interface: X3DProtoDeclaration
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.

Specified by:
getProtoName in interface X3DProtoDeclaration
Returns:
The type of this node.
Throws:
InvalidNodeException - The node has had it's resources disposed of
See Also:
X3DProtoDeclaration.getProtoName()

getNodeType

public int[] getNodeType()
                  throws InvalidNodeException
Description copied from interface: X3DProtoDeclaration
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.

Specified by:
getNodeType in interface X3DProtoDeclaration
Returns:
The primary type(s) of this node
Throws:
InvalidNodeException - The node has had it's resources disposed of
See Also:
X3DProtoDeclaration.getNodeType()

getFieldDefinitions

public X3DFieldDefinition[] getFieldDefinitions()
                                         throws InvalidNodeException
Description copied from interface: X3DProtoDeclaration
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.

Specified by:
getFieldDefinitions in interface X3DProtoDeclaration
Returns:
The definitions for all fields of this node
Throws:
InvalidNodeException - The node has had it's resources disposed of
See Also:
X3DProtoDeclaration.getFieldDefinitions()

createInstance

public X3DProtoInstance createInstance()
                                throws InvalidNodeException
Description copied from interface: X3DProtoDeclaration
Create an instance of this proto that may be used at runtime.

Specified by:
createInstance in interface X3DProtoDeclaration
Returns:
An instance of this proto to work with
Throws:
InvalidNodeException - The node has had it's resources disposed of
See Also:
X3DProtoDeclaration.createInstance()

dispose

public void dispose()
             throws InvalidNodeException
Description copied from interface: X3DProtoDeclaration
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.

Specified by:
dispose in interface X3DProtoDeclaration
Throws:
InvalidNodeException - The node is no longer valid and can't be disposed of again.
See Also:
X3DProtoDeclaration.dispose()

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium