Class dnx.lr.NodeDefinition
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dnx.lr.NodeDefinition

java.lang.Object
   |
   +----dnx.util.DNXObject
           |
           +----dnx.lr.NodeDefinition

public class NodeDefinition
extends DNXObject
A NodeDefinition describes a particular type of node, e.g. TransformNode or AnchorNode. There is one of these objects per class of node; this object is created and initialized when the first node of that class is created. Each node has a pointer to the proper NodeDefinition object for its class. (You cannot directly retrieve the NodeDefinition object from a Node, but you can retrieve a ConstNodeDefinition object, which is a read-only class that mirrors a NodeDefinition and provides all the same accessor methods that the NodeDefinition provides. This is similar in spirit to the SceneContext, which mirrors a Scene.) A subclass of NodeDefinition is Prototype, used for node types created using a PROTO declaration. Fields, eventIns, and eventOuts (generically termed "interfaces") are accessed using indices. The interface indices work as follows: -- All types of interface indices start at 0 and are numbered consecutively and contiguously up to one less than the total number of interfaces of that type. -- Field indices are ordered as follows: -- First, any exposed fields. -- Then, any non-exposed but still externally visible fields. -- Finally, any "embedded" fields, i.e. extra fields that are maintained internally but are not externally visible and cannot be specified in a .wrl file. This includes, for example, the field that holds the children of an InlineNode. -- EventIn and eventOut indices are ordered as follows: -- First, the eventIns and eventOuts corresponding to exposed fields. -- Then, any other eventIns and eventOuts that have been declared. -- The eventIn, eventOut, and field indices for exposed fields always match up.

Variable Index

 o EVENT_IN
 o EVENT_OUT
 o EXPOSED_FIELD
 o FIELD
 o UNKNOWN

Constructor Index

 o NodeDefinition(String)

Method Index

 o addAlias(String, String)
Add an alias for a field name; used for backward compatibility.
 o countEmbeddedChildCarryingFields()
Return the number of embedded child-carrying fields (i.e.
 o countEmbeddedFields()
Return the number of embedded fields in the NodeDefinition.
 o countEventIns()
Return the number of EventIns in the NodeDefinition.
 o countEventOuts()
Return the number of EventOuts in the NodeDefinition.
 o countExposedChildCarryingFields()
Return the number of exposed child-carrying fields (i.e.
 o countExposedFields()
Return the number of exposed fields in the NodeDefinition.
 o countNonEmbeddedChildCarryingFields()
Return the number of child-carrying fields (i.e.
 o countNonEmbeddedFields()
Return the number of fields in the NodeDefinition, not including any embedded fields.
 o countTotalChildCarryingFields()
Return the total number of child-carrying fields (i.e.
 o countTotalFields()
Return the total number of fields in the NodeDefinition, including any embedded fields.
 o embeddedField(Field)
Add an embedded field.
 o eventIn(String, Field)
Add an event-in to the node definition.
 o eventOut(String, Field)
Add an event-out to the node definition.
 o exposedField(String, Field)
Add an "exposed field" to the node definition.
 o field(String, Field)
Add a field to the node definition.
 o fieldIndexToFieldInstanceIndex(int)
Convert field index INDEX (which should be the index of a child- carrying field) into a field instance index.
 o fieldInstanceIndexToFieldIndex(int)
Convert field instance index into a field index.
 o getEmbeddedFieldIndex(int)
Return the field index of the nth embedded field, numbering from 0.
 o getEventInIndex(String)
Get the index of a named EventIn from its name.
 o getEventInName(int)
Get the name of an EventIn from its index.
 o getEventInType(int)
Returns the type of EventIn from its index.
 o getEventInType(String)
Returns the type of EventIn from its name.
 o getEventOutIndex(String)
Get the index of a named EventOut.
 o getEventOutName(int)
Get the name of an EventOut from its index.
 o getEventOutType(int)
Returns the type of EventOut from its index.
 o getEventOutType(String)
Returns the type of EventOut from its name.
 o getFieldDefault(int)
Return the field default value/type given its index.
 o getFieldDefault(String)
Return the field default value/type given its name.
 o getFieldIndex(String)
Look up a field index given its name.
 o getFieldName(int)
Look up a field name given its index.
 o getInterfaceType(String)
Return whether a given name refers to a field, exposedField, eventIn, or eventOut.
 o getMirror()
Return a sanitized version of the definition (see ConstNodeDefinition).
 o getName()
 o isFieldExposed(int)
Return true if a field is exposed, false if it isn't.
 o print(PrintAction)
 o print(PrintAction, boolean)
Print out a NodeDefinition.
 o readInterfaces(ReadAction)
 o readInterfaces(ReadAction, boolean)
Parse the interfaces for a node definition

Variables

 o UNKNOWN
  public final static int UNKNOWN
 o EXPOSED_FIELD
  public final static int EXPOSED_FIELD
 o FIELD
  public final static int FIELD
 o EVENT_IN
  public final static int EVENT_IN
 o EVENT_OUT
  public final static int EVENT_OUT

Constructors

 o NodeDefinition
  public NodeDefinition(String name)

Methods

 o getName
  public String getName()
 o readInterfaces
  public void readInterfaces(ReadAction a) throws IOException, VRMLSyntaxException
 o readInterfaces
  public void readInterfaces(ReadAction a,
                             boolean readDefaults) throws IOException, VRMLSyntaxException
Parse the interfaces for a node definition
 o print
  public void print(PrintAction a)
 o print
  public void print(PrintAction a,
                    boolean printDefaults)
Print out a NodeDefinition.
 o field
  public void field(String name,
                    Field def)
Add a field to the node definition. This happens at creation time. The DEF argument specifies both the type of the field and its default value.
 o exposedField
  public void exposedField(String name,
                           Field def)
Add an "exposed field" to the node definition. This happens at creation time. An exposed field is a field plus events to allow external interaction with the field's value. The DEF argument specifies both the type of the field and its default value.
 o embeddedField
  public void embeddedField(Field def)
Add an embedded field. This happens at creation time. The DEF argument specifies both the type of the field and its default value. (It really only makes sense, however, to have embedded MFNode and SFNode fields, and in such cases, the default value is meaningless.)
 o eventIn
  public void eventIn(String name,
                      Field type)
Add an event-in to the node definition. This happens at creation time. Event-ins and event-outs don't have default values, so the TYPE argument specifies only the type of the field. (#### And as such should perhaps be a Class object? Although that would introduce some non-parallelism with the FieldDefinition() structure.)
 o eventOut
  public void eventOut(String name,
                       Field type)
Add an event-out to the node definition. This happens at creation time.
 o addAlias
  public void addAlias(String oldName,
                       String newName)
Add an alias for a field name; used for backward compatibility. This happens at creation time.
 o getMirror
  public ConstNodeDefinition getMirror()
Return a sanitized version of the definition (see ConstNodeDefinition).
 o getInterfaceType
  public int getInterfaceType(String name)
Return whether a given name refers to a field, exposedField, eventIn, or eventOut. Automatically-declared eventIns and eventOuts in exposedFields are correctly recognized. The result will be one of EXPOSED_FIELD, FIELD, EVENT_IN, EVENT_OUT, or UNKNONW.
 o getFieldName
  public String getFieldName(int index)
Look up a field name given its index.
 o getFieldIndex
  public int getFieldIndex(String name)
Look up a field index given its name.
 o getFieldDefault
  public final Field getFieldDefault(int index)
Return the field default value/type given its index.
 o getFieldDefault
  public final Field getFieldDefault(String fieldName)
Return the field default value/type given its name.
 o isFieldExposed
  public final boolean isFieldExposed(int index)
Return true if a field is exposed, false if it isn't.
 o getEventInName
  public String getEventInName(int index)
Get the name of an EventIn from its index. If the index refers to an invalid EventIn, null is returned.
 o getEventInIndex
  public int getEventInIndex(String name)
Get the index of a named EventIn from its name. If there is no EventIn with the specified name, -1 is returned.
 o getEventInType
  public final Class getEventInType(int index)
Returns the type of EventIn from its index. If the index refers to an invalid EventIn, null is returned.
 o getEventInType
  public final Class getEventInType(String eventName)
Returns the type of EventIn from its name. If the name refers to an invalid EventIn, null is returned.
 o getEventOutName
  public String getEventOutName(int index)
Get the name of an EventOut from its index. If the index refers to an invalid EventOut, null is returned.
 o getEventOutIndex
  public int getEventOutIndex(String name)
Get the index of a named EventOut. If there is no EventOut with the specified name, -1 is returned.
 o getEventOutType
  public final Class getEventOutType(int index)
Returns the type of EventOut from its index. If the index refers to an invalid EventOut, null is returned.
 o getEventOutType
  public final Class getEventOutType(String eventName)
Returns the type of EventOut from its name. If the name refers to an invalid EventOut, null is returned.
 o getEmbeddedFieldIndex
  public int getEmbeddedFieldIndex(int n)
Return the field index of the nth embedded field, numbering from 0.
 o fieldIndexToFieldInstanceIndex
  public int fieldIndexToFieldInstanceIndex(int index)
Convert field index INDEX (which should be the index of a child- carrying field) into a field instance index. Field instance indices are used to access the equivalent field instances out of a node instance.
 o fieldInstanceIndexToFieldIndex
  public int fieldInstanceIndexToFieldIndex(int index)
Convert field instance index into a field index. Field instance indices are used to access the equivalent field instances out of a node instance.
 o countNonEmbeddedFields
  public final int countNonEmbeddedFields()
Return the number of fields in the NodeDefinition, not including any embedded fields. (Embedded fields are those fields used internally to hold embedded nodes, such as in an InlineNode.)
 o countEmbeddedFields
  public final int countEmbeddedFields()
Return the number of embedded fields in the NodeDefinition. (Embedded fields are those fields used internally to hold embedded nodes, such as in an InlineNode.)
 o countTotalFields
  public final int countTotalFields()
Return the total number of fields in the NodeDefinition, including any embedded fields. (Embedded fields are those fields used internally to hold embedded nodes, such as in an InlineNode.)
 o countExposedFields
  public final int countExposedFields()
Return the number of exposed fields in the NodeDefinition. (Embedded fields can never be exposed fields.)
 o countNonEmbeddedChildCarryingFields
  public final int countNonEmbeddedChildCarryingFields()
Return the number of child-carrying fields (i.e. MFNodes and SFNodes) in the NodeDefinition, not including any embedded fields. (Embedded fields are those fields used internally to hold embedded nodes, such as in an InlineNode.)
 o countEmbeddedChildCarryingFields
  public final int countEmbeddedChildCarryingFields()
Return the number of embedded child-carrying fields (i.e. MFNodes and SFNodes) in the NodeDefinition. (Embedded fields are those fields used internally to hold embedded nodes, such as in an InlineNode.)
 o countTotalChildCarryingFields
  public final int countTotalChildCarryingFields()
Return the total number of child-carrying fields (i.e. MFNodes and SFNodes) in the NodeDefinition, including any embedded fields. (Embedded fields are those fields used internally to hold embedded nodes, such as in an InlineNode.)
 o countExposedChildCarryingFields
  public final int countExposedChildCarryingFields()
Return the number of exposed child-carrying fields (i.e. MFNodes and SFNodes) in the NodeDefinition. (Embedded fields can never be exposed fields.)
 o countEventIns
  public final int countEventIns()
Return the number of EventIns in the NodeDefinition. This includes those implicitly declared as part of an exposedField.
 o countEventOuts
  public final int countEventOuts()
Return the number of EventOuts in the NodeDefinition. This includes those implicitly declared as part of an exposedField.

All Packages  Class Hierarchy  This Package  Previous  Next  Index