Package org.xj3d.core.loading
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:
- Waiting to be loaded
- In the process of being loaded
- Load complete (or failed) and waiting for initialize() to be called
- Load finished (or failed), nothing left to do
- 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.2 $
- Author:
- Justin Couch
-
Method Summary
Modifier and TypeMethodDescriptionint
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
(org.j3d.util.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
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
Unregister a the scripting engine with this loader.
-
Method Details
-
setErrorReporter
void setErrorReporter(org.j3d.util.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
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
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
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
Attempt to load the script. Queues the script and lets the internals deal with it.- Parameters:
script
- The script instance to load
-
getNumberInProgress
int getNumberInProgress()Get the number of items in progress of loading.- Returns:
- The number of items queued.
-
shutdown
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.
-