Package org.xj3d.impl.core.loading
Class DefaultWorldLoaderManager
java.lang.Object
org.xj3d.impl.core.loading.DefaultWorldLoaderManager
- All Implemented Interfaces:
BrowserCoreListener,WorldLoaderManager
public class DefaultWorldLoaderManager
extends Object
implements WorldLoaderManager, BrowserCoreListener
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 vrmlNodeType 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.7 $
- Author:
- Justin Couch
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultWorldLoaderManager(BrowserCore core, FrameStateManager fsm, RouteManager rm) Construct a new instance of the world loader that uses the given frame state manager. -
Method Summary
Modifier and TypeMethodDescriptionvoidThe browser has been disposed, all resources may be freed.voidbrowserInitialized(VRMLScene scene) The browser has been initialised with new content.voidThe browser has been shut down and the previous content is no longer valid.Fetch a world loader instance from the global pool to work on loading of a world.getBuilderFactory(int renderer) Get the factory for the given renderer type.intReturn the number of WorldLoaders that are currently allocated from the pool and active loading.getParserFactory(int renderer) Get the factory for the given renderer type.voidqueueCreateURL(String[] urls, VRMLNodeType node, int field, VRMLExecutionSpace space) Queue a request for a loadURL call.voidqueueLoadURL(String[] urls, Map<String, Object> params) Queue a request for a loadURL call.voidregisterBuilderFactory(int renderer, SceneBuilderFactory factory) Register the scene builder factory to be used for the given renderer type.voidregisterParserFactory(int renderer, VRMLParserFactory factory) Register the parser factory to be used for the given renderer type.voidreleaseLoader(WorldLoader loader) Release a currently used world loader back into the cache for others to make use of.voidsetErrorReporter(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.voidsetProgressListener(org.ietf.uri.event.ProgressListener listener) Register a progress listener with the engine so progress can be tracked.voidurlLoadFailed(String msg) The tried to load a URL and failed.
-
Constructor Details
-
DefaultWorldLoaderManager
Construct a new instance of the world loader that uses the given frame state manager.- Parameters:
core- The browserCore of the browser for fetching info fromfsm- The state manager for this loader to userm-
-
-
Method Details
-
setErrorReporter
public 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.- Specified by:
setErrorReporterin interfaceWorldLoaderManager- Parameters:
reporter- The instance to use or null
-
setProgressListener
public void setProgressListener(org.ietf.uri.event.ProgressListener listener) Register a progress listener with the engine so progress can be tracked. Only loadURL calls will issue progress, not createURL.- Specified by:
setProgressListenerin interfaceWorldLoaderManager- Parameters:
listener- The instance to use or null
-
queueLoadURL
Queue a request for a loadURL call.- Specified by:
queueLoadURLin interfaceWorldLoaderManager- Parameters:
urls- List of urls to loadparams- The parameters to accompany the URLs
-
queueCreateURL
Queue a request for a loadURL call.- Specified by:
queueCreateURLin interfaceWorldLoaderManager- Parameters:
urls- List of urls to loadnode- The vrmlNodeType to send the values tofield- index of the field to write tospace- The executionSpace the script is in for route adding
-
fetchLoader
Fetch a world loader instance from the global pool to work on loading of a world.- Specified by:
fetchLoaderin interfaceWorldLoaderManager- Returns:
- A loader instance to use
-
releaseLoader
Release a currently used world loader back into the cache for others to make use of.- Specified by:
releaseLoaderin interfaceWorldLoaderManager- Parameters:
loader- The instance to return
-
registerBuilderFactory
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 inBrowserCore. If the factory instance is null, it will clear the factory for the given renderer type from the map.- Specified by:
registerBuilderFactoryin interfaceWorldLoaderManager- Parameters:
renderer- The ID of the renderer typefactory- The instance of the factory to use
-
getBuilderFactory
Get the factory for the given renderer type. If no factory exists return null.- Specified by:
getBuilderFactoryin interfaceWorldLoaderManager- Parameters:
renderer- The ID of the renderer type- Returns:
- The instance of the factory or null
-
registerParserFactory
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 inBrowserCore. If the factory instance is null, it will clear the factory for the given renderer type from the map.- Specified by:
registerParserFactoryin interfaceWorldLoaderManager- Parameters:
renderer- The ID of the renderer typefactory- The instance of the factory to use
-
getParserFactory
Get the factory for the given renderer type. If no factory exists return null.- Specified by:
getParserFactoryin interfaceWorldLoaderManager- Parameters:
renderer- The ID of the renderer type- Returns:
- The instance of the factory or null
-
getNumberLoadersActive
public int getNumberLoadersActive()Return the number of WorldLoaders that are currently allocated from the pool and active loading.- Specified by:
getNumberLoadersActivein interfaceWorldLoaderManager- Returns:
- The number of WorldLoaders currently active.
-
browserInitialized
The browser has been initialised with new content. The content given is found in the accompanying scene and description.- Specified by:
browserInitializedin interfaceBrowserCoreListener- Parameters:
scene- The scene of the new content
-
urlLoadFailed
The tried to load a URL and failed. It is typically because none of the URLs resolved to anything valid or there were network failures.- Specified by:
urlLoadFailedin interfaceBrowserCoreListener- Parameters:
msg- An error message to go with the failure
-
browserShutdown
public void browserShutdown()The browser has been shut down and the previous content is no longer valid.- Specified by:
browserShutdownin interfaceBrowserCoreListener
-
browserDisposed
public void browserDisposed()The browser has been disposed, all resources may be freed.- Specified by:
browserDisposedin interfaceBrowserCoreListener
-