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 MessageFigure extends Shape {
31  
32      boolean selected;
33  
34      public MessageFigure() {
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          graphics.setLineWidth(getLineWidth());
47          graphics.drawOval(r.x + getLineWidth(), r.y + getLineWidth(), 
48          		r.width - 2 * getLineWidth(), r.height - 2 * getLineWidth());
49          graphics.drawOval(r.x + getLineWidth() + 2 , r.y + getLineWidth() + 2, 
50                  r.width - 2 * getLineWidth() - 4, r.height - 2 * getLineWidth() - 4);
51  
52          graphics.setLineWidth(1);
53  
54          int dimm = Math.min(r.width, r.height);
55          
56          graphics.drawRectangle(centerX - dimm / 4, centerY - dimm / 6, 
57          		               dimm / 2, dimm / 3);
58          
59          graphics.drawLine(centerX - dimm / 4, centerY - dimm / 6 + 1, centerX, centerY);
60          graphics.drawLine(centerX + dimm / 4, centerY - dimm / 6 + 1, centerX, centerY);
61          
62      }
63  
64      protected void fillShape(Graphics g) {
65          Rectangle r = getBounds();
66          g.fillOval(r.x + getLineWidth(), r.y  + getLineWidth(), 
67          		r.width  - 2 * getLineWidth(), r.height - 2 * getLineWidth());
68      }
69  
70      public void setSelected(boolean selected) {
71          if (this.selected == selected)
72              return;
73          this.selected = selected;
74          repaint();
75      }
76  
77  }
78  
79  /*
80   * $Log$
81   * Revision 1.1  2007/08/22 16:19:10  alex_simov
82   * no message
83   *
84   */