View Javadoc

1   /*
2    WSMO Studio - a Semantic Web Service Editor
3    Copyright (c) 2004-2007, Ontotext Lab. / SIRMA Group
4    
5    This library is free software; you can redistribute it and/or modify it under
6    the terms of the GNU Lesser General Public License as published by the Free
7    Software Foundation; either version 2.1 of the License, or (at your option)
8    any later version.
9    This library is distributed in the hope that it will be useful, but WITHOUT
10   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   details.
13   You should have received a copy of the GNU Lesser General Public License along
14   with this library; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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 MultipleMergeFigure extends Shape {
31  
32      boolean selected;
33  
34      public MultipleMergeFigure() {
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.setLineWidth(3);
46  
47          graphics.drawPolygon(new int[] {centerX - r.width / 2 + 2, centerY,
48                  centerX, centerY - r.height / 2 + 2,
49                  centerX + r.width / 2 - 2, centerY,
50                  centerX, centerY + r.height / 2 - 2});
51          
52          int step = Math.min(Math.round(((float)r.width) / 6), 
53                              Math.round(((float)r.height) / 6));
54  
55          graphics.drawOval(centerX - step, centerY - step, 2 * step, step * 2);
56  
57      }
58  
59      protected void fillShape(Graphics g) {
60          Rectangle r = getBounds();
61          g.fillPolygon(new int[] {r.x + 2, r.y + r.height / 2,
62                  r.x + r.width / 2, r.y + 2,
63                  r.x + r.width - 2, r.y + r.height / 2,
64                  r.x + r.width / 2, r.y + r.height - 2});
65      }
66  
67      public void setSelected(boolean selected) {
68          if (this.selected == selected)
69              return;
70          this.selected = selected;
71          repaint();
72      }
73  
74      
75  }
76  
77  /*
78   * $Log$
79   * Revision 1.4  2007/04/26 11:57:46  alex_simov
80   * bugfix [1707565]: proper images are set
81   *
82   * Revision 1.3  2007/03/30 17:19:59  alex_simov
83   * The workflow entities and connections can have now user
84   * defined/adjustable colors
85   *
86   * Revision 1.2  2007/03/28 15:56:16  alex_simov
87   * licence header added
88   *
89   */