Math2mat
|
00001 00015 package m2m.frontend.dynamicview.figure; 00016 00017 import m2m.frontend.dynamicview.model.*; 00018 00019 import org.eclipse.draw2d.ActionEvent; 00020 import org.eclipse.draw2d.ActionListener; 00021 import org.eclipse.draw2d.CheckBox; 00022 import org.eclipse.draw2d.ColorConstants; 00023 import org.eclipse.draw2d.Figure; 00024 import org.eclipse.draw2d.Label; 00025 import org.eclipse.draw2d.ToolbarLayout; 00026 import org.eclipse.draw2d.XYLayout; 00027 import org.eclipse.draw2d.geometry.Rectangle; 00028 00029 00030 public class PointConnectionPropertyFigure extends Figure implements ActionListener 00031 { 00035 private PointConnection pc; 00039 private XYLayout layout; 00043 private Label labelName = new Label(); 00047 private CheckBox checkBoxMonitor = new CheckBox("Monitor mode"); 00048 00049 00053 public PointConnectionPropertyFigure() 00054 { 00055 /* Set the type of layout */ 00056 layout = new XYLayout(); 00057 setLayoutManager(layout); 00058 00059 /* Initialisation of the labelName */ 00060 labelName.setForegroundColor(ColorConstants.black); 00061 add(labelName, ToolbarLayout.VERTICAL); 00062 setConstraint(labelName, new Rectangle(0, 0, -1, -1)); 00063 labelName.setText("Unknown"); 00064 00065 /* Initialisation of the checkBoxMonitor */ 00066 add(checkBoxMonitor); 00067 setConstraint(checkBoxMonitor, new Rectangle(0, 30, -1, -1)); 00068 checkBoxMonitor.addActionListener(this); 00069 00070 /* Initialisation of the figure */ 00071 setOpaque(true); 00072 setBackgroundColor(ColorConstants.menuBackground); 00073 setForegroundColor(ColorConstants.menuForeground); 00074 } 00075 00076 00081 public void setProperty(PointConnection pc) 00082 { 00083 this.pc = pc; 00084 00085 // Initialize the state of the checkBox 00086 checkBoxMonitor.setSelected(pc.getMonitor()); 00087 00088 // Get and show the name of name and condition nodes of the GraphicIf 00089 labelName.setText("Name : " + pc.getName()); 00090 } 00091 00092 00097 @Override 00098 public void actionPerformed(ActionEvent arg0) 00099 { 00100 pc.setMonitor(checkBoxMonitor.isSelected()); 00101 } 00102 }