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 providedActionis 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. ThisActionis 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)- ThisActionis invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of theDragSourceDropEventcan 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 anOptionalof 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.DragActionenum values:UI.DragAction.NONEUI.DragAction.COPYUI.DragAction.MOVEUI.DragAction.COPY_OR_MOVEUI.DragAction.LINKThis 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.booleanenabled()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.doublemouseX()Exposes the current x-coordinate of the mouse position of the drag operation.doublemouseY()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 theActionthat is invoked to signify that the Drag and Drop operation is complete.onDragDropEnd(sprouts.Action<ComponentDelegate<C, DragSourceDropEvent>> onDragDropEnd) Use this to specify anActionthat is invoked to signify that the Drag and Drop operation is complete.sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> Returns theActionthat is invoked when the cursor's hotspot enters a platform-dependent drop site.onDragEnter(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragEnter) Use this to specify anActionthat is invoked when the cursor's hotspot enters a platform-dependent drop site.sprouts.Action<ComponentDelegate<C, DragSourceEvent>> Returns theActionthat is invoked as the cursor's hotspot exits a platform-dependent drop site.onDragExit(sprouts.Action<ComponentDelegate<C, DragSourceEvent>> onDragExit) Use this to specify anActionthat is invoked as the cursor's hotspot exits a platform-dependent drop site.sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> Returns theActionthat is invoked whenever the mouse is moved during a drag operation.onDragMove(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragMove) Use this to specify anActionthat is invoked whenever the mouse is moved during a drag operation.sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> Returns theActionthat 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 anActionthat is invoked as the cursor's hotspot moves over a platform-dependent drop site.sprouts.Action<ComponentDelegate<C, DragGestureEvent>> Returns theActionthat is invoked when the drag operation is initiated.
This event handler is invoked by theDragGestureRecognizerwhen theDragGestureRecognizerdetects a platform-dependent drag initiating gesture.onDragStart(sprouts.Action<ComponentDelegate<C, DragGestureEvent>> onDragStart) Use this to specify anActionthat is invoked when the drag operation is initiated.sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> Returns theActionthat is invoked when the user has modified the drop gesture.onDropActionChanged(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDropActionChanged) Use this to specify anActionthat is invoked when the user has modified the drop gesture.doubleopacity()Exposes the current opacity of the drag image.opacity(double opacity) Allows you to define the opacity of the drag image.payload()Returns anOptionalof the currentTransferableobject 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 aTransferableobject.Allows you to specify the payload of this drag away operation in the form of aStringobject 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:
trueif the drag away operation is enabled,falseotherwise.
-
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.MOVEfor example to indicate that the user is moving the component.- Returns:
- The cursor to be used during the drag operation.
-
customDragImage
Returns anOptionalof 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 anOptionalof the currentTransferableobject that is used to transfer the data during the drag operation. If no customTransferableobject is set, the defaultTransferableobject will be used to transfer the data.- Returns:
- The
Transferableobject that is used to transfer the data during the drag operation orOptional.empty()if no customTransferableobject 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.DragActionenum type used here, directly maps to the int based constants defined inDnDConstants.- Returns:
- The drag action of this drag away operation.
-
onDragStart
Returns theActionthat is invoked when the drag operation is initiated.
This event handler is invoked by theDragGestureRecognizerwhen theDragGestureRecognizerdetects a platform-dependent drag initiating gesture.- Returns:
- The
Actionthat is invoked when the drag operation is initiated.
-
onDragEnter
Returns theActionthat 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 suppliedActionwill be invoked inside theDragSourceListener.dragEnter(DragSourceDragEvent)method as part of a customDragSourceListenerimplementation 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
Actionthat is invoked when the cursor's hotspot enters a platform-dependent drop site.
-
onDragMove
Returns theActionthat 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 suppliedActionwill be invoked inside theDragSourceMotionListener.dragMouseMoved(DragSourceDragEvent)method as part of a customDragSourceMotionListenerimplementation registered to listen to AWT native drag operations, throughDragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener).- Returns:
- The
Actionthat is invoked whenever the mouse is moved during a drag operation.
-
onDragOver
Returns theActionthat 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 suppliedActionwill be invoked inside theDragSourceListener.dragOver(DragSourceDragEvent)method as part of a customDragSourceListenerimplementation 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
Actionthat 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 theActionthat 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 suppliedActionwill be invoked inside theDragSourceListener.dropActionChanged(DragSourceDragEvent)method as part of a customDragSourceListenerimplementation 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
Actionthat is invoked when the user has modified the drop gesture.
-
onDragExit
Returns theActionthat is invoked as the cursor's hotspot exits a platform-dependent drop site. ThisActionis 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 suppliedActionwill be invoked inside theDragSourceListener.dragExit(DragSourceEvent)method as part of a customDragSourceListenerimplementation 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
Actionthat 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 theActionthat is invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of theDragSourceDropEventcan 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 suppliedActionwill be invoked inside theDragSourceListener.dragDropEnd(DragSourceDropEvent)method as part of a customDragSourceListenerimplementation 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
Actionthat is invoked to signify that the Drag and Drop operation is complete.
-
enabled
Enables or disables the drag away operation entirely.- Parameters:
enabled-trueto enable the drag away operation,falseto disable it.- Returns:
- A new
DragAwayComponentConfinstance with the updated enabled state.
-
opacity
Allows you to define the opacity of the drag image. The value should be between0.0and1.0, where the number0.0means the drag image is completely transparent and a value of1.0means 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.0to1.0.- Returns:
- A new
DragAwayComponentConfinstance 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.MOVEfor example to indicate that the user is moving the component.- Parameters:
cursor- The cursor to be used during the drag operation.- Returns:
- A new
DragAwayComponentConfinstance 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
DragAwayComponentConfinstance 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. AnIconDeclarationis a constant which defines the path to the icon image.- Returns:
- A new
DragAwayComponentConfinstance 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
DragAwayComponentConfinstance with the updated custom drag image.
-
payload
Use this to specify the payload of this drag away operation in the form of aTransferableobject. TheTransferableobject 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 customTransferableobject is set,StringSelectionwith an empty string is used as the default payload.- Parameters:
payload- TheTransferableobject that is used to transfer the data during the drag operation.- Returns:
- A new
DragAwayComponentConfinstance with the updatedTransferableobject.
-
payload
Allows you to specify the payload of this drag away operation in the form of aStringobject 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- TheStringobject that is used to transfer the data during the drag operation.- Returns:
- A new
DragAwayComponentConfinstance with the updatedTransferableof theStringSelectionsubtype.
-
dragAction
Use this to specify the type drag action of this drag away operation by passing one of the followingUI.DragActionenum values:UI.DragAction.NONEUI.DragAction.COPYUI.DragAction.MOVEUI.DragAction.COPY_OR_MOVEUI.DragAction.LINK
If no drag action is set, the default drag action isUI.DragAction.NONE.
TheUI.DragActionenum 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
DragAwayComponentConfinstance with the updated drag action.
-
onDragStart
public DragAwayComponentConf<C> onDragStart(sprouts.Action<ComponentDelegate<C, DragGestureEvent>> onDragStart) Use this to specify anActionthat is invoked when the drag operation is initiated. This method is invoked by theDragGestureRecognizerwhen theDragGestureRecognizerdetects 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 theDragGestureEventexposed in thisAction.
To initiate another the drag and drop operation, you can call theDragGestureEvent.startDrag(Cursor, Transferable, DragSourceListener)method on theDragGestureEventexposed in theComponentDelegateparameter.- Parameters:
onDragStart- TheActionto be invoked when the drag operation is initiated. It receives aComponentDelegatewith theDragGestureEventas well as theJComponentthat is being dragged away.- Returns:
- A new
DragAwayComponentConfinstance with the updatedActionfor onDragStart. - See Also:
-
onDragEnter
public DragAwayComponentConf<C> onDragEnter(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragEnter) Use this to specify anActionthat 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 suppliedActionwill be invoked inside theDragSourceListener.dragEnter(DragSourceDragEvent)method as part of a customDragSourceListenerimplementation 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- TheActionto be invoked when the cursor's hotspot enters a platform-dependent drop site.- Returns:
- A new
DragAwayComponentConfinstance with the updatedActionfor onDragEnter.
-
onDragMove
public DragAwayComponentConf<C> onDragMove(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragMove) Use this to specify anActionthat 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 suppliedActionwill be invoked inside theDragSourceMotionListener.dragMouseMoved(DragSourceDragEvent)method as part of a customDragSourceMotionListenerimplementation registered to listen to AWT native drag operations, throughDragSource.addDragSourceMotionListener(java.awt.dnd.DragSourceMotionListener).- Parameters:
onDragMove- TheActionto be invoked whenever the mouse is moved during a drag operation.- Returns:
- A new
DragAwayComponentConfinstance with the updatedActionfor onDragMove.
-
onDragOver
public DragAwayComponentConf<C> onDragOver(sprouts.Action<ComponentDelegate<C, DragSourceDragEvent>> onDragOver) Use this to specify anActionthat 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 suppliedActionwill be invoked inside theDragSourceListener.dragOver(DragSourceDragEvent)method as part of a customDragSourceListenerimplementation 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- TheActionto be invoked as the cursor's hotspot moves over a platform-dependent drop site.- Returns:
- A new
DragAwayComponentConfinstance with the updatedActionfor 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 anActionthat 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 suppliedActionwill be invoked inside theDragSourceListener.dropActionChanged(DragSourceDragEvent)method as part of a customDragSourceListenerimplementation 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- TheActionto be invoked when the user has modified the drop gesture.- Returns:
- A new
DragAwayComponentConfinstance with the updatedActionfor onDropActionChanged.
-
onDragExit
public DragAwayComponentConf<C> onDragExit(sprouts.Action<ComponentDelegate<C, DragSourceEvent>> onDragExit) Use this to specify anActionthat is invoked as the cursor's hotspot exits a platform-dependent drop site. ThisActionis 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 suppliedActionwill be invoked inside theDragSourceListener.dragExit(DragSourceEvent)method as part of a customDragSourceListenerimplementation 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- TheActionto be invoked as the cursor's hotspot exits a platform-dependent drop site.- Returns:
- A new
DragAwayComponentConfinstance with the updatedActionfor 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 anActionthat is invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of theDragSourceDropEventcan 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 suppliedActionwill be invoked inside theDragSourceListener.dragDropEnd(DragSourceDropEvent)method as part of a customDragSourceListenerimplementation 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- TheActionto be invoked to signify that the Drag and Drop operation is complete.- Returns:
- A new
DragAwayComponentConfinstance with the updatedActionfor onDragDropEnd.
-