IUIBridge
interface IUIBridge
Extends: IBridge
Known subtypes: UIBridge
Package: dev.joid.lib.bridge.ui · Module: core · Source: IUIBridge.java
The contract of a UI bridge, the place where JOID opens, holds and closes the UIs of one surface.
Description
Section titled “Description”JOID.open asks UIBridgeRegistry.get for a bridge and opens the UI there; the UI stays in that bridge until it closes.
A bridge registered in BridgeHandler.UI extends UIBridge, which implements this interface.
Add a UI bridge of your own writes one that takes the panels of the application only.
Learn more
Section titled “Learn more”Methods
Section titled “Methods”Queries
Section titled “Queries”| Returns | Signature | Summary |
|---|---|---|
boolean | canHandle(UI ui) default | If true, the bridge accepts to open the UI; it asks canHandle(Class) with the class of the UI by default. |
double | getInterfaceScale(UI ui) default | Returns a factor that JOID applies on top of the canvas scaling of the UI, read every frame; 1D by default. |
Actions
Section titled “Actions”| Returns | Signature | Summary |
|---|---|---|
void | forceOpen(UI ui) default | Closes every UI of the bridge with closeAll(), then opens the UI. |
void | replace(UI ui, UI replacement) default | Disposes the first UI (its onClose listeners and the onDetach listeners of its nodes run, its stores and remembered fields are saved), removes it and adds the second, without transition and without beforeClose. |
void | closeAll() default | Disposes and removes every UI of the bridge: their onClose listeners (never beforeClose) and the onDetach listeners of their nodes run, and their stores and remembered fields are saved. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
void | open(UI ui) abstract | JOID calls it on the render thread from JOID.open(ui), on the bridge chosen for the UI. |
void | close(UI ui) abstract | JOID calls it on the render thread from JOID.close(ui) once the close listeners accepted, from JOID.forceClose(ui), and when Escape closes a UI. |
void | add(UI ui) abstract | Adds the UI to the bridge without closing anything. |
void | remove(UI ui) abstract | Removes the UI from the bridge, without any close listener. |
boolean | isOpen(UI ui) abstract | If true, the bridge holds the UI. |
boolean | isOnTop(UI ui) abstract | If true, the UI is the first of its kind to receive the input: screens and popups on one side, overlays on the other. |
boolean | canHandle(Class<? extends UI> clazz) abstract | If true, the bridge accepts the UIs of that class; it answers from the class alone, so that lookups without an instance give the same answer. |
List<UI> | getUiList() abstract | Returns the UIs that the bridge holds, sorted by zindex, then by opening order. |
void | drawHover(UI ui, Object content, double mouseX, double mouseY) abstract | JOID calls it while the pointer rests on a node that has a text tooltip, with the content and the pointer position in design pixels of the UI. |
Method details
Section titled “Method details”canHandle
Section titled “canHandle”boolean canHandle(UI ui) default
If true, the bridge accepts to open the UI; it asks canHandle(Class) with the class of the UI by default.
boolean canHandle(Class<? extends UI> clazz) abstract
If true, the bridge accepts the UIs of that class; it answers from the class alone, so that lookups without an instance give the same answer.
getInterfaceScale
Section titled “getInterfaceScale”double getInterfaceScale(UI ui) default
Returns a factor that JOID applies on top of the canvas scaling of the UI, read every frame; 1D by default.
See interface scale.
forceOpen
Section titled “forceOpen”void forceOpen(UI ui) default
Closes every UI of the bridge with closeAll(), then opens the UI.
replace
Section titled “replace”void replace(UI ui, UI replacement) default
Disposes the first UI (its onClose listeners and the onDetach listeners of its nodes run, its stores and remembered fields are saved), removes it and adds the second, without transition and without beforeClose.
closeAll
Section titled “closeAll”void closeAll() default
Disposes and removes every UI of the bridge: their onClose listeners (never beforeClose) and the onDetach listeners of their nodes run, and their stores and remembered fields are saved.
Call it after your loop: Close the UIs before the program ends.
void open(UI ui) abstract
JOID calls it on the render thread from JOID.open(ui), on the bridge chosen for the UI.
It decides what the UI replaces, then adds it.
void close(UI ui) abstract
JOID calls it on the render thread from JOID.close(ui) once the close listeners accepted, from JOID.forceClose(ui), and when Escape closes a UI.
It removes the UI from the bridge.
void add(UI ui) abstract
Adds the UI to the bridge without closing anything.
remove
Section titled “remove”void remove(UI ui) abstract
Removes the UI from the bridge, without any close listener.
isOpen
Section titled “isOpen”boolean isOpen(UI ui) abstract
If true, the bridge holds the UI.
isOnTop
Section titled “isOnTop”boolean isOnTop(UI ui) abstract
If true, the UI is the first of its kind to receive the input: screens and popups on one side, overlays on the other.
getUiList
Section titled “getUiList”List<UI> getUiList() abstract
Returns the UIs that the bridge holds, sorted by zindex, then by opening order.
drawHover
Section titled “drawHover”void drawHover(UI ui, Object content, double mouseX, double mouseY) abstract
JOID calls it while the pointer rests on a node that has a text tooltip, with the content and the pointer position in design pixels of the UI. It draws the tooltip.
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
