Xj3D VRML/X3D Code API

org.web3d.vrml.nodes.loader
Interface ScriptLoader

All Known Implementing Classes:
DefaultScriptLoader

public interface ScriptLoader

Abstract representation of a class that can be used to provide script loading and initlisation facilities to the browser core.

The loader also takes part in the event model evaluation as well. For this, it must hook into the URL change handling through the VRMLUrlListener interface and participate as part of the larger event model. Method calls are provided in this interface for other classes (eg EventModelEvaluator) to make calls to at the appropriate time in the event model. This interface does not extend the URLListener interface directly as it assumes that an implementation may take other internal arrangements. It assumes that listeners will be registered with the script nodes.

For VRML97/X3D conformant behaviour, the implied architecture of an implementation of this interface is 5 separate buckets of data:

  1. Waiting to be loaded
  2. In the proces of being loaded
  3. Load complete (or failed) and waiting for initialize() to be called
  4. Load finished (or failed), nothing left to do
  5. Previously loaded scripts that have had set_url called and need to shutdown the old script and start the load process for others.

Version:
$Revision: 1.16 $
Author:
Justin Couch

Method Summary
 int getNumberInProgress()
          Get the number of items in progress of loading.
 void loadScript(VRMLScriptNodeType script)
          Attempt to load the script.
 void registerScriptingEngine(ScriptEngine engine)
          Register a new scripting engine with this loader.
 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.
 void setStatusListener(ScriptLoadStatusListener l)
          Set the script load status listener for this loader.
 void shutdown()
          Notification that the manager needs to shut down all the currently running threads.
 void unregisterScriptingEngine(ScriptEngine engine)
          Unregister a the scripting engine with this loader.
 

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.

Parameters:
reporter - The instance to use or null

registerScriptingEngine

public void registerScriptingEngine(ScriptEngine engine)
Register a new scripting engine with this loader. There can be only one scripting engine per content type so if the new engine supports a content type that is already registered, the new engine will replace the old one.

Parameters:
engine - The new engine instance to register

unregisterScriptingEngine

public void unregisterScriptingEngine(ScriptEngine engine)
Unregister a the scripting engine with this loader. If the engine was not registered in the first place, this method is ignored.

Parameters:
engine - The engine instance to deregister

setStatusListener

public void setStatusListener(ScriptLoadStatusListener l)
Set the script load status listener for this loader. A null value is used to clear the reference.

Parameters:
l - The listener instance to use or null

loadScript

public void loadScript(VRMLScriptNodeType script)
Attempt to load the script. Queues the script and lets the internals deal with it.

Parameters:
script - The script instance to load

getNumberInProgress

public int getNumberInProgress()
Get the number of items in progress of loading.

Returns:
The number of items queued.

shutdown

public void shutdown()
Notification that the manager needs to shut down all the currently running threads. Normally called when the application is exiting, so it is not expected that the manager needs to act sanely after this method has been called.


Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium