com.swfm.mica.core
Class MiDragAndDropManager

java.lang.Object
  extended bycom.swfm.mica.core.MiDragAndDropManager
All Implemented Interfaces:
MiiEventTypes

public class MiDragAndDropManager
extends java.lang.Object
implements MiiEventTypes

This class manages drag and drop functionality for a window. The default behavior maps the following events to drag and drop actions:


 pickup:	Mi_LEFT_MOUSE_START_DRAG_EVENT + Mi_SHIFT_KEY_HELD_DOWN
 drag:	Mi_LEFT_MOUSE_DRAG_EVENT + Mi_SHIFT_KEY_HELD_DOWN
 cancel:	Mi_ESC_KEY + Mi_ANY_MODIFIERS_HELD_DOWN
 drop:	Mi_LEFT_MOUSE_UP_EVENT + Mi_ANY_MODIFIERS_HELD_DOWN

 

The default behavior can be modified for the window by using this manager's setDragAndDropBehavior() method. The default behavior can be modified for any part or container in the container-part hierarchy by using the part or container's setDragAndDropBehavior() method.

When these events occur the part under the mouse is examined to see if isDragAndDropSource() is true (for the pickup) and if isDragAndDropTarget() during drag and drop.

When the dragged part is picked up an action is sent to it of type:

Mi_DRAG_AND_DROP_PICKUP_ACTION, with systemInfo the current MiDataTransferOperation information.

Any action handlers can then generate what the normal appearance of the dragged part is. 'Normal' is when there are no other effects occuring.

When the dragged part is over a valid drop target an action is sent to the drop target of type:

Mi_DRAG_AND_DROP_ENTER_ACTION, with systemInfo the current MiDataTransferOperation information.

Any action handlers can then generate what the dragOver appearance of the dragged part is. 'DragOver' is when there is a valid part underneath the dragged part and the dragged part changes appearance in response to this condition. This method may also change the mouse cursor appearance at this time as well.

The action handlers can also take this opportunity to generate the dragUnder appearance of the drop target. 'DragUnder' is when there is a valid part underneath the dragged part and the part underneath changes appearance in response to this condition.

When the dragged part is no longer over a particular valid drop target an action is sent to the old drop target of type:

Mi_DRAG_AND_DROP_EXIT_ACTION, with systemInfo the current MiDataTransferOperation information.

The action handlers can also take this opportunity to restore the old drop target from it's dragUnder appearance and the dragged part from it's dragOver appearance.

When the dragged part is paused an action is sent to the valid drop target (if it exists otherwise it is sent to the dragged part) of type:

Mi_DRAG_AND_DROP_PAUSE_ACTION, with systemInfo the current MiDataTransferOperation information.

The action handlers can take this opportunity to generate 'scroll-under' effects or to allow the dragged part to be shown in it's entirety when previously only an outline of the part was being drawn. When no longer paused the dragged part an action will be sent to the corresponding part of type:

Mi_DRAG_AND_DROP_CONTINUE_ACTION, with systemInfo the current MiDataTransferOperation information.

If the drag and drop operation is canceled then an action is sent to the valid drop target (if it exists otherwise it is sent to the dragged part) of type:

Mi_DRAG_AND_DROP_CANCEL_ACTION, with systemInfo the current MiDataTransferOperation information.

If the drag and drop operation completes successfully then an action is sent to the drop target of type:

Mi_DRAG_AND_DROP_COMMIT_ACTION, with systemInfo the current MiDataTransferOperation information.

The action handlers can take this opportunity to generate disolve effects.

Set the MiDebug.tracingMode to MiDebug.TRACE_DRAG_AND_DROP to get debug information.

Version:
%I% %G%
Author:
Michael L. Davis
See Also:
setDragAndDropBehavior(com.swfm.mica.core.MiiDragAndDropBehavior), MiiDragAndDropBehavior, MiDragAndDropBehavior, MiAction.getActionSystemInfo()

Field Summary
static java.lang.String Mi_DRAG_AND_DROP_THIS_INSTEAD
           
   
Constructor Summary
MiDragAndDropManager(MiWindow window)
          Constructs a new MiDragAndDropManager for the given window and initializes the default behavior.
 
Method Summary
 MiiDragAndDropBehavior getDragAndDropBehavior()
          Gets the default drag and drop behavior for the window.
 void setDragAndDropBehavior(MiiDragAndDropBehavior b)
          Sets the default drag and drop behavior for the window.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Mi_DRAG_AND_DROP_THIS_INSTEAD

public static final java.lang.String Mi_DRAG_AND_DROP_THIS_INSTEAD
See Also:
Constant Field Values
Constructor Detail

MiDragAndDropManager

public MiDragAndDropManager(MiWindow window)
Constructs a new MiDragAndDropManager for the given window and initializes the default behavior.

Parameters:
window - the window to manage
Method Detail

setDragAndDropBehavior

public void setDragAndDropBehavior(MiiDragAndDropBehavior b)
Sets the default drag and drop behavior for the window.

Parameters:
b - the new default behavior

getDragAndDropBehavior

public MiiDragAndDropBehavior getDragAndDropBehavior()
Gets the default drag and drop behavior for the window.

Returns:
the default behavior