1 package net.sf.mmapps.applications.developer.modules.appview;
2
3 import java.awt.*;
4 import java.awt.geom.*;
5
6 import com.touchgraph.graphlayout.*;
7
8 /***
9 * @author Kees Jongenburger
10 * @version $Id: MMBaseInheritanceEdge.java,v 1.1.1.1 2004/02/06 08:44:07 keesj Exp $
11 */
12 public class MMBaseInheritanceEdge extends Edge {
13
14 public MMBaseInheritanceEdge(Node firstNode, Node secondNode) {
15 super(firstNode, secondNode);
16 setColor(javax.swing.plaf.metal.MetalLookAndFeel.getPrimaryControl());
17 };
18
19 public MMBaseInheritanceEdge(Node firstNode, Node secondNode, int strength) {
20 super(firstNode, secondNode, strength);
21 setColor(javax.swing.plaf.metal.MetalLookAndFeel.getPrimaryControl());
22 };
23
24 public void paint(Graphics graphics, TGPanel tgPanel) {
25 Graphics2D g = (Graphics2D) graphics;
26
27
28
29 Color c = javax.swing.plaf.metal.MetalLookAndFeel.getPrimaryControl();
30 g.setColor(c);
31 double x1 = from.drawx;
32 double y1 = from.drawy;
33 double x2 = to.drawx;
34 double y2 = to.drawy;
35 if (from != to) {
36
37 double dy = y2 - y1;
38 double dx = x2 - x1;
39 double ctrl1x = x1;
40 double ctrl1y = y1 + dy / 3;
41 double ctrl2x = x2;
42 double ctrl2y = y2 - dy / 3;
43
44 GeneralPath p = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
45 CubicCurve2D curve = new CubicCurve2D.Double(x1, y1, ctrl1x, ctrl1y, ctrl2x, ctrl2y, x2, y2);
46
47 p.append(curve, true);
48
49 CubicCurve2D curve2 = new CubicCurve2D.Double(x2, y2, ctrl2x, ctrl2y, ctrl1x + 10, ctrl1y, x1 + 10, y1);
50 p.append(curve2, true);
51
52 p.lineTo((float) x1, (float) y1);
53 g.fill(p);
54 g.setColor(Color.black);
55 g.draw(p);
56 }
57 g.setColor(c);
58
59 }
60 }