01: package net.sourceforge.squirrel_sql.plugins.graph;
02:
03: import net.sourceforge.squirrel_sql.plugins.graph.xmlbeans.FormatXmlBean;
04:
05: import java.awt.*;
06:
07: public class EdgesGraphComponent implements GraphComponent {
08: private FormatXmlBean _format;
09: private double _sldValue;
10: private boolean _valueIsAdjusting;
11: private int _widht;
12: private int _height;
13: public static final double CM_BY_INCH = 1 / 2.54;
14:
15: public void init(FormatXmlBean format, double sldValue,
16: boolean valueIsAdjusting) {
17: _format = format;
18: _sldValue = sldValue;
19: _valueIsAdjusting = valueIsAdjusting;
20: }
21:
22: public void setBounds(int widht, int height) {
23: _widht = widht;
24: _height = height;
25: }
26:
27: public void paint(Graphics g, boolean isPrinting) {
28: if (isPrinting) {
29: return;
30: }
31:
32: PixelCalculater pc = new PixelCalculater(_format, _sldValue);
33:
34: int stepWitdth = pc.getPixelWidth();
35: int stepHeight = pc.getPixelHeight();
36:
37: Color oldColor = g.getColor();
38: try {
39: g.setColor(Color.GREEN);
40:
41: for (int i = stepHeight; i < _height; i += stepHeight) {
42: g.drawLine(0, i, _widht, i);
43: }
44:
45: for (int i = 0; i < _widht; i += stepWitdth) {
46: g.drawLine(i, 0, i, _height);
47: }
48: } finally {
49: g.setColor(oldColor);
50: }
51:
52: }
53:
54: public Dimension getRequiredSize() {
55: return new Dimension(0, 0);
56: }
57: }
|