Class DragAwayComponentConf<C extends JComponent>
- Type Parameters:
C
- The type of the component to be dragged away.
UIForAnySwing.withDragAway(Configurator)
method, where an instance of this
class is passed to the Configurator
lambda defining how
the component should behave and look when dragged away. So you may for example use the following methods to define the visual appearance of the drag away operation:
enabled(boolean)
- Enables or disables the drag away operation entirely.opacity(double)
- Sets the opacity of the drag image. The value should be between 0.0 and 1.0. A value of 0.0 means the drag image is completely transparent and a value of 1.0 means the drag image is completely opaque.cursor(UI.Cursor)
- Sets the cursor to be used during the drag operation. The default cursor isUI.Cursor.DEFAULT
.customDragImage(Image)
- Sets a custom drag image to be used during the drag operation. If no custom drag image is set, the component will be rendered int a drag image during the drag operation.
For listening to drag away events, the following methods are available:
onDragEnter(Action)
- Called as the cursor's hotspot enters a platform-dependent drop site. The providedAction
is invoked when all the following conditions are true:- The cursor's hotspot enters the operable part of a platform- dependent drop site.
- The drop site is active.
- The drop site accepts the drag.
onDragMove(Action)
- Called whenever the mouse is moved during a drag operation.onDragOver(Action)
- Called as the cursor's hotspot moves over a platform-dependent drop site. This method is invoked when all the following conditions are true:- The cursor's hotspot has moved, but still intersects the operable part of the drop site associated with the previous dragEnter() invocation.
- The drop site is still active.
- The drop site accepts the drag.
onDropActionChanged(Action)
- Called when the user has modified the drop gesture. This method is invoked when the state of the input device(s) that the user is interacting with changes. Such devices are typically the mouse buttons or keyboard modifiers that the user is interacting with.onDragExit(Action)
- Called as the cursor's hotspot exits a platform-dependent drop site. ThisAction
is invoked when any of the following conditions are true:- The cursor's hotspot no longer intersects the operable part of the drop site associated with the previous dragEnter() invocation.
- The drop site associated with the previous dragEnter() invocation is no longer active.
- The drop site associated with the previous dragEnter() invocation has rejected the drag.
onDragDropEnd(Action)
- ThisAction
is invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of theDragSourceDropEvent
can be used to determine the termination state. The getDropAction() method
-
Method Summary
Modifier and TypeMethodDescriptionExposes the component that can be dragged away by the user.cursor()
Gives you the current cursor to be used during the drag operation.Configures the mouse cursor to be displayed during the drag operation.Returns anOptional
of the current custom drag image to be used as a visual representation of the component during the drag operation.customDragImage
(Image customDragImage) Allows you to define a custom drag image to be used during the drag operation.customDragImage
(String path) Allows you to define a custom drag image to be used during the drag operation.Allows you to define a custom drag image to be used during the drag operation.Returns the current drag action of this drag away operation.dragAction
(UI.DragAction dragAction) Use this to specify the type drag action of this drag away operation by passing one of the followingUI.DragAction
enum values:UI.DragAction.NONE
UI.DragAction.COPY
UI.DragAction.MOVE
UI.DragAction.COPY_OR_MOVE
UI.DragAction.LINK
This drag action constant is used to specify the action(s) supported by the drag source.
If no drag action is set, the default drag action isUI.DragAction.NONE
.boolean
enabled()
Exposes the current enabled state of the drag away operation.enabled
(boolean enabled) Enables or disables the drag away operation entirely.Exposes the current mouse position of the drag operation.double
mouseX()
Exposes the current x-coordinate of the mouse position of the drag operation.double
mouseY()
Exposes the current y-coordinate of the mouse position of the drag operation.static <C extends JComponent>
DragAwayComponentConf<C> sprouts.Action
<ComponentDelegate<C, DragSourceDropEvent>> Returns theAction
that is invoked to signify that the Drag and Drop operation is complete.onDragDropEnd
(sprouts.Action<ComponentDelegate<C, DragSourceDropEvent>> onDragDropEnd) Use this to specify anAction
that is invoked to signify that the Drag and Drop operation is complete.sprouts.Action
<ComponentDelegate<C, DragSourceDragEvent>> Returns theAction
that is invoked when the cursor's hotspot enters a platform-dependent drop site.onDragEnter
(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragEnter) Use this to specify anAction
that is invoked when the cursor's hotspot enters a platform-dependent drop site.sprouts.Action
<ComponentDelegate<C, DragSourceEvent>> Returns theAction
that is invoked as the cursor's hotspot exits a platform-dependent drop site.onDragExit
(sprouts.Action<ComponentDelegate<C, DragSourceEvent>> onDragExit) Use this to specify anAction
that is invoked as the cursor's hotspot exits a platform-dependent drop site.sprouts.Action
<ComponentDelegate<C, DragSourceDragEvent>> Returns theAction
that is invoked whenever the mouse is moved during a drag operation.onDragMove
(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragMove) Use this to specify anAction
that is invoked whenever the mouse is moved during a drag operation.sprouts.Action
<ComponentDelegate<C, DragSourceDragEvent>> Returns theAction
that is invoked as the cursor's hotspot moves over a platform-dependent drop site.onDragOver
(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragOver) Use this to specify anAction
that is invoked as the cursor's hotspot moves over a platform-dependent drop site.sprouts.Action
<ComponentDelegate<C, DragGestureEvent>> Returns theAction
that is invoked when the drag operation is initiated.
This event handler is invoked by theDragGestureRecognizer
when theDragGestureRecognizer
detects a platform-dependent drag initiating gesture.onDragStart
(sprouts.Action<ComponentDelegate<C, DragGestureEvent>> onDragStart) Use this to specify anAction
that is invoked when the drag operation is initiated.sprouts.Action
<ComponentDelegate<C, DragSourceDragEvent>> Returns theAction
that is invoked when the user has modified the drop gesture.onDropActionChanged
(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDropActionChanged) Use this to specify anAction
that is invoked when the user has modified the drop gesture.double
opacity()
Exposes the current opacity of the drag image.opacity
(double opacity) Allows you to define the opacity of the drag image.payload()
Returns anOptional
of the currentTransferable
object that is used to transfer the data during the drag operation.payload
(Transferable payload) Use this to specify the payload of this drag away operation in the form of aTransferable
object.Allows you to specify the payload of this drag away operation in the form of aString
object to be transferred during the drag away operation.
-
Method Details
-
of
public static <C extends JComponent> DragAwayComponentConf<C> of(C component, Position mousePosition) -
component
Exposes the component that can be dragged away by the user. You may use this method configure the drag away operation based on the component's properties.- Returns:
- The component to be dragged away.
-
mousePosition
Exposes the current mouse position of the drag operation. The mouse position is the location of the mouse cursor when the drag operation was initiated.- Returns:
- The mouse position of the drag operation.
-
mouseX
public double mouseX()Exposes the current x-coordinate of the mouse position of the drag operation. The x-coordinate is the horizontal position of the mouse cursor when the drag operation was initiated.- Returns:
- The x-coordinate of the mouse position of the drag operation.
-
mouseY
public double mouseY()Exposes the current y-coordinate of the mouse position of the drag operation. The y-coordinate is the vertical position of the mouse cursor when the drag operation was initiated.- Returns:
- The y-coordinate of the mouse position of the drag operation.
-
enabled
public boolean enabled()Exposes the current enabled state of the drag away operation. If the drag away operation is disabled, the user will not be able to drag the component away.- Returns:
true
if the drag away operation is enabled,false
otherwise.
-
opacity
public double opacity()Exposes the current opacity of the drag image. The value should be between 0.0 and 1.0. A value of 0.0 means the drag image is completely transparent and a value of 1.0 means the drag image is completely opaque.- Returns:
- The opacity of the drag image in the form of a double value ranging from 0.0 to 1.0.
-
cursor
Gives you the current cursor to be used during the drag operation. The default cursor isUI.Cursor.DEFAULT
. You may want to useUI.Cursor.MOVE
for example to indicate that the user is moving the component.- Returns:
- The cursor to be used during the drag operation.
-
customDragImage
Returns anOptional
of the current custom drag image to be used as a visual representation of the component during the drag operation. If no custom drag image is set, the component will be rendered into a drag image during the drag operation.
Note that a visualization of the component outside the application window depends on the platform and the implementation of the drag and drop operation, seeDragSource.isDragImageSupported()
for more information.- Returns:
- The custom drag image to be used during the drag operation
or
Optional.empty()
if no custom drag image is set.
-
payload
Returns anOptional
of the currentTransferable
object that is used to transfer the data during the drag operation. If no customTransferable
object is set, the defaultTransferable
object will be used to transfer the data.- Returns:
- The
Transferable
object that is used to transfer the data during the drag operation orOptional.empty()
if no customTransferable
object is set.
-
dragAction
Returns the current drag action of this drag away operation. The drag action constant is used to specify the action(s) supported by the drag source. If no drag action is set, the default drag action isUI.DragAction.NONE
. TheUI.DragAction
enum type used here, directly maps to the int based constants defined inDnDConstants
.- Returns:
- The drag action of this drag away operation.
-
onDragStart
Returns theAction
that is invoked when the drag operation is initiated.
This event handler is invoked by theDragGestureRecognizer
when theDragGestureRecognizer
detects a platform-dependent drag initiating gesture.- Returns:
- The
Action
that is invoked when the drag operation is initiated.
-
onDragEnter
Returns theAction
that is invoked when the cursor's hotspot enters a platform-dependent drop site. This method is invoked when all the following conditions are true:- The cursor's hotspot enters the operable part of a platform-dependent drop site.
- The drop site is active.
- The drop site accepts the drag.
For more information about how this is implemented, check out the documentation of
DragSourceListener
.
As the suppliedAction
will be invoked inside theDragSourceListener.dragEnter(DragSourceDragEvent)
method as part of a customDragSourceListener
implementation registered to listen to AWT native drag and drop operations, throughDragGestureEvent.startDrag(java.awt.Cursor, java.awt.datatransfer.Transferable)
and ultimatelyDragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)
.- Returns:
- The
Action
that is invoked when the cursor's hotspot enters a platform-dependent drop site.
-
onDragMove
Returns theAction
that is invoked whenever the mouse is moved during a drag operation.For more information about how this is implemented, check out the documentation of
DragSourceMotionListener
.
As the suppliedAction
will be invoked inside theDragSourceMotionListener.dragMouseMoved(DragSourceDragEvent)
method as part of a customDragSourceMotionListener
implementation registered to listen to AWT native drag operations, throughDragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener)
.- Returns:
- The
Action
that is invoked whenever the mouse is moved during a drag operation.
-
onDragOver
Returns theAction
that is invoked as the cursor's hotspot moves over a platform-dependent drop site. This method is invoked when all the following conditions are true:- The cursor's hotspot has moved, but still intersects the operable part of the drop site
associated with the previous
onDragEnter(Action)
invocation. - The drop site is still active.
- The drop site accepts the drag.
For more information about how this is implemented, check out the documentation of
DragSourceListener
.
As the suppliedAction
will be invoked inside theDragSourceListener.dragOver(DragSourceDragEvent)
method as part of a customDragSourceListener
implementation registered to listen to AWT native drag and drop operations, throughDragGestureEvent.startDrag(java.awt.Cursor, java.awt.datatransfer.Transferable)
and ultimatelyDragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)
.- Returns:
- The
Action
that is invoked as the cursor's hotspot moves over a platform-dependent drop site.
- The cursor's hotspot has moved, but still intersects the operable part of the drop site
associated with the previous
-
onDropActionChanged
Returns theAction
that is invoked when the user has modified the drop gesture. This method is invoked when the state of the input device(s) that the user is interacting with changes. Such devices are typically the mouse buttons or keyboard modifiers that the user is interacting with.For more information about how this is implemented, check out the documentation of
DragSourceListener
.
As the suppliedAction
will be invoked inside theDragSourceListener.dropActionChanged(DragSourceDragEvent)
method as part of a customDragSourceListener
implementation registered to listen to AWT native drag and drop operations, throughDragGestureEvent.startDrag(java.awt.Cursor, java.awt.datatransfer.Transferable)
and ultimatelyDragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)
.- Returns:
- The
Action
that is invoked when the user has modified the drop gesture.
-
onDragExit
Returns theAction
that is invoked as the cursor's hotspot exits a platform-dependent drop site. ThisAction
is invoked when any of the following conditions are true:-
The cursor's hotspot no longer intersects the operable part of the
drop site associated with the previous
onDragEnter(Action)
invocation.
-
The drop site associated with the previous
onDragEnter(Action)
invocation is no longer active.
-
The drop site associated with the previous
onDragEnter(Action)
invocation has rejected the drag.
For more information about how this is implemented, check out the documentation of
DragSourceListener
.
As the suppliedAction
will be invoked inside theDragSourceListener.dragExit(DragSourceEvent)
method as part of a customDragSourceListener
implementation registered to listen to AWT native drag and drop operations, throughDragGestureEvent.startDrag(java.awt.Cursor, java.awt.datatransfer.Transferable)
and ultimatelyDragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)
.- Returns:
- The
Action
that is invoked as the cursor's hotspot exits a platform-dependent drop site.
-
The cursor's hotspot no longer intersects the operable part of the
drop site associated with the previous
-
onDragDropEnd
Returns theAction
that is invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of theDragSourceDropEvent
can be used to determine the termination state. The getDropAction() methodFor more information about how this is implemented, check out the documentation of
DragSourceListener
.
As the suppliedAction
will be invoked inside theDragSourceListener.dragDropEnd(DragSourceDropEvent)
method as part of a customDragSourceListener
implementation registered to listen to AWT native drag and drop operations, throughDragGestureEvent.startDrag(java.awt.Cursor, java.awt.datatransfer.Transferable)
and ultimatelyDragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)
.- Returns:
- The
Action
that is invoked to signify that the Drag and Drop operation is complete.
-
enabled
Enables or disables the drag away operation entirely.- Parameters:
enabled
-true
to enable the drag away operation,false
to disable it.- Returns:
- A new
DragAwayComponentConf
instance with the updated enabled state.
-
opacity
Allows you to define the opacity of the drag image. The value should be between0.0
and1.0
, where the number0.0
means the drag image is completely transparent and a value of1.0
means the drag image is completely opaque.Note that the opacity will automatically applied to the
customDragImage(Image)
if a custom drag image is set.
If no custom drag image is set, the opacity will be applied to the drag image that is created from the component during the drag operation.- Parameters:
opacity
- The opacity of the drag image in the form of a double value ranging from0.0
to1.0
.- Returns:
- A new
DragAwayComponentConf
instance with the updated opacity.
-
cursor
Configures the mouse cursor to be displayed during the drag operation. The default cursor isUI.Cursor.DEFAULT
. You may want to useUI.Cursor.MOVE
for example to indicate that the user is moving the component.- Parameters:
cursor
- The cursor to be used during the drag operation.- Returns:
- A new
DragAwayComponentConf
instance with the updated cursor.
-
customDragImage
Allows you to define a custom drag image to be used during the drag operation. If no custom drag image is set, the component appearance will be used as the drag image during the drag operation.
Note that a visualization of the component outside the application window depends on the platform and the implementation of the drag and drop operation, seeDragSource.isDragImageSupported()
for more information.- Parameters:
customDragImage
- The custom drag image to be used during the drag operation.- Returns:
- A new
DragAwayComponentConf
instance with the updated custom drag image.
-
customDragImage
Allows you to define a custom drag image to be used during the drag operation. If no custom drag image is set, the component appearance will be used as the drag image during the drag operation.
Note that a visualization of the component outside the application window depends on the platform and the implementation of the drag and drop operation, seeDragSource.isDragImageSupported()
for more information.- Parameters:
icon
- The icon declaration to be used as the custom drag image. AnIconDeclaration
is a constant which defines the path to the icon image.- Returns:
- A new
DragAwayComponentConf
instance with the updated custom drag image.
-
customDragImage
Allows you to define a custom drag image to be used during the drag operation. If no custom drag image is set, the component appearance will be used as the drag image during the drag operation.
Note that a visualization of the component outside the application window depends on the platform and the implementation of the drag and drop operation, seeDragSource.isDragImageSupported()
for more information.- Parameters:
path
- The path to the custom drag image to be used during the drag operation.- Returns:
- A new
DragAwayComponentConf
instance with the updated custom drag image.
-
payload
Use this to specify the payload of this drag away operation in the form of aTransferable
object. TheTransferable
object is used to transfer data in various data formats during the drag operation so that it may eventually be dropped at a drop site, like for exampleUIForAnySwing.withDropSite(Configurator)
.
If no customTransferable
object is set,StringSelection
with an empty string is used as the default payload.- Parameters:
payload
- TheTransferable
object that is used to transfer the data during the drag operation.- Returns:
- A new
DragAwayComponentConf
instance with the updatedTransferable
object.
-
payload
Allows you to specify the payload of this drag away operation in the form of aString
object to be transferred during the drag away operation.
If no payload object is specified an empty string will be used as the default payload.- Parameters:
payload
- TheString
object that is used to transfer the data during the drag operation.- Returns:
- A new
DragAwayComponentConf
instance with the updatedTransferable
of theStringSelection
subtype.
-
dragAction
Use this to specify the type drag action of this drag away operation by passing one of the followingUI.DragAction
enum values:UI.DragAction.NONE
UI.DragAction.COPY
UI.DragAction.MOVE
UI.DragAction.COPY_OR_MOVE
UI.DragAction.LINK
If no drag action is set, the default drag action isUI.DragAction.NONE
.
TheUI.DragAction
enum type used here, directly maps to the int based constants defined inDnDConstants
.- Parameters:
dragAction
- The drag action of this drag away operation.- Returns:
- A new
DragAwayComponentConf
instance with the updated drag action.
-
onDragStart
public DragAwayComponentConf<C> onDragStart(sprouts.Action<ComponentDelegate<C, DragGestureEvent>> onDragStart) Use this to specify anAction
that is invoked when the drag operation is initiated. This method is invoked by theDragGestureRecognizer
when theDragGestureRecognizer
detects a platform-dependent drag initiating gesture.
By using this API, SwingTree will automatically initiate the drag and drop operation through theDragGestureEvent.startDrag(Cursor, Transferable, DragSourceListener)
method on theDragGestureEvent
exposed in thisAction
.
To initiate another the drag and drop operation, you can call theDragGestureEvent.startDrag(Cursor, Transferable, DragSourceListener)
method on theDragGestureEvent
exposed in theComponentDelegate
parameter.- Parameters:
onDragStart
- TheAction
to be invoked when the drag operation is initiated. It receives aComponentDelegate
with theDragGestureEvent
as well as theJComponent
that is being dragged away.- Returns:
- A new
DragAwayComponentConf
instance with the updatedAction
for onDragStart. - See Also:
-
onDragEnter
public DragAwayComponentConf<C> onDragEnter(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragEnter) Use this to specify anAction
that is invoked when the cursor's hotspot enters a platform-dependent drop site. This method is invoked when all the following conditions are true:- The cursor's hotspot enters the operable part of a platform-dependent drop site.
- The drop site is active.
- The drop site accepts the drag.
For more information about how this is implemented, check out the documentation of
DragSourceListener
.
As the suppliedAction
will be invoked inside theDragSourceListener.dragEnter(DragSourceDragEvent)
method as part of a customDragSourceListener
implementation registered to listen to AWT native drag and drop operations, throughDragGestureEvent.startDrag(java.awt.Cursor, java.awt.datatransfer.Transferable)
and ultimatelyDragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)
.- Parameters:
onDragEnter
- TheAction
to be invoked when the cursor's hotspot enters a platform-dependent drop site.- Returns:
- A new
DragAwayComponentConf
instance with the updatedAction
for onDragEnter.
-
onDragMove
public DragAwayComponentConf<C> onDragMove(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragMove) Use this to specify anAction
that is invoked whenever the mouse is moved during a drag operation.For more information about how this is implemented, check out the documentation of
DragSourceMotionListener
.
As the suppliedAction
will be invoked inside theDragSourceMotionListener.dragMouseMoved(DragSourceDragEvent)
method as part of a customDragSourceMotionListener
implementation registered to listen to AWT native drag operations, throughDragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener)
.- Parameters:
onDragMove
- TheAction
to be invoked whenever the mouse is moved during a drag operation.- Returns:
- A new
DragAwayComponentConf
instance with the updatedAction
for onDragMove.
-
onDragOver
public DragAwayComponentConf<C> onDragOver(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragOver) Use this to specify anAction
that is invoked as the cursor's hotspot moves over a platform-dependent drop site. This method is invoked when all the following conditions are true:- The cursor's hotspot has moved, but still intersects the operable part of the drop site
associated with the previous
onDragEnter(Action)
invocation. - The drop site is still active.
- The drop site accepts the drag.
For more information about how this is implemented, check out the documentation of
DragSourceListener
.
As the suppliedAction
will be invoked inside theDragSourceListener.dragOver(DragSourceDragEvent)
method as part of a customDragSourceListener
implementation registered to listen to AWT native drag and drop operations, throughDragGestureEvent.startDrag(java.awt.Cursor, java.awt.datatransfer.Transferable)
and ultimatelyDragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)
.- Parameters:
onDragOver
- TheAction
to be invoked as the cursor's hotspot moves over a platform-dependent drop site.- Returns:
- A new
DragAwayComponentConf
instance with the updatedAction
for onDragOver.
- The cursor's hotspot has moved, but still intersects the operable part of the drop site
associated with the previous
-
onDropActionChanged
public DragAwayComponentConf<C> onDropActionChanged(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDropActionChanged) Use this to specify anAction
that is invoked when the user has modified the drop gesture. This method is invoked when the state of the input device(s) that the user is interacting with changes. Such devices are typically the mouse buttons or keyboard modifiers that the user is interacting with.For more information about how this is implemented, check out the documentation of
DragSourceListener
.
As the suppliedAction
will be invoked inside theDragSourceListener.dropActionChanged(DragSourceDragEvent)
method as part of a customDragSourceListener
implementation registered to listen to AWT native drag and drop operations, throughDragGestureEvent.startDrag(java.awt.Cursor, java.awt.datatransfer.Transferable)
and ultimatelyDragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)
.- Parameters:
onDropActionChanged
- TheAction
to be invoked when the user has modified the drop gesture.- Returns:
- A new
DragAwayComponentConf
instance with the updatedAction
for onDropActionChanged.
-
onDragExit
public DragAwayComponentConf<C> onDragExit(sprouts.Action<ComponentDelegate<C, DragSourceEvent>> onDragExit) Use this to specify anAction
that is invoked as the cursor's hotspot exits a platform-dependent drop site. ThisAction
is invoked when any of the following conditions are true:-
The cursor's hotspot no longer intersects the operable part of the
drop site associated with the previous
onDragEnter(Action)
invocation.
-
The drop site associated with the previous
onDragEnter(Action)
invocation is no longer active.
-
The drop site associated with the previous
onDragEnter(Action)
invocation has rejected the drag.
For more information about how this is implemented, check out the documentation of
DragSourceListener
.
As the suppliedAction
will be invoked inside theDragSourceListener.dragExit(DragSourceEvent)
method as part of a customDragSourceListener
implementation registered to listen to AWT native drag and drop operations, throughDragGestureEvent.startDrag(java.awt.Cursor, java.awt.datatransfer.Transferable)
and ultimatelyDragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)
.- Parameters:
onDragExit
- TheAction
to be invoked as the cursor's hotspot exits a platform-dependent drop site.- Returns:
- A new
DragAwayComponentConf
instance with the updatedAction
for onDragExit.
-
The cursor's hotspot no longer intersects the operable part of the
drop site associated with the previous
-
onDragDropEnd
public DragAwayComponentConf<C> onDragDropEnd(sprouts.Action<ComponentDelegate<C, DragSourceDropEvent>> onDragDropEnd) Use this to specify anAction
that is invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of theDragSourceDropEvent
can be used to determine the termination state. The getDropAction() methodFor more information about how this is implemented, check out the documentation of
DragSourceListener
.
As the suppliedAction
will be invoked inside theDragSourceListener.dragDropEnd(DragSourceDropEvent)
method as part of a customDragSourceListener
implementation registered to listen to AWT native drag and drop operations, throughDragGestureEvent.startDrag(java.awt.Cursor, java.awt.datatransfer.Transferable)
and ultimatelyDragSource.startDrag(java.awt.dnd.DragGestureEvent, java.awt.Cursor, java.awt.Image, java.awt.Point, java.awt.datatransfer.Transferable, java.awt.dnd.DragSourceListener, java.awt.datatransfer.FlavorMap)
.- Parameters:
onDragDropEnd
- TheAction
to be invoked to signify that the Drag and Drop operation is complete.- Returns:
- A new
DragAwayComponentConf
instance with the updatedAction
for onDragDropEnd.
-