Package edu.cnu.mdi.transfer
Interface PaletteDragSupport.PaletteDragSource
- Enclosing class:
PaletteDragSupport
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Supplies the drag payload and receives end-of-drag notification.
Implement this interface (typically as a lambda) and pass it to the
PaletteDragSupport constructor. The two methods correspond to the
two moments the palette cares about: "what are we dragging?" and "the
drag is over, clean up".
-
Method Summary
Modifier and TypeMethodDescriptioncreateTransferable(Point dragOrigin) default voidCalled on the EDT after every drag attempt ends — success, failure, or cancellation.
-
Method Details
-
createTransferable
Return theTransferablepayload for a drag starting atdragOrigin, ornullto cancel the drag.Called on the EDT from the
DragSourcegesture recogniser. Returningnullsuppresses the drag entirely — no cursor change, no drop target notification. This is the correct way to reject a drag that starts on a non-draggable area (e.g. a label column in a table).- Parameters:
dragOrigin- the point, in the source component's coordinate space, where the drag gesture began- Returns:
- the payload to carry, or
nullto cancel
-
onDragEnd
default void onDragEnd()Called on the EDT after every drag attempt ends — success, failure, or cancellation.The default implementation is a no-op. Override to clear a selection highlight or reset any transient visual state.
-