// File: ModeCreateNPlaceVertex.java // Classes: ModeCreateNPlaceVertex // Original Author: Kedar Patankar // Date 31 Jan 1997 package uci.graphedit; import java.awt.Graphics; import java.awt.Event; import java.awt.Frame; import java.awt.Point; /** Mode to place new a Perspective on a NetNode in a diagram. * Normally invoked via ActionCreateNode. * @see ActionCreateNode * @see Perspective */ public class ModeCreateVertex extends Mode { /** the (new) node being placed. It might be an existing node that * is adding a new perspective. */ private Editor _editor; /** the (new) perspective being placed. It might be an existing * perspective on an existing node being place in another diagram. */ private String _className; /** Construct a new instance of ModePlace and store the given * NetNode and Perspective */ ModeCreateVertex(Document d,Editor e,String classname) { super(d); _editor=e; _className=classname; } public void setCursorType(Editor ed) { ed.setCursor(Frame.HAND_CURSOR); } /** Move the perpective along with the mouse */ public boolean mouseMove(Event evt,int x,int y) { return true; } /** Eat this event and do nothing */ public boolean mouseDown(Event evt,int x,int y) { return true; } /* Eactly the same as mouse move */ public boolean mouseDrag(Event evt,int x,int y) { return mouseMove(evt,x,y); } /** Actually add the Perpective to the diagram. * And give the NetNode a chance to do post processing. * @see NetNode#postPlacement */ public boolean mouseUp(Event evt,int x,int y) { Point p=new Point(x,y); Action addClass = new ActionCreateVertex(_className,_editor,p); addClass.doIt(); done(); return true; } /** draw the perspective being dragged around */ public void draw(Graphics g) { } } /* end class ModeCreateVertex */