01: /**
02: * LibreSource
03: * Copyright (C) 2004-2008 Artenum SARL / INRIA
04: * http://www.libresource.org - contact@artenum.com
05: *
06: * This file is part of the LibreSource software,
07: * which can be used and distributed under license conditions.
08: * The license conditions are provided in the LICENSE.TXT file
09: * at the root path of the packaging that enclose this file.
10: * More information can be found at
11: * - http://dev.libresource.org/home/license
12: *
13: * Initial authors :
14: *
15: * Guillaume Bort / INRIA
16: * Francois Charoy / Universite Nancy 2
17: * Julien Forest / Artenum
18: * Claude Godart / Universite Henry Poincare
19: * Florent Jouille / INRIA
20: * Sebastien Jourdain / INRIA / Artenum
21: * Yves Lerumeur / Artenum
22: * Pascal Molli / Universite Henry Poincare
23: * Gerald Oster / INRIA
24: * Mariarosa Penzi / Artenum
25: * Gerard Sookahet / Artenum
26: * Raphael Tani / INRIA
27: *
28: * Contributors :
29: *
30: * Stephane Bagnier / Artenum
31: * Amadou Dia / Artenum-IUP Blois
32: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33: */package com.artenum.so6.dataflow.graph;
34:
35: import com.artenum.graph.SimpleGraphPanel;
36: import com.artenum.graph.interfaces.Connection;
37: import com.artenum.graph.interfaces.GraphModel;
38:
39: import com.artenum.so6.dataflow.StyleManager;
40:
41: import java.awt.Graphics;
42: import java.awt.Graphics2D;
43: import java.awt.Point;
44:
45: /**
46: * @author Sebastien
47: */
48: public class So6GraphPanel extends SimpleGraphPanel {
49: public So6GraphPanel(GraphModel model) {
50: super (model);
51: }
52:
53: protected void drawConnection(Graphics g1, Connection connection) {
54: Graphics2D g = (Graphics2D) g1;
55: Point sourcePoint = connection.getSource().getConnectionPoint(
56: connection);
57: Point targetPoint = connection.getTarget().getConnectionPoint(
58: connection);
59: g.setColor(StyleManager.getInstance().getElectricalWireColor());
60: g.setStroke(StyleManager.getInstance()
61: .getElectricalWireStroke());
62: g.drawLine(sourcePoint.x, sourcePoint.y, sourcePoint.x,
63: sourcePoint.y + ((targetPoint.y - sourcePoint.y) / 2));
64:
65: g.drawLine(sourcePoint.x, sourcePoint.y
66: + ((targetPoint.y - sourcePoint.y) / 2), targetPoint.x,
67: sourcePoint.y + ((targetPoint.y - sourcePoint.y) / 2));
68:
69: g.drawLine(targetPoint.x, targetPoint.y, targetPoint.x,
70: targetPoint.y + ((sourcePoint.y - targetPoint.y) / 2));
71: }
72: }
|