Xj3D 2.0 VRML/X3D Code API

org.web3d.x3d.sai
Interface X3DExternProtoDeclaration

All Superinterfaces:
X3DProtoDeclaration
All Known Implementing Classes:
SAIExternProtoDeclaration

public interface X3DExternProtoDeclaration
extends X3DProtoDeclaration

The representation of an EXTERNPROTO 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.

The implementation extends the basic proto declaration class to represent externally represented information. While all the basic method calls are supported, they do need to have thier behaivour modified somewhat to deal with the external nature of this structure. The following modifications to the behaviours are made:

createInstance()
getNodeType()
If the instance has not loaded yet or failed to load, this will generate an InvalidNodeException in addition to the normal reasons. A user should check the load state first before trying to create an instance if they wish to avoid this error.

getFieldDeclarations()
When queried, this will return the definitions of the fields as declared in the externproto, not the underlying proto definition.

No access is provided to the underlying proto declaration that fulfills this external representation. If the user wishes to access that, then they may make use of the createVrmlFromURL feature of the browser to load the individual file as needed.

Version:
$Revision: 1.3 $
Author:
Justin Couch

Method Summary
 int getLoadState()
          Check to see if the underlying definition has been loaded yet.
 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 interface org.web3d.x3d.sai.X3DProtoDeclaration
createInstance, dispose, getFieldDefinitions, getNodeType, getProtoName
 

Method Detail

getLoadState

int getLoadState()
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.

Returns:
The current load state
See Also:
X3DLoadStateTypes

loadNow

void loadNow()
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.


getURLs

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

Returns:
The URLs used to describe this node's contents

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium