KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nightlabs > editor2d > edit > DrawComponentEditPart


1 /**
2  * <p> Project: com.nightlabs.editor2d </p>
3  * <p> Copyright: Copyright (c) 2004 </p>
4  * <p> Company: NightLabs GmbH (Germany) </p>
5  * <p> Creation Date: 26.10.2004 </p>
6  * <p> Author: Daniel Mazurek </p>
7 **/

8 package com.nightlabs.editor2d.edit;
9
10 import org.eclipse.gef.EditPolicy;
11
12 import com.nightlabs.editor2d.DrawComponent;
13 import com.nightlabs.editor2d.editpolicy.DrawComponentEditPolicy;
14
15 public abstract class DrawComponentEditPart
16 extends AbstractDrawComponentEditPart
17 {
18     /**
19      * @param drawComponent
20      */

21     public DrawComponentEditPart(DrawComponent drawComponent)
22     {
23         super(drawComponent);
24     }
25
26 // protected abstract IFigure createFigure();
27

28     /*
29      * @see org.eclipse.gef.editparts.AbstractEditPart#createEditPolicies()
30      */

31     protected void createEditPolicies()
32     {
33         // allow removal of the associated model element
34
installEditPolicy(EditPolicy.COMPONENT_ROLE, new DrawComponentEditPolicy());
35     }
36             
37 // protected void refreshVisuals()
38
// {
39
//// LOGGER.debug("refreshVisuals()!");
40
// // transfer the size and location from the model instance to the corresponding figure
41
//// Rectangle bounds = new Rectangle(getCastedModel().getX(), getCastedModel().getY(),
42
//// getCastedModel().getWidth(), getCastedModel().getHeight());
43
// Rectangle bounds = new Rectangle(J2DUtil.toDraw2D(getCastedModel().getBounds()));
44
//
45
// figure.setBounds(bounds);
46
// // notify parent container of changed position & location
47
// // if this line is removed, the XYLayoutManager used by the parent container
48
// // (the Figure of the ShapesDiagramEditPart), will not know the bounds of this figure
49
// // and will not draw it correctly.
50
// ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, bounds);
51
// }
52
//
53
// private DrawComponent getCastedModel() {
54
// return (DrawComponent) getModel();
55
// }
56
}
57
Popular Tags