org.tigris.gef.base
Class SelectionReshape

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

public class SelectionReshape
extends Selection
implements java.awt.event.KeyListener

A Selection that allows the user to reshape the selected Fig. This is used with FigPoly, FigLine, and FigInk. One handle is drawn over each point on the Fig.

See Also:
FigLine, FigPoly, FigInk, Serialized Form

Field Summary
protected  int _selectedHandle
           
 
Fields inherited from class org.tigris.gef.base.Selection
_content, BORDER_WIDTH, HAND_SIZE
 
Constructor Summary
SelectionReshape(Fig f)
          Construct a new SelectionReshape for the given Fig
 
Method Summary
 void dragHandle(int mX, int mY, int anX, int anY, Handle h)
          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 keyPressed(java.awt.event.KeyEvent ke)
           
 void keyReleased(java.awt.event.KeyEvent ke)
           
 void keyTyped(java.awt.event.KeyEvent ke)
          If the user presses delete or backaspace while a handle is selected, remove that point from the polygon.
 void paint(java.awt.Graphics g)
          Paint the handles at the four corners and midway along each edge of the bounding box.
 void updateEdgeEnds(FigEdgePoly poly, Handle handle, int x, int y)
           
 
Methods inherited from class org.tigris.gef.base.Selection
contains, contains, contains, damage, delete, dispose, endTrans, getBounds, getContent, getContentBounds, getLocation, getLocked, hit, hitHandle, 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
 

Field Detail

_selectedHandle

protected int _selectedHandle
Constructor Detail

SelectionReshape

public SelectionReshape(Fig f)
Construct a new SelectionReshape 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.

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 h)
Change some attribute of the selected Fig when the user drags one of its handles.

Specified by:
dragHandle in class Selection

updateEdgeEnds

public void updateEdgeEnds(FigEdgePoly poly,
                           Handle handle,
                           int x,
                           int y)

keyPressed

public void keyPressed(java.awt.event.KeyEvent ke)
Specified by:
keyPressed in interface java.awt.event.KeyListener
Overrides:
keyPressed in class Selection

keyReleased

public void keyReleased(java.awt.event.KeyEvent ke)
Specified by:
keyReleased in interface java.awt.event.KeyListener
Overrides:
keyReleased in class Selection

keyTyped

public void keyTyped(java.awt.event.KeyEvent ke)
If the user presses delete or backaspace while a handle is selected, remove that point from the polygon. The 'n' and 'p' keys select the next and previous points. The 'i' key inserts a new point.

Specified by:
keyTyped in interface java.awt.event.KeyListener
Overrides:
keyTyped in class Selection