Xj3D 2.0 VRML/X3D Code API

org.xj3d.ui.construct
Class BlockingWorldLoader

java.lang.Object
  extended by org.xj3d.ui.construct.BlockingWorldLoader
All Implemented Interfaces:
java.lang.Runnable, BrowserCoreListener, FrameStateListener

public class BlockingWorldLoader
extends java.lang.Object
implements java.lang.Runnable, BrowserCoreListener, FrameStateListener

A function module that handles world loading and blocks until the world is loaded and all the content loader threads return to their idle state. Additionally this loader reduces the frame rate while loading is in process to prevent unnecessary CPU time being spent on rendering.

Version:
$Revision: 1.2 $
Author:
Rex Melton

Field Summary
protected  Construct construct
          The construct instance to load
protected  ErrorReporter errorReporter
          The error reporting mechanism
protected  java.util.Map inProgress
          Map of in progress loader tasks
protected  LoaderThreadPool loaderPool
          Manager of the loader threads
protected  boolean loadInProgress
          Synchronization variable, indicating that loader threads are active
protected  boolean loadStatus
          The completion status of the load, true for success, false otherwise.
protected  ContentLoadQueue pending
          Shared queue of load tasks
protected  ScenePreprocessor preprocessor
          The preprocessor to invoke after the scene is loaded, and before the scene is set to the Construct
protected  InputSource source
          The source to load from
 
Constructor Summary
BlockingWorldLoader(Construct construct)
          Constructor
 
Method Summary
 void allEventsComplete()
          Notification that the rendering of the event model is complete and that rendering is about to begin.
 void browserDisposed()
          Ignored.
 void browserInitialized(VRMLScene scene)
          The browser has been initialised with new content.
 void browserShutdown()
          Ignored.
 boolean isLoadingInProgress()
          Return whether loading threads are active
 boolean load(InputSource source)
          Load the world from the specified source, return when all the loading threads have returned to the idle state.
 void run()
          Thread that handles the initial world load
 void setScenePreprocessor(ScenePreprocessor preprocessor)
          Set the preprocessor module
 void urlLoadFailed(java.lang.String msg)
          Ignored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

construct

protected Construct construct
The construct instance to load


preprocessor

protected ScenePreprocessor preprocessor
The preprocessor to invoke after the scene is loaded, and before the scene is set to the Construct


errorReporter

protected ErrorReporter errorReporter
The error reporting mechanism


source

protected InputSource source
The source to load from


loadStatus

protected boolean loadStatus
The completion status of the load, true for success, false otherwise.


loadInProgress

protected boolean loadInProgress
Synchronization variable, indicating that loader threads are active


loaderPool

protected LoaderThreadPool loaderPool
Manager of the loader threads


pending

protected ContentLoadQueue pending
Shared queue of load tasks


inProgress

protected java.util.Map inProgress
Map of in progress loader tasks

Constructor Detail

BlockingWorldLoader

public BlockingWorldLoader(Construct construct)
Constructor

Parameters:
construct - The Construct instance to load to
Method Detail

run

public void run()
Thread that handles the initial world load

Specified by:
run in interface java.lang.Runnable

browserInitialized

public void browserInitialized(VRMLScene scene)
The browser has been initialised with new content. The content given is found in the accompanying scene and description.

Specified by:
browserInitialized in interface BrowserCoreListener
Parameters:
scene - The scene of the new content

urlLoadFailed

public void urlLoadFailed(java.lang.String msg)
Ignored. 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:
urlLoadFailed in interface BrowserCoreListener
Parameters:
msg - An error message to go with the failure

browserShutdown

public void browserShutdown()
Ignored. The browser has been shut down and the previous content is no longer valid.

Specified by:
browserShutdown in interface BrowserCoreListener

browserDisposed

public void browserDisposed()
Ignored. The browser has been disposed, all resources may be freed.

Specified by:
browserDisposed in interface BrowserCoreListener

allEventsComplete

public void allEventsComplete()
Description copied from interface: FrameStateListener
Notification that the rendering of the event model is complete and that rendering is about to begin. If the node needs to update itself for this frame, it should do so now before the render pass takes place.

Specified by:
allEventsComplete in interface FrameStateListener

load

public boolean load(InputSource source)
Load the world from the specified source, return when all the loading threads have returned to the idle state.

Parameters:
source - The source to load

isLoadingInProgress

public boolean isLoadingInProgress()
Return whether loading threads are active

Returns:
whether loading threads are active. true if there are loading threads active, false if the loading threads are idle.

setScenePreprocessor

public void setScenePreprocessor(ScenePreprocessor preprocessor)
Set the preprocessor module

Parameters:
preprocessor - The ScenePreprocessor module. If null, this clears any previous preprocessor module.

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium