|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tigris.gef.base.ModeImpl
org.tigris.gef.base.FigModifyingModeImpl
org.tigris.gef.base.ModeCreate
Abstract superclass for all Mode's that create new Figs. This class factors our shared code that would otherwise be duplicated in its subclasses. On a mouse down the new item is created in memory. On mouse drag the new item is resized via its createDrag() method. On mouse up the new item is officially added to the Layer being edited in the parent Editor, the item is selected, and the Editor is placed in the next Mode (usually ModeSelect). Subclasses override various of these event handlers to give specific behaviors, for example, ModeCreateEdge handles dragging differently.
ModeCreateEdge,
ModeCreateFigRect,
ModeCreateFigRRect,
ModeCreateFigLine,
ModeCreateFigCircle,
ModeCreateFigPoly,
ModeCreateFigInk,
ModeCreateFigText,
ModeCreateFigImage,
Serialized Form| Field Summary | |
protected int |
_defaultHeight
|
protected int |
_defaultWidth
The default size of a Fig if the user simply clicks instead of dragging out a size. |
protected org.tigris.gef.presentation.Fig |
_newItem
This holds the Fig to be added to the parent Editor. |
protected int |
anchorX
Original mouse down event coordinates |
protected int |
anchorY
Original mouse down event coordinates |
| Fields inherited from class org.tigris.gef.base.FigModifyingModeImpl |
editor |
| Fields inherited from class org.tigris.gef.base.ModeImpl |
_args |
| Constructor Summary | |
ModeCreate()
|
|
ModeCreate(Editor par)
|
|
| Method Summary | |
abstract org.tigris.gef.presentation.Fig |
createNewItem(java.awt.event.MouseEvent me,
int snapX,
int snapY)
Abstact method to construct a new Fig to be added to the Editor. |
protected void |
creationDrag(int x,
int y)
Update the new item to reflect the new mouse position. |
java.awt.Cursor |
getInitialCursor()
By default all creation modes use CROSSHAIR_CURSOR. |
void |
keyPressed(java.awt.event.KeyEvent ke)
|
void |
mouseDragged(java.awt.event.MouseEvent me)
On mouse drag, resize the new item as the user moves the mouse. |
void |
mousePressed(java.awt.event.MouseEvent me)
On mouse down, make a new Fig in memory. |
void |
mouseReleased(java.awt.event.MouseEvent me)
On mouse up, officially add the new item to the parent Editor and select it. |
void |
paint(java.awt.Graphics g)
Paint this mode by painting the new item. |
| Methods inherited from class org.tigris.gef.base.FigModifyingModeImpl |
done, getEditor, instructions, isFigEnclosedIn, print, setCursor, setEditor |
| Methods inherited from class org.tigris.gef.base.ModeImpl |
canExit, getArg, getArgs, init, keyReleased, keyTyped, leave, mouseClicked, mouseEntered, mouseExited, mouseMoved, setArg, setArgs, start |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.tigris.gef.base.Mode |
canExit, getArg, getArgs, init, setArg, setArgs, start |
| Field Detail |
protected int _defaultWidth
protected int _defaultHeight
protected int anchorX
protected int anchorY
protected org.tigris.gef.presentation.Fig _newItem
| Constructor Detail |
public ModeCreate(Editor par)
public ModeCreate()
| Method Detail |
public java.awt.Cursor getInitialCursor()
getInitialCursor in interface FigModifyingModegetInitialCursor in class FigModifyingModeImplpublic void mousePressed(java.awt.event.MouseEvent me)
mousePressed in interface java.awt.event.MouseListenermousePressed in class ModeImplpublic void mouseDragged(java.awt.event.MouseEvent me)
Note: _newItem has not been added to any Layer yet. So you cannot use _newItem.damage(), instead use editor.damageAll(_newItem).
mouseDragged in interface java.awt.event.MouseMotionListenermouseDragged in class ModeImplpublic void mouseReleased(java.awt.event.MouseEvent me)
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class ModeImplpublic void keyPressed(java.awt.event.KeyEvent ke)
keyPressed in interface java.awt.event.KeyListenerkeyPressed in class ModeImpl
protected void creationDrag(int x,
int y)
creationDrag(int, int)public void paint(java.awt.Graphics g)
paint in interface FigModifyingModepaint in class FigModifyingModeImpl
public abstract org.tigris.gef.presentation.Fig createNewItem(java.awt.event.MouseEvent me,
int snapX,
int snapY)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||