next up previous contents
Next: Attribute Context Editor Up: Adding Attributes to a Previous: Adding Attributes to a   Contents

Attribute Editor

In AGG the attribution of objects is performed in a special editor. There are different ways to invoke the attribute editor. A convenient one is to click on a node or edge with the right mouse button and choose the item Attributes .... Another possibility to invoke the attribute editor is to select a node or edge and choose the Edit menu item Attributes. Please note that only one graph object can be edited at once. So there is an error message if more than one object is selected. Last but not least, there is the possibility to invoke the attribute editor by switching to the mode Attributes ... in the Mode menu and then clicking on the object which attributes are to be edited. The mode Attributes is also available in the pop-up menu Edit Mode as shown above.

There are several occurrences of attributes: in type graphs, rules, host graphs, graph constraints. If attributes are edited in a rule, the attribute editor is shown instead of the host graph. To get the host graph back, click on the graph in the GraGra tree.
The attribute editor allows to declare a $type$, a $name$ and a $value$ for an attribute. Additionally, the visibility of an attribute can be changed between shown and hidden. There may be multiple attributes for one type of graph object. As the underlying attribute handler interprets expressions in Java syntax, the types for attributes are either primitive Java types (i.e. byte, short, char, int, double, long, float, boolean) or Java classes. Java expressions are arithmetic expressions (e.g. x + 1), boolean expressions (e.g. width <= 7), bit manipulations, conditional expressions (e.g. v>8?7:0), operations on arrays, creating a new object instance by calling a constructor of a class (e.g. new Vector()), access to class and instance variables and invocation of class and instance methods (e.g. java.lang.Math.sin(0.5) or v.elementAt(i)). Please note, if a method returns no object (is void), we will use ;(semicolon) to return the object (e.g. v;addElement(new Integer(i))). Apart from the standard Java library $JDK$1, user-defined classes can also be used for attribution. The CLASSPATH environment variable and the class libraries have to be adapted accordingly. Alternatively, a configuration editor can be used.
As an example for a user-defined Java class we will use a class Entry of our HTML_Browser example. This class defines the operations for getting directories and files and displaying a file in a browser. It will be shown in Section 1.8.
Figure 4 shows the attribute editor for attribute declaration and value definition. The attribute editor has been invoked for the black unnamed edge in the left-hand side of the rule expand (Fig. 24) of the grammar shown in the next section. This edge type has one attribute of type $int$ with name $d$ set to variable x.

Figure 4: The Attribute Editor
\begin{figure}\def
\epsfsize  ...

Figure 5 shows the attribute context editor for variable declaration and attribute condition definition of the rule expand.

Let us shortly explain the other window elements of the attribute editor. First of all the attribute editor is devided in three editors which can be selected by clicking of the according tab at the top of the attribute editor.
The three editors are called according to the appearance in the attribute editor from the left to the right: attribute context editor, current attribute editor and customize editor.
If you invoke the attribute editor, the current attribute editor is shown (see Figure 4). The current attribute editor is devided into three parts. At the top is a table which holds all attributes. One attribute is called member and all together are a tuple. The attribute editor knows two orders of members. The first order is the one how the user inserted the members. The second one is how they are displayed. That means a member can be at the last position which was inserted at first. To change the display order of the attributes use the middle mouse button.
In the middle, there is a text area which displays help messages and error reports. At the bottom, a button bar occurs which get you access operations on attributes. The \fbox{Reset} button sets all layout changes to the initial state. The \fbox{Show All} button marks all members visible at once. The \fbox{Hide All} button does it vice versa. The \fbox{Delete} button deletes the marked member. NOTE: This takes affect on the tuple type and all its instances. The \fbox{Evaluate} button tries to evaluate the expression in the marked line.
Whenever the attribute editor is opened for another graph object of the same type, the names and types of all attribute members edited for this type before are shown in the list. Only the values have to be entered for each new graph object.


next up previous contents
Next: Attribute Context Editor Up: Adding Attributes to a Previous: Adding Attributes to a   Contents
Olga Runge 2006-08-16