1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 /***
19 * <p>Title: WSMO Studio</p>
20 * <p>Description: Semantic Web Service Editor</p>
21 * <p>Copyright: Copyright (c) 2004-2007</p>
22 * <p>Company: Ontotext Lab. / SIRMA </p>
23 */
24
25 package org.wsmostudio.bpmo.figures;
26
27 import org.eclipse.draw2d.*;
28 import org.eclipse.draw2d.geometry.Rectangle;
29
30 public class TimerFigure extends Shape {
31
32 boolean selected;
33
34 public TimerFigure() {
35 super();
36 setBorder(new MarginBorder(3,3,3,3));
37 setOpaque(false);
38 }
39
40 protected void outlineShape(Graphics graphics) {
41
42 Rectangle r = getBounds();
43 int centerX = r.x + r.width / 2;
44 int centerY = r.y + r.height / 2;
45
46 int rad = Math.min(r.width / 2, r.height / 2) - getLineWidth();
47
48 graphics.setLineWidth(getLineWidth());
49 graphics.drawOval(centerX - r.width / 2 + getLineWidth(), centerY - r.height / 2 + getLineWidth(),
50 (r.width / 2) * 2 - 2 * getLineWidth(), (r.height / 2) * 2 - 2 * getLineWidth());
51 graphics.drawOval(centerX - r.width / 2 + getLineWidth() + 2, centerY - r.height / 2 + getLineWidth() + 2,
52 (r.width / 2) * 2 - 2 * getLineWidth() - 4, (r.height / 2) * 2 - 2 * getLineWidth() - 4);
53
54
55 graphics.drawLine(centerX, centerY, centerX, centerY - rad/3);
56 graphics.drawLine(centerX, centerY, centerX + rad / 4, centerY);
57
58 graphics.setLineWidth(3);
59 graphics.drawOval(centerX - rad / 2, centerY - rad / 2, rad, rad);
60
61 }
62
63 protected void fillShape(Graphics g) {
64 Rectangle r = getBounds();
65 int centerX = r.x + r.width / 2;
66 int centerY = r.y + r.height / 2;
67 g.fillOval(centerX - r.width / 2 + getLineWidth(), centerY - r.height / 2 + getLineWidth(),
68 (r.width / 2) * 2 - 2 * getLineWidth(), (r.height / 2) * 2 - 2 * getLineWidth());
69 }
70
71 public void setSelected(boolean selected) {
72 if (this.selected == selected)
73 return;
74 this.selected = selected;
75 repaint();
76 }
77
78 }
79
80
81
82
83
84
85
86
87
88