UIBridgeRegistry
final class UIBridgeRegistry
Extends: BridgeRegistry<UIBridge>
Package: dev.joid.lib.bridge.ui · Module: core · Source: UIBridgeRegistry.java
The registry of UI bridges, which runs the frame of each one and routes the input between them.
Description
Section titled “Description”BridgeHandler.UI is the only instance.
Backend.frame calls frame(), and the input forwarders of the backends call the input methods; you call them yourself only when you forward the input of a host by hand.
Each input method returns true when JOID consumed the event, which should then not reach the rest of your application.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| UIBridgeRegistry() | Creates an empty registry; JOID creates the one of BridgeHandler.UI. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
boolean | mouseMoved() | Sends a mouse move to the bridges from the highest priority down, until one consumes it. |
boolean | mousePressed(MouseButton button) | Sends a press to the bridges from the highest priority down, until one consumes it, and remembers the bridges that received it. |
boolean | mouseReleased(MouseButton button) | Sends the release to every bridge that received the press of that button; returns true when one of them consumed the press. |
boolean | mouseScroll(double notchesX, double notchesY) | Sends a scroll, in wheel notches, to the bridges from the highest priority down, until one consumes it. |
boolean | charTyped(int codepoint) | Sends a typed Unicode code point to the bridges from the highest priority down, until one consumes it. |
boolean | keyPressed(Key physicalKey, Key key) | Records the press in the key state, with the physical key and the key of the layout, then sends it to the bridges from the highest priority down, until one consumes it. |
boolean | keyReleased(Key physicalKey) | Records the release in the key state and sends it to every bridge; returns true when the press of that key was consumed, so that the host hides its release too. |
boolean | isKeyConsumed(Key physicalKey) | If true, a bridge consumed the last press of that physical key. |
KeyState | getKeyState() | Returns the state of the held keys, which Key.isDown reads for the keys that depend on the layout. |
Queries
Section titled “Queries”| Returns | Signature | Summary |
|---|---|---|
IUIBridge | get(UI ui) | Returns the bridge that holds the UI when it is open, otherwise the bridge of highest priority that can handle it, or null. |
IUIBridge | get(Class<? extends UI> clazz) | Returns the bridge of highest priority that can handle UIs of that class, or null. |
Actions
Section titled “Actions”| Returns | Signature | Summary |
|---|---|---|
void | frame() | Runs one frame: when the window size changed and is not zero, it resizes the screen and lays every UI out again; then it runs fireFrame(), updates every bridge, begins the frame of the render bridge, lets the bridge of lowest priority draw the background, draws every bridge from the lowest priority to the highest, and ends the frame. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
void | fireFrame() | Runs the tasks queued by other threads on every FrameThreadBridge, then the tasks given to onFrame; frame() calls it. |
Inherited from BridgeRegistry (5)
register · unregister · getBridge · find · getBridgeList
Events
Section titled “Events”| Event | Listener | Summary |
|---|---|---|
| onFrame | Runnable | Adds a task that runs at the start of every frame, after the tasks of other threads and before the UIs update. |
Creation details
Section titled “Creation details”UIBridgeRegistry
Section titled “UIBridgeRegistry”UIBridgeRegistry()
Creates an empty registry; JOID creates the one of BridgeHandler.UI.
Method details
Section titled “Method details”mouseMoved
Section titled “mouseMoved”boolean mouseMoved()
Sends a mouse move to the bridges from the highest priority down, until one consumes it.
mousePressed
Section titled “mousePressed”boolean mousePressed(MouseButton button)
Sends a press to the bridges from the highest priority down, until one consumes it, and remembers the bridges that received it.
mouseReleased
Section titled “mouseReleased”boolean mouseReleased(MouseButton button)
Sends the release to every bridge that received the press of that button; returns true when one of them consumed the press.
mouseScroll
Section titled “mouseScroll”boolean mouseScroll(double notchesX, double notchesY)
Sends a scroll, in wheel notches, to the bridges from the highest priority down, until one consumes it.
charTyped
Section titled “charTyped”boolean charTyped(int codepoint)
Sends a typed Unicode code point to the bridges from the highest priority down, until one consumes it.
keyPressed
Section titled “keyPressed”boolean keyPressed(Key physicalKey, Key key)
Records the press in the key state, with the physical key and the key of the layout, then sends it to the bridges from the highest priority down, until one consumes it. Key repeats come from JOID itself: send only the first press.
keyReleased
Section titled “keyReleased”boolean keyReleased(Key physicalKey)
Records the release in the key state and sends it to every bridge; returns true when the press of that key was consumed, so that the host hides its release too.
isKeyConsumed
Section titled “isKeyConsumed”boolean isKeyConsumed(Key physicalKey)
If true, a bridge consumed the last press of that physical key.
getKeyState
Section titled “getKeyState”KeyState getKeyState()
Returns the state of the held keys, which Key.isDown reads for the keys that depend on the layout.
IUIBridge get(UI ui)
Returns the bridge that holds the UI when it is open, otherwise the bridge of highest priority that can handle it, or null.
IUIBridge get(Class<? extends UI> clazz)
Returns the bridge of highest priority that can handle UIs of that class, or null.
void frame()
Runs one frame: when the window size changed and is not zero, it resizes the screen and lays every UI out again; then it runs fireFrame(), updates every bridge, begins the frame of the render bridge, lets the bridge of lowest priority draw the background, draws every bridge from the lowest priority to the highest, and ends the frame.
fireFrame
Section titled “fireFrame”void fireFrame()
Runs the tasks queued by other threads on every FrameThreadBridge, then the tasks given to onFrame; frame() calls it.
Event details
Section titled “Event details”onFrame
Section titled “onFrame”this onFrame(Runnable task) fluent
Adds a task that runs at the start of every frame, after the tasks of other threads and before the UIs update.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
