1 27 28 package org.nightlabs.editor2d.handle; 29 30 import java.util.List ; 31 32 import org.eclipse.draw2d.Graphics; 33 import org.eclipse.draw2d.geometry.Rectangle; 34 import org.eclipse.gef.DragTracker; 35 36 import org.nightlabs.editor2d.custom.EditorCursors; 37 import org.nightlabs.editor2d.edit.AbstractDrawComponentEditPart; 38 import org.nightlabs.editor2d.tools.RotateCenterTracker; 39 40 41 public class RotateCenterHandle 42 extends EditorAbstractHandle 43 { 44 protected List editParts; 45 public RotateCenterHandle(List editParts) 46 { 47 super(); 48 if (editParts.size() == 1) { 49 setLocator(new RotateCenterLocator((AbstractDrawComponentEditPart)editParts.get(0))); 50 } else { 51 setLocator(new MultipleCenterLocator(editParts)); 52 multiple = true; 53 } 54 setOwner((AbstractDrawComponentEditPart)editParts.get(0)); 55 setCursor(EditorCursors.CROSS); 56 } 57 58 protected DragTracker createDragTracker() { 59 return new RotateCenterTracker((AbstractDrawComponentEditPart)getOwner()); 60 } 61 62 public void paintFigure(Graphics g) 63 { 64 Rectangle r = getBounds(); 65 r.shrink(1, 1); 66 try { 67 g.fillOval(r); 68 g.drawOval(r); 69 } finally { 72 r.expand(1, 1); 74 } 75 } 76 77 protected boolean multiple = false; 78 public boolean isMultiple() { 79 return multiple; 80 } 81 } 82 | Popular Tags |