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.
-
EVENT_IN
-
-
EVENT_OUT
-
-
EXPOSED_FIELD
-
-
FIELD
-
-
UNKNOWN
-
-
NodeDefinition(String)
-
-
addAlias(String, String)
- Add an alias for a field name; used for backward compatibility.
-
countEmbeddedChildCarryingFields()
- Return the number of embedded child-carrying fields
(i.e.
-
countEmbeddedFields()
- Return the number of embedded fields in the NodeDefinition.
-
countEventIns()
- Return the number of EventIns in the NodeDefinition.
-
countEventOuts()
- Return the number of EventOuts in the NodeDefinition.
-
countExposedChildCarryingFields()
- Return the number of exposed child-carrying fields
(i.e.
-
countExposedFields()
- Return the number of exposed fields in the NodeDefinition.
-
countNonEmbeddedChildCarryingFields()
- Return the number of child-carrying fields (i.e.
-
countNonEmbeddedFields()
- Return the number of fields in the NodeDefinition, not
including any embedded fields.
-
countTotalChildCarryingFields()
- Return the total number of child-carrying fields (i.e.
-
countTotalFields()
- Return the total number of fields in the NodeDefinition,
including any embedded fields.
-
embeddedField(Field)
- Add an embedded field.
-
eventIn(String, Field)
- Add an event-in to the node definition.
-
eventOut(String, Field)
- Add an event-out to the node definition.
-
exposedField(String, Field)
- Add an "exposed field" to the node definition.
-
field(String, Field)
- Add a field to the node definition.
-
fieldIndexToFieldInstanceIndex(int)
- Convert field index INDEX (which should be the index of a child-
carrying field) into a field instance index.
-
fieldInstanceIndexToFieldIndex(int)
- Convert field instance index into a field index.
-
getEmbeddedFieldIndex(int)
- Return the field index of the nth embedded field, numbering
from 0.
-
getEventInIndex(String)
- Get the index of a named EventIn from its name.
-
getEventInName(int)
- Get the name of an EventIn from its index.
-
getEventInType(int)
- Returns the type of EventIn from its index.
-
getEventInType(String)
- Returns the type of EventIn from its name.
-
getEventOutIndex(String)
- Get the index of a named EventOut.
-
getEventOutName(int)
- Get the name of an EventOut from its index.
-
getEventOutType(int)
- Returns the type of EventOut from its index.
-
getEventOutType(String)
- Returns the type of EventOut from its name.
-
getFieldDefault(int)
- Return the field default value/type given its index.
-
getFieldDefault(String)
- Return the field default value/type given its name.
-
getFieldIndex(String)
- Look up a field index given its name.
-
getFieldName(int)
- Look up a field name given its index.
-
getInterfaceType(String)
- Return whether a given name refers to a field, exposedField,
eventIn, or eventOut.
-
getMirror()
- Return a sanitized version of the definition (see
ConstNodeDefinition).
-
getName()
-
-
isFieldExposed(int)
- Return true if a field is exposed, false if it isn't.
-
print(PrintAction)
-
-
print(PrintAction, boolean)
- Print out a NodeDefinition.
-
readInterfaces(ReadAction)
-
-
readInterfaces(ReadAction, boolean)
- Parse the interfaces for a node definition
UNKNOWN
public final static int UNKNOWN
EXPOSED_FIELD
public final static int EXPOSED_FIELD
FIELD
public final static int FIELD
EVENT_IN
public final static int EVENT_IN
EVENT_OUT
public final static int EVENT_OUT
NodeDefinition
public NodeDefinition(String name)
getName
public String getName()
readInterfaces
public void readInterfaces(ReadAction a) throws IOException, VRMLSyntaxException
readInterfaces
public void readInterfaces(ReadAction a,
boolean readDefaults) throws IOException, VRMLSyntaxException
- Parse the interfaces for a node definition
print
public void print(PrintAction a)
print
public void print(PrintAction a,
boolean printDefaults)
- Print out a NodeDefinition.
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.
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.
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.)
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.)
eventOut
public void eventOut(String name,
Field type)
- Add an event-out to the node definition. This happens at
creation time.
addAlias
public void addAlias(String oldName,
String newName)
- Add an alias for a field name; used for backward compatibility.
This happens at creation time.
getMirror
public ConstNodeDefinition getMirror()
- Return a sanitized version of the definition (see
ConstNodeDefinition).
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.
getFieldName
public String getFieldName(int index)
- Look up a field name given its index.
getFieldIndex
public int getFieldIndex(String name)
- Look up a field index given its name.
getFieldDefault
public final Field getFieldDefault(int index)
- Return the field default value/type given its index.
getFieldDefault
public final Field getFieldDefault(String fieldName)
- Return the field default value/type given its name.
isFieldExposed
public final boolean isFieldExposed(int index)
- Return true if a field is exposed, false if it isn't.
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.
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.
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.
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.
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.
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.
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.
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.
getEmbeddedFieldIndex
public int getEmbeddedFieldIndex(int n)
- Return the field index of the nth embedded field, numbering
from 0.
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.
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.
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.)
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.)
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.)
countExposedFields
public final int countExposedFields()
- Return the number of exposed fields in the NodeDefinition.
(Embedded fields can never be exposed fields.)
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.)
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.)
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.)
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.)
countEventIns
public final int countEventIns()
- Return the number of EventIns in the NodeDefinition.
This includes those implicitly declared as part of an exposedField.
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