Package org.web3d.vrml.scripting.sai
Class JavaSAIScriptWrapper
java.lang.Object
org.web3d.vrml.scripting.sai.JavaSAIScriptWrapper
- All Implemented Interfaces:
FieldAccessListener
,ScriptWrapper
A wrapper class used to convert between the Xj3D implementation specific
details and the X3D spec requirements for a script.
Note that as this class does not wrap VRML97 scripts, the class does not need to take an instance of VRMLScriptNodeType as we cannot change the field listing dynamically.
- Version:
- $Revision: 1.20 $
- Author:
- Justin Couch
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new script wrapper for the given script class -
Method Summary
Modifier and TypeMethodDescriptionvoid
childRequiresAccessStateChange
(boolean state) Notify that the child field now requires access to be valid or not valid as the case may be from the various flags.void
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
-
JavaSAIScriptWrapper
Create a new script wrapper for the given script class- Parameters:
sc
- The script that this class is wrapping
-
-
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 if events were processed this time around
-
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
-
childRequiresAccessStateChange
public void childRequiresAccessStateChange(boolean state) Notify that the child field now requires access to be valid or not valid as the case may be from the various flags.- Specified by:
childRequiresAccessStateChange
in interfaceFieldAccessListener
- Parameters:
state
- true if access should be currently valid.
-