Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.nodes
Interface VRMLSingleExternalNodeType

All Superinterfaces:
VRMLExternalNodeType
All Known Subinterfaces:
VRMLExternProtoDeclare, VRMLInlineNodeType, VRMLScriptNodeType
All Known Implementing Classes:
CRExternPrototypeDecl, ExternalPrototypeDecl, NRExternPrototypeDecl, OGLExternPrototypeDecl

public interface VRMLSingleExternalNodeType
extends VRMLExternalNodeType

Representation of a node that defines it's content at a URL separate to this file that will also need loading.

The idea behind this node interface is that we are going to allow a separate thread from the one that created the initial node to simultaneously load the contents of this node. As we really don't know all the possible types to load, particularly with profiles, a common base class will make life much easier for us to deal with in a generic fashion.

The operation of this interface is to get the loader thread to set the load state as it is going. Once it has loaded the content it then tells the implementation about what it has found.

When fetching the URL list, it is expected that all URLs will be fully qualified. It will be up to the implementor to process the set URLs to contain only fully qualified URLs. For this, we will ensure that the world URL is set on every instance through the setWorldUrl() method.

Version:
$Revision: 1.6 $
Author:
Justin Couch

Field Summary
 
Fields inherited from interface org.web3d.vrml.nodes.VRMLExternalNodeType
LOAD_COMPLETE, LOAD_FAILED, LOADING, NOT_LOADED
 
Method Summary
 boolean checkValidContentType(java.lang.String mimetype)
          Check to see if the given MIME type is one that would be supported as content coming into this node.
 int getLoadState()
          Ask the state of the load of this node.
 java.lang.String[] getUrl()
          Get the list of URLs requested by this node.
 void setContent(java.lang.String mimetype, java.lang.Object content)
          Set the content of this node to the given object.
 void setLoadedURI(java.lang.String URI)
          Notify the node which URL was used to load the content.
 void setLoadState(int state)
          Set the load state of the node.
 void setUrl(java.lang.String[] newUrl, int numValid)
          Replace the existing set of URLs with this new set.
 
Methods inherited from interface org.web3d.vrml.nodes.VRMLExternalNodeType
addContentStateListener, addUrlListener, getWorldUrl, removeContentStateListener, removeUrlListener, setWorldUrl
 

Method Detail

getLoadState

int getLoadState()
Ask the state of the load of this node. The value will be one of the constants defined above.

Returns:
The current load state of the node

setLoadState

void setLoadState(int state)
Set the load state of the node. The value must be one of the constants defined above.

Parameters:
state - The new state of the node

setUrl

void setUrl(java.lang.String[] newUrl,
            int numValid)
Replace the existing set of URLs with this new set. If the array is null or zero length, it will clear the existing values.

Parameters:
newUrl - The list of new instances to use
numValid - The number of valid values to copy from the array

getUrl

java.lang.String[] getUrl()
Get the list of URLs requested by this node. If there are no URLs supplied in the text file then this will return a zero length array.

Returns:
The list of URLs to attempt to load

checkValidContentType

boolean checkValidContentType(java.lang.String mimetype)
Check to see if the given MIME type is one that would be supported as content coming into this node.

Parameters:
mimetype - The type to check for
Returns:
true if this is OK, false if not

setContent

void setContent(java.lang.String mimetype,
                java.lang.Object content)
                throws java.lang.IllegalArgumentException
Set the content of this node to the given object. The object is then cast by the internal representation to the form it needs. This assumes at least some amount of intelligence on the part of the caller, but we also know that we should not pass something dumb to it when we can check what sort of content types it likes to handle. We assume the loader thread is operating in the same context as the one that created the node in the first place and thus knows the general types of items to pass through.

Parameters:
mimetype - The mime type of this object if known
content - The content of the object
Throws:
IllegalArguementException - The content object is not supported
java.lang.IllegalArgumentException

setLoadedURI

void setLoadedURI(java.lang.String URI)
Notify the node which URL was used to load the content. It will be the complete URI with path, query and references parts. This method will be called before setContent.

Parameters:
URI - The URI used to load this content

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium