Package org.xj3d.impl.core.loading
Class FramerateThrottle
java.lang.Object
java.lang.Thread
org.xj3d.impl.core.loading.FramerateThrottle
- All Implemented Interfaces:
Runnable
,org.ietf.uri.event.ProgressListener
,BrowserCoreListener
public class FramerateThrottle
extends Thread
implements org.ietf.uri.event.ProgressListener, BrowserCoreListener
Determines what the frame rate should be based on available information.
- Version:
- $Revision: 1.7 $
- Author:
- Alan Hudson
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionFramerateThrottle
(BrowserCore core, org.j3d.util.ErrorReporter reporter) Construct a new instance of the throttle for the given core instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
The browser has been disposed, all resources may be freed.void
browserInitialized
(VRMLScene scene) The browser has been initialised with new content.void
The browser has been shut down and the previous content is no longer valid.void
connectionEstablished
(org.ietf.uri.event.ProgressEvent evt) A connection to the resource has been established.void
downloadEnded
(org.ietf.uri.event.ProgressEvent evt) The download has ended.void
downloadError
(org.ietf.uri.event.ProgressEvent evt) An error has occurred during the download.void
downloadStarted
(org.ietf.uri.event.ProgressEvent evt) The download has started.void
downloadUpdate
(org.ietf.uri.event.ProgressEvent evt) The download has updated its status.void
handshakeInProgress
(org.ietf.uri.event.ProgressEvent evt) The header information reading and handshaking is taking place.boolean
Has the initial load finished.void
run()
Run the contents of this thread now.void
setLoadManager
(ContentLoadManager manager) Set the content load manager to query.void
setMinimumNoLoading
(int val) Set the minimum frame cycle time when nothing is loading.void
setScriptLoader
(ScriptLoader loader) Set the script loader to query.void
shutdown()
Stop the execution of this thread.void
Notify the throttle that a file load has started.void
urlLoadFailed
(String msg) The tried to load a URL and failed.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Constructor Details
-
FramerateThrottle
Construct a new instance of the throttle for the given core instance.- Parameters:
core
- The core instance to work withreporter
-
-
-
Method Details
-
browserInitialized
The browser has been initialised with new content. The content given is found in the accompanying scene and description.- Specified by:
browserInitialized
in 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:
urlLoadFailed
in 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:
browserShutdown
in interfaceBrowserCoreListener
-
browserDisposed
public void browserDisposed()The browser has been disposed, all resources may be freed.- Specified by:
browserDisposed
in interfaceBrowserCoreListener
-
connectionEstablished
public void connectionEstablished(org.ietf.uri.event.ProgressEvent evt) A connection to the resource has been established. At this point, no data has yet been downloaded.- Specified by:
connectionEstablished
in interfaceorg.ietf.uri.event.ProgressListener
- Parameters:
evt
- The event that caused this method to be called.
-
handshakeInProgress
public void handshakeInProgress(org.ietf.uri.event.ProgressEvent evt) The header information reading and handshaking is taking place. Reading and interpreting of the data (a download started event) should commence shortly. When that begins, you will be given the appropriate event.- Specified by:
handshakeInProgress
in interfaceorg.ietf.uri.event.ProgressListener
- Parameters:
evt
- The event that caused this method to be called.
-
downloadStarted
public void downloadStarted(org.ietf.uri.event.ProgressEvent evt) The download has started.- Specified by:
downloadStarted
in interfaceorg.ietf.uri.event.ProgressListener
- Parameters:
evt
- The event that caused this method to be called.
-
downloadUpdate
public void downloadUpdate(org.ietf.uri.event.ProgressEvent evt) The download has updated its status.- Specified by:
downloadUpdate
in interfaceorg.ietf.uri.event.ProgressListener
- Parameters:
evt
- The event that caused this method to be called.
-
downloadEnded
public void downloadEnded(org.ietf.uri.event.ProgressEvent evt) The download has ended.- Specified by:
downloadEnded
in interfaceorg.ietf.uri.event.ProgressListener
- Parameters:
evt
- The event that caused this method to be called.
-
downloadError
public void downloadError(org.ietf.uri.event.ProgressEvent evt) An error has occurred during the download.- Specified by:
downloadError
in interfaceorg.ietf.uri.event.ProgressListener
- Parameters:
evt
- The event that caused this method to be called.
-
run
-
isInitialLoadDone
public boolean isInitialLoadDone()Has the initial load finished. Somewhat subjective, but basically have the items referenced in the main file finished loading.- Returns:
- Is the initial loading finished.
-
setMinimumNoLoading
public void setMinimumNoLoading(int val) Set the minimum frame cycle time when nothing is loading.- Parameters:
val
- The minimum cycle time
-
startedLoading
public void startedLoading()Notify the throttle that a file load has started. Won't be necessary once the main loading use a content handler. -
setScriptLoader
Set the script loader to query. Null is ok.- Parameters:
loader
- The script loader
-
setLoadManager
Set the content load manager to query. Null is ok.- Parameters:
manager
- The content load manager
-
shutdown
public void shutdown()Stop the execution of this thread.
-