Math2mat
|
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.LineBorder; 00020 import org.eclipse.draw2d.XYLayout; 00021 import org.eclipse.draw2d.geometry.Rectangle; 00022 00023 public class PointConnectionFigure extends Figure 00024 { 00028 public static final int WIDTH = 10; 00029 public static final int HEIGHT = 10; 00030 00031 00035 private XYLayout layout; 00036 00037 00041 public PointConnectionFigure() 00042 { 00043 /* Set the type of layout */ 00044 layout = new XYLayout(); 00045 setLayoutManager(layout); 00046 00047 /* Initialisation the figure */ 00048 setFocusTraversable(true); 00049 setOpaque(true); 00050 setBackgroundColor(ColorConstants.red); 00051 setForegroundColor(ColorConstants.black); 00052 setBorder(new LineBorder(1)); 00053 } 00054 00055 00060 public void setLayout(Rectangle rect) 00061 { 00062 getParent().setConstraint(this, rect); 00063 } 00064 00065 00070 public void setBackgroundColor(boolean cond) 00071 { 00072 if(cond) 00073 setBackgroundColor(ColorConstants.blue); 00074 else 00075 setBackgroundColor(ColorConstants.red); 00076 } 00077 }