The visualizer metamodel for the definition of user-defined form-based lan- guages is shown in Figure 7.2. Like the visualizers for all other formats the
7.2. Form-based User-defined Language FormVisualizer StandardColor color:ColorEnumeration RGBColor R:Integer G:Integer B:Integer EnumerationAttribute BooleanAttribute checkbox:Boolean trueLiteral:String falseLiteral:String EnumerationLiteralMapping enumerationLiteral:String literal:String 1 mappings columns:Integer 1 * aspect Aspect kind:AspectKind joinpoint:String condition:String Widget columnSpan:Integer rowSpan:Integer name:String label:String horizontalAlignment:Alignment verticalAlignment:Alignment grabhorizontalExcess:Boolean grabVerticalExcess:Boolean 1 foregroundColor 1 0..1 form 1 0..1 widget 1 widget 0..1 Group Section expanded:Boolean description:String CustomAction id:String Attribute attribute:plm::Attribute Connection navigable:Boolean deletable:Boolean addable:Boolean multiselection:Boolean connection:plm::Connection Font name:FontKind height:Integer style:FontStyle font0..1 1 CalculatedAttribute attribute:ecore::Attribute expression:String calculatedAttribute0..1 1 backgroundColor Form title:String columns:Integer showBreadcrumb:Boolean 0..1 content 1 <<Enumeration>> ColorEnumeration white = 0 black = 1 red = 2green = 3
<<Enumeration>> AspectKind before = 0 after = 1 around = 2 <<Enumeration>> FontStyle normal = 0 bold = 1 italics = 2 <<Enumeration>> FontKind Arial = 0
Tahoma = 1Courier = 2Times = 3
<<Enumeration>> Alignment
begin = 0 center = 1 end = 2fill = 3
<<Enumeration>> ActionKind save = 0 undo = 1 close = 2 add = 3 remove = 4 Expression expression:String Action kind:ActionKind 1 1 0..* 1 instanceLevel:Boolean
notation:String BreadcrumbConfigurationattribute:plm::Attribute expression:String
0..1 breadcrumbConfiguration 1
Figure 7.2: Form-based visualizer metamodel.
tached to instances of all linguistic types. All content in a FormVisualizer is a subclass of VisualizerElement which can store CalculatedAttributes. These Cal- culatedAttributes are used to set visualizer attributes based on the outcome of statements in a constraintexpression. For instance, the titleof a Form can be set to the name of the currently displayed ontological model element.
TheFormVisualizercontains theFormdescribing the outer-most container of a statement in the form-based language. TheFormcan be configured by setting atitleand the number ofcolumnsin its grid layout that arranges its content. For simplicity, the grid layout is used as the default layout in the form-based visual- ization implementation. TheFormis further described byContainerswhich are eitherGroupsorSectionswhich containContainersor otherWidgetsfor displaying and manipulating information using the form-based user-defined language. A form can be configured to show or hide a breadcrumb (showBreadcrumb). If a language engineer decides to show a breadcrumb in the form-based language, it can be further configured through aBreadcrumbConfigurationto either display the value of an ontologicalattributeor to show the value of anexpressionwritten in a deep constraint language.
a label, inherited from Widget, in the top left corner of the border. This label
serves as a caption summarizing the nature of a Group’s content. A Section, however, does not surround its content with a border. It just displays a header at the section start. In contrast to a Group, a Section can be collapsed and expanded by the modeler. The initial state is configured by setting itsexpanded
attribute to show or hide the section’s content. Additionally, a description of the content located in the section can be displayed below the Section’s label. Both, Section andGroupcan have the amount of columns they use to arrange content in a grid set via the columnsattribute inherited fromContainer.
Containers contain Widgets which themselves can be Containers organizing form content orWidgetsfor viewing and manipulating model data. To execute actions on a model the Actionmetaclass is available providing default actions which are selected through thekind enumeration attribute of typeActionKind. TheseActionKindsinclude amongst other things thesave,undoandcloseopera- tions. User-defined actions can be used in a form-based language by defining
CustomActions. For these, a language engineer has to provide alabelto be dis- played for an action and anididentifying the operation to be performed when it is selected. In the form-based language actions are visualized as buttons.
To display and manipulate data from the model represented by the form- based language,Attribute,ConnectionandExpressionare available. Attributemaps an ontological attribute to a text box. By default the name of the mapped
attribute is displayed on the left of the text box. This text can be configured by setting the Attribute’s label inherited from Widget. The visualized Attribute
controls are data type sensitive like in the textual and tabular formats. The
BooleanAttribute and EnumerationAttribute subtypes of Attribute offer advanced configuration options mapping attributes of enumeration or boolean data type. User-defined strings for displayingBooleanAttributescan be mapped to the true (trueLiteral) and false (falseLiteral) values to display more informative text than merely true or false to the user. To display a checkbox instead of a value selection the checkbox attribute is set to true. EnumerationAttributes map the singleenumerationLiteralsof an enumeration type to strings which are displayed to the modeler instead of the enumeration literals as defined in the modeling language’s abstract syntax when editing attributes of an enumeration data type.
7.2. Form-based User-defined Language
To display values which do not depend on one single ontological attribute but on a combination of several ontological attributes, anExpressionin a deep constraint language can be defined to calculate the value to be displayed. Since they are calculated the results ofExpressionsare not editable by the user. The label attribute defines the text shown next to the calculated expression value. Thelabel attribute of an Expression must be explicitly set because an
Expression cannot be mapped to one single attribute from which the title for the calculated value can be derived.
Connectiondisplays all entities connected via the specifiedconnection. It can be configured to allow: 1. navigation via the connection (navigable), 2. the dele- tion of the connection and the connected elements (deletable), 3. the addition of new elements by creating a new connection (addable), 4. the selection of multiple connections at the same time and the execution of operations such as delete on the selected items (multiselection) or 5. the overriding of the default label’s text displayed next to the list of all connected elements (labelinherited fromwidget).
The font, backgroundColor and foregroundColor of Widgets are set using the respective attributes. The usedFont is specified by defining the name of the font,sizeand style(i.e. normal, italicsand bold). TheforegroundColor andback- groundColor are specified either through a StandardColor or an RGBColor. A
StandardColor offers the default colors defined in the ColorEnumeration. Even though this enumeration is limit to three colors in Figure 7.2, it can be ex- tended to as many colors as needed. TheRGBColorcan specify any color using
Red, Green, and Blue values. Furthermore, all Widgets can be configured to span more than one row (rowSpan) and more than one column (columnSpan) in the grid of its container. Widgetscan also be configured to occupy all vertical space (grabVerticalExcess) and occupy all horizontal space (grabHorizontalExcess). ThehorizontalAlignment and verticalAlignment attributes are used to determine the alignment of aWidgetwithin a grid cell.
Aspect-orientation is supported by declaringWidgetsas join points by set- ting theirnameattribute. Aspectscan then provideWidgetsto these join points through theircontentattribute. As with all other formats, Aspectscan be con- figured via their kind attribute to replace the join point (around), place the widgets before the join point (before) or after the join point (after). Thename
Data (LML) User-defined Visualization User-defined Visualizer
Bob0:ResearchEmployee
name0=Bob
expertise0=RC Car Research
salary0=48k
hasPhD0=false
Company Structure O2 Quality Toys Inc.
Toy Research
Name Bob Salary 48k General Information
Bob
Delete Employee PhD Expertise RC Car Research
Bob FormVisualizer
Form (columns=1; showBreadcrumb=true)
CalculatedAttribute (attribute=title; expression=name) BreadcrumbConfiguration (attribute=name;)
Group (label='General Information'; columns=2) Attribute (attribute=name)
Attribute (attribute=salary)
BooleanAttribute (attribute=hasPhD; checkbox=true; label='PhD') Attribute (attribute=expertise)
Group (laebl=Operations, columns=1)
Action (label='Delete Employee'; kind=remove; grabHorizontalExcess=true; horizontalAlignment=end)
Operations
Figure 7.3: Bobvisualized in the form-based company structure modeling lan- guage.
attribute identifies the join point to which the aspect contributes and thecondi- tionattribute specifies a condition defined in a deep constraint language which must hold true in order to apply the aspect.
7.2.1
Form-based Visualizer Metamodel Example
An example of the usage of the form-based user-defined visualization definition metamodel is shown in Figure 7.3. The bottom left of the figure displaysBob, an instance ofResearchEmployee, in the predefined diagrammatic LML notation.
Bob hasexpertiseinRC Car Research, asalaryof 48kand does not have a PhD. The user-defined form-based visualizer which is applied toBobis shown in the center top of Figure 7.3. TheFormVisualizercontains aFormwhich receives its title from a CalculatedAttribute, which sets thetitleattribute of Formto the
expressionretrieving the nameof the currently displayed employee. The bread- crumb of the Form is configured to be visible (showBreadcrumb=true) and to display the name of the currently displayed employee (attribute=name) through theBreadcrumbConfigurationowned by theForm. The grid layout of theFormhas