Skip to content

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.

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.

ReturnsSignatureSummary
booleancanHandle(UI ui) defaultIf true, the bridge accepts to open the UI; it asks canHandle(Class) with the class of the UI by default.
doublegetInterfaceScale(UI ui) defaultReturns a factor that JOID applies on top of the canvas scaling of the UI, read every frame; 1D by default.
ReturnsSignatureSummary
voidforceOpen(UI ui) defaultCloses every UI of the bridge with closeAll(), then opens the UI.
voidreplace(UI ui, UI replacement) defaultDisposes 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.
voidcloseAll() defaultDisposes 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.
ReturnsSignatureSummary
voidopen(UI ui) abstractJOID calls it on the render thread from JOID.open(ui), on the bridge chosen for the UI.
voidclose(UI ui) abstractJOID 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.
voidadd(UI ui) abstractAdds the UI to the bridge without closing anything.
voidremove(UI ui) abstractRemoves the UI from the bridge, without any close listener.
booleanisOpen(UI ui) abstractIf true, the bridge holds the UI.
booleanisOnTop(UI ui) abstractIf true, the UI is the first of its kind to receive the input: screens and popups on one side, overlays on the other.
booleancanHandle(Class<? extends UI> clazz) abstractIf 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() abstractReturns the UIs that the bridge holds, sorted by zindex, then by opening order.
voiddrawHover(UI ui, Object content, double mouseX, double mouseY) abstractJOID 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.

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.

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.

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. 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.

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.

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. 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

Report a problem with this page