Module org.snapfx

Class DockFloatingController

java.lang.Object
org.snapfx.floating.DockFloatingController

public final class DockFloatingController extends Object
Manages floating-window interaction helpers and active-floating-window state for SnapFX.

This controller keeps the currently active floating window and provides reusable lookup/state helpers (for example, by scene ownership, contained dock node, hit testing, list-order promotion, and remembered floating bounds propagation), so those concerns are isolated from facade orchestration code.

  • Constructor Details

    • DockFloatingController

      public DockFloatingController()
      Creates a floating controller with an empty active-window state.
  • Method Details

    • setActiveFloatingWindow

      public void setActiveFloatingWindow(DockFloatingWindow floatingWindow)
      Marks a floating window as active.
      Parameters:
      floatingWindow - active floating window, or null
    • clearActiveFloatingWindowIfMatches

      public void clearActiveFloatingWindowIfMatches(DockFloatingWindow floatingWindow)
      Clears the active floating window when it matches the provided window.
      Parameters:
      floatingWindow - window to clear if currently active
    • resolveActiveFloatingWindow

      public DockFloatingWindow resolveActiveFloatingWindow(List<DockFloatingWindow> floatingWindows, javafx.scene.Scene eventScene, javafx.scene.Scene focusedScene)
      Resolves the active floating window using event/focus scenes, current active-window state, and fallback-to-last-window behavior.
      Parameters:
      floatingWindows - current floating-window list
      eventScene - scene derived from the triggering event target, or null
      focusedScene - currently focused scene, or null
      Returns:
      resolved active floating window, or null
    • findFloatingWindowByScene

      public DockFloatingWindow findFloatingWindowByScene(List<DockFloatingWindow> floatingWindows, javafx.scene.Scene scene)
      Finds the floating window that owns a scene.
      Parameters:
      floatingWindows - current floating-window list
      scene - scene to match
      Returns:
      owning floating window, or null
    • findFloatingWindowContainingNode

      public DockFloatingWindow findFloatingWindowContainingNode(List<DockFloatingWindow> floatingWindows, DockNode node)
      Finds the floating window that currently contains a dock node.
      Parameters:
      floatingWindows - current floating-window list
      node - dock node to locate
      Returns:
      containing floating window, or null
    • resolveActivePlacementHost

      public DockFloatingWindow resolveActivePlacementHost(List<DockFloatingWindow> floatingWindows, DockFloatingWindow hostWindow)
      Resolves a remembered host floating window only when it is still active in the current window list.
      Parameters:
      floatingWindows - current floating-window list
      hostWindow - remembered host window candidate
      Returns:
      active host window, or null
    • removeFloatingWindow

      public boolean removeFloatingWindow(List<DockFloatingWindow> floatingWindows, DockFloatingWindow floatingWindow)
      Removes a floating window from the registry and clears active-window state when needed.
      Parameters:
      floatingWindows - current floating-window list
      floatingWindow - window to remove
      Returns:
      true when a window was removed
    • isMainDropSuppressedByFloatingWindow

      public boolean isMainDropSuppressedByFloatingWindow(List<DockFloatingWindow> floatingWindows, Double screenX, Double screenY)
      Returns whether a main-layout drop should be suppressed because the pointer is above a floating window.
      Parameters:
      floatingWindows - current floating-window list
      screenX - screen x-coordinate
      screenY - screen y-coordinate
      Returns:
      true when a floating window is hit at the screen point
    • findTopFloatingWindowAt

      public DockFloatingWindow findTopFloatingWindowAt(List<DockFloatingWindow> floatingWindows, double screenX, double screenY)
      Finds the top-most floating window containing the given screen point.
      Parameters:
      floatingWindows - current floating-window list
      screenX - screen x-coordinate
      screenY - screen y-coordinate
      Returns:
      top-most hit floating window, or null
    • promoteFloatingWindowToFront

      public void promoteFloatingWindowToFront(List<DockFloatingWindow> floatingWindows, DockFloatingWindow floatingWindow)
      Moves a floating window to the end of the ordered list to mark it as top-most in ordering.
      Parameters:
      floatingWindows - current floating-window list
      floatingWindow - window to promote
    • applyRememberedFloatingBounds

      public void applyRememberedFloatingBounds(DockNode node, DockFloatingWindow floatingWindow)
      Applies remembered floating bounds and always-on-top state from a node to a floating window.
      Parameters:
      node - node that stores remembered floating state
      floatingWindow - target floating window
    • rememberFloatingBoundsForNodes

      public void rememberFloatingBoundsForNodes(DockFloatingWindow floatingWindow)
      Captures preferred window bounds and propagates them plus always-on-top state to all hosted nodes for restore workflows.
      Parameters:
      floatingWindow - source floating window
    • rememberFloatingAlwaysOnTopForNodes

      public void rememberFloatingAlwaysOnTopForNodes(DockFloatingWindow floatingWindow)
      Propagates the floating window always-on-top state to all hosted nodes.
      Parameters:
      floatingWindow - source floating window
    • applyFloatingPinSettings

      public void applyFloatingPinSettings(DockFloatingWindow floatingWindow, DockFloatingPinButtonMode pinButtonMode, boolean pinToggleEnabled, DockFloatingPinLockedBehavior pinLockedBehavior)
      Applies floating-window pin interaction settings.
      Parameters:
      floatingWindow - target floating window
      pinButtonMode - pin-button visibility mode
      pinToggleEnabled - whether users may toggle always-on-top
      pinLockedBehavior - locked-mode pin behavior
    • applyFloatingSnapSettings

      public void applyFloatingSnapSettings(DockFloatingWindow floatingWindow, boolean snappingEnabled, double snapDistance, Set<DockFloatingSnapTarget> snapTargets, Supplier<List<DockFloatingWindow>> snapPeerWindowsSupplier)
      Applies floating-window snapping settings.
      Parameters:
      floatingWindow - target floating window
      snappingEnabled - whether snapping is enabled
      snapDistance - snapping distance in pixels
      snapTargets - active snap targets
      snapPeerWindowsSupplier - supplier for peer floating windows used as snap candidates
    • applyFloatingWindowInitialAlwaysOnTop

      public void applyFloatingWindowInitialAlwaysOnTop(DockFloatingWindow floatingWindow, Boolean initialValue, boolean defaultFloatingAlwaysOnTop, DockFloatingPinSource source)
      Applies initial always-on-top state to a floating window.
      Parameters:
      floatingWindow - target floating window
      initialValue - explicit initial value, or null
      defaultFloatingAlwaysOnTop - default value used when explicit value is null
      source - source of the initial pin state