|
Xj3D VRML/X3D Code API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.web3d.vrml.renderer.common.nodes.AbstractDynamicFieldNode
Common functionality that represents a node that has its fields dynamically assigned.
Dynamic node structures are used in two places - scripts and protos. This class provides the common functionality for managing dynamically assigned fields.
The implementation does not handle deletion of fields particularly well at this point in time. Works fine if the node is not realised yet, but doesn't work well if the node is live.
| Field Summary | |
protected static java.lang.String |
BAD_NODE_MSG
A standard message for when the supplied node is wrong. |
protected ErrorReporter |
errorReporter
Reporter instance for handing out errors |
protected static java.lang.String |
FIELD_CLASH_MSG
When the same field is defined twice, but with different types |
protected int |
fieldCount
The count of the last added field index |
protected VRMLFieldData |
fieldData
Scratch class var for returning field data |
protected java.util.List |
fieldDeclList
List of the field maps registered in order for their definitions. |
protected java.util.Map |
fieldIndexMap
Data mapping holding the field name -> index (Integer) mapping |
protected boolean |
inSetup
Is this node still being setup/parsed. |
protected boolean |
isVrml97
Flag indicating this node is following VRML97 rules |
protected static java.lang.String |
METADATA_NODE_MSG
Message for when the node in setValue() is not a Metadata |
protected static java.lang.String |
METADATA_PROTO_MSG
Message for when the proto is not a Metadata |
protected java.lang.String |
nodeName
The name of the node. |
protected VRMLProtoInstance |
pMetadata
proto representation of the metadata node |
protected int |
refCount
The current number of references to this node. |
protected FrameStateManager |
stateManager
State manager for propogating updates |
protected VRMLNodeType |
vfMetadata
SFNode metadata NULL |
| Constructor Summary | |
AbstractDynamicFieldNode(java.lang.String name)
Create a new instance of a proto that has the given name. |
|
| Method Summary | |
void |
addNodeListener(VRMLNodeListener l)
Add a listener to this node instance. |
void |
allEventsComplete()
Ignored by this implementation. |
int |
appendField(VRMLFieldDeclaration field)
Append a field declaration to this node. |
protected void |
checkNodeType(VRMLNodeType node)
Check to see if the supplied node type is the same as this node. |
void |
deleteField(int index)
Delete the field at the given index. |
void |
deleteField(VRMLFieldDeclaration field)
Delete the named field. |
protected void |
fireFieldChanged(int index)
Send a notification to the registered listeners that a field has been changed. |
java.util.List |
getAllFields()
Make a listing of all fields that are currently registered in this node. |
int |
getFieldCount()
Get the count of the number of fields currently registered. |
VRMLFieldDeclaration |
getFieldDeclaration(int index)
Get the declaration of the field at the given index. |
int |
getFieldIndex(java.lang.String fieldName)
Get the index of the given field name. |
VRMLNodeType |
getMetadataObject()
Get the currently registered vfMetadata object instance. |
int[] |
getNodeFieldIndices()
Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode). |
int |
getNumFields()
Get the number of fields. |
int |
getRefCount()
Ask for the current number of references to this object. |
java.lang.String |
getVRMLNodeName()
Get the name of this node as a string. |
boolean |
isVRML97()
Check to see if the node is using VRML97 semantics |
void |
removeNodeListener(VRMLNodeListener l)
Remove a listener from this node instance. |
void |
setErrorReporter(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 |
setFrameStateManager(FrameStateManager mgr)
Ignored by this implementation. |
void |
setMetadataObject(VRMLNodeType data)
Set the X3DMetadataObject that is associated with this node. |
void |
setupFinished()
Perform the setup completion routine. |
int |
updateRefCount(boolean add)
Change the reference count up or down by one. |
| 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.nodes.VRMLNodeType |
getFieldValue, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, sendRoute, setDEF, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue |
| Methods inherited from interface org.web3d.vrml.lang.VRMLNode |
getPrimaryType, getSecondaryType, getUserData, isDEF, setUserData, setVersion |
| Field Detail |
protected static final java.lang.String BAD_NODE_MSG
protected static final java.lang.String METADATA_PROTO_MSG
protected static final java.lang.String METADATA_NODE_MSG
protected static final java.lang.String FIELD_CLASH_MSG
protected ErrorReporter errorReporter
protected final java.util.Map fieldIndexMap
protected final java.util.List fieldDeclList
appendField(VRMLFieldDeclaration) method instead.
protected final java.lang.String nodeName
protected final VRMLFieldData fieldData
protected FrameStateManager stateManager
protected int fieldCount
protected boolean isVrml97
protected boolean inSetup
protected int refCount
protected VRMLNodeType vfMetadata
protected VRMLProtoInstance pMetadata
| Constructor Detail |
public AbstractDynamicFieldNode(java.lang.String name)
name - The name of the proto to use| Method Detail |
public void allEventsComplete()
allEventsComplete in interface FrameStateListenerpublic void setErrorReporter(ErrorReporter reporter)
setErrorReporter in interface VRMLNodereporter - The instance to use or nullpublic java.lang.String getVRMLNodeName()
getVRMLNodeName in interface VRMLNodepublic int getRefCount()
getRefCount in interface VRMLNodeTypepublic int updateRefCount(boolean add)
updateRefCount in interface VRMLNodeTypeadd - true to increment the reference count, false to decrement
public void addNodeListener(VRMLNodeListener l)
addNodeListener in interface VRMLNodeTypel - The listener instance to addpublic void removeNodeListener(VRMLNodeListener l)
removeNodeListener in interface VRMLNodeTypel - The listener to be removedpublic void setFrameStateManager(FrameStateManager mgr)
setFrameStateManager in interface VRMLNodeTypemgr - The manager instance to use
public void setMetadataObject(VRMLNodeType data)
throws InvalidFieldValueException
setMetadataObject in interface VRMLNodeTypedata - The node to register as the vfMetadata
InvalidFieldValueException - The object instance provided
does not implment VRMLMetadataNodeType or is not a proto instance
that encapsulates it as it's primary typepublic VRMLNodeType getMetadataObject()
getMetadataObject in interface VRMLNodeTypepublic void setupFinished()
setupFinished in interface VRMLNodeTypepublic int getFieldIndex(java.lang.String fieldName)
getFieldIndex in interface VRMLNodefieldName - The name of the field we want the index from
public int[] getNodeFieldIndices()
getNodeFieldIndices in interface VRMLNodepublic VRMLFieldDeclaration getFieldDeclaration(int index)
getFieldDeclaration in interface VRMLNodeindex - The index of the field to get information
public int getNumFields()
getNumFields in interface VRMLNodeprotected void checkNodeType(VRMLNodeType node)
node - The node to check
java.lang.IllegalArgumentException - The nodes are not the samepublic boolean isVRML97()
protected void fireFieldChanged(int index)
index - The index of the field that changedpublic int getFieldCount()
public int appendField(VRMLFieldDeclaration field)
throws FieldExistsException
field - The new field to add
FieldExistsException - A conflicting field of the same name
already exists for this node
public void deleteField(int index)
throws InvalidFieldException,
java.lang.IndexOutOfBoundsException
index - The index of the field to delete
InvalidFieldException - The field does not exist at the index
java.lang.IndexOutOfBoundsException - The index provided is out of
range for the current field numbers
public void deleteField(VRMLFieldDeclaration field)
throws InvalidFieldException,
java.lang.IndexOutOfBoundsException
field - The field to delete
InvalidFieldException - The named field does not exist
java.lang.IndexOutOfBoundsException - The index provided is out of
range for the current field numberspublic java.util.List getAllFields()
VRMLFieldDeclaration.
|
Xj3D VRML/X3D Code API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||