Package org.web3d.vrml.scripting.jsai
Class VRML97ScriptWrapper
java.lang.Object
org.web3d.vrml.scripting.jsai.VRML97ScriptWrapper
- All Implemented Interfaces:
ScriptWrapper
A wrapper class used to convert between the Xj3D implementation specific
details and the VRML97 spec requirements for a script.
Note that as this class does not wrap VRML200x scripts, the class does not need to take an instance of VRMLScriptNodeType as we cannot change the field listing dynamically.
- Version:
- $Revision: 1.16 $
- Author:
- Justin Couch
-
Constructor Summary
ConstructorsConstructorDescriptionVRML97ScriptWrapper
(Script sc, Browser b) Create a new script wrapper for the given script class -
Method Summary
Modifier and TypeMethodDescriptionvoid
Notification that the eventsProcessed() functionality should be called on the script code now.void
initialize
(VRMLScriptNodeType node) Initialise the underlying script, based on the surrounding node's details.boolean
Call the prepareEvents() method on the script, if it has one.void
queueEvent
(int type, String name, boolean value) Queue a changed SFBool event value ready for processing by the script.void
queueEvent
(int type, String name, boolean[] value, int numValid) Queue a changed MFBool event value ready for processing by the script.void
queueEvent
(int type, String name, double value) Queue a changed SFTime event value ready for processing by the script.void
queueEvent
(int type, String name, double[] value, int numValid) Queue a changed MFTime or MFDouble event value ready for processing by the script.void
queueEvent
(int type, String name, float value) Queue a changed SFFloat event value ready for processing by the script.void
queueEvent
(int type, String name, float[] value, int numValid) Queue a changed event value ready for processing by the script.void
queueEvent
(int type, String name, int value) Queue a changed SFInt32 event value ready for processing by the script.void
queueEvent
(int type, String name, int[] value, int numValid) Queue a changed MFInt32 event value ready for processing by the script.void
queueEvent
(int type, String name, long value) Queue a changed SFLong event value ready for processing by the script.void
queueEvent
(int type, String name, long[] value, int numValid) Queue a changed MFLong event value ready for processing by the script.void
queueEvent
(int type, String name, String value) Queue a changed SFString event value ready for processing by the script.void
queueEvent
(int type, String name, String[] value, int numValid) Queue a changed MFString event value ready for processing by the script.void
queueEvent
(int type, String name, VRMLNodeType value) Queue a changed SFNode event value ready for processing by the script.void
queueEvent
(int type, String name, VRMLNodeType[] value, int numValid) Queue a changed MFNode event value ready for processing by the script.boolean
Send the events to the real script now, and then call eventsProcessed.void
setTimestamp
(double time) Set the timestamp that we shall start the next queue with.void
shutdown()
Called when the Script node is deleted.void
Process the eventOuts of the script now.
-
Constructor Details
-
VRML97ScriptWrapper
Create a new script wrapper for the given script class- Parameters:
sc
- The script that this class is wrappingb
-- Throws:
IllegalArgumentException
- Either of the arguments was null
-
-
Method Details
-
initialize
Initialise the underlying script, based on the surrounding node's details.- Specified by:
initialize
in interfaceScriptWrapper
- Parameters:
node
- The working node from the live scene graph
-
setTimestamp
public void setTimestamp(double time) Set the timestamp that we shall start the next queue with.- Specified by:
setTimestamp
in interfaceScriptWrapper
- Parameters:
time
- The timestamp to use (in seconds)
-
prepareEvents
public boolean prepareEvents()Call the prepareEvents() method on the script, if it has one. If it does not, this becomes a no-op. Return true if something executed and therefore we need to check on further events being sent.- Specified by:
prepareEvents
in interfaceScriptWrapper
- Returns:
- true if something executed
-
queueEvent
Queue a changed SFInt32 event value ready for processing by the script.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the field
-
queueEvent
Queue a changed MFInt32 event value ready for processing by the script.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the fieldnumValid
- The number of valid values to copy from the array
-
queueEvent
Queue a changed SFLong event value ready for processing by the script. Not used as VRML97 does not support these types.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the field
-
queueEvent
Queue a changed MFLong event value ready for processing by the script. Not used as VRML97 does not support these types.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the fieldnumValid
- The number of valid values to copy from the array
-
queueEvent
Queue a changed SFBool event value ready for processing by the script.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the field
-
queueEvent
Queue a changed MFBool event value ready for processing by the script. Not used as VRML97 does not have MFBool.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the fieldnumValid
- The number of valid values to copy from the array
-
queueEvent
Queue a changed SFFloat event value ready for processing by the script.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the field
-
queueEvent
Queue a changed event value ready for processing by the script. Used to set SFColor, SFRotation, SFVec2f, SFVec3f or MFFloat fields- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the fieldnumValid
- The number of valid values to copy from the array
-
queueEvent
Queue a changed SFTime event value ready for processing by the script.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the field
-
queueEvent
Queue a changed MFTime or MFDouble event value ready for processing by the script. Not used as VRML97 does not support these types.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the fieldnumValid
- The number of valid values to copy from the array
-
queueEvent
Queue a changed SFString event value ready for processing by the script.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the field
-
queueEvent
Queue a changed MFString event value ready for processing by the script.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the fieldnumValid
- The number of valid values to copy from the array
-
queueEvent
Queue a changed SFNode event value ready for processing by the script.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the field
-
queueEvent
Queue a changed MFNode event value ready for processing by the script.- Specified by:
queueEvent
in interfaceScriptWrapper
- Parameters:
type
- The type of field to processname
- The field name to processvalue
- The new value of the fieldnumValid
- The number of valid values to copy from the array
-
sendEvents
public boolean sendEvents()Send the events to the real script now, and then call eventsProcessed.- Specified by:
sendEvents
in interfaceScriptWrapper
- Returns:
- true One or more output events nee to be sent
-
updateEventOuts
public void updateEventOuts()Process the eventOuts of the script now. It should do that by calling setValue() on the script node instance passed in as part of the the initialize() method.- Specified by:
updateEventOuts
in interfaceScriptWrapper
-
eventsProcessed
public void eventsProcessed()Notification that the eventsProcessed() functionality should be called on the script code now.- Specified by:
eventsProcessed
in interfaceScriptWrapper
-
shutdown
public void shutdown()Called when the Script node is deleted. We free everything here to allow the GC to do its magic.- Specified by:
shutdown
in interfaceScriptWrapper
-