Module org.snapfx

Class DockDragService

java.lang.Object
org.snapfx.dnd.DockDragService

public class DockDragService extends Object
Central service for drag & drop operations. Manages the drag state and coordinates visual feedback.
  • Property Details

  • Constructor Details

    • DockDragService

      public DockDragService(DockGraph dockGraph)
      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

      public void startDrag(DockNode node, javafx.scene.input.MouseEvent event)
      Prepares for a potential drag operation (called on mouse press). Actual dragging starts only after threshold is exceeded.
      Parameters:
      node - node that should be dragged
      event - 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 be null for programmatic endings
    • cancelDrag

      public void cancelDrag()
      Cancels the drag operation.
    • isDragging

      public boolean isDragging()
      Returns whether a drag operation is currently active.
      Returns:
      true when drag data is currently tracked
    • getCurrentDrag

      public DockDragData getCurrentDrag()
      Returns the current drag data snapshot.
      Returns:
      current drag data, or null when not dragging
    • setLayoutEngine

      public void setLayoutEngine(DockLayoutEngine layoutEngine)
      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, or null
    • setOnDropRequest

      public void setOnDropRequest(Consumer<DockDragService.DropRequest> onDropRequest)
      Sets the callback for resolved drop requests.
      Parameters:
      onDropRequest - drop callback, or null
    • setOnDragHover

      public void setOnDragHover(Consumer<DockDragService.DragHoverEvent> onDragHover)
      Sets the callback invoked while pointer hover updates during drag.
      Parameters:
      onDragHover - hover callback, or null
    • setOnDragFinished

      public void setOnDragFinished(Runnable onDragFinished)
      Sets a callback invoked after drag completion or cancellation.
      Parameters:
      onDragFinished - completion callback, or null
    • 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, or null
    • currentDragProperty

      public javafx.beans.property.ObjectProperty<DockDragData> currentDragProperty()
      Returns the observable drag-data property.
      Returns:
      property that mirrors current drag lifecycle
      See Also:
    • getDropVisualizationMode

      public DockDropVisualizationMode getDropVisualizationMode()
      Returns the current drop-zone visualization mode.
      Returns:
      active visualization mode
    • setDropVisualizationMode

      public void setDropVisualizationMode(DockDropVisualizationMode mode)
      Sets the drop-zone visualization mode.
      Parameters:
      mode - visualization mode, ignored when null