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 ConditionFigure extends Shape {
31  
32      
33      public ConditionFigure() {
34          super();
35          setBorder(new MarginBorder(3,5,3,5));
36          setOpaque(false);
37      }
38      
39      @Override
40      protected void fillShape(Graphics graphics) {
41          Rectangle r = getBounds();
42          graphics.fillPolygon(new int[] {r.x, r.y + r.height / 2,
43                  r.x + r.width / 2, r.y,
44                  r.x + r.width, r.y + r.height / 2,
45                  r.x + r.width / 2, r.y + r.height});
46      }
47  
48      @Override
49      protected void outlineShape(Graphics graphics) {
50          Rectangle r = getBounds();
51          int centerX = r.x + r.width / 2;
52          int centerY = r.y + r.height / 2;
53          graphics.drawPolygon(new int[] {centerX - r.width / 2, centerY,
54                  centerX, centerY - r.height / 2,
55                  centerX + r.width / 2, centerY,
56                  centerX, centerY + r.height / 2});
57      }
58  }
59  
60  /*
61   * $Log$
62   * Revision 1.1  2007/04/05 16:47:47  alex_simov
63   * conditional shape added (needed for loops)
64   *
65   */