Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.nodes
Interface VRMLMultiExternalNodeType

All Superinterfaces:
VRMLExternalNodeType

public interface VRMLMultiExternalNodeType
extends VRMLExternalNodeType

Representation of a node that defines more than one piece of its content at a list of URLs separate to this file that will also need loading.

This is the same system as used by the VRMLExternalNodeType except expanded to provide more than one field with external content.

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.7 $
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(int index, java.lang.String mimetype)
          Check to see if the given MIME type is one that would be supported as content coming into this node at the given field index.
 int getLoadState(int index)
          Ask the state of the load of this node.
 java.lang.Class[] getPreferredClassTypes(int index)
          Get the list of preferred content class types in order of preference.
 java.lang.String[] getUrl(int index)
          Get the list of URLs for the given field index requested by this node.
 int[] getUrlFieldIndexes()
          Get the list of field index values that require external content.
 void setContent(int index, java.lang.String mimetype, java.lang.Object content)
          Set the content of this node to the given object.
 void setLoadedURI(int fieldIdx, java.lang.String URI)
          Notify the node which URL was used to load the content.
 void setLoadState(int index, int state)
          Set the load state of the node.
 
Methods inherited from interface org.web3d.vrml.nodes.VRMLExternalNodeType
addContentStateListener, addUrlListener, getWorldUrl, removeContentStateListener, removeUrlListener, setWorldUrl
 

Method Detail

getUrlFieldIndexes

int[] getUrlFieldIndexes()
Get the list of field index values that require external content. These will be used to query for the URL values later. The field must be non-null and non-zero in length.

Returns:
A list of field indexes requiring textures

getLoadState

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

Parameters:
index - The field index we want to set the state for
Returns:
The current load state of the node

setLoadState

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

Parameters:
index - The field index we want to set the state for.
state - The new state of the node

getUrl

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

Parameters:
index - The field index we want URL values for
Returns:
The list of URLs to attempt to load
Throws:
InvalidFieldException - The field index is not valid for the query

checkValidContentType

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

Parameters:
index - The field index we want to check content type for.
mimetype - The type to check for
Returns:
true if this is OK, false if not
Throws:
InvalidFieldException - The field index is not valid for the query

getPreferredClassTypes

java.lang.Class[] getPreferredClassTypes(int index)
                                         throws InvalidFieldException
Get the list of preferred content class types in order of preference. This allows the code to ask for data in an order of preference. For example, for images it might want a BufferedImage preferance to an Image. This is passed to the URI loading code. If there is no preference this may return a null list.

Parameters:
index - THe field index for the prefered types.
Returns:
A list of prefered class types
Throws:
InvalidFieldException - The field index is not valid for the query

setContent

void setContent(int index,
                java.lang.String mimetype,
                java.lang.Object content)
                throws java.lang.IllegalArgumentException,
                       InvalidFieldException
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:
index - The field index to set the content for
mimetype - The mime type of this object if known
content - The content of the object
Throws:
IllegalArguementException - The content object is not supported
InvalidFieldException - The field index is not valid for the query
java.lang.IllegalArgumentException

setLoadedURI

void setLoadedURI(int fieldIdx,
                  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:
fieldIdx - The field index that was loaded
URI - The URI used to load this content

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium