java.lang.Object
org.snapfx.dnd.DockDragService
Central service for drag & drop operations.
Manages the drag state and coordinates visual feedback.
-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.ObjectProperty<DockDragData> Returns the observable drag-data property. -
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordImmutable callback payload emitted while drag hover coordinates update.static final recordImmutable callback payload used for accepted dock-drop requests.static final recordImmutable callback payload used for float-detach requests. -
Constructor Summary
ConstructorsConstructorDescriptionDockDragService(DockGraph dockGraph) Creates a drag service bound to one dock graph. -
Method Summary
Modifier and TypeMethodDescriptionvoidCancels the drag operation.javafx.beans.property.ObjectProperty<DockDragData> Returns the observable drag-data property.voidendDrag(javafx.scene.input.MouseEvent event) Ends the drag operation and performs the dock operation.Returns the current drag data snapshot.Returns the current drop-zone visualization mode.voidinitialize(javafx.stage.Stage stage) Initializes the service with the primary stage.booleanReturns whether a drag operation is currently active.voidSets the drop-zone visualization mode.voidsetLayoutEngine(DockLayoutEngine layoutEngine) Sets the layout engine used for hit-testing and drop-zone collection.voidsetOnDragFinished(Runnable onDragFinished) Sets a callback invoked after drag completion or cancellation.voidsetOnDragHover(Consumer<DockDragService.DragHoverEvent> onDragHover) Sets the callback invoked while pointer hover updates during drag.voidsetOnDropRequest(Consumer<DockDragService.DropRequest> onDropRequest) Sets the callback for resolved drop requests.voidsetOnFloatDetachRequest(Consumer<DockDragService.FloatDetachRequest> onFloatDetachRequest) Sets the callback for unresolved drop requests that should detach to floating windows.voidsetSuppressMainDropAtScreenPoint(BiPredicate<Double, Double> suppressMainDropAtScreenPoint) Sets an optional predicate that can suppress main-scene drop handling for given screen coordinates.voidPrepares for a potential drag operation (called on mouse press).voidupdateDrag(javafx.scene.input.MouseEvent event) Updates the drag position (called on mouse drag).
-
Property Details
-
currentDrag
Returns the observable drag-data property.- See Also:
-
-
Constructor Details
-
DockDragService
Creates a drag service bound to one dock graph.- Parameters:
dockGraph- dock graph updated by drag/drop operations
-
-
Method Details
-
initialize
public void initialize(javafx.stage.Stage stage) Initializes the service with the primary stage.- Parameters:
stage- primary stage hosting the main dock scene
-
startDrag
Prepares for a potential drag operation (called on mouse press). Actual dragging starts only after threshold is exceeded.- Parameters:
node- node that should be draggedevent- source mouse-press event
-
updateDrag
public void updateDrag(javafx.scene.input.MouseEvent event) Updates the drag position (called on mouse drag). Activates drag only after threshold is exceeded.- Parameters:
event- source drag event
-
endDrag
public void endDrag(javafx.scene.input.MouseEvent event) Ends the drag operation and performs the dock operation.- Parameters:
event- source mouse-release event, may benullfor programmatic endings
-
cancelDrag
public void cancelDrag()Cancels the drag operation. -
isDragging
public boolean isDragging()Returns whether a drag operation is currently active.- Returns:
truewhen drag data is currently tracked
-
getCurrentDrag
Returns the current drag data snapshot.- Returns:
- current drag data, or
nullwhen not dragging
-
setLayoutEngine
Sets the layout engine used for hit-testing and drop-zone collection.- Parameters:
layoutEngine- layout engine bound to the active dock scene
-
setOnFloatDetachRequest
public void setOnFloatDetachRequest(Consumer<DockDragService.FloatDetachRequest> onFloatDetachRequest) Sets the callback for unresolved drop requests that should detach to floating windows.- Parameters:
onFloatDetachRequest- detach callback, ornull
-
setOnDropRequest
Sets the callback for resolved drop requests.- Parameters:
onDropRequest- drop callback, ornull
-
setOnDragHover
Sets the callback invoked while pointer hover updates during drag.- Parameters:
onDragHover- hover callback, ornull
-
setOnDragFinished
Sets a callback invoked after drag completion or cancellation.- Parameters:
onDragFinished- completion callback, ornull
-
setSuppressMainDropAtScreenPoint
public void setSuppressMainDropAtScreenPoint(BiPredicate<Double, Double> suppressMainDropAtScreenPoint) Sets an optional predicate that can suppress main-scene drop handling for given screen coordinates.- Parameters:
suppressMainDropAtScreenPoint- suppression predicate, ornull
-
currentDragProperty
Returns the observable drag-data property.- Returns:
- property that mirrors current drag lifecycle
- See Also:
-
getDropVisualizationMode
Returns the current drop-zone visualization mode.- Returns:
- active visualization mode
-
setDropVisualizationMode
Sets the drop-zone visualization mode.- Parameters:
mode- visualization mode, ignored whennull
-