Xj3D VRML/X3D Code API

org.web3d.vrml.nodes.loader
Class DefaultWorldLoaderManager

java.lang.Object
  extended byorg.web3d.vrml.nodes.loader.DefaultWorldLoaderManager
All Implemented Interfaces:
WorldLoaderManager

public class DefaultWorldLoaderManager
extends java.lang.Object
implements WorldLoaderManager

Independent thread used to load a world from a list of URLs and then place it in the given node.

This implementation is designed to work as both a loadURL() and createVrmlFromUrl() call handler. The difference is defined by what data is supplied to the thread. If the target node is specified, then we assume that the caller wants us to put the results there. If it is null, then assume that we're doing a loadURL call and replace the entire world.

Version:
$Revision: 1.5 $
Author:
Justin Couch

Constructor Summary
DefaultWorldLoaderManager(FrameStateManager fsm)
          Construct a new instance of the world loader that uses the given frame state manager.
 
Method Summary
 WorldLoader fetchLoader()
          Fetch a world loader instance from the global pool to work on loading of a world.
 SceneBuilderFactory getBuilderFactory(int renderer)
          Get the factory for the given renderer type.
 VRMLParserFactory getParserFactory(int renderer)
          Get the factory for the given renderer type.
 void registerBuilderFactory(int renderer, SceneBuilderFactory factory)
          Register the scene builder factory to be used for the given renderer type.
 void registerParserFactory(int renderer, VRMLParserFactory factory)
          Register the parser factory to be used for the given renderer type.
 void releaseLoader(WorldLoader loader)
          Release a currently used world loader back into the cache for others to make use of.
 void setErrorReporter(ErrorReporter reporter)
          Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWorldLoaderManager

public DefaultWorldLoaderManager(FrameStateManager fsm)
Construct a new instance of the world loader that uses the given frame state manager.

Parameters:
fsm - The state manager for this loader to use
Method Detail

setErrorReporter

public void setErrorReporter(ErrorReporter reporter)
Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.

Specified by:
setErrorReporter in interface WorldLoaderManager
Parameters:
reporter - The instance to use or null

fetchLoader

public WorldLoader fetchLoader()
Fetch a world loader instance from the global pool to work on loading of a world.

Specified by:
fetchLoader in interface WorldLoaderManager
Returns:
A loader instance to use

releaseLoader

public void releaseLoader(WorldLoader loader)
Release a currently used world loader back into the cache for others to make use of.

Specified by:
releaseLoader in interface WorldLoaderManager
Parameters:
loader - The instance to return

registerBuilderFactory

public void registerBuilderFactory(int renderer,
                                   SceneBuilderFactory factory)
Register the scene builder factory to be used for the given renderer type. There can only be one for any given renderer type (where the type value is defined by the constants in BrowserCore. If the factory instance is null, it will clear the facctory for the given renderer type from the map.

Specified by:
registerBuilderFactory in interface WorldLoaderManager
Parameters:
renderer - The ID of the renderer type
factory - The instance of the factory to use

getBuilderFactory

public SceneBuilderFactory getBuilderFactory(int renderer)
Get the factory for the given renderer type. If no factory exists return null.

Specified by:
getBuilderFactory in interface WorldLoaderManager
Parameters:
renderer - The ID of the renderer type
Returns:
The instance of the factory or null

registerParserFactory

public void registerParserFactory(int renderer,
                                  VRMLParserFactory factory)
Register the parser factory to be used for the given renderer type. There can only be one for any given renderer type (where the type value is defined by the constants in BrowserCore. If the factory instance is null, it will clear the facctory for the given renderer type from the map.

Specified by:
registerParserFactory in interface WorldLoaderManager
Parameters:
renderer - The ID of the renderer type
factory - The instance of the factory to use

getParserFactory

public VRMLParserFactory getParserFactory(int renderer)
Get the factory for the given renderer type. If no factory exists return null.

Specified by:
getParserFactory in interface WorldLoaderManager
Parameters:
renderer - The ID of the renderer type
Returns:
The instance of the factory or null

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium