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, parentNodeFields inherited from class org.web3d.vrml.scripting.ecmascript.builtin.FieldScriptableObject
BAD_FORMAT_MSG, dataChanged, INVALID_TYPE_MSG, readOnly, READONLY_MSG, scriptFieldFields 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.booleanhas(int index, org.mozilla.javascript.Scriptable start) booleanbooleanQuery this field object to see if it has changed since the last time this method was called.booleanCheck to see if there are a local changes to this node instance.static org.mozilla.javascript.ScriptablejsConstructor(org.mozilla.javascript.Context cx, Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr) Constructor for a new Rhino objectbooleanjsFunction_equals(Object val) Comparison of this object to another of the same type.Creates a string version of this node.voidSets a property based on the index.voidSets the named property with a new value.voidrealize()If the node contains a node instance, check and call its setupFinished if needed.toString()Return the string representation of the node value.voidupdateRawData(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
setParentFieldMethods 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:
hasin interfaceorg.mozilla.javascript.Scriptable- Overrides:
hasin classFieldScriptableObject
-
has
- Specified by:
hasin interfaceorg.mozilla.javascript.Scriptable- Overrides:
hasin classFieldScriptableObject
-
get
- Specified by:
getin interfaceorg.mozilla.javascript.Scriptable- Overrides:
getin 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:
getin interfaceorg.mozilla.javascript.Scriptable- Overrides:
getin 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:
putin interfaceorg.mozilla.javascript.Scriptable- Overrides:
putin 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:
putin interfaceorg.mozilla.javascript.Scriptable- Overrides:
putin 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 singleNodeFieldDatainstance or anArrayListof 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:
getChangedFieldsin classNodeFieldObject- Returns:
- A single
NodeFieldData,ArrayListor null
-
realize
public void realize()If the node contains a node instance, check and call its setupFinished if needed.- Specified by:
realizein 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:
hasChangedin 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
-