|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.zaval.awt.gdp.Controller | +--org.zaval.awt.gdp.ShapeController
This shape controller class that can be used to control size and location for the specified
target component.
The controller registers itself as MouseDragListener listener of the target component and
registers a cursor controller for the target component.
Constructor Summary | |
ShapeController(java.awt.Component target)
Constructs a new shape controller with the specified target component. |
Method Summary | |
void |
dragMoved(MouseDragEvent e)
Invoked every time when mouse drag event is performed with the source component. |
void |
dragStarted(MouseDragEvent e)
Invoked when first mouse drag events has been performed with the source component. |
void |
dragStopped(MouseDragEvent e)
Invoked when mouse drag is stopped. |
protected java.awt.Insets |
getBoundsMask()
Gets the insets mask. |
CursorController |
getCursorController()
Gets the cursor controller that is used for the target component with the controller. |
protected void |
moveComponent(int ax,
int ay)
Moves the target component to the new location. |
protected void |
resizeComponent(java.awt.Rectangle r)
Shapes the target component with the specified bounds. |
protected void |
setCursorController(CursorController c)
Sets the specified cursor controller. |
protected void |
targetWasChanged(java.awt.Component n,
java.awt.Component o)
The method is called whenever the target component has been changed. |
Methods inherited from class org.zaval.awt.gdp.Controller |
getTarget, setTarget |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ShapeController(java.awt.Component target)
target
- the specified target component.
Method Detail |
public void dragStarted(MouseDragEvent e)
dragStarted
in interface MouseDragListener
e
- the specified mouse drag event.
public void dragMoved(MouseDragEvent e)
dragMoved
in interface MouseDragListener
e
- the specified mouse drag event.
public void dragStopped(MouseDragEvent e)
dragStopped
in interface MouseDragListener
e
- the specified mouse drag event.
public CursorController getCursorController()
protected void setCursorController(CursorController c)
c
- the specified cursor controller.
protected void moveComponent(int ax, int ay)
ax
- the specified x coordinate relatively the top-level parent
component of the target component.ay
- the specified y coordinate relatively the top-level parent
component of the target component.
protected void resizeComponent(java.awt.Rectangle r)
r
- the new bounds for the target component. The x
and
y
fields of the bounds define a new location of the target relatively
the top-level parent component.
protected java.awt.Insets getBoundsMask()
null
if nothing should be changed for the target component.
The implementation defines the insets fields according to the current mouse cursor type
(the mouse cursor type is set with the cursor controller). The table bellow shows the
correspondence the cursor type and the insets that will be returnd.
Cursor type | Returned insets |
Cursor.W_RESIZE_CURSOR | left=1, top=0, right=0, bottom=0 |
Cursor.E_RESIZE_CURSOR | left=0, top=0, right=1, bottom=0 |
Cursor.N_RESIZE_CURSOR | left=0, top=1, right=0, bottom=0 |
Cursor.S_RESIZE_CURSOR | left=0, top=0, right=0, bottom=1 |
Cursor.NW_RESIZE_CURSOR | left=1, top=1, right=0, bottom=0 |
Cursor.NE_RESIZE_CURSOR | left=0, top=1, right=1, bottom=0 |
Cursor.SW_RESIZE_CURSOR | left=1, top=0, right=0, bottom=1 |
Cursor.SE_RESIZE_CURSOR | left=0, top=0, right=1, bottom=1 | Cursor.MOVE_CURSOR | left=1, top=1, right=1, bottom=1 |
protected void targetWasChanged(java.awt.Component n, java.awt.Component o)
targetWasChanged
in class Controller
n
- the specified new target component.o
- the specified old target component.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |