Class AbstractNode
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
- All Implemented Interfaces:
VRMLNode
,FrameStateListener
,VRMLNodeType
- Direct Known Subclasses:
BaseAnnotation
,BaseAnnotationTarget
,BaseAppearance
,BaseArc2D
,BaseBindableNode
,BaseBooleanFilter
,BaseBooleanToggle
,BaseBooleanTrigger
,BaseBox
,BaseCADFace
,BaseClipPlane
,BaseCollidableNode
,BaseCollisionCollection
,BaseCollisionSpace
,BaseComponentGeometryNode
,BaseCone
,BaseContact
,BaseContour2D
,BaseContourPolyline2D
,BaseCustomViewport
,BaseCylinder
,BaseDISEntityManager
,BaseDISEntityTypeMapping
,BaseDisk2D
,BaseElevationGrid
,BaseEmitter
,BaseExtrusion
,BaseFillProperties
,BaseFixedViewport
,BaseFontStyle
,BaseGeoElevationGrid
,BaseGeoMetadata
,BaseGeometricPropertyNode
,BaseGeoOrigin
,BaseGeoReferenceSurfaceInfo
,BaseGeoSRFParametersInfoNode
,BaseGeoSRFParametersNode
,BaseGeoSRFTParametersNode
,BaseGroupingNode
,BaseHAnimHumanoid
,BaseHIDSensor
,BaseInline
,BaseIntegerTrigger
,BaseInterpolatorNode
,BaseJointNode
,BaseLayer
,BaseLayer2D
,BaseLayerSet
,BaseLightNode
,BaseLineProperties
,BaseLocalFog
,BaseMaterial
,BaseMetadataObjectNode
,BaseMidiSource
,BaseMultiTextureTransform
,BaseNurbsCurve
,BaseNurbsCurve2D
,BaseNurbsPatchSurface
,BaseNurbsTrimmedSurface
,BaseOverlay
,BaseParticleSystem
,BasePhysicsModel
,BasePointProperties
,BasePolyline2D
,BasePolypoint2D
,BaseProportionalViewport
,BaseRectangle2D
,BaseRigidBody
,BaseRigidBodyCollection
,BaseScreenMarker
,BaseSensorNode
,BaseSequencerNode
,BaseShape
,BaseSolidBREP
,BaseSound
,BaseSphere
,BaseStaticGroup
,BaseSurfaceChildNode
,BaseSurfaceChildNode
,BaseText
,BaseTextureNode
,BaseTextureProperties
,BaseTextureTransform
,BaseTextureTransform3D
,BaseTimeDependentNode
,BaseTimeTrigger
,BaseTriangleSet2D
,BaseTwoSidedMaterial
,BaseWorldInfo
,BaseWorldRoot
,NRNode
Base node for all implementations that define their own field handling.
Each node will keep its own fieldDeclarations and fieldMaps. These will be created in a static constructor so only one copy per class will be created.
Each node will maintain its own LAST_*_INDEX which tells others what the last field declared by this node.
Internationalisation Resource Names
- vrmlMetaMsg: Error when someone attempts to set meta data objects in in a VRML97 scene.
- badNodeCopyMsg: Attempting to copy a node that doesn't have the right type match.
- defSetTimingMsg: Caller attempting to set the DEF name for this node after it has been realised.
- noLayerRefMsg: In doing our layer reference counting, the caller gave us an unknown layer ID
- invalidNodeMsg: The node given is not a node of the required type. The message is dynamically generated with the node type given as an argument to the generation method.
- invalidProtoMsg: The proto given is not a node of the required type. The message is dynamically generated with the node type given as an argument to the generation method.
- readOnlyWriteMsg: Attempting to write to an initializeOnly/field field after the node has been realised.
- outputOnlyWriteMsg: Attempting to write to an outputOnly/eventOut field
- inputOnlyWriteMsg: Attempting to write to an inputOnly/eventIn field before the node has been realised.
- Version:
- $Revision: 1.32 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.j3d.util.ErrorReporter
Reporter instance for handing out errorsstatic final int
The field index for the metadata node fieldprotected final ThreadLocal
<VRMLFieldData> Scratch class var for returning field data.protected boolean[]
hasChanged flags for fieldsprotected boolean
Is this node still being setup/parsed.protected boolean
Flag indicating this is a DEF nodeprotected boolean
Flag for the node being staticstatic final int
The last field index used by this classprotected int[]
The list of layer IDs that reference this node.protected final String
The name of this nodeprotected VRMLProtoInstance
proto representation of the metadata nodeprotected int[]
The current number of references to this node.protected int[]
The list of IDs that have been marked as being removed.protected FrameStateManager
State manager for propagating updatesstatic final boolean
Is the scene graph staticprotected VRMLNodeType
SFNode metadata NULLprotected int
The major version of the spec this instance belongs to.protected int
The minor version of the spec this instance belongs to. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractNode
(String name) Create a new instance of this node with the given node type name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener to this node instance.void
Notification that the rendering of the event model is complete and that rendering is about to begin.protected void
checkNodeType
(VRMLNodeType node) Check to see if the supplied node type is the same as this node.protected static void
checkSecondaryType
(VRMLNodeType instance, int[] type, String msg) Verify that one of a protoInstance's secondary type is one of the supplied types.protected static void
checkSecondaryType
(VRMLNodeType instance, int type, String msg) Verify that one of a protoInstance's secondary type is the supplied type.void
Clear the current removed layer ID list.protected void
fireFieldChanged
(int index) Send a notification to the registered listeners that a field has been changed.getFieldValue
(int index) Get the value of a field.int[]
Get a listing of the current layer IDs that are directly or indirectly referencing this node.Get the currently registered metadata object instance.int
getRefCount
(int layer) Ask for the current number of references to this object in the given layer.int[]
Get the list of layer IDs that this node has just been removed from.int[]
Get the secondary types of this node.getUserData
(int index) Fetch the stored user data for a given field index.Get the name of this node as a string.boolean
hasFieldChanged
(int index) Check to see if the given field has changed since we last checked.boolean
isDEF()
Check to see if this node has been DEFd.boolean
Check to see if setupFinished() has already been called on this node.void
notifyExternProtoLoaded
(int index, VRMLNodeType node) Notify a node that an ExternProto has resolved.void
Remove a listener from this node instance.void
sendRoute
(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.void
setDEF()
Notify this node that is has been DEFd.void
setErrorReporter
(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the node's internals can be reported in a nice, pretty fashion.void
Tell the node about the frame registration state manager to use.void
Set the X3DMetadataObject that is associated with this node.void
Notification that the construction phase of this node has finished.void
setUserData
(int index, Object data) Set arbitrary data for a given field.void
setValue
(int index, boolean value) Set the value of the field at the given index as an boolean.void
setValue
(int index, boolean[] value, int numValid) Set the value of the field at the given index as an array of boolean.void
setValue
(int index, double value) Set the value of the field at the given index as an double.void
setValue
(int index, double[] value, int numValid) Set the value of the field at the given index as an array of doubles.void
setValue
(int index, float value) Set the value of the field at the given index as a float.void
setValue
(int index, float[] value, int numValid) Set the value of the field at the given index as an array of floats.void
setValue
(int index, int value) Set the value of the field at the given index as an integer.void
setValue
(int index, int[] value, int numValid) Set the value of the field at the given index as an array of integers.void
setValue
(int index, long value) Set the value of the field at the given index as an long.void
setValue
(int index, long[] value, int numValid) Set the value of the field at the given index as an array of longs.void
Set the value of the field at the given index as a string.void
Set the value of the field at the given index as an array of strings.void
setValue
(int index, VRMLNodeType child) Set the value of the field at the given index as a node.void
setValue
(int index, VRMLNodeType[] children, int numValid) Set the value of the field at the given index as an array of nodes.void
setVersion
(int major, int minor, boolean isStatic) Set the version of VRML that this node should represent.protected void
throwInitOnlyWriteException
(String fieldName) Generate an error message for attempting to write an initOnly field after setup has finished.protected void
throwInputOnlyWriteException
(String fieldName) Generate an error message for attempting to write an inputOnly field before setup has finished.protected void
throwInvalidNodeException
(String nodeName) Generate an error message for the node type not being of the right type that is requested.protected void
throwInvalidProtoException
(String protoName) Generate an error message for the proto type not being of the right type that is requested.protected void
throwOutputOnlyWriteException
(String fieldName) Generate an error message for attempting to write an outputOnly field.void
updateRefCount
(int layer, boolean add) Change the reference count up or down by one for a given layer ID.protected void
updateRefs
(VRMLNodeType node, boolean add) Internal convenience method to update references on the given child node of the current node.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.web3d.vrml.lang.VRMLNode
getFieldDeclaration, getFieldIndex, getNodeFieldIndices, getNumFields, getPrimaryType
-
Field Details
-
FIELD_METADATA
public static final int FIELD_METADATAThe field index for the metadata node field- See Also:
-
LAST_NODE_INDEX
public static final int LAST_NODE_INDEXThe last field index used by this class- See Also:
-
STATIC_SCENE_GRAPH
public static final boolean STATIC_SCENE_GRAPHIs the scene graph static -
nodeName
The name of this node -
fieldLocalData
Scratch class var for returning field data. Assigned at construction. -
errorReporter
protected org.j3d.util.ErrorReporter errorReporterReporter instance for handing out errors -
hasChanged
protected boolean[] hasChangedhasChanged flags for fields -
inSetup
protected boolean inSetupIs this node still being setup/parsed. Cleared by setupFinished -
isDEF
protected boolean isDEFFlag indicating this is a DEF node -
isStatic
protected boolean isStaticFlag for the node being static -
vrmlMajorVersion
protected int vrmlMajorVersionThe major version of the spec this instance belongs to. -
vrmlMinorVersion
protected int vrmlMinorVersionThe minor version of the spec this instance belongs to. -
stateManager
State manager for propagating updates -
refCounts
protected int[] refCountsThe current number of references to this node. This is for informational purposes only and should never be touched by derived classes. -
layerIds
protected int[] layerIdsThe list of layer IDs that reference this node. Should correspond 1:1 to the counts inrefCounts
. If none, this is null. -
removedLayerIds
protected int[] removedLayerIdsThe list of IDs that have been marked as being removed. -
vfMetadata
SFNode metadata NULL -
pMetadata
proto representation of the metadata node
-
-
Constructor Details
-
AbstractNode
Create a new instance of this node with the given node type name. inSetup will be set to true and isDEF set to false.- Parameters:
name
- The name of the type of node
-
-
Method Details
-
allEventsComplete
public void allEventsComplete()Description copied from interface:FrameStateListener
Notification that the rendering of the event model is complete and that rendering is about to begin. If the node needs to update itself for this frame, it should do so now before the render pass takes place.- Specified by:
allEventsComplete
in interfaceFrameStateListener
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Description copied from interface:VRMLNode
Register an error reporter with the engine so that any errors generated by the node's internals can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.- Specified by:
setErrorReporter
in interfaceVRMLNode
- Parameters:
reporter
- The instance to use or null
-
getVRMLNodeName
Description copied from interface:VRMLNode
Get the name of this node as a string.- Specified by:
getVRMLNodeName
in interfaceVRMLNode
- Returns:
- The name of the node
-
isDEF
-
getSecondaryType
public int[] getSecondaryType()Description copied from interface:VRMLNode
Get the secondary types of this node. Replaces the instanceof mechanism for use in switch statements. If there are no secondary types, it will return a zero-length array.- Specified by:
getSecondaryType
in interfaceVRMLNode
- Returns:
- The secondary type
-
setVersion
public void setVersion(int major, int minor, boolean isStatic) Description copied from interface:VRMLNode
Set the version of VRML that this node should represent. Different versions have different capabilities, even within the same node.- Specified by:
setVersion
in interfaceVRMLNode
- Parameters:
major
- The major version number of this sceneminor
- The minor version number of this sceneisStatic
- true if this node is under a StaticGroup and won't change after the setup is finished
-
setUserData
Description copied from interface:VRMLNode
Set arbitrary data for a given field. Provided primarily to help the EAI fulfill its requirements, but may be useful elsewhere.- Specified by:
setUserData
in interfaceVRMLNode
- Parameters:
index
- The index of destination field to setdata
- The item to store for the field- Throws:
InvalidFieldException
- The field index is not known
-
getUserData
Description copied from interface:VRMLNode
Fetch the stored user data for a given field index. If nothing is registered, null is returned.- Specified by:
getUserData
in interfaceVRMLNode
- Parameters:
index
- The index of destination field to set- Returns:
- The item stored for the field or null
- Throws:
InvalidFieldException
- The field index is not known
-
setMetadataObject
Description copied from interface:VRMLNodeType
Set the X3DMetadataObject that is associated with this node.- Specified by:
setMetadataObject
in interfaceVRMLNodeType
- Parameters:
data
- The node to register as the metadata- Throws:
InvalidFieldValueException
- The object instance provided does not implement VRMLMetadataNodeType or is not a proto instance that encapsulates it as it's primary type
-
getMetadataObject
Description copied from interface:VRMLNodeType
Get the currently registered metadata object instance. If none is set then return null.- Specified by:
getMetadataObject
in interfaceVRMLNodeType
- Returns:
- The current metadata object or null
-
isSetupFinished
public boolean isSetupFinished()Description copied from interface:VRMLNodeType
Check to see if setupFinished() has already been called on this node.- Specified by:
isSetupFinished
in interfaceVRMLNodeType
- Returns:
- true if setupFinished() has been called
-
setupFinished
public void setupFinished()Description copied from interface:VRMLNodeType
Notification that the construction phase of this node has finished. If the node would like to do any internal processing, such as setting up geometry, then go for it now. It is then responsible for calling its children's setupFinished.- Specified by:
setupFinished
in interfaceVRMLNodeType
-
setDEF
public void setDEF()Description copied from interface:VRMLNodeType
Notify this node that is has been DEFd. This method shall only be called before setupFinished(). It is an error to call it any other time. It is also guaranteed that this call will be made after construction, but before any of the setValue() methods have been called.- Specified by:
setDEF
in interfaceVRMLNodeType
-
getRefCount
public int getRefCount(int layer) Description copied from interface:VRMLNodeType
Ask for the current number of references to this object in the given layer. If this node represents a layer node itself, then the value returned for that ID should always be one. If the layer requested does not have a reference to this node, return zero.- Specified by:
getRefCount
in interfaceVRMLNodeType
- Parameters:
layer
- The id of the layer to get the ref count for- Returns:
- The number of references to this node
-
updateRefCount
public void updateRefCount(int layer, boolean add) Description copied from interface:VRMLNodeType
Change the reference count up or down by one for a given layer ID. If there is no reference to the given layer ID previously, add one now. A listing of the layer IDs that reference this node can be retrieved throughVRMLNodeType.getLayerIds()
.- Specified by:
updateRefCount
in interfaceVRMLNodeType
- Parameters:
layer
- The id of the layer to modify the ref count onadd
- true to increment the reference count, false to decrement
-
getLayerIds
public int[] getLayerIds()Description copied from interface:VRMLNodeType
Get a listing of the current layer IDs that are directly or indirectly referencing this node. If this layer is not part of a live scene graph (eg held by a script code, but not by the script itself) then this will will return a null value. The array will always be exactly equal in length to the number of IDs that reference this node.- Specified by:
getLayerIds
in interfaceVRMLNodeType
- Returns:
- An array of all the IDs referencing this node or null if none
-
getRemovedLayerIds
public int[] getRemovedLayerIds()Description copied from interface:VRMLNodeType
Get the list of layer IDs that this node has just been removed from. If it currently has not been removed from anything, this will return null. This will remain updated until the nextVRMLNodeType.clearRemovedLayerIds()
call.- Specified by:
getRemovedLayerIds
in interfaceVRMLNodeType
- Returns:
- An array of all the IDs this is delete from or null if none
-
clearRemovedLayerIds
public void clearRemovedLayerIds()Description copied from interface:VRMLNodeType
Clear the current removed layer ID list. If there is nothing removed, this method does nothing.- Specified by:
clearRemovedLayerIds
in interfaceVRMLNodeType
-
setFrameStateManager
Description copied from interface:VRMLNodeType
Tell the node about the frame registration state manager to use. If the manager is not useful for this node, ignore the call. A value of null will clear the manager, but that will only happen during a dispose. After the setup process has finished a node may assume that it will always have a valid pointer to this node.- Specified by:
setFrameStateManager
in interfaceVRMLNodeType
- Parameters:
mgr
- The manager instance to use
-
hasFieldChanged
public boolean hasFieldChanged(int index) Description copied from interface:VRMLNodeType
Check to see if the given field has changed since we last checked. Calling this method will set the flag back to "not changed" so that two consecutive reads after a changed value would result in a true and then false being returned. If the field number is not recognized for this node then this returns false.- Specified by:
hasFieldChanged
in interfaceVRMLNodeType
- Parameters:
index
- The index of the field to change- Returns:
- true if the field has changed since last read
-
sendRoute
Description copied from interface:VRMLNodeType
Send a routed value from this node to the given destination node. The route should use the appropriate setValue() method of the destination node. It should not attempt to cast the node up to a higher level. Routing should also follow the standard rules for the loop breaking and other appropriate rules for the specification.- Specified by:
sendRoute
in interfaceVRMLNodeType
- Parameters:
time
- The time that this route occurred (not necessarily epoch time. Should be treated as a relative value only)srcIndex
- The index of the field in this node that the value should be sent fromdestNode
- The node reference that we will be sending the value todestIndex
- The index of the field in the destination node that the value should be sent to.
-
addNodeListener
Description copied from interface:VRMLNodeType
Add a listener to this node instance. If the listener is already added or null the request is silently ignored.- Specified by:
addNodeListener
in interfaceVRMLNodeType
- Parameters:
l
- The listener instance to add
-
removeNodeListener
Description copied from interface:VRMLNodeType
Remove a listener from this node instance. If the listener is null or not registered, the request is silently ignored.- Specified by:
removeNodeListener
in interfaceVRMLNodeType
- Parameters:
l
- The listener to be removed
-
getFieldValue
Description copied from interface:VRMLNodeType
Get the value of a field. If the field is a primitive type, it will return a class representing the value. For arrays or nodes it will return the instance directly.- Specified by:
getFieldValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of the field to change.- Returns:
- The class representing the field value
- Throws:
InvalidFieldException
- The field index is not known
-
setValue
public void setValue(int index, int value) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an integer. This would be used to set SFInt32 field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, int[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an array of integers. This would be used to set MFInt32 field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the nodenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, boolean value) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an boolean. This would be used to set SFBool field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, boolean[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an array of boolean. This would be used to set MFBool field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the nodenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, float value) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as a float. This would be used to set SFFloat field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, float[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an array of floats. This would be used to set MFFloat, SFVec2f, SFVec3f and SFRotation field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the nodenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, long value) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an long. This would be used to set SFTime field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, long[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an array of longs. This would be used to set MFTime field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the nodenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, double value) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an double. This would be used to set SFDouble field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, double[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an array of doubles. This would be used to set MFDouble, SFVec2d and SFVec3d field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the nodenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, String value) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as a string. This would be used to set SFString field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, String[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an array of strings. This would be used to set MFString field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the nodenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this fieldInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, VRMLNodeType child) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as a node. This would be used to set SFNode field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setchild
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided does not fit this type of nodeInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, VRMLNodeType[] children, int numValid) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Description copied from interface:VRMLNodeType
Set the value of the field at the given index as an array of nodes. This would be used to set MFNode field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Parameters:
index
- The index of destination field to setchildren
- The new value to use for the nodenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided does not fit this type of nodeInvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
notifyExternProtoLoaded
Description copied from interface:VRMLNodeType
Notify a node that an ExternProto has resolved. This will verify the objects type and add it to the render sceneGraph.- Specified by:
notifyExternProtoLoaded
in interfaceVRMLNodeType
- Parameters:
index
- The field indexnode
- The node resolved- Throws:
InvalidFieldValueException
- If the proto contains he wrong type
-
fireFieldChanged
protected void fireFieldChanged(int index) Send a notification to the registered listeners that a field has been changed. If no listeners have been registered, then this does nothing, so always call it regardless.- Parameters:
index
- The index of the field that changed
-
checkNodeType
Check to see if the supplied node type is the same as this node. It does a case sensitive string comparison based on their node name. If they are not the same then an IllegalArgumentException is thrown. If the same, nothing happens.- Parameters:
node
- The node to check- Throws:
IllegalArgumentException
- The nodes are not the same
-
checkSecondaryType
Verify that one of a protoInstance's secondary type is the supplied type. This method will throw an InvalidFieldValueException if its not the right type.- Parameters:
instance
- The proto instancetype
- The type to check formsg
- The error to message for the InvalidFieldValueException thrown- Throws:
InvalidFieldValueException
- if its not the right type
-
checkSecondaryType
Verify that one of a protoInstance's secondary type is one of the supplied types. This method will throw an InvalidFieldValueException if its not the right type.- Parameters:
instance
- The proto instancetype
- The types to check formsg
- The error to message for the InvalidFieldValueException thrown- Throws:
InvalidFieldValueException
- if its not the right type
-
throwInvalidNodeException
Generate an error message for the node type not being of the right type that is requested. The type is passed in as a string and substituted in to the right place in the internationalised string.- Parameters:
nodeName
- The type name string for the node to complain about- Throws:
InvalidFieldValueException
- Always throws this as a response to this method call
-
throwInvalidProtoException
Generate an error message for the proto type not being of the right type that is requested. The type is passed in as a string and substituted in to the right place in the internationalised string.- Parameters:
protoName
- The type name string for the proto to complain about- Throws:
InvalidFieldValueException
- Always throws this as a response to this method call
-
throwInitOnlyWriteException
Generate an error message for attempting to write an initOnly field after setup has finished.- Parameters:
fieldName
- name of the field that we are complaining about- Throws:
InvalidFieldAccessException
- Always throws this as a response to this method call
-
throwInputOnlyWriteException
Generate an error message for attempting to write an inputOnly field before setup has finished.- Parameters:
fieldName
- name of the field that we are complaining about- Throws:
InvalidFieldAccessException
- Always throws this as a response to this method call
-
throwOutputOnlyWriteException
Generate an error message for attempting to write an outputOnly field.- Parameters:
fieldName
- name of the field that we are complaining about- Throws:
InvalidFieldAccessException
- Always throws this as a response to this method call
-
updateRefs
Internal convenience method to update references on the given child node of the current node.- Parameters:
node
- The child node of this group to send updates toadd
- true if this is adding a new reference, false for delete
-