com.swfm.mica.core
Class MiDragAndDropBehavior

java.lang.Object
  extended bycom.swfm.mica.core.MiDragAndDropBehavior
All Implemented Interfaces:
MiiDragAndDropBehavior

public class MiDragAndDropBehavior
extends java.lang.Object
implements MiiDragAndDropBehavior

This class implements the MiiDragAndDropBehavior interface. At the present time it only supports the specification of the events involved. Common effects will implemented in a future release.

For example, if it so desired that a treeList widget is to be a drag and drop source and that the end-user should not have to hold down the shift key while dragging items out of the treelist then one might have:

	// Assume that the items in the tree list will have called
	// their setIsDragAndDropSource(true) methods...

	MiTreeList treeList = new MiTreeList(28, false);

	MiDragAndDropBehavior dndBehavior = new MiDragAndDropBehavior();

	dndBehavior.setDragAndCopyPickUpEvent(
		new MiEvent(MiEvent.Mi_LEFT_MOUSE_START_DRAG_EVENT, 0, 0));
	dndBehavior.setDragAndCopyDragEvent(
		new MiEvent(MiEvent.Mi_LEFT_MOUSE_DRAG_EVENT, 0, 0));
	dndBehavior.setDragAndCopyCancelEvent(
		new MiEvent(MiEvent.Mi_KEY_EVENT, MiEvent.Mi_ESC_KEY, 0));
	dndBehavior.setDragAndCopyDropEvent(
		new MiEvent(MiEvent.Mi_LEFT_MOUSE_UP_EVENT, 0, 0));

	treeList.setDragAndDropBehavior(dndBehavior);

 

Version:
%I% %G%
Author:
Michael L. Davis

Constructor Summary
MiDragAndDropBehavior()
          Constructs a new MiDragAndDropBehavior.
 
Method Summary
 java.lang.Object getDataToExport()
          Gets the data to be exported during the drop operation for parts with this behavior.
 MiEvent getDragAndCopyCancelEvent()
          Gets the event that will cancel a drag-and-copy operation.
 MiEvent getDragAndCopyDragEvent()
          Gets the event that will move a part during a drag-and-copy operation.
 MiEvent getDragAndCopyDropEvent()
          Gets the event that will complete a drag-and-copy operation.
 MiEvent getDragAndCopyPickUpEvent()
          Gets the event that will 'pick up' a part to start a drag-and-copy operation.
 MiEvent getDragAndCutCancelEvent()
          Gets the event that will cancel a drag-and-cut operation.
 MiEvent getDragAndCutDragEvent()
          Gets the event that will move a part during a drag-and-cut operation.
 MiEvent getDragAndCutDropEvent()
          Gets the event that will complete a drag-and-cut operation.
 MiEvent getDragAndCutPickUpEvent()
          Gets the event that will 'pick up' a part to start a drag-and-cut operation.
 MiPart getDraggingLook()
          Gets the appearance to be used during the drag operation for parts with this behavior.
 boolean getDragsReferenceNotCopy()
           
 boolean getKeepLookCompletelyWithinRootWindow()
           
 boolean getSnapLookCenterToCursor()
           
 MiEditor getTargetEditor()
           
 MiParts getValidTargets()
          Gets the valid targets for drag and drop for parts with this behavior.
 boolean isDefaultBehaviorForParts()
           
 boolean isOpaqueDragAndDropTarget()
          Gets whether, if the part with this behavior rejects a drop, the parent of the part can then be inquired as to whether it wants the drop.
 boolean isPartDragAndDropSource(MiPart part)
           
 boolean isPartDragAndDropTarget(MiPart part)
           
 void setDataToExport(java.lang.Object data)
           
 void setDragAndCopyCancelEvent(MiEvent event)
          Sets the event that will cancel a drag-and-copy operation.
 void setDragAndCopyDragEvent(MiEvent event)
          Sets the event that will move a part during a drag-and-copy operation.
 void setDragAndCopyDropEvent(MiEvent event)
          Sets the event that will complete a drag-and-copy operation.
 void setDragAndCopyPickUpEvent(MiEvent event)
          Sets the event that will 'pick up' a part to start a drag-and-copy operation.
 void setDragAndCutCancelEvent(MiEvent event)
          Sets the event that will cancel a drag-and-cut operation.
 void setDragAndCutDragEvent(MiEvent event)
          Sets the event that will move a part during a drag-and-cut operation.
 void setDragAndCutDropEvent(MiEvent event)
          Sets the event that will complete a drag-and-cut operation.
 void setDragAndCutPickUpEvent(MiEvent event)
          Sets the event that will 'pick up' a part to start a drag-and-cut operation.
 void setDraggingLook(MiPart look)
           
 void setDragsReferenceNotCopy(boolean flag)
           
 void setIsDefaultBehaviorForParts(boolean flag)
           
 void setIsOpaqueDragAndDropTarget(boolean flag)
          Sets whether, if the part with this behavior rejects a drop, the parent of the part can then be inquired as to whether it wants the drop.
 void setKeepLookCompletelyWithinRootWindow(boolean flag)
           
 void setSnapLookCenterToCursor(boolean flag)
           
 void setTargetEditor(MiEditor editor)
           
 void setValidTargets(MiParts targets)
          Sets the valid targets for drag and drop for parts with this behavior.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiDragAndDropBehavior

public MiDragAndDropBehavior()
Constructs a new MiDragAndDropBehavior.

Method Detail

setIsDefaultBehaviorForParts

public void setIsDefaultBehaviorForParts(boolean flag)

isDefaultBehaviorForParts

public boolean isDefaultBehaviorForParts()
Specified by:
isDefaultBehaviorForParts in interface MiiDragAndDropBehavior

setDragsReferenceNotCopy

public void setDragsReferenceNotCopy(boolean flag)

getDragsReferenceNotCopy

public boolean getDragsReferenceNotCopy()
Specified by:
getDragsReferenceNotCopy in interface MiiDragAndDropBehavior

setSnapLookCenterToCursor

public void setSnapLookCenterToCursor(boolean flag)

getSnapLookCenterToCursor

public boolean getSnapLookCenterToCursor()
Specified by:
getSnapLookCenterToCursor in interface MiiDragAndDropBehavior

setKeepLookCompletelyWithinRootWindow

public void setKeepLookCompletelyWithinRootWindow(boolean flag)

getKeepLookCompletelyWithinRootWindow

public boolean getKeepLookCompletelyWithinRootWindow()
Specified by:
getKeepLookCompletelyWithinRootWindow in interface MiiDragAndDropBehavior

isPartDragAndDropSource

public boolean isPartDragAndDropSource(MiPart part)
Specified by:
isPartDragAndDropSource in interface MiiDragAndDropBehavior

isPartDragAndDropTarget

public boolean isPartDragAndDropTarget(MiPart part)
Specified by:
isPartDragAndDropTarget in interface MiiDragAndDropBehavior

setValidTargets

public void setValidTargets(MiParts targets)
Description copied from interface: MiiDragAndDropBehavior
Sets the valid targets for drag and drop for parts with this behavior. If null (the default) then all targets are valid.

Specified by:
setValidTargets in interface MiiDragAndDropBehavior
Parameters:
targets - the valid targets or null

getValidTargets

public MiParts getValidTargets()
Description copied from interface: MiiDragAndDropBehavior
Gets the valid targets for drag and drop for parts with this behavior. If null (the default) then all targets are valid.

Specified by:
getValidTargets in interface MiiDragAndDropBehavior
Returns:
the valid targets or null

setDataToExport

public void setDataToExport(java.lang.Object data)

getDataToExport

public java.lang.Object getDataToExport()
Description copied from interface: MiiDragAndDropBehavior
Gets the data to be exported during the drop operation for parts with this behavior. If null (the default) then the source's doExport method is used to get the data.

Specified by:
getDataToExport in interface MiiDragAndDropBehavior
Returns:
the export data or null

setDraggingLook

public void setDraggingLook(MiPart look)

getDraggingLook

public MiPart getDraggingLook()
Description copied from interface: MiiDragAndDropBehavior
Gets the appearance to be used during the drag operation for parts with this behavior. If null (the default) then the source's look is copied.

Specified by:
getDraggingLook in interface MiiDragAndDropBehavior
Returns:
the look or null

setTargetEditor

public void setTargetEditor(MiEditor editor)

getTargetEditor

public MiEditor getTargetEditor()
Specified by:
getTargetEditor in interface MiiDragAndDropBehavior

isOpaqueDragAndDropTarget

public boolean isOpaqueDragAndDropTarget()
Gets whether, if the part with this behavior rejects a drop, the parent of the part can then be inquired as to whether it wants the drop. False is the default value.

Specified by:
isOpaqueDragAndDropTarget in interface MiiDragAndDropBehavior
Returns:
true if cannot drop on part(s) underneath the part assigned this behavior
See Also:
setIsOpaqueDragAndDropTarget

setIsOpaqueDragAndDropTarget

public void setIsOpaqueDragAndDropTarget(boolean flag)
Sets whether, if the part with this behavior rejects a drop, the parent of the part can then be inquired as to whether it wants the drop.

Parameters:
flag - true if cannot drop on part(s) underneath the part assigned this behavior
See Also:
isOpaqueDragAndDropTarget

setDragAndCopyPickUpEvent

public void setDragAndCopyPickUpEvent(MiEvent event)
Sets the event that will 'pick up' a part to start a drag-and-copy operation. A null indicates that all the drag-and-copy events are unspecified.

Parameters:
event - the pickup event

setDragAndCopyDragEvent

public void setDragAndCopyDragEvent(MiEvent event)
Sets the event that will move a part during a drag-and-copy operation.

Parameters:
event - the drag event

setDragAndCopyCancelEvent

public void setDragAndCopyCancelEvent(MiEvent event)
Sets the event that will cancel a drag-and-copy operation.

Parameters:
event - the cancel event

setDragAndCopyDropEvent

public void setDragAndCopyDropEvent(MiEvent event)
Sets the event that will complete a drag-and-copy operation.

Parameters:
event - the drop event

getDragAndCopyPickUpEvent

public MiEvent getDragAndCopyPickUpEvent()
Gets the event that will 'pick up' a part to start a drag-and-copy operation.

Specified by:
getDragAndCopyPickUpEvent in interface MiiDragAndDropBehavior
Returns:
the pickup event

getDragAndCopyDragEvent

public MiEvent getDragAndCopyDragEvent()
Gets the event that will move a part during a drag-and-copy operation.

Specified by:
getDragAndCopyDragEvent in interface MiiDragAndDropBehavior
Returns:
the drag event

getDragAndCopyCancelEvent

public MiEvent getDragAndCopyCancelEvent()
Gets the event that will cancel a drag-and-copy operation.

Specified by:
getDragAndCopyCancelEvent in interface MiiDragAndDropBehavior
Returns:
the cancel event

getDragAndCopyDropEvent

public MiEvent getDragAndCopyDropEvent()
Gets the event that will complete a drag-and-copy operation.

Specified by:
getDragAndCopyDropEvent in interface MiiDragAndDropBehavior
Returns:
the drop event

setDragAndCutPickUpEvent

public void setDragAndCutPickUpEvent(MiEvent event)
Sets the event that will 'pick up' a part to start a drag-and-cut operation. A null indicates that all the drag-and-cut events are unspecified.

Parameters:
event - the pickup event

setDragAndCutDragEvent

public void setDragAndCutDragEvent(MiEvent event)
Sets the event that will move a part during a drag-and-cut operation.

Parameters:
event - the drag event

setDragAndCutCancelEvent

public void setDragAndCutCancelEvent(MiEvent event)
Sets the event that will cancel a drag-and-cut operation.

Parameters:
event - the cancel event

setDragAndCutDropEvent

public void setDragAndCutDropEvent(MiEvent event)
Sets the event that will complete a drag-and-cut operation.

Parameters:
event - the drop event

getDragAndCutPickUpEvent

public MiEvent getDragAndCutPickUpEvent()
Gets the event that will 'pick up' a part to start a drag-and-cut operation.

Specified by:
getDragAndCutPickUpEvent in interface MiiDragAndDropBehavior
Returns:
the pickup event

getDragAndCutDragEvent

public MiEvent getDragAndCutDragEvent()
Gets the event that will move a part during a drag-and-cut operation.

Specified by:
getDragAndCutDragEvent in interface MiiDragAndDropBehavior
Returns:
the drag event

getDragAndCutCancelEvent

public MiEvent getDragAndCutCancelEvent()
Gets the event that will cancel a drag-and-cut operation.

Specified by:
getDragAndCutCancelEvent in interface MiiDragAndDropBehavior
Returns:
the cancel event

getDragAndCutDropEvent

public MiEvent getDragAndCutDropEvent()
Gets the event that will complete a drag-and-cut operation.

Specified by:
getDragAndCutDropEvent in interface MiiDragAndDropBehavior
Returns:
the drop event