java.lang.Object
org.snapfx.floating.DockFloatingController
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 Summary
ConstructorsConstructorDescriptionCreates a floating controller with an empty active-window state. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyFloatingPinSettings(DockFloatingWindow floatingWindow, DockFloatingPinButtonMode pinButtonMode, boolean pinToggleEnabled, DockFloatingPinLockedBehavior pinLockedBehavior) Applies floating-window pin interaction settings.voidapplyFloatingSnapSettings(DockFloatingWindow floatingWindow, boolean snappingEnabled, double snapDistance, Set<DockFloatingSnapTarget> snapTargets, Supplier<List<DockFloatingWindow>> snapPeerWindowsSupplier) Applies floating-window snapping settings.voidapplyFloatingWindowInitialAlwaysOnTop(DockFloatingWindow floatingWindow, Boolean initialValue, boolean defaultFloatingAlwaysOnTop, DockFloatingPinSource source) Applies initial always-on-top state to a floating window.voidapplyRememberedFloatingBounds(DockNode node, DockFloatingWindow floatingWindow) Applies remembered floating bounds and always-on-top state from a node to a floating window.voidclearActiveFloatingWindowIfMatches(DockFloatingWindow floatingWindow) Clears the active floating window when it matches the provided window.findFloatingWindowByScene(List<DockFloatingWindow> floatingWindows, javafx.scene.Scene scene) Finds the floating window that owns a scene.findFloatingWindowContainingNode(List<DockFloatingWindow> floatingWindows, DockNode node) Finds the floating window that currently contains a dock node.findTopFloatingWindowAt(List<DockFloatingWindow> floatingWindows, double screenX, double screenY) Finds the top-most floating window containing the given screen point.booleanisMainDropSuppressedByFloatingWindow(List<DockFloatingWindow> floatingWindows, Double screenX, Double screenY) Returns whether a main-layout drop should be suppressed because the pointer is above a floating window.voidpromoteFloatingWindowToFront(List<DockFloatingWindow> floatingWindows, DockFloatingWindow floatingWindow) Moves a floating window to the end of the ordered list to mark it as top-most in ordering.voidrememberFloatingAlwaysOnTopForNodes(DockFloatingWindow floatingWindow) Propagates the floating window always-on-top state to all hosted nodes.voidrememberFloatingBoundsForNodes(DockFloatingWindow floatingWindow) Captures preferred window bounds and propagates them plus always-on-top state to all hosted nodes for restore workflows.booleanremoveFloatingWindow(List<DockFloatingWindow> floatingWindows, DockFloatingWindow floatingWindow) Removes a floating window from the registry and clears active-window state when needed.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.resolveActivePlacementHost(List<DockFloatingWindow> floatingWindows, DockFloatingWindow hostWindow) Resolves a remembered host floating window only when it is still active in the current window list.voidsetActiveFloatingWindow(DockFloatingWindow floatingWindow) Marks a floating window as active.
-
Constructor Details
-
DockFloatingController
public DockFloatingController()Creates a floating controller with an empty active-window state.
-
-
Method Details
-
setActiveFloatingWindow
Marks a floating window as active.- Parameters:
floatingWindow- active floating window, ornull
-
clearActiveFloatingWindowIfMatches
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 listeventScene- scene derived from the triggering event target, ornullfocusedScene- currently focused scene, ornull- 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 listscene- 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 listnode- 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 listhostWindow- 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 listfloatingWindow- window to remove- Returns:
truewhen 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 listscreenX- screen x-coordinatescreenY- screen y-coordinate- Returns:
truewhen 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 listscreenX- screen x-coordinatescreenY- 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 listfloatingWindow- window to promote
-
applyRememberedFloatingBounds
Applies remembered floating bounds and always-on-top state from a node to a floating window.- Parameters:
node- node that stores remembered floating statefloatingWindow- target floating window
-
rememberFloatingBoundsForNodes
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
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 windowpinButtonMode- pin-button visibility modepinToggleEnabled- whether users may toggle always-on-toppinLockedBehavior- 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 windowsnappingEnabled- whether snapping is enabledsnapDistance- snapping distance in pixelssnapTargets- active snap targetssnapPeerWindowsSupplier- 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 windowinitialValue- explicit initial value, ornulldefaultFloatingAlwaysOnTop- default value used when explicit value isnullsource- source of the initial pin state
-