|
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
org.web3d.vrml.nodes.proto.ProtoInstancePlaceHolder
public class ProtoInstancePlaceHolder
A placeholder instance of a Prototype used when declaring and then using a nested proto instance.
The idea of this class is to fake being a real prototype instance when the code stubs a nested proto instance. A nested proto instance is of the form
PROTO Outer [] {
PROTO Inner [] { Box {} }
Inner {}
}
In this case, when we are storing the definition of Inner then we
really don't want to expand the internal prototype definition at this point.
The expansion should only take place when we create an instance of
Outer. This class is used as a placeholder in this definition
for this scenario. The idea is that when the code is traversing the
definition, it will be replaced by a real runtime version.
| Field Summary | |
|---|---|
protected int[] |
layerIds
The list of layer IDs that reference this node. |
protected int[] |
refCounts
The current number of references to this node. |
| Fields inherited from class org.web3d.vrml.nodes.proto.AbstractProto |
|---|
BAD_NODE_MSG, errorReporter, FIELD_CLASH_MSG, fieldDeclList, fieldIndexMap, fieldLocalData, isVrml97, nodeName, protoCreator, VRML97_FIELD_MSG, vrmlMajorVersion, vrmlMinorVersion |
| Constructor Summary | |
|---|---|
ProtoInstancePlaceHolder(VRMLNodeTemplate proto,
int major,
int minor,
boolean staticNodes,
NodeTemplateToInstanceCreator creator)
Create a new instance place holder that represents the given proto declaration. |
|
| Method Summary | |
|---|---|
void |
allEventsComplete()
Ignored by this implementation. |
void |
clearRemovedLayerIds()
Clear the current removed layer ID list. |
VRMLNode |
createNewInstance(VRMLNode root,
boolean isStatic)
Create a new instance of a real node from this template. |
VRMLNodeType[] |
getBodyNodes()
Get the list of all the body nodes in this proto instance. |
BasicScene |
getContainedScene()
Get the contained scene graph that this instance has. |
VRMLFieldData |
getFieldValue(int index)
Get the value of a field. |
VRMLNodeType |
getImplementationNode()
Get the first node declared in the proto as that defines just how we we can add this into the scenegraph. |
int[] |
getLayerIds()
Get a listing of the current layer IDs that are directly or indirectly referencing this node. |
VRMLNodeType |
getMetadataObject()
Get the currently registered metadata object instance. |
int[] |
getNodeFieldIndices()
Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode). |
int |
getPrimaryType()
Get the primary type of this node. |
VRMLNodeTemplate |
getProtoDefinition()
Get the PROTO/EXTERNPROTO definition used by this place holder. |
int |
getRefCount(int layer)
Ask for the current number of references to this object in the given layer. |
int[] |
getRemovedLayerIds()
Get the list of layer IDs that this node has just been removed from. |
int[] |
getSecondaryType()
Get the secondary type of this node. |
java.lang.Object |
getUserData(int index)
Fetch the stored user data for a given field index. |
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 |
isSetupFinished()
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 |
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 |
setFrameStateManager(FrameStateManager mgr)
Ignored by this implementation. |
void |
setMetadataObject(VRMLNodeType data)
Set the X3DMetadataObject that is associated with this node. |
void |
setupFinished()
Notification that the construction phase of this node has finished. |
void |
setUserData(int index,
java.lang.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 booleaneger. |
void |
setValue(int index,
boolean[] value,
int numValid)
Set the value of the field at the given index as an array of booleanegers. |
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 |
setValue(int index,
java.lang.String value)
Set the value of the field at the given index as a string. |
void |
setValue(int index,
java.lang.String[] value,
int numValid)
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. |
void |
updateRefCount(int layer,
boolean add)
Change the reference count up or down by one for a given layer ID. |
| Methods inherited from class org.web3d.vrml.nodes.proto.AbstractProto |
|---|
addNodeListener, appendField, checkNodeType, deleteField, deleteField, fireFieldChanged, getAllFields, getFieldCount, getFieldDeclaration, getFieldIndex, getNumFields, getVRMLNodeName, isVRML97, removeNodeListener, setErrorReporter |
| 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.VRMLProtoInstance |
|---|
getAllFields, getFieldCount |
| Methods inherited from interface org.web3d.vrml.nodes.VRMLNodeType |
|---|
addNodeListener, removeNodeListener |
| Methods inherited from interface org.web3d.vrml.lang.VRMLNode |
|---|
getFieldDeclaration, getFieldIndex, getNumFields, getVRMLNodeName, setErrorReporter |
| Field Detail |
|---|
protected int[] refCounts
protected int[] layerIds
refCounts. If none, this is null.
| Constructor Detail |
|---|
public ProtoInstancePlaceHolder(VRMLNodeTemplate proto,
int major,
int minor,
boolean staticNodes,
NodeTemplateToInstanceCreator creator)
proto - The prototype declaration to base this placeholder onmajor - The major version number of this sceneminor - The minor version number of this scenestaticNodes - Whether this node is will be modifiedcreator - The node creator for generating instances of ourself| Method Detail |
|---|
public VRMLNode createNewInstance(VRMLNode root,
boolean isStatic)
throws InvalidNodeTypeException
createNewInstance in interface VRMLNodeTemplateroot - The node that represents the root node of the
VRMLExecutionSpace that we're in.isStatic - true if this is created within a StaticGroup
InvalidNodeTypeException - The root node is not a node capable
of representing a root of a scene graphVRMLProtoInstance,
VRMLWorldRootNodeTypepublic VRMLNodeType getImplementationNode()
getImplementationNode in interface VRMLProtoInstancepublic VRMLNodeTemplate getProtoDefinition()
public VRMLNodeType[] getBodyNodes()
getImplementationNode(). This should be called
sparingly. It is really only of use to something that needs to traverse
the entire scene graph or for scripting to provide access to the root of
the scene.
getBodyNodes in interface VRMLProtoInstancepublic BasicScene getContainedScene()
getContainedScene in interface VRMLExecutionSpacepublic void allEventsComplete()
allEventsComplete in interface FrameStateListener
public void notifyExternProtoLoaded(int index,
VRMLNodeType node)
throws InvalidFieldValueException
notifyExternProtoLoaded in interface VRMLNodeTypeindex - The field indexnode - The node resolved
InvalidFieldValueException - If the proto contains he wrong typepublic int getRefCount(int layer)
getRefCount in interface VRMLNodeTypelayer - The id of the layer to get the ref count for
public void updateRefCount(int layer,
boolean add)
getLayerIds().
updateRefCount in interface VRMLNodeTypelayer - The id of the layer to modify the ref count onadd - true to increment the reference count, false to decrementpublic int[] getLayerIds()
getLayerIds in interface VRMLNodeTypepublic int[] getRemovedLayerIds()
clearRemovedLayerIds() call.
getRemovedLayerIds in interface VRMLNodeTypepublic void clearRemovedLayerIds()
clearRemovedLayerIds in interface VRMLNodeTypepublic void setFrameStateManager(FrameStateManager mgr)
setFrameStateManager in interface VRMLNodeTypemgr - The manager instance to usepublic void setDEF()
setDEF in interface VRMLNodeTypejava.lang.IllegalStateException - The setup is finished.public boolean isDEF()
isDEF in interface VRMLNodepublic int getPrimaryType()
getPrimaryType in interface VRMLNodegetPrimaryType in interface VRMLNodeTemplatepublic int[] getSecondaryType()
getSecondaryType in interface VRMLNodepublic boolean hasFieldChanged(int index)
hasFieldChanged in interface VRMLNodeTypeindex - The index of the field to change.
public int[] getNodeFieldIndices()
getNodeFieldIndices in interface VRMLNode
public VRMLFieldData getFieldValue(int index)
throws InvalidFieldException
getFieldValue in interface VRMLNodeTypeindex - The index of the field to change.
InvalidFieldException - The field index is not known
public void setMetadataObject(VRMLNodeType data)
throws InvalidFieldValueException
setMetadataObject in interface VRMLNodeTypedata - The node to register as the metadata
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 VRMLNodeType
public void sendRoute(double time,
int srcIndex,
VRMLNodeType destNode,
int destIndex)
sendRoute in interface VRMLNodeTypetime - 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.
public void setValue(int index,
int value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
int[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - 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
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
boolean value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
boolean[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - 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
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
float value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
float[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - 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
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
long value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
long[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - 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
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
double value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
double[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - 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
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
java.lang.String value)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - The index of destination field to setvalue - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
java.lang.String[] value,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - 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
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
VRMLNodeType child)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - The index of destination field to setchild - The new value to use for the node
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setValue(int index,
VRMLNodeType[] children,
int numValid)
throws InvalidFieldException,
InvalidFieldValueException
setValue in interface VRMLNodeTypeindex - 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
InvalidFieldException - The field index is not known
InvalidFieldValueException - The value provided is out of range
for the field type.
public void setUserData(int index,
java.lang.Object data)
throws InvalidFieldException
setUserData in interface VRMLNodeindex - The index of destination field to setdata - The item to store for the field
InvalidFieldException - The field index is not known
public java.lang.Object getUserData(int index)
throws InvalidFieldException
getUserData in interface VRMLNodeindex - The index of destination field to set
InvalidFieldException - The field index is not knownpublic boolean isSetupFinished()
isSetupFinished in interface VRMLNodeTypepublic void setupFinished()
setupFinished in interface VRMLNodeType
public void setVersion(int major,
int minor,
boolean isStatic)
setVersion in interface VRMLNodemajor - The major version number of this sceneminor - The minor version number of this sceneisStatic - true if this node is under a static group and won't
change after the setup is finished
|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||