Math2mat

/home/ythoma/docs/math2mat/svn/wp1/framework/m2mGUI/src/m2m/frontend/dynamicview/editpolicies/EditLayoutPolicy.java

Go to the documentation of this file.
00001 
00016 package m2m.frontend.dynamicview.editpolicies;
00017 
00018 import m2m.frontend.dynamicview.commands.*;
00019 import m2m.frontend.dynamicview.editPart.*;
00020 import m2m.frontend.dynamicview.model.Node;
00021 
00022 import org.eclipse.draw2d.geometry.Rectangle;
00023 import org.eclipse.gef.EditPart;
00024 import org.eclipse.gef.EditPolicy;
00025 import org.eclipse.gef.commands.Command;
00026 import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
00027 import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
00028 import org.eclipse.gef.requests.CreateRequest;
00029 
00030 
00031 public class EditLayoutPolicy extends XYLayoutEditPolicy 
00032 {
00039     protected Command createChangeConstraintCommand(EditPart child, Object constraint) 
00040     {
00041             AbstractLayoutCommand command = null;
00042             
00043             /* Creation of the command who correspond to the child EditPart */
00044             if (child instanceof PointConnectionPart) 
00045                 command = new PointConnectionChangeLayoutCommand();
00046             else if (child instanceof OperationPart) 
00047                 command = new OperationChangeLayoutCommand();   
00048             else if (child instanceof FunctionPart) 
00049                 command = new FunctionChangeLayoutCommand();
00050             else if (child instanceof IfPart) 
00051                 command = new IfChangeLayoutCommand();
00052             else if (child instanceof LoopPart) 
00053                 command = new FunctionChangeLayoutCommand();
00054             else if (child instanceof LoopIteratorPart) 
00055                 command = new IteratorChangeLayoutCommand();
00056             
00057             /* Intialisation of the command */
00058             command.setModel((Node)child.getModel());
00059             command.setLayout((Rectangle)constraint);
00060             command.setRootPart((SchemaPart)child.getRoot().getContents());
00061             
00062             return command;
00063     }
00064 
00065     
00071     protected EditPolicy createChildEditPolicy(EditPart child)
00072     {
00073         return new NonResizableEditPolicy();
00074     }
00075     
00076     
00077     protected Command getCreateCommand(CreateRequest request) 
00078     {
00079         // TODO Auto-generated method stub
00080         return null;
00081     }
00082 }
 All Classes Namespaces Files Functions Variables Enumerations