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 ExclusiveChoiceFigure extends Shape {
31
32 boolean selected;
33
34 public ExclusiveChoiceFigure() {
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 graphics.drawPolygon(new int[] {centerX - r.width / 2, centerY,
46 centerX, centerY - r.height / 2,
47 centerX + r.width / 2, centerY,
48 centerX, centerY + r.height / 2});
49 graphics.setLineWidth(3);
50
51 int step = Math.min(Math.round(((float)r.width) / 6),
52 Math.round(((float)r.height) / 6));
53
54 graphics.drawLine(centerX - step, centerY - step, centerX + step, centerY + step);
55 graphics.drawLine(centerX + step, centerY - step, centerX - step, centerY + step);
56 }
57
58 protected void fillShape(Graphics g) {
59 Rectangle r = getBounds();
60 g.fillPolygon(new int[] {r.x, r.y + r.height / 2,
61 r.x + r.width / 2, r.y,
62 r.x + r.width, r.y + r.height / 2,
63 r.x + r.width / 2, r.y + r.height});
64 }
65
66 public void setSelected(boolean selected) {
67 if (this.selected == selected)
68 return;
69 this.selected = selected;
70 repaint();
71 }
72
73 }
74
75
76
77
78
79
80
81
82
83
84
85
86