bibliothek.gui.dock.control
Interface DirectRemoteRelocator


public interface DirectRemoteRelocator

A simplified version of RemoteRelocator. This direct remote relocator assumes that the correct mouse buttons are always pressed. A client can initiate a drag & drop operation by calling init. Then the client has to call at least one time drag, before he can invoke drop to let the dragged Dockable fall down. A client can cancel the operation at any time.
Note that only one operation is supported at once. Note also that there is no guarantee, that a drag & drop operation is executed successfully.

Author:
Benjamin Sigg

Method Summary
 void cancel()
          Cancels the current drag & drop operation.
 void drag(int x, int y, boolean always)
          Gives a feedback to the user, that a Dockable is moved around.
 void drop(int x, int y)
          Stops a dnd-operation either by dropping the Dockable (if possible) or by canceling the operation.
 void init(int x, int y, int dx, int dy)
          This method starts a drag & drop operation.
 

Method Detail

init

void init(int x,
          int y,
          int dx,
          int dy)
This method starts a drag & drop operation. This method simulates a mouse-pressed event.

Parameters:
x - the x-coordinate on the screen, where the (simulated) event occurred
y - the y-coordinate on the screen, where the (simulated) event occurred
dx - the x-coordinate of the mouse on the simulated Component which sent the event, 0 is a good default-value.
dy - the y-coordinate of the mouse on the simulated Component which sent the event, 0 is a good default-value.

drag

void drag(int x,
          int y,
          boolean always)
Gives a feedback to the user, that a Dockable is moved around.
Prepares for a drop-event.

Parameters:
x - the x-coordinate on the screen, where the (simulated) event occurred
y - the y-coordinate on the screen, where the (simulated) event occurred
always - true if a call to this method should always result in a drag-event, false if the restrictions of the DockRelocator should be respected. A restriction might be, that the location of the mouse must have a minimal distance to the initial location of the mouse.
See Also:
DockRelocator.getDragDistance()

drop

void drop(int x,
          int y)
Stops a dnd-operation either by dropping the Dockable (if possible) or by canceling the operation.

Parameters:
x - the x-coordinate on the screen, where the (simulated) event occurred
y - the y-coordinate on the screen, where the (simulated) event occurred

cancel

void cancel()
Cancels the current drag & drop operation.