org.tigris.gef.base
Class SelectionResize

java.lang.Object
  extended by org.tigris.gef.base.Selection
      extended by org.tigris.gef.base.SelectionResize
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, java.util.EventListener

public class SelectionResize
extends Selection

A Selection class to represent selections on Figs that present resize handles. The selected Fig can be moved or resized. Figrect, FigRRect, FigCircle, and FigGroup are some of the Figs that normally use this Selection. The selected Fig is told it's new bounding box, and some Figs (like FigGroup or FigPoly) do calculations to scale themselves.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.tigris.gef.base.Selection
_content, BORDER_WIDTH, HAND_SIZE
 
Constructor Summary
SelectionResize(Fig f)
          Construct a new SelectionResize for the given Fig
 
Method Summary
 void dragHandle(int mX, int mY, int anX, int anY, Handle hand)
          Change some attribute of the selected Fig when the user drags one of its handles.
 void hitHandle(java.awt.Rectangle r, Handle h)
          Return a handle ID for the handle under the mouse, or -1 if none.
 void paint(java.awt.Graphics g)
          Paint the handles at the four corners and midway along each edge of the bounding box.
 
Methods inherited from class org.tigris.gef.base.Selection
contains, contains, contains, damage, delete, dispose, endTrans, getBounds, getContent, getContentBounds, getLocation, getLocked, hit, hitHandle, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, print, reorder, setcontent, stuffBounds, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionResize

public SelectionResize(Fig f)
Construct a new SelectionResize for the given Fig

Method Detail

hitHandle

public void hitHandle(java.awt.Rectangle r,
                      Handle h)
Return a handle ID for the handle under the mouse, or -1 if none. Needs-More-Work: in the future, return a Handle instance or null.

   0-------1-------2
   |               |
   3               4
   |               |
   5-------6-------7
 

Specified by:
hitHandle in class Selection

paint

public void paint(java.awt.Graphics g)
Paint the handles at the four corners and midway along each edge of the bounding box.

Overrides:
paint in class Selection

dragHandle

public void dragHandle(int mX,
                       int mY,
                       int anX,
                       int anY,
                       Handle hand)
Change some attribute of the selected Fig when the user drags one of its handles. Needs-More-Work: someday I might implement resizing that maintains the aspect ratio.

Specified by:
dragHandle in class Selection