Math2mat
|
00001 00015 package m2m.frontend.dynamicview.figure; 00016 00017 import org.eclipse.draw2d.ColorConstants; 00018 import org.eclipse.draw2d.Ellipse; 00019 import org.eclipse.draw2d.Figure; 00020 import org.eclipse.draw2d.Label; 00021 import org.eclipse.draw2d.Shape; 00022 import org.eclipse.draw2d.ToolbarLayout; 00023 import org.eclipse.draw2d.XYLayout; 00024 import org.eclipse.draw2d.geometry.Rectangle; 00025 00026 public class OperationFigure extends Figure 00027 { 00028 public static final int WIDTH = 19; 00029 public static final int HEIGHT = 19; 00030 00034 private Label labelName = new Label(); 00038 Shape ellipse = new Ellipse(); 00042 private XYLayout layout; 00043 00044 00048 public OperationFigure() 00049 { 00050 /* Set the type of layout manager */ 00051 layout = new XYLayout(); 00052 setLayoutManager(layout); 00053 00054 /* Initialisation ot the ellipse */ 00055 ellipse.setLayoutManager(new ToolbarLayout()); 00056 ellipse.setBackgroundColor(ColorConstants.lightGreen); 00057 add(ellipse); 00058 00059 /* Initialisation ot the labelName */ 00060 labelName.setForegroundColor(ColorConstants.black); 00061 ellipse.add(labelName, ToolbarLayout.ALIGN_CENTER); 00062 } 00063 00064 00069 public void setName(String name) 00070 { 00071 labelName.setText(name); 00072 } 00073 00074 00079 public void setLayout(Rectangle rect) 00080 { 00081 getParent().setConstraint(this, rect); 00082 ellipse.setSize(rect.width, rect.height); 00083 } 00084 }