|
Xj3D 2.0 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.nodes.proto.AbstractProto
public abstract class AbstractProto
Base representation of the common functionality for the PROTO and EXTERNPROTO node types.
Note: This implementation does not handle IS values to pass field information to body nodes.
| 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 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 java.lang.ThreadLocal<VRMLFieldData> |
fieldLocalData
Scratch class var for returning field data. |
protected boolean |
isVrml97
Flag indicating VRML97 semantics |
protected java.lang.String |
nodeName
The name of the node. |
protected NodeTemplateToInstanceCreator |
protoCreator
The proto creator that is responsible for creating new instances of this node. |
protected static java.lang.String |
VRML97_FIELD_MSG
Message when the field type is not valid in VRML97 |
protected int |
vrmlMajorVersion
The major version of the spec this instance belongs to. |
protected int |
vrmlMinorVersion
The minor version of the spec this instance belongs to. |
| Constructor Summary | |
|---|---|
AbstractProto(java.lang.String name,
int majorVersion,
int minorVersion,
NodeTemplateToInstanceCreator creator)
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. |
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. |
int |
getNumFields()
Get the number of fields defined for this node. |
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. |
| 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.VRMLNodeTemplate |
|---|
createNewInstance, getPrimaryType |
| Field Detail |
|---|
protected static final java.lang.String BAD_NODE_MSG
protected static final java.lang.String VRML97_FIELD_MSG
protected static final java.lang.String FIELD_CLASH_MSG
protected final java.util.Map fieldIndexMap
protected final java.util.List fieldDeclList
appendField(VRMLFieldDeclaration) method instead.
protected final java.lang.String nodeName
protected final java.lang.ThreadLocal<VRMLFieldData> fieldLocalData
protected ErrorReporter errorReporter
protected final int vrmlMajorVersion
protected final int vrmlMinorVersion
protected boolean isVrml97
protected NodeTemplateToInstanceCreator protoCreator
| Constructor Detail |
|---|
public AbstractProto(java.lang.String name,
int majorVersion,
int minorVersion,
NodeTemplateToInstanceCreator creator)
name - The name of the proto to usemajorVersion - The major version number of this sceneminorVersion - The minor version number of this scenecreator - The node creator for generating instances of ourself| Method Detail |
|---|
public void setErrorReporter(ErrorReporter reporter)
setErrorReporter in interface VRMLNodeTemplatereporter - The instance to use or nullpublic void addNodeListener(VRMLNodeListener l)
l - The listener instance to addpublic void removeNodeListener(VRMLNodeListener l)
l - The listener to be removedprotected void fireFieldChanged(int index)
index - The index of the field that changedpublic java.lang.String getVRMLNodeName()
getVRMLNodeName in interface VRMLNodeTemplatepublic int getFieldCount()
getFieldCount in interface VRMLNodeTemplate
public int appendField(VRMLFieldDeclaration field)
throws FieldExistsException,
InvalidFieldException
appendField in interface VRMLNodeTemplatefield - The new field to add
FieldExistsException - A conflicting field of the same name
already exists for this node
InvalidFieldException - The field type is not valid for this
specification version
public void deleteField(int index)
throws InvalidFieldException,
java.lang.IndexOutOfBoundsException
deleteField in interface VRMLNodeTemplateindex - 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
deleteField in interface VRMLNodeTemplatefield - 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.
getAllFields in interface VRMLNodeTemplatepublic boolean isVRML97()
protected void checkNodeType(VRMLNodeType node)
node - The node to check
java.lang.IllegalArgumentException - The nodes are not the samepublic int getFieldIndex(java.lang.String fieldName)
getFieldIndex in interface VRMLNodeTemplatefieldName - The name of the field we want the index from
public VRMLFieldDeclaration getFieldDeclaration(int index)
getFieldDeclaration in interface VRMLNodeTemplateindex - The index of the field to get information
public int getNumFields()
getNumFields in interface VRMLNodeTemplate
|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||