An element is the combination of a StyleDescriptor and a GeometryDescriptor.
An element has a name and a optional reference to a rule.
Furthermore it may contain layout contexts for nodes and edges which is
currently used for groups, so they can be layouted when the repository
is built.
An example for an element definition looks like
Example 3.7. Definition of a NodeElement
<list name="NodeElement">
<attribute name="Name" value="RhombusNode"/>
<attribute name="Geometry" value="Rhombus"/>
<attribute name="Style" value="TenseRhombus"/>
<attribute name="Rule" value="nrule1"/>
<attribute name="EdgeLayout" value="Edge Layout" />
<attribute name="NodeLayout" value="Hierarchical left to right" />
<list name="Attributes">
<list name="Attribute">
<attribute name="Name" value="ID"/>
<attribute name="InitialValue" value="12"/>
<attribute name="Type" value="Integer"/>
<attribute name="Mutable" type="Boolean" value="false"/>
<attribute name="Constraint" value="(value > 0)"/>
</list>
</list>
</list>
The 'Geometry' attribute references a previously defined
GeometryDescriptor, and the 'Style' attribute a
StyleDescriptor. The 'Rule' attribute is optional and references a
previously defined Rule. The definition can also contain a list of
'Attributes' that will be added as custom attributes to the element.
The list consists of attribute lists with the name 'Attribute', each
list defines one custom attribute and contains attributes whose names,
types and values are described in the table below.
The 'EdgeLayout' and 'NodeLayout" attributes are optional and only used
for groups. They have to reference predefined layout contexts in the
default layout controller, if the layout should be applied during
creation of the repository item. At least the contexts should be
available in the document this element is added to.
Table 3.2. Custom Attributes Definition
| Name | Type | Description |
|---|---|---|
| Name | String | Defines the name of the custom attribute. This has to be unique in the list of custom attributes for the current element. |
| Type | String |
Defines the type of the custom attribute. This can be one of
the following constants or a generator key of a
CustomAttribute that can be used to obtain a
CustomAttributeGenerator from the
CustomAttributeGeneratorRegistry.
|
| InitialValue | String | Defines the value of the custom attribute. This has to be parseable into a value of type 'Type'. If the 'Type' attribute is a generator key for a CustomAttributeGenerator, this String will be passed to the method generateCustomAttribute(). |
| Mutable | Boolean | This attribute is optional. When the value is set to false, the created custom attribute will not be mutable. |
| Constraint | String | This attribute is optional. This has to be a parseable String representation of a Constraint. |
© 2004, 2005 Tensegrity Software GmbH