Class BaseMetadataObjectNode
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.BaseMetadataObjectNode
- All Implemented Interfaces:
VRMLNode
,FrameStateListener
,VRMLMetadataObjectNodeType
,VRMLNodeType
- Direct Known Subclasses:
BaseMetadataBoolean
,BaseMetadataDouble
,BaseMetadataFloat
,BaseMetadataInteger
,BaseMetadataSet
,BaseMetadataString
public abstract class BaseMetadataObjectNode
extends AbstractNode
implements VRMLMetadataObjectNodeType
An abstract implementation of any node that uses component nodes to provide
coordinate, normal and texture information.
- Version:
- $Revision: 1.3 $
- Author:
- =Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
Index of the name fieldprotected static final int
Index of the reference fieldprotected static final int
The last field index used by this classprotected String
exposedField SFString name ""protected String
exposedField SFString reference ""Fields inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
errorReporter, FIELD_METADATA, fieldLocalData, hasChanged, inSetup, isDEF, isStatic, LAST_NODE_INDEX, layerIds, nodeName, pMetadata, refCounts, removedLayerIds, stateManager, STATIC_SCENE_GRAPH, vfMetadata, vrmlMajorVersion, vrmlMinorVersion
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseMetadataObjectNode
(String name) Construct a default instance of this class with the bind flag set to false and no time information set (effective value of zero). -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Copy the values of the metadata node into this node.getFieldValue
(int index) Get the value of a field.getName()
Get the currently set name associated with this metadata object.int
Get the primary type of this node.Get the currently set reference associated with this metadata object.void
sendRoute
(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.void
Set the name value for the metadata object.void
setReference
(String reference) Set the reference value for the metadata object.void
Set the value of the field at the given index as an array of strings.Methods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, allEventsComplete, checkNodeType, checkSecondaryType, checkSecondaryType, clearRemovedLayerIds, fireFieldChanged, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, getSecondaryType, getUserData, getVRMLNodeName, hasFieldChanged, isDEF, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setupFinished, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, throwInitOnlyWriteException, throwInputOnlyWriteException, throwInvalidNodeException, throwInvalidProtoException, throwOutputOnlyWriteException, updateRefCount, updateRefs
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
-
Field Details
-
FIELD_NAME
protected static final int FIELD_NAMEIndex of the name field- See Also:
-
FIELD_REFERENCE
protected static final int FIELD_REFERENCEIndex of the reference field- See Also:
-
LAST_METADATA_INDEX
protected static final int LAST_METADATA_INDEXThe last field index used by this class- See Also:
-
vfName
exposedField SFString name "" -
vfReference
exposedField SFString reference ""
-
-
Constructor Details
-
BaseMetadataObjectNode
Construct a default instance of this class with the bind flag set to false and no time information set (effective value of zero).- Parameters:
name
- The name of the type of node
-
-
Method Details
-
copy
Copy the values of the metadata node into this node.- Parameters:
node
- The node to copy details from
-
getName
Get the currently set name associated with this metadata object. If none is set, this returns null.- Specified by:
getName
in interfaceVRMLMetadataObjectNodeType
- Returns:
- The current name
-
setName
Set the name value for the metadata object. Use null to clear the currently set name.- Specified by:
setName
in interfaceVRMLMetadataObjectNodeType
- Parameters:
name
- The name to use
-
getReference
Get the currently set reference associated with this metadata object. If none is set, this returns null.- Specified by:
getReference
in interfaceVRMLMetadataObjectNodeType
- Returns:
- The current reference
-
setReference
Set the reference value for the metadata object. Use null to clear the currently set reference.- Specified by:
setReference
in interfaceVRMLMetadataObjectNodeType
- Parameters:
reference
- The reference to use
-
getPrimaryType
public int getPrimaryType()Get the primary type of this node. Replaces the instanceof mechanism for use in switch statements.- Specified by:
getPrimaryType
in interfaceVRMLNode
- Returns:
- The primary type
-
getFieldValue
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
- Overrides:
getFieldValue
in classAbstractNode
- Parameters:
index
- The index of the field to change.- Returns:
- The class representing the field value
- Throws:
InvalidFieldException
- The field index is not known
-
sendRoute
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
- Overrides:
sendRoute
in classAbstractNode
- 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.
-
setValue
public void setValue(int index, String value) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as an array of strings. This would be used to set SFString field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Overrides:
setValue
in classAbstractNode
- 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 field
-