Minimal Example HowTo

Version 1.1 by cmot on 2013/11/09 01:48

These instructions should guide you if you'd like to try out using KLighD for visualizing your own models or data structures. A minimal example is shown where a trivial data structure is visualized with KLighD.

The Data

The data structure is defined like follows:

public class MyData {
   
   public String name;
   public List<MyData> subData = new LinkedList<MyData>();
   
   public static MyData getTestData() {
        MyData d1 = new MyData();
        d1.name = "all data";
        MyData d2 = new MyData();
        d2.name = "outer data";
        MyData d3 = new MyData();
        d3.name = "inner 1";
        MyData d4 = new MyData();
        d4.name = "inner 2";
        MyData d5 = new MyData();
        d5.name = "inner 5";
        MyData d6 = new MyData();
        d6.name = "most inner 6";
        d1.subData.add(d2);
        d2.subData.add(d3);
        d2.subData.add(d4);
        d2.subData.add(d5);
        d4.subData.add(d6);
       return d1;
   }
   
}

The method getTestData() will build a small instance of the MyData class that is used for visualization.

Step-by-step guide

In order to get this example working, please follow the instructions below:

  1. Download Eclipse Kepler:
    http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/kepler/SR1/eclipse-modeling-kepler-SR1-win32-x86_64.zip&mirror_id=546
  2. Add the KIELE Pragmatics Nightly update site to your Eclipse (Help -> Install New Software ... -> Add)
    http://rtsys.informatik.uni-kiel.de/~kieler/updatesite/nightly/pragmatics/
  3. Select
    [x] Layout,
    [x] Lightweight Diagrams, and
    [x] Sources
    to be installed into your Eclipse
  4. Download the following file, unzip it and import it as an existing project into your Eclipse workspace
    de.cau.cs.kieler.klighd.example.mydata.zip
  5. You may now create a new run configuration and run everything as an Eclipse Application
  6. Once you click on the red-circled button, you should see the visualization as follows
    klighd-minimal-example.png

 

The Details

Mainly there a three classes involved:

  1. MyData.java : It contains the simple model

 

You may also want to use visual panels to communicate related information, tips or things users need to be aware of.

Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

Unknown macro: contentbylabel. Click on this message for details.