OpenFin

Java Adapter

API Docs Maven

The Java API provides much of the same functionality as the JavaScript API. For example, creating, wrapping and/or controlling applications/windows. It can listen/react to changes/events via addEventListener and also send/receive messages over the InterApplicationBus.

Please include your licenseKey in RuntimeConfiguration.setLicenseKey when launching apps from the Java Adapter. If you’re interested in an Enterprise license, please contact us for one here.

Overview

All classes are defined in the Openfin.Desktop namespace.

The DesktopConnection class encapsulates a Java websocket connection with the OpenFin Desktop and is responsible for maintaining the lifetime of that connection, dispatching event listeners, invoking callbacks, and sending messages from Java to the desktop.

/**
* Creates a new connection to Runtime
*
* @param uuid unique ID for Runtime to refer to this DesktopConnection
* @throws DesktopException if this method fails to create a connection
*/
public DesktopConnection(String uuid) throws DesktopException

Every DesktopConnection must be provided a UUID upon construction. This identifies the connection and can be communicated with using the InterApplicationBus.

The desktop can be launched and connected to by calling DesktopConnection.connect.

/**
* Connect to Runtime with the specified configuration.  If the specified version is not running, this method will try to start it.
*
* @param configuration an instance of RuntimeConfiguration
* @param listener Receives updates on startup and connection state
* @param timeout number of seconds to wait for connection. If connection to Runtime is not established by the timeout the listener will get an onError() call
* @throws DesktopIOException if this method fails to connect to Runtime
* @throws IOException if IO exception is thrown during launching Runtime
* @see RuntimeConfiguration
*/
public void connect(final RuntimeConfiguration configuration, final DesktopStateListener listener, final int timeout) throws DesktopIOException, IOException {

Typically, your application would inherit from DesktopStateListener and handle further initialization inside of onReady(). Please note that DesktopStateListener methods are invoked on the same thread as DesktopConnection’s web socket.

More examples are available from here.

Have questions? Get in touch with us at support@openfin.co.

Java Adapter


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.