org.apache.pivot.wtk
Interface DragSource


public interface DragSource

Interface representing a drag source.


Method Summary
 boolean beginDrag(Component component, int x, int y)
          Called by the framework to initiate a drag operation.
 void endDrag(Component component, DropAction dropAction)
          Called by the framework to terminate a drag operation.
 LocalManifest getContent()
          Returns the drag content.
 Point getOffset()
          Returns the offset of the mouse pointer within the drag visual.
 Visual getRepresentation()
          Returns a visual representing the drag content.
 int getSupportedDropActions()
          Returns the drop actions supported by this drag source.
 boolean isNative()
          Returns the drag source's native flag.
 

Method Detail

beginDrag

boolean beginDrag(Component component,
                  int x,
                  int y)
Called by the framework to initiate a drag operation.

Parameters:
component -
x -
y -
Returns:
true to accept the drag; false to reject it.

endDrag

void endDrag(Component component,
             DropAction dropAction)
Called by the framework to terminate a drag operation.

Parameters:
component -
dropAction -

isNative

boolean isNative()
Returns the drag source's native flag.

Returns:
If true, the drag will be executed via the native OS. Otherwise, it will be executed locally.

getContent

LocalManifest getContent()
Returns the drag content.


getRepresentation

Visual getRepresentation()
Returns a visual representing the drag content.

Returns:
The drag visual, or null for no visual.

getOffset

Point getOffset()
Returns the offset of the mouse pointer within the drag visual. Not required unless a representation is specified.

Returns:
The mouse offset within the drag visual, or null if no visual is specified.

getSupportedDropActions

int getSupportedDropActions()
Returns the drop actions supported by this drag source.

Returns:
A bitfield of the supported drop actions.