Class SFNode
java.lang.Object
org.web3d.vrml.scripting.ecmascript.builtin.FieldScriptableObject
org.web3d.vrml.scripting.ecmascript.builtin.NodeFieldObject
org.web3d.vrml.scripting.ecmascript.builtin.SFNode
- All Implemented Interfaces:
org.mozilla.javascript.Scriptable
,NodeImplSource
SFNode field object wrapper for ECMAScript.
The node implementation works by dynamically querying the underlying node for fields. Once it finds a field, it will cache the details internally. We do this because scripts generally tend to operate on only a few fields of a given node, but when they do, they access that field very regularly.
- Version:
- $Revision: 1.26 $
- Author:
- Justin Couch
-
Field Summary
Fields inherited from class org.web3d.vrml.scripting.ecmascript.builtin.NodeFieldObject
parentFieldIndex, parentNode
Fields inherited from class org.web3d.vrml.scripting.ecmascript.builtin.FieldScriptableObject
BAD_FORMAT_MSG, dataChanged, INVALID_TYPE_MSG, readOnly, READONLY_MSG, scriptField
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
-
Constructor Summary
ConstructorsConstructorDescriptionSFNode()
Default public constructor required by Rhino for when created by an Ecmascript call.Construct the class based on a real node.SFNode
(VRMLNodeType parent, int fieldIndex, VRMLNodeType n) Construct the class based on a real node. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares two objects for equality base on the components being the same.Get the value of the named function.Get the list of fields that have changed.Get the underlying node that this object represents.boolean
boolean
Query this field object to see if it has changed since the last time this method was called.void
jsConstructor
(String vrmlSyntax) boolean
jsFunction_equals
(Object val) Comparison of this object to another of the same type.Get the objects field declarations.Get the objects node nameCreates a string version of this node.void
Sets the named property with a new value.void
realize()
If the node contains a node instance, check and call its setupFinished if needed.toString()
Format the internal values of this field as a string.Methods inherited from class org.web3d.vrml.scripting.ecmascript.builtin.NodeFieldObject
setParentField
Methods inherited from class org.web3d.vrml.scripting.ecmascript.builtin.FieldScriptableObject
delete, delete, get, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, hasInstance, locateFunction, put, registerFunction, setParentScope, setPrototype, setReadOnly, setScriptField
-
Constructor Details
-
SFNode
public SFNode()Default public constructor required by Rhino for when created by an Ecmascript call. -
SFNode
Construct the class based on a real node.- Parameters:
n
- The node that this wraps
-
SFNode
Construct the class based on a real node.- Parameters:
parent
- The parent node of this fieldfieldIndex
- The index of the field that this field wrapsn
- The node that this wraps
-
-
Method Details
-
jsConstructor
-
has
- Specified by:
has
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
has
in classFieldScriptableObject
-
get
Description copied from class:FieldScriptableObject
Get the value of the named function. If no function object is registered for this name, the method will return null.- Specified by:
get
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
get
in classFieldScriptableObject
- Parameters:
name
- The variable namestart
- The object where the lookup began- Returns:
- the corresponding function object or null
-
put
Description copied from class:FieldScriptableObject
Sets the named property with a new value. A put usually means changing the entire property. So, if the property has changed using an operation likee = new SFVec3f(0, 1, 0);
then a whole new object is passed to us.- Specified by:
put
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
put
in classFieldScriptableObject
- Parameters:
name
- The name of the property to definestart
- The object who's property is being setvalue
- The value being requested
-
jsFunction_toString
Creates a string version of this node. Just calls the standard toString() method of the object.- Returns:
- A VRML string representation of the field
-
jsFunction_equals
Comparison of this object to another of the same type. Just calls the standard equals() method of the object.- Parameters:
val
- The value to compare to this object- Returns:
- true if the components of the object are the same
-
jsFunction_getNodeName
-
jsFunction_getFieldDefinitions
Get the objects field declarations.- Returns:
- The field declarations
-
getChangedFields
Get the list of fields that have changed. The return value may be either a singleNodeFieldData
instance or anArrayList
of field data instances if more than one has changed. When called, this is recursive so that all fields and nodes referenced by this node field will be included. If no fields have changed, this will return null. However, that should never happen as the user should always checkFieldScriptableObject.hasChanged()
which would return false before calling this method.- Specified by:
getChangedFields
in classNodeFieldObject
- Returns:
- A single
NodeFieldData
,ArrayList
or null
-
realize
public void realize()If the node contains a node instance, check and call its setupFinished if needed.- Specified by:
realize
in classNodeFieldObject
-
hasChanged
public boolean hasChanged()Query this field object to see if it has changed since the last time this method was called. In a single-threaded environment, calling this method twice should return true and then false (assuming that data had changed since the previous calls).- Overrides:
hasChanged
in classFieldScriptableObject
- Returns:
- true if the data has changed.
-
getImplNode
Get the underlying node that this object represents.- Specified by:
getImplNode
in interfaceNodeImplSource
- Returns:
- The node reference
-
toString
-
equals
-