java.lang.Object
org.snapfx.shortcuts.DockShortcutController
Manages framework shortcut bindings and resolves matching shortcut actions for key events.
This controller is framework-internal implementation detail used by SnapFX
to keep shortcut state and matching logic isolated from facade orchestration code.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a controller with the default shortcut mapping. -
Method Summary
Modifier and TypeMethodDescriptionvoidbindFloatingShortcutScene(DockFloatingWindow floatingWindow, javafx.event.EventHandler<javafx.scene.input.KeyEvent> keyEventFilter) Binds the framework shortcut key filter to the current scene of a floating window.voidclearShortcut(DockShortcutAction action) Removes the key binding for a shortcut action.javafx.scene.control.TabPanefindFirstTabPane(javafx.scene.Node root) Finds the firstTabPanein a depth-first traversal of a node subtree.javafx.scene.control.TabPanefindTabPaneInHierarchy(javafx.scene.Node node) Finds the nearestTabPanewhile traversing parent hierarchy upward.javafx.scene.input.KeyCombinationgetShortcut(DockShortcutAction action) Returns the configured key binding for a shortcut action.Map<DockShortcutAction, javafx.scene.input.KeyCombination> Returns an immutable snapshot of all current shortcut bindings.voidRestores the default framework shortcut mapping.resolveActiveDockNode(Object eventTarget, javafx.scene.Scene fallbackScene, DockElement fallbackRoot) Resolves the activeDockNodefor shortcut actions from event/focus context with root fallback.javafx.scene.control.TabPaneresolveActiveTabPane(Object eventTarget, javafx.scene.Scene fallbackScene, javafx.scene.Node fallbackRoot) Resolves the currently active tab pane from event/focus context and an optional root fallback.javafx.scene.NoderesolveFocusedNode(Object eventTarget, javafx.scene.Scene fallbackScene) Resolves the focused node associated with an event target.javafx.scene.NoderesolveNodeFromEventTarget(Object eventTarget) Resolves a node from an event target object.javafx.scene.SceneresolveSceneFromEventTarget(Object eventTarget) Resolves a scene from an event target object.javafx.scene.SceneresolveSceneFromNode(javafx.scene.Node node) Resolves a scene from a node.resolveShortcutAction(javafx.scene.input.KeyEvent event) Resolves the shortcut action that matches the given key event.booleanselectTabRelative(int direction, Object eventTarget, javafx.scene.Scene fallbackScene, javafx.scene.Node fallbackRoot) Selects the next/previous tab relative to the currently selected tab in the active tab pane.voidsetShortcut(DockShortcutAction action, javafx.scene.input.KeyCombination keyCombination) Assigns or removes a key binding for a built-in shortcut action.voidunbindFloatingShortcutScene(DockFloatingWindow floatingWindow, javafx.event.EventHandler<javafx.scene.input.KeyEvent> keyEventFilter) Removes the framework shortcut key filter binding for a floating window scene.
-
Constructor Details
-
DockShortcutController
public DockShortcutController()Creates a controller with the default shortcut mapping.
-
-
Method Details
-
resetToDefaults
public void resetToDefaults()Restores the default framework shortcut mapping. -
setShortcut
public void setShortcut(DockShortcutAction action, javafx.scene.input.KeyCombination keyCombination) Assigns or removes a key binding for a built-in shortcut action.- Parameters:
action- shortcut action to configurekeyCombination- key combination to assign, ornullto remove the binding
-
clearShortcut
Removes the key binding for a shortcut action.- Parameters:
action- shortcut action to clear
-
getShortcut
Returns the configured key binding for a shortcut action.- Parameters:
action- shortcut action to query- Returns:
- configured key combination, or
null
-
getShortcutsSnapshot
Returns an immutable snapshot of all current shortcut bindings.- Returns:
- immutable snapshot of shortcut bindings
-
resolveShortcutAction
Resolves the shortcut action that matches the given key event.- Parameters:
event- key event to evaluate- Returns:
- matching shortcut action, or
nullwhen no mapping matches
-
bindFloatingShortcutScene
public void bindFloatingShortcutScene(DockFloatingWindow floatingWindow, javafx.event.EventHandler<javafx.scene.input.KeyEvent> keyEventFilter) Binds the framework shortcut key filter to the current scene of a floating window.When the floating window scene changes, this method removes the filter from the previous scene and installs it on the new one.
- Parameters:
floatingWindow- floating window whose scene should receive shortcut handlingkeyEventFilter- key filter used for framework shortcuts
-
unbindFloatingShortcutScene
public void unbindFloatingShortcutScene(DockFloatingWindow floatingWindow, javafx.event.EventHandler<javafx.scene.input.KeyEvent> keyEventFilter) Removes the framework shortcut key filter binding for a floating window scene.- Parameters:
floatingWindow- floating window whose bound scene should be unboundkeyEventFilter- key filter previously installed for framework shortcuts
-
resolveNodeFromEventTarget
Resolves a node from an event target object.- Parameters:
eventTarget- event target object (Node,Scene, or other)- Returns:
- resolved node, or
null
-
resolveFocusedNode
Resolves the focused node associated with an event target.- Parameters:
eventTarget- event target object (Node,Scene, or other)fallbackScene- fallback scene used when target does not provide a focus owner- Returns:
- focused node, or
null
-
resolveSceneFromEventTarget
Resolves a scene from an event target object.- Parameters:
eventTarget- event target object (Scene,Node, or other)- Returns:
- resolved scene, or
null
-
resolveSceneFromNode
public javafx.scene.Scene resolveSceneFromNode(javafx.scene.Node node) Resolves a scene from a node.- Parameters:
node- source node- Returns:
- node scene, or
null
-
resolveActiveTabPane
public javafx.scene.control.TabPane resolveActiveTabPane(Object eventTarget, javafx.scene.Scene fallbackScene, javafx.scene.Node fallbackRoot) Resolves the currently active tab pane from event/focus context and an optional root fallback.- Parameters:
eventTarget- event target object (Node,Scene, or other)fallbackScene- fallback scene used for focus lookupfallbackRoot- fallback root node searched when no target/focus tab pane is found- Returns:
- resolved tab pane, or
null
-
findTabPaneInHierarchy
public javafx.scene.control.TabPane findTabPaneInHierarchy(javafx.scene.Node node) Finds the nearestTabPanewhile traversing parent hierarchy upward.- Parameters:
node- start node- Returns:
- nearest ancestor tab pane, or
null
-
findFirstTabPane
public javafx.scene.control.TabPane findFirstTabPane(javafx.scene.Node root) Finds the firstTabPanein a depth-first traversal of a node subtree.- Parameters:
root- traversal root node- Returns:
- first tab pane found, or
null
-
selectTabRelative
public boolean selectTabRelative(int direction, Object eventTarget, javafx.scene.Scene fallbackScene, javafx.scene.Node fallbackRoot) Selects the next/previous tab relative to the currently selected tab in the active tab pane.- Parameters:
direction- selection direction (+1for next,-1for previous)eventTarget- event target object (Node,Scene, or other)fallbackScene- fallback scene used for focus lookupfallbackRoot- fallback root node searched when no target/focus tab pane is found- Returns:
truewhen a tab selection changed; otherwisefalse
-
resolveActiveDockNode
public DockNode resolveActiveDockNode(Object eventTarget, javafx.scene.Scene fallbackScene, DockElement fallbackRoot) Resolves the activeDockNodefor shortcut actions from event/focus context with root fallback.- Parameters:
eventTarget- event target object (Node,Scene, or other)fallbackScene- fallback scene used for focus lookupfallbackRoot- fallback dock root used when event/focus lookup yields no node- Returns:
- resolved active dock node, or
null
-