KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nightlabs > editor2d > handle > ShapeEditHandleKit


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: 13.01.2005 </p>
6  * <p> Author: Daniel Mazurek </p>
7 **/

8 package com.nightlabs.editor2d.handle;
9
10 import java.util.List JavaDoc;
11
12 import org.eclipse.draw2d.Polyline;
13 import org.eclipse.draw2d.geometry.PointList;
14
15 import com.nightlabs.editor2d.edit.ShapeDrawComponentEditPart;
16 import com.nightlabs.editor2d.util.J2DUtil;
17
18
19 public class ShapeEditHandleKit
20 {
21
22   public ShapeEditHandleKit() {
23     super();
24   }
25     
26   /**
27    * Fills the given List with handles at PathSegment of the GeneralShape of the
28    * ShapeDrawComponentEditPart.
29    *
30    * @param part the handles' ShapeDrawComponentEditPart
31    * @param handles the List to add the handles to
32    */

33   public static void addHandles(ShapeDrawComponentEditPart part, List JavaDoc handles)
34   {
35 // Polyline polyline = J2DUtil.toPolyline(part.getGeneralShape());
36
// PointList points = polyline.getPoints();
37
// for (int i=0; i<points.size(); i++)
38
// {
39
// ShapeEditHandle handle = new ShapeEditHandle(part, i);
40
// handles.add(handle);
41
// }
42

43     Polyline polyline = J2DUtil.toPolyline(part.getGeneralShape());
44     PointList points = polyline.getPoints();
45     for (int i=0; i<points.size(); i++)
46     {
47       ShapeEditHandle handle = new ShapeEditHandle(part, i);
48       handles.add(handle);
49     }
50     
51   }
52   
53 }
54
Popular Tags