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  import org.eclipse.swt.graphics.Color;
30  
31  public class SendMessageFigure extends Shape {
32  
33      boolean selected;
34  
35      public SendMessageFigure() {
36          super();
37          setBorder(new MarginBorder(3,3,3,3));
38          setOpaque(false);
39      }
40  
41      protected void outlineShape(Graphics graphics) {
42  
43          Rectangle r = getBounds();
44          int centerX = r.x + r.width / 2;
45          int centerY = r.y + r.height / 2;
46          
47          graphics.setLineWidth(getLineWidth());
48          graphics.drawOval(r.x + getLineWidth(), r.y + getLineWidth(), 
49          		r.width - 2 * getLineWidth(), r.height - 2 * getLineWidth());
50          graphics.drawOval(r.x + getLineWidth() + 2 , r.y + getLineWidth() + 2, 
51                  r.width - 2 * getLineWidth() - 4, r.height - 2 * getLineWidth() - 4);
52  
53          graphics.setLineWidth(1);
54  
55          int dimm = Math.min(r.width, r.height);
56          
57          Color oldBackground = getBackgroundColor();
58          
59          graphics.setBackgroundColor(getForegroundColor());
60          graphics.fillRectangle(centerX - dimm / 4, centerY - dimm / 6, 
61          		               dimm / 2, dimm / 3);
62          
63          graphics.setForegroundColor(oldBackground);
64          graphics.drawLine(centerX - dimm / 4, centerY - dimm / 6 + 1, centerX, centerY);
65          graphics.drawLine(centerX + dimm / 4, centerY - dimm / 6 + 1, centerX, centerY);
66          
67      }
68  
69      protected void fillShape(Graphics g) {
70          Rectangle r = getBounds();
71          g.fillOval(r.x + getLineWidth(), r.y  + getLineWidth(), 
72          		r.width  - 2 * getLineWidth(), r.height - 2 * getLineWidth());
73      }
74  
75      public void setSelected(boolean selected) {
76          if (this.selected == selected)
77              return;
78          this.selected = selected;
79          repaint();
80      }
81  
82  }
83  
84  /*
85   * $Log$
86   * Revision 1.1  2007/08/22 16:19:10  alex_simov
87   * no message
88   *
89   */