Developer’s corner

[[jlow]]

JLOW - Java Libraries fOr Workflow - Release 1.0

Requirements

  • JAVA J2SE Development Kit (JDK) 1.4 or later
  • Use the last version of JLOW
  • JGraph library is needed and available at http://www.jgraph.com (download the free library)

First application with JLOW

In a first step we will use JLOW in a very simple application in which the Workflow is just one box.

  • How to create a window ?
  • How to use the class GraphJ ?
  • How to add a descriptor ?
  • How to show the result ?

How to create a window ?

You must create the window in which the Workflow will be displayed :

  public HelloWorldFrame() {
 
          Container content = getContentPane();
 
          content.setLayout(new BorderLayout());
 
          setSize(400, 300);
 
          setTitle("Hello World");         
 
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
     }

Don't forget the main :

public static void main(String args[]) {
 
         HelloWorldFrame frame = new HelloWorldFrame();
 
 
         frame.setVisible(true);
 
}

How to use the class JGraph ?

You must create a GraphJ object which offer the display zone of the Workflow :

IRegisterer register = new Registerer();
 
GraphJ graph = new GraphJ(register);
 
content.add(graph, "Center");

How to add a descriptor ?

You must create a descriptor for your task Hello World and specify its display features with an Attributs object :

Attributs atts = new Attributs("AttHW", new Color(141, 90, 99), Attributs.TASK, new Dimension(80, 100));
 
 
atts.putAtt(Attributs.GRADIENTCOLOR, new GradientPaint(0, 0, new Color(141, 90, 99), 175,175, new Color(255, 255, 255, 200), true));
 
 
register.putAtt("CatHW", atts);

Creation of a descriptor for “Hello World” and adding to the registry :

TaskDescriptor desc = new TaskDescriptor("Hello World", "CatHW");
 
register.putDescriptor("Helloworld", desc);

The task is now known from the graph and it can be inserted with insert method (of GraphJ) :

graph.insert(new Point(10,10), "Helloworld");

How to show the result ?

Execute your application :

Remark : the “Name : Hello World” is only shown when the mouse is on the bow “Hello World”.

What we have learnt

Download and links

jlow.txt · Last modified: 2010/05/06 09:09 by root

Thanks for acknowledging the CDS developer’s resources (libraries, source code, etc.)

© UDS/CNRS

Contact