# KIELER Lightweight Diagrams

Last modified by Soeren Domroes on 2025/01/30 12:04
Export
Office Formats
Export as PDF Export as ODT Export as RTF
Other Formats

Select the pages to export:

select all/ none

Legend:
  Created Page
  Modified Extension Page
  Clean Extension Page

Export as HTML

This tutorial fits into the row of our tutorials teaching the basics of Eclipse and Eclipse modeling technologies. It is intended to be performed by bachelor or master students taking part on practicals (e.g. Eclipse Practical (winter term 201213)) or warming up for a thesis.

The aim of this tutorial is to make you familiar with KLighD and the KLighD way of creating diagrams of models and even any data structures being worth to be visualized by node-link-diagrams.

# Preliminaries

1. Read about the ideas & motivation of KLighD in our paper "Just Model! – Putting Automatic Synthesis of Node-Link-Diagrams into Practice", cited at Lightweight Diagrams (KLighD)
   - You can skip the size estimation part and focus on section I, III, IV A, and V.
2. Install the KLighD from our latest release update site as demonstrated on Lightweight Diagrams (KLighD) and import the examples project.
3. Make yourself familiar with the UML2UseCaseDiagramSynthesis contained that project

   - Have also a look at the ...Extensions classes mentioned in UML2UseCaseDiagramSynthesis, especially KNodeExtensions.
     What is the purpose of createNode(...) and getNode(...)?

# Implement a simple turing diagram synthesis

1. Create a new diagram synthesis implementation by means of the KLighD project wizard as illustrated on Lightweight Diagrams (KLighD).
2. Add a dependency of the newly introduced plug-in project to the project defining your turing modeling language.
3. Let your diagram synthesis create a node for each state declared in your state machine.
   - Let those node be depicted by ellipses or rounded rectangles containing a text field showing the corresponding state's name
   - Add some space around the text by trying out all of
     - setSurroundingSpace(...), make sure to let the rel parameter satisfy
       rel < 0.5f
     - setAreaPlacementData().from(LEFT, ..., ..., TOP, ..., ...).to(RIGHT, ..., ..., BOTTOM, ..., ...), as well as

     - setPointPlacementData LEFT 00.5f TOP 00.5f H_CENTRALV_CENTRAL 0000(, , , , , , , , 1, 1, , )

   - Make yourself familiar with all of that opportunities, play around with the parameters to figure out their effects!
4. Let your diagram synthesis create an edge for each transition being depicted by a polyline
   - Attach arrow decorators to those polylines.

# Augment your diagram synthesis

1. Highlight the initial state of your turing diagrams by setting some different color, line width, line style, or what ever
2. The actor nodes in UML2UseCaseDiagramSynthesis are equipped with (node) labels. This is done by means of a convenience method provided KLabelExtensions.
   - Equip the edges of your turing diagrams with labels exhibiting the guard, new symbol, etc; use a fitting method for edge labels from KLabelExtensions.
3. Improve the layout of your diagrams
   - switch the layout algorithm to Graphviz dot by setting the layout option LayoutOptions.ALGORITHM on the root node to de.cau.cs.kieler.graphviz.dot.
   - change the edge figures from polylines to splines.

# Introduce synthesis and layout options

1. Try out the EcoreDiagramSynthesis as shown in the meeting, make yourself familiar with the implementation
   - Focus on the declaration of SynthesisOptions and their usages, have also a look SynthesisOption's class documentation.
2. Add a synthesis option to your diagram synthesis implementation for turning edge labels on & off.
3. Feel free to add further options, e.g. for changing the coloring of the nodes and edges
4. Provide some reasonable layout options in the side bar, allowing the tool user to tailor the diagrams' layout

# Add hierarchy

1. Add a further KNode representing the TuringMachine, move all nodes representing states into that machine node
2. Choose a reasonable basis figure for that node
   1. add a text field showing the machine's name (or some fixed title text)
   2. add a text field showing the machine's tape alphabet, extend your turing machine language (meta model) respectively, if necessary
   3. add a KChildArea, e.g. by calling addChildArea()
   4. define a grid-based children placement of the root figure by calling setGridPlacement(1)
      - What is the effect of the 1?
   5. add polylines acting as separators of the above figure elements

# Manipulate displayed diagrams

KLighD diagrams provide interactivity by allowing to link action to KRenderings

1. add a KAction to the title text of node representing the turing machine by calling
   text.addAction(Trigger::DOUBLECLICK, KlighdConstants::ACTION_COLLAPSE_EXPAND)
   - observe the effect and enjoy
2. Implement your own action
   - have a look at de.cau.cs.kieler.klighd.actions.CollapseExpandAction and its registration in the corresponding plugin.xml
   - implement an own IAction that manipulates the current diagram by changing colors, adding or removing elements, hiding and showing single nodes or edges, ... , and register it
   - associate it with a diagram part of your choice and test it
3. Run your action via a menu contribution

   - copy the following snippet into a plugin.xml of your projects, replace ##YOUR_PLUGINS_ID## and ##YOUR_ACTIONS_ID## by the corresponding strings

     <extension
     id="##YOUR_PLUGINS_ID##.internal.commands.handler"
     point="org.eclipse.ui.menus">
     <menuContribution
     allPopups="false"
     locationURI="toolbar:de.cau.cs.kieler.layout.toolbar">
     <command
     commandId="de.cau.cs.kieler.klighd.ui.actionExecution"
     label="TestContribution"
     style="push">
     <parameter
     name="de.cau.cs.kieler.klighd.ui.action"
     value="##YOUR_ACTIONS_ID##">
     </parameter>
     </command>
     </menuContribution>
     </extension>
   - change ##YOUR_PLUGINS_ID## part of the label, enter your action's id (##YOUR_ACTIONS_ID##), feel free to put it at a different location, e.g. the context menu
   - test it by selecting a diagram node or edge and hitting your menu entry

Tags:
Created by chsch on 2013/11/12 13:21

- Comments (0)
- Attachments (0)
- History
- Information

# Quick Links

KIELER on GitHub
RTSYS Homepage

XWiki 14.4.7