// File: SelectionHandles.java // Classes: SelectionHandles // Original Author: Jason Robbins // $Id: SelectionHandles.java,v 1.1.1.1 1997/02/27 20:52:48 chandra Exp $ package uci.graphedit; import java.util.*; import java.awt.*; /** A Selection class to represent selections on DiagramElement's that * present handles. Needs-More-Work: in an early version of this graph * editing framework the DiagramElement's did their own drawing of * handles. I want to get away from that, but it has not happened * yet. */ public class SelectionHandles extends SelectionSingle { /** Height and width of handle */ public static final int HAND_SIZE = 6; // protected Vector _handles; // needs-more-work /** Construct a new SelectionHandles for the given DiagramElement */ public SelectionHandles(DiagramElement de) { super(de); } /** Draw the SelectionHandles by asking the contained DiagramElement * to drawSelected. Some of this logic is common to all * DiagramElement's that have handles and I want to move more of it * here to avoid duplication. * * @see DiagramElement#drawSelected */ public void draw(Graphics g) { // needs-more-work: should manage Handle objects here _content.drawSelected(g); } /** The bounding box of the selection is the bbox of the contained * DiagramElement, plus the size of the handles. */ public Rectangle getBoundingBox() { Rectangle r = _content.getBoundingBox(); r.reshape(r.x - HAND_SIZE, r.y - HAND_SIZE, r.width + 2*HAND_SIZE, r.height + 2*HAND_SIZE); return r; } } /* end class SelectionHandles */