Class MFNode
java.lang.Object
org.web3d.vrml.scripting.ecmascript.builtin.FieldScriptableObject
org.web3d.vrml.scripting.ecmascript.builtin.NodeFieldObject
org.web3d.vrml.scripting.ecmascript.builtin.MFNode
- All Implemented Interfaces:
org.mozilla.javascript.Scriptable
MFNode field object.
- Version:
- $Revision: 1.28 $
- 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
ConstructorsConstructorDescriptionMFNode()
Default public constructor required by Rhino for when created by an Ecmascript call.Construct a field based on an array of SFNode objects.MFNode
(VRMLNodeType parent, int fieldIndex, VRMLNodeType[] nodes, int numValid) Construct a field based on the given array of data (sourced from a node). -
Method Summary
Modifier and TypeMethodDescriptionget
(int index, org.mozilla.javascript.Scriptable start) Get the value of the named function.Get the list of fields that have changed.Get the underlying nodes that this object represents.boolean
has
(int index, org.mozilla.javascript.Scriptable start) boolean
boolean
Query this field object to see if it has changed since the last time this method was called.boolean
Check to see if there are a local changes to this node instance.static org.mozilla.javascript.Scriptable
jsConstructor
(org.mozilla.javascript.Context cx, Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr) Constructor for a new Rhino objectboolean
jsFunction_equals
(Object val) Comparison of this object to another of the same type.Creates a string version of this node.void
Sets a property based on the index.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()
Return the string representation of the node value.void
updateRawData
(VRMLNodeType[] nodes, int numValid) Update the node's raw data from the underlying model.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, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, hasInstance, locateFunction, registerFunction, setParentScope, setPrototype, setReadOnly, setScriptField
-
Constructor Details
-
MFNode
public MFNode()Default public constructor required by Rhino for when created by an Ecmascript call. -
MFNode
Construct a field based on the given array of data (sourced from a node). May be constructed with a null array reference to indicate a field that contains no values.- Parameters:
parent
- The parent node of this fieldfieldIndex
- The index of the field that this field wrapsnodes
- The list of nodes to use or nullnumValid
- The number of valid values to copy from the array The number of valid nodes to use from the array
-
MFNode
Construct a field based on an array of SFNode objects.- Parameters:
args
- the objects
-
-
Method Details
-
jsConstructor
public static org.mozilla.javascript.Scriptable jsConstructor(org.mozilla.javascript.Context cx, Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr) Constructor for a new Rhino object- Parameters:
cx
-args
-ctorObj
-inNewExpr
-- Returns:
- MFNode result
-
has
public boolean has(int index, org.mozilla.javascript.Scriptable start) - Specified by:
has
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
has
in classFieldScriptableObject
-
has
- Specified by:
has
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
has
in classFieldScriptableObject
-
get
- Specified by:
get
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
get
in classFieldScriptableObject
-
get
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
Sets a property based on the index. According to C.6.13.1 if the index is greater than the current number of nodes, expand the size by one and add the new value to the end.- Specified by:
put
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
put
in classFieldScriptableObject
- Parameters:
index
- The index of the property to setstart
- The object who's property is being setvalue
- The value being requested
-
put
Sets the named property with a new value. We don't allow the users to dynamically change the length property of this node. That would cause all sorts of problems. Therefore it is read-only as far as this implementation is concerned.- 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
-
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.
-
toString
-
hasLocalChanges
public boolean hasLocalChanges()Check to see if there are a local changes to this node instance. This call is for the convenience of the X3D Browser/Scene objects so they can tell when the local and should be called before any of the normal methods. It will clear the local change flag as part of the- Returns:
- true if there are a local changes to this node instance
-
updateRawData
Update the node's raw data from the underlying model. If this wrapper has a local changed copy of the data that has not yet been committed to the underlying model, this request is ignored and the current data stays.- Parameters:
nodes
- The list of nodes to update herenumValid
- The number of valid values to copy from the array The number of valid nodes to use from the array
-
getRawData
Get the underlying nodes that this object represents. If there are no referenced node then a zero length array is returned.- Returns:
- The node references
-