// Copyright (c) 1996-98 The Regents of the University of California. All // Rights Reserved. Permission to use, copy, modify, and distribute this // software and its documentation for educational, research and non-profit // purposes, without fee, and without a written agreement is hereby granted, // provided that the above copyright notice and this paragraph appear in all // copies. Permission to incorporate this software into commercial products may // be obtained by contacting the University of California. David F. Redmiles // Department of Information and Computer Science (ICS) University of // California Irvine, California 92697-3425 Phone: 714-824-3823. This software // program and documentation are copyrighted by The Regents of the University // of California. The software program and documentation are supplied "as is", // without any accompanying services from The Regents. The Regents do not // warrant that the operation of the program will be uninterrupted or // error-free. The end-user understands that the program was developed for // research purposes and is advised not to rely exclusively on the program for // any reason. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY // PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, // INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS // DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY // DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE // SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, // ENHANCEMENTS, OR MODIFICATIONS. // File: SelectionHandles.java // Classes: SelectionHandles // Original Author: jrobbins@ics.uci.edu // $Id: SelectionHandles.java,v 1.7 1997/06/10 23:43:31 jrobbins 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. * * FEATURE: selections_handles */ 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 */