Repository Element Definition

In this section, you will learn how to define a repository element, including its name, geometry, style and optional modeling rule.

A repository element is a prototype for a visual element that is duplicated inside your view documents. This means that the repository element's type, geometry, style and rule are used to create the new visual elements you add to a view (programmatically or via drag and drop). You may create as many repository elements as you require for your business application.

Similar to geometries, styles and rules, repository elements are specified in xml and loaded into a “Pool” object, which functions as a singleton.

The following xml fragment is part of the file named elements.xml. Here you should analyze its contents and decipher the NodeElement named “AppNodeElement”.

Example 5.10. Element definition

<list name="NodeElement">
  <attribute name="Name" value="AppNodeElement"/>
  <attribute name="Geometry" value="AppLabelGeometryDescriptor"/>
  <attribute name="Style" value="AppLabelStyleDescriptor"/>
  <attribute name="Rule" value="AppNodeRule"/>
</list>

Note that the above repository item has been declared a “NodeElement.” Both NodeElements and EdgeElements aggregate a named GeometryDescriptor, StyleDescriptor and an optional Rule inside their definitions. Please read Modeling Rules to understand what these rules are and how to configure their attributes.

Taken together, the descriptors and the optional rule completely define a unique repository element that you may retrieve by name and apply to a particular visual element in a view.