Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.renderer.common.nodes
Class BaseMetadataObjectNode

java.lang.Object
  extended by org.web3d.vrml.renderer.common.nodes.AbstractNode
      extended by org.web3d.vrml.renderer.common.nodes.BaseMetadataObjectNode
All Implemented Interfaces:
VRMLNode, FrameStateListener, VRMLMetadataObjectNodeType, VRMLNodeType

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
protected static int FIELD_NAME
          Index of the name field
protected static int FIELD_REFERENCE
          Index of the reference field
protected static int LAST_METADATA_INDEX
          The last field index used by this class
protected  java.lang.String vfName
          exposedField SFString name ""
protected  java.lang.String vfReference
          exposedField SFString reference ""
 
Fields inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
BAD_NODE_MSG, errorReporter, FIELD_METADATA, fieldLocalData, hasChanged, INIT_ONLY_WRITE_MSG, inSetup, isDEF, isStatic, LAST_NODE_INDEX, layerIds, METADATA_NODE_MSG, METADATA_PROTO_MSG, nodeName, pMetadata, refCounts, removedLayerIds, stateManager, vfMetadata, vrmlMajorVersion, vrmlMinorVersion
 
Constructor Summary
protected BaseMetadataObjectNode(java.lang.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
protected  void copy(VRMLMetadataObjectNodeType node)
          Copy the values of the metadata node into this node.
 VRMLFieldData getFieldValue(int index)
          Get the value of a field.
 java.lang.String getName()
          Get the currently set name associated with this metadata object.
 int getPrimaryType()
          Get the primary type of this node.
 java.lang.String getReference()
          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 setName(java.lang.String name)
          Set the name value for the metadata object.
 void setReference(java.lang.String reference)
          Set the reference value for the metadata object.
 void setValue(int index, java.lang.String value)
          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, 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 Detail

FIELD_NAME

protected static final int FIELD_NAME
Index of the name field

See Also:
Constant Field Values

FIELD_REFERENCE

protected static final int FIELD_REFERENCE
Index of the reference field

See Also:
Constant Field Values

LAST_METADATA_INDEX

protected static final int LAST_METADATA_INDEX
The last field index used by this class

See Also:
Constant Field Values

vfName

protected java.lang.String vfName
exposedField SFString name ""


vfReference

protected java.lang.String vfReference
exposedField SFString reference ""

Constructor Detail

BaseMetadataObjectNode

protected BaseMetadataObjectNode(java.lang.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).

Parameters:
name - The name of the type of node
Method Detail

copy

protected void copy(VRMLMetadataObjectNodeType node)
Copy the values of the metadata node into this node.

Parameters:
node - The node to copy details from

getName

public java.lang.String getName()
Get the currently set name associated with this metadata object. If none is set, this returns null.

Specified by:
getName in interface VRMLMetadataObjectNodeType
Returns:
The current name

setName

public void setName(java.lang.String name)
Set the name value for the metadata object. Use null to clear the currently set name.

Specified by:
setName in interface VRMLMetadataObjectNodeType
Parameters:
name - The name to use

getReference

public java.lang.String getReference()
Get the currently set reference associated with this metadata object. If none is set, this returns null.

Specified by:
getReference in interface VRMLMetadataObjectNodeType
Returns:
The current reference

setReference

public void setReference(java.lang.String reference)
Set the reference value for the metadata object. Use null to clear the currently set reference.

Specified by:
setReference in interface VRMLMetadataObjectNodeType
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 interface VRMLNode
Returns:
The primary type

getFieldValue

public VRMLFieldData getFieldValue(int index)
                            throws InvalidFieldException
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 interface VRMLNodeType
Overrides:
getFieldValue in class AbstractNode
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

public void sendRoute(double time,
                      int srcIndex,
                      VRMLNodeType destNode,
                      int destIndex)
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 interface VRMLNodeType
Overrides:
sendRoute in class AbstractNode
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 from
destNode - The node reference that we will be sending the value to
destIndex - The index of the field in the destination node that the value should be sent to.

setValue

public void setValue(int index,
                     java.lang.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 interface VRMLNodeType
Overrides:
setValue in class AbstractNode
Parameters:
index - The index of destination field to set
value - The new value to use for the node
Throws:
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range for the field type.

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium