Skip to content

JOID

final class JOID
Package: dev.joid.lib · Module: core · Source: JOID.java

Entry point that opens and closes UIs, finds the open ones and runs code once JOID has loaded.

JOID holds static methods only, apart from inst().load() that the backend calls. open, close, forceOpen and forceClose can be called from any thread: off the render thread, JOID runs them at the next frame.

ReturnsSignatureSummary
JOIDinst() factoryThe single instance of JOID.

ReturnsSignatureSummary
thisload() fluentLoads JOID once: prints the version, the mode and the data and cache folders, cleans the cache in the background, loads the fonts of the dev tools in dev mode, installs the hook that closes the open UIs and saves the stores when the JVM stops, then runs the onReady listeners.
voidonReady(Runnable callback) staticRuns the listener on the render thread once JOID has loaded; when it has already loaded, at once on the render thread, or at the start of the next frame from another thread.
voidcheckVersion(String version) staticThrows an IllegalStateException when this version has another major number than the loaded core.
StringreadVersion(Class<?> owner, String resource) staticReads the version property of a properties file found next to this class, or development when the file or the property is missing.
booleanisOpen(UI ui) staticIf true, this UI is open in a UI bridge.
booleanisOpen(Class<? extends UI> uiClass) staticIf true, a UI of this class (or of a subclass) is open in any UI bridge.
TgetUi(Class uiClass) staticThe first open UI of this class or of a subclass, searched in every UI bridge from the highest priority down, or null when none is open.
IUIBridgeopen(UI ui) staticOpens the UI in the UI bridge that already holds it, otherwise in the bridge of highest priority whose canHandle accepts it, and returns that bridge.
voidclose(UI ui) staticCloses the UI: the beforeClose listeners can refuse, then the closing transition plays.
IUIBridgeforceOpen(UI ui) staticCloses every UI of the bridge that accepts this one, without asking them and without transition, then opens it; returns that bridge.
voidforceClose(UI ui) staticCloses the UI at once, without asking the beforeClose listeners and without its closing transition.
booleanisReady()If true, load() has finished; another thread sees it at once.
TypeNameValueSummary
StringVERSIONJOID.readVersion(JOID.class, "joid.properties")Version of the JOID core on the classpath, read from its jar; development when the classes do not come from a released jar.

JOID inst() factory

The single instance of JOID.

this load() fluent

Thread: runs on the render thread.

Loads JOID once: prints the version, the mode and the data and cache folders, cleans the cache in the background, loads the fonts of the dev tools in dev mode, installs the hook that closes the open UIs and saves the stores when the JVM stops, then runs the onReady listeners. Backend calls it at the end of register(); a second call does nothing.

void onReady(Runnable callback) static

Thread: runs on the render thread.

Runs the listener on the render thread once JOID has loaded; when it has already loaded, at once on the render thread, or at the start of the next frame from another thread. A listener given before JOID has loaded that throws prints a warning and does not stop the next ones; once JOID has loaded, the exception reaches a caller on the render thread, and a call from another thread prints the warning of a failed render-thread task.

void checkVersion(String version) static

Throws an IllegalStateException when this version has another major number than the loaded core. A backend calls it with the version it was built for; a development version on either side always passes.

String readVersion(Class<?> owner, String resource) static

Reads the version property of a properties file found next to this class, or development when the file or the property is missing.

boolean isOpen(UI ui) static

If true, this UI is open in a UI bridge.

boolean isOpen(Class<? extends UI> uiClass) static

If true, a UI of this class (or of a subclass) is open in any UI bridge.

<T extends UI> T getUi(Class<T> uiClass) static

The first open UI of this class or of a subclass, searched in every UI bridge from the highest priority down, or null when none is open.

IUIBridge open(UI ui) static

Thread: runs on the render thread.

Opens the UI in the UI bridge that already holds it, otherwise in the bridge of highest priority whose canHandle accepts it, and returns that bridge. A screen replaces the open screens, a popup or an overlay opens above them, and a UI already open moves to the top. Throws an IllegalStateException when no registered bridge accepts the UI.

void close(UI ui) static

Thread: runs on the render thread.

Closes the UI: the beforeClose listeners can refuse, then the closing transition plays. A UI that is not open is only removed from its bridge.

IUIBridge forceOpen(UI ui) static

Thread: runs on the render thread.

Closes every UI of the bridge that accepts this one, without asking them and without transition, then opens it; returns that bridge. Throws an IllegalStateException when no registered bridge accepts the UI.

void forceClose(UI ui) static

Thread: runs on the render thread.

Closes the UI at once, without asking the beforeClose listeners and without its closing transition.

boolean isReady()

If true, load() has finished; another thread sees it at once.

String VERSION

Version of the JOID core on the classpath, read from its jar; development when the classes do not come from a released jar.


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