org.openbp.jaspira.gui.interaction
Interface DragAwareRegion

All Known Implementing Classes:
BasicDragReactor, BasicDropRegion, CircleDropRegion, ViewDropRegion

public interface DragAwareRegion

A DropRegion is a single acceptanceRegion for for a DropReceiver. It consists of a region (defined by a Graphics2D region) and a list of acceptable DataFlavors.

Author:
Stephan Moritz

Field Summary
static int COPY
          This Regions supports copy actions only.
static int COPY_OR_MOVE
          This Regions supports copy and move actions.
static int MOVE
          This Regions supports move actions only.
static int NONE
          No source actions are supported.
 
Method Summary
 boolean canImport()
          Used to distinguish between active components (triggers) and real data accpetors.
 boolean dragEnter()
          Called when the mouse enters the region.
 boolean dragExit()
          Called when the mouse leaves the region.
 void draw(java.awt.Graphics2D g)
          Draws the graphical representation of this dropRegion.
 java.awt.Rectangle getBounds()
          Returns the bounding box of the region.
 CursorPrototype getCursor()
          Returns the cursor prototype that should be used for constructing a cursor if a drag over occurs.
 java.awt.Shape getOverlay()
          Returns the overlay that is to be shown when the cursor is over the region.
 java.lang.String getToolTipText()
          Returns a Tooltip for this region.
 boolean importData(java.awt.datatransfer.Transferable data, java.awt.Point p)
          Delivers a transferable to the drop receiver of this region.
 boolean reactsOn(int x, int y)
          Checks if the given point is inside the region.
 

Field Detail

NONE

static final int NONE
No source actions are supported. Only here for completeness.

See Also:
Constant Field Values

COPY

static final int COPY
This Regions supports copy actions only.

See Also:
Constant Field Values

MOVE

static final int MOVE
This Regions supports move actions only.

See Also:
Constant Field Values

COPY_OR_MOVE

static final int COPY_OR_MOVE
This Regions supports copy and move actions.

See Also:
Constant Field Values
Method Detail

getOverlay

java.awt.Shape getOverlay()
Returns the overlay that is to be shown when the cursor is over the region.

Returns:
The overlay or null if no overlay should be shown

getCursor

CursorPrototype getCursor()
Returns the cursor prototype that should be used for constructing a cursor if a drag over occurs.

Returns:
The drag cursor prototype or null

draw

void draw(java.awt.Graphics2D g)
Draws the graphical representation of this dropRegion.

Parameters:
g - Graphics context

reactsOn

boolean reactsOn(int x,
                 int y)
Checks if the given point is inside the region.

Parameters:
x - Position in screen coordinates
y - Position in screen coordinates

getBounds

java.awt.Rectangle getBounds()
Returns the bounding box of the region.

Returns:
The bounding box

getToolTipText

java.lang.String getToolTipText()
Returns a Tooltip for this region.

Returns:
The tool tip or null if no tool tip should be displayed

importData

boolean importData(java.awt.datatransfer.Transferable data,
                   java.awt.Point p)
Delivers a transferable to the drop receiver of this region.

Parameters:
data - The transferable to import
p - Import position in glass coordinates
Returns:
true If the import was successful
false Otherwise

canImport

boolean canImport()
Used to distinguish between active components (triggers) and real data accpetors.


dragEnter

boolean dragEnter()
Called when the mouse enters the region.

Returns:
true If this event should be passed to other eglible targets
false To purge the event

dragExit

boolean dragExit()
Called when the mouse leaves the region.

Returns:
true If this event should be passed to other eglible targets
false To purge the event


Copyright © 2011. All Rights Reserved.