Applet

1)  The HTML web page and the Medusa jar file should be under the SAME folder. The lib folder containing the

extra libraries that are necessary for the applet to run should also be under the same folder. 

2) Indicates the name of the jar file. The width and the height define the size of the applet in pixels.

3) List of interaction colors to be used. In this case, the first interaction is black, the second is some other color

4) Indicates the section of edges. Whatever follow should be in " " symbols

5) n1:n2:1:1:0

node_name : node name :  i parameter : c parameter : o parameter

Edges: node1, node2, type of interaction, confidence, orientation. Required. Semicolons separate edge definitions

Explanations of these parameters are given in File Format section.

6) Indicates the section of nodes. Whatever follow should be in " " symbols

5) o parameter

Parameter i  is followed by a single space and then by a value. The values can be >0. This parameter indicates how much curvy the lines between two nodes will be.

For example the right image shows that nodes n1 and n2 have o-value 3. If o parameter equals to 0 ten the line appears as straight.

Before this column a tab is required.

6) *nodes

This tag indicates that the section that will follow contains information about the nodes.

Nodes: node name, X, Y, color (R,G,B),...

7) n1:350:350:250:12,12:2:'Annot':'cluster 1';

node_name : R : G : B : X , Y: s parameter: ' annotation ' : ' cluster cluster_number' 

R:G:B is th RGB color

X, Y are the coordinates

s (shape) parameter is  given in File Format section.

8) The physical width and height of the applet on the screen. Not the same as the graph area. The graph area should of course be smaller than the applet area

Other options are linkStart and linkEnd, which enables node linking. If you shift-click on a node, you can open a new browser window to an address defined by linkStart+node+linkEnd. In the example above, node names are sent to google in a new browser. Finally, if layout is set to true, graphs will be layed out before being shown.

Usually, what you would do is something like this: Get the data from whatever database you are using, and write the parameters to the applet.

Users can export HTML parameters from the Medusa application. You can then use them for display with your applet or as a template for writing your own parameters.

A sample HTML web page can be downloaded together with the application.

How to customize the applet display

You can easily customize the appearance of the graph to draw edges and nodes in any way you want. To do this, you need to know some java programming.

First, you extend the class medusa.display.BasicGraphPanel like this:

    * Overridden <CODE>paintNode</CODE> method.

    * Paints two ellipses with a gradient based on the node

    * color. The button effect is created by using opposite gradients.

    * If you want the dragged node to be painted differently, override

    * <CODE>paintPick</CODE>. If you want the fixed nodes to be painted

    * differently, check for <CODE>Node.isFixed</CODE>.

    * @param g Graphics2D

    * @param n Node n

    */

   public void paintNode(Graphics2D g, Node n) {

       paintShadedNode(g,n);

   }

  

   private void paintShadedNode(Graphics2D g, Node n){

       Color c=n.getColor();

       int nodeSize=16;

      

       int border=2;

       int x=(int) n.getX() - (int)(nodeSize/2);

       int y=(int) n.getY() - (int)(nodeSize/2);

       float fx=(float)x;

       float fy=(float)y;

       Point2D p1=new Point2D.Float(x,y);

       Point2D p2=new Point2D.Float(x+nodeSize,y+nodeSize);

       GradientPaint outside=

               new GradientPaint(p1,c,

               p2,Color.white);

       GradientPaint inside=

               new GradientPaint(p1,Color.white,

               p2,c);

      

      

       Shape outsideShape =

               new Ellipse2D.Double(x, y, nodeSize, nodeSize);

       Shape insideShape =

               new Ellipse2D.Double(x+border, y+border,

               nodeSize-2*border, nodeSize-2*border);

       g.setPaint(outside);

      

       g.fill(outsideShape);

       g.setPaint(inside);

       g.fill(insideShape);

      

       g.setPaint(Color.black);

       if (label)

           g.drawString(n.getLabel(),x-2,y-2);

   }

  

 

  

}

Source for ExamplePanel

Then you add this to your applet and display. For instance, an applet could look like this:

/*

* ExampleApplet.java

*

* Created on October 24, 2006, 6:38 PM

*

* To change this template, choose Tools | Template Manager

* and open the template in the editor.

*/

package medusa.example;

import medusa.MedusaSettings;

import medusa.applet.MedusaLite;

/**

*

* @author hooper

*/

public class ExampleApplet extends MedusaLite {

  

  

   public void initPanel(){

       System.out.println("Initializing ExampleAppletPanel");

       String settingsParam=getParameter("settings");

      

       MedusaSettings stringSettings = new MedusaSettings(settingsParam);

      

       String linkStart=getParameter("linkStart");

       String linkEnd=getParameter("linkEnd");

       System.out.println(linkStart);

       panel=new ExamplePanel(stringSettings);

       System.out.println(panel);

   }

  

  

  

}

Then run it as an applet.