1 /* 2 * @(#)PolyLineHandle.java 5.1 3 * 4 */ 5 6 package CH.ifa.draw.figures; 7 8 import java.awt.*; 9 import CH.ifa.draw.framework.*; 10 import CH.ifa.draw.standard.LocatorHandle; 11 12 /** 13 * A handle for a node on the polyline. 14 */ 15 public class PolyLineHandle extends LocatorHandle { 16 17 private int fIndex; 18 private Point fAnchor; 19 20 /** 21 * Constructs a poly line handle. 22 * @param owner the owning polyline figure. 23 * @l the locator 24 * @index the index of the node associated with this handle. 25 */ PolyLineHandle(PolyLineFigure owner, Locator l, int index)26 public PolyLineHandle(PolyLineFigure owner, Locator l, int index) { 27 super(owner, l); 28 fIndex = index; 29 } 30 invokeStart(int x, int y, DrawingView view)31 public void invokeStart(int x, int y, DrawingView view) { 32 fAnchor = new Point(x, y); 33 } 34 invokeStep(int x, int y, int anchorX, int anchorY, DrawingView view)35 public void invokeStep (int x, int y, int anchorX, int anchorY, DrawingView view) { 36 myOwner().setPointAt(new Point(x, y), fIndex); 37 } 38 myOwner()39 private PolyLineFigure myOwner() { 40 return (PolyLineFigure)owner(); 41 } 42 } 43 44 45