Math2mat

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

Go to the documentation of this file.
00001 
00015 package m2m.frontend.dynamicview.figure;
00016 
00017 import org.eclipse.draw2d.Button;
00018 import org.eclipse.draw2d.ColorConstants;
00019 import org.eclipse.draw2d.Figure;
00020 import org.eclipse.draw2d.Label;
00021 import org.eclipse.draw2d.LineBorder;
00022 import org.eclipse.draw2d.ToolbarLayout;
00023 import org.eclipse.draw2d.XYLayout;
00024 import org.eclipse.draw2d.geometry.Rectangle;
00025 
00026 public class FunctionFigure extends Figure
00027 {       
00031         public static final int WIDTH_BTN  = 15;
00032         public static final int HEIGHT_BTN = 15;
00036         public static final int SPACE_REDUCTION = 20;
00037         
00038         
00042         private Label labelName = new Label();
00046     private XYLayout layout;
00050     private Button btnMinimize;
00051 
00052 
00056     public FunctionFigure() 
00057     {
00058         /* Set the type of layout */
00059         layout = new XYLayout();
00060         setLayoutManager(layout);   
00061         
00062         /* Initialisation of the label */
00063         labelName.setForegroundColor(ColorConstants.black);
00064         add(labelName, ToolbarLayout.VERTICAL); 
00065         setConstraint(labelName, new Rectangle(0, 0, -1, -1));
00066         
00067         /* Initialisation of the button */
00068         btnMinimize = new Button("-");
00069         add(btnMinimize);       
00070         
00071         /* Initialisation of the figure */
00072         setOpaque(true);
00073         setBackgroundColor(ColorConstants.white);
00074         setBorder(new LineBorder(2));  
00075     }
00076     
00077     
00082     public void setName(String text) 
00083     {
00084         labelName.setText(text);
00085     }
00086     
00087     
00092     public void setLayout(Rectangle rect)
00093     {
00094         getParent().setConstraint(this, rect);          
00095         setConstraint(btnMinimize, new Rectangle(rect.width-WIDTH_BTN-3, 0, WIDTH_BTN, HEIGHT_BTN));
00096     }
00097 
00098     
00103     public Button getBtnMinimize()
00104     {
00105         return btnMinimize;
00106     }
00107 }
 All Classes Namespaces Files Functions Variables Enumerations