Math2mat

/home/ythoma/docs/math2mat/svn/wp1/framework/m2mGUI/src/m2m/frontend/dynamicview/editPart/OperationPart.java

Go to the documentation of this file.
00001 
00018 package m2m.frontend.dynamicview.editPart;
00019 
00020 import java.util.Vector;
00021 
00022 import java.beans.PropertyChangeEvent;
00023 
00024 import m2m.frontend.dynamicview.editpolicies.EditLayoutPolicy;
00025 import m2m.frontend.dynamicview.figure.OperationFigure;
00026 import m2m.frontend.dynamicview.model.GraphicOperation;
00027 import m2m.frontend.dynamicview.model.Node;
00028 
00029 import org.eclipse.draw2d.IFigure;
00030 import org.eclipse.gef.EditPolicy;
00031 
00032 
00033 public class OperationPart extends AbstractEditPart 
00034 {
00039     @Override
00040     protected IFigure createFigure() 
00041     {
00042         IFigure figure = new OperationFigure();
00043         ((OperationFigure) figure).addMouseMotionListener(this);
00044         ((OperationFigure) figure).addMouseListener(this);
00045         return figure;
00046     }
00047 
00048     
00052     @Override
00053     protected void createEditPolicies() 
00054     {
00055         installEditPolicy(EditPolicy.LAYOUT_ROLE, new EditLayoutPolicy()); 
00056     }
00057     
00058     
00062     protected void refreshVisuals()
00063     { 
00064         /* Get the figure and the model */
00065         OperationFigure figure = (OperationFigure)getFigure();
00066         GraphicOperation model = (GraphicOperation)getModel();
00067         
00068         /* Update the figure with the model */
00069         figure.setName(model.getOperatorName());
00070         figure.setLayout(model.getLayout());
00071         figure.setVisible(model.getVisible());
00072     }
00073 
00074     
00079     public Vector<Node> getModelChildren()
00080     {
00081         return ((GraphicOperation)getModel()).getChildrenArray();
00082     }
00083 
00084     
00089         @Override
00090         public void propertyChange(PropertyChangeEvent evt) 
00091         {
00092                  if (evt.getPropertyName().equals(Node.LAYOUT)) 
00093                 refreshVisuals();       
00094                  else if(evt.getPropertyName().equals(Node.VISIBLE_COMPONENT))
00095                          refreshVisuals();
00096         }
00097 }
 All Classes Namespaces Files Functions Variables Enumerations