Math2mat

/home/ythoma/docs/math2mat/svn/wp1/framework/m2mGUI/src/m2m/frontend/dynamicview/figure/LoopIteratorFigure.java

Go to the documentation of this file.
00001 
00015 package m2m.frontend.dynamicview.figure;
00016 
00017 import org.eclipse.draw2d.ColorConstants;
00018 import org.eclipse.draw2d.Figure;
00019 import org.eclipse.draw2d.Label;
00020 import org.eclipse.draw2d.LineBorder;
00021 import org.eclipse.draw2d.RectangleFigure;
00022 import org.eclipse.draw2d.Shape;
00023 import org.eclipse.draw2d.ToolbarLayout;
00024 import org.eclipse.draw2d.XYLayout;
00025 import org.eclipse.draw2d.geometry.Point;
00026 import org.eclipse.draw2d.geometry.Rectangle;
00027 
00028 public class LoopIteratorFigure extends Figure
00029 {
00033         public static final int OUT_POINT_X_POSITION = 33;
00034         public static final int OUT_POINT_Y_POSITION = 15;
00038         public static final int WIDTH  = 40;
00039         public static final int HEIGHT = 35;
00040         
00041         
00045     private XYLayout layout;
00049         private Label labelName = new Label();
00053         private Label labelStart = new Label();
00057         private Label labelInc = new Label();
00061         private Label labelEnd = new Label();
00062         
00063     
00067     public LoopIteratorFigure() 
00068     {
00069         layout = new XYLayout();
00070         setLayoutManager(layout);   
00071          
00072         /* Initialisation of the labelName */
00073         labelName.setForegroundColor(ColorConstants.black);
00074         add(labelName, ToolbarLayout.VERTICAL); 
00075         setConstraint(labelName, new Rectangle(WIDTH/2, HEIGHT/2, -1, -1)); 
00076         
00077         /* Initialisation of the labelStart */
00078         labelStart.setForegroundColor(ColorConstants.black);
00079         labelStart.setText("Start");
00080         add(labelStart, ToolbarLayout.VERTICAL); 
00081         setConstraint(labelStart, new Rectangle(8, 0, -1, -1)); 
00082         
00083         /* Initialisation of the labelInc */
00084         labelInc.setForegroundColor(ColorConstants.black);
00085         labelInc.setText("Inc");
00086         add(labelInc, ToolbarLayout.VERTICAL); 
00087         setConstraint(labelInc, new Rectangle(8, 10, -1, -1)); 
00088         
00089         /* Initialisation of the labelEnd */
00090         labelEnd.setForegroundColor(ColorConstants.black);
00091         labelEnd.setText("End");
00092         add(labelEnd, ToolbarLayout.VERTICAL); 
00093         setConstraint(labelEnd, new Rectangle(8, 20, -1, -1)); 
00094         
00095         /* Create and locate the start rectangle of the loop iterator */
00096                 Shape rectangle1 = new RectangleFigure();
00097                 rectangle1.setSize(5, 5);
00098                 rectangle1.setLocation(new Point(0, 5));
00099                 rectangle1.setBackgroundColor(ColorConstants.blue);
00100                 
00101                 /* Create and locate the incrementation rectangle of the loop iterator */
00102                 Shape rectangle2 = new RectangleFigure();
00103                 rectangle2.setSize(5, 5);
00104                 rectangle2.setLocation(new Point(0, 15));
00105                 rectangle2.setBackgroundColor(ColorConstants.blue);
00106                 
00107                 /* Create and locate the end rectangle of the loop iterator */
00108                 Shape rectangle3 = new RectangleFigure();
00109                 rectangle3.setSize(5, 5);
00110                 rectangle3.setLocation(new Point(0, 25));
00111                 rectangle3.setBackgroundColor(ColorConstants.blue);
00112                         
00113         add(rectangle1);
00114         add(rectangle2);
00115         add(rectangle3);
00116         
00117         setOpaque(true);
00118         setBorder(new LineBorder(1));  
00119         setBackgroundColor(ColorConstants.red);
00120         setForegroundColor(ColorConstants.black);
00121     }
00122     
00123     
00128     public void setLayout(Rectangle rect) 
00129     {
00130         getParent().setConstraint(this, rect);
00131     }
00132     
00133     
00138     public void setBackgroundColor(boolean cond) 
00139     {
00140         if(cond)
00141                 setBackgroundColor(ColorConstants.blue);
00142         else
00143                 setBackgroundColor(ColorConstants.white);
00144     }
00145 }
 All Classes Namespaces Files Functions Variables Enumerations