Xj3D VRML/X3D Code API

org.web3d.vrml.nodes.runtime
Interface ScriptManager

All Known Implementing Classes:
DefaultScriptManager

public interface ScriptManager

Abstract representation of a class that can be used to provide script lifecycle management 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.5 $
Author:
Justin Couch

Method Summary
 void addScripts(NodeArray list)
          Queue the scripts to add to the scene.
 void eventsProcessed()
          Notification that all of the processing is finished and that eventsProcessed() should now be called.
 void getProcessedScripts(NodeArray list)
          Copy all the processed scripts to date into the given list.
 ScriptLoader getScriptLoader()
          Get the current script loader to be used by this manager.
 void initializeScripts(double timestamp)
          Initialise any newly loaded scripts and then put them into the completed basket.
 void prepareEvents(double timestamp)
          Setup the scripts for the new timestamp.
 void processEvents()
          Process any events that scripts need to send.
 void removeScripts(NodeArray list)
          Remove this list of scripts from active service.
 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 setScriptLoader(ScriptLoader ldr)
          Set the script loader to be used by this manager.
 void shutdown()
          Shutdown all scripts as the system is about to shutdown all of the current world and is starting again.
 void shutdownActiveScripts()
          The loader should now shutdown any scripts that have had their set_url events called.
 

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

setScriptLoader

public void setScriptLoader(ScriptLoader ldr)
Set the script loader to be used by this manager. Setting a null value will clear the current instance and disable all script loading.

Parameters:
ldr - The loader instance to use

getScriptLoader

public ScriptLoader getScriptLoader()
Get the current script loader to be used by this manager. If none is currently in use, null will be returned.

Returns:
The current loader instance or null

shutdownActiveScripts

public void shutdownActiveScripts()
The loader should now shutdown any scripts that have had their set_url events called.


shutdown

public void shutdown()
Shutdown all scripts as the system is about to shutdown all of the current world and is starting again.


initializeScripts

public void initializeScripts(double timestamp)
Initialise any newly loaded scripts and then put them into the completed basket.

Parameters:
timestamp - The VRML time that the initialisation occured at

prepareEvents

public void prepareEvents(double timestamp)
Setup the scripts for the new timestamp. For X3D, this will also call the prepareEvents() method/function on the script, if it has one.

Parameters:
timestamp - The current time in VRML time

processEvents

public void processEvents()
Process any events that scripts need to send. This looks for any inputs that have changed, and also any outputs and propogates the values to the eventOuts of the script. If the eventOuts are routed somewhere, it is the RouteManager's responsibility to look after sending those changed values.


eventsProcessed

public void eventsProcessed()
Notification that all of the processing is finished and that eventsProcessed() should now be called.


removeScripts

public void removeScripts(NodeArray list)
Remove this list of scripts from active service. They have been deleted from the scene graph and therefore the listener should no longer be registered with them.

Parameters:
list - The list of scripts to remove

addScripts

public void addScripts(NodeArray list)
Queue the scripts to add to the scene.

Parameters:
list - the list of scripts to add

getProcessedScripts

public void getProcessedScripts(NodeArray list)
Copy all the processed scripts to date into the given list. After this is done, clear the internal collection. The calling script should be empty because it will replace the contents of the given list with this collection of values.

Parameters:
list - The list to copy values into

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium