public class Application extends Object
Constructor and Description |
---|
Application(ApplicationOptions options,
DesktopConnection connection,
AckListener listener)
Application Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(String type,
EventListener listener,
AckListener callback)
Registers an event listener on the specified event.
|
void |
close()
Closes the application and any child windows created by the application
|
void |
close(Boolean force,
AckListener listener)
Closes the application with a listener that gets called if the method succeeds
|
static CompletableFuture<Application> |
createApplication(ApplicationOptions options,
DesktopConnection connection) |
void |
createChildWindow(WindowOptions windowOptions,
AckListener callback)
Create a child window of this application
|
static void |
createFromManifest(String manifestUrl,
AsyncCallback<Application> callback,
AckListener listener,
DesktopConnection connection)
Deprecated.
use launchManifest() instead.
|
static CompletableFuture<Application> |
createFromManifestAsync(String manifestUrl,
DesktopConnection connection)
Deprecated.
use launchManifest() instead.
|
CompletableFuture<List<Window>> |
getChildWindows() |
void |
getChildWindows(AsyncCallback<List<Window>> callback,
AckListener listener)
Retrieves an list of wrapped fin.desktop.Windows for each of the
application’s child windows
|
DesktopConnection |
getConnection()
Returns the applications connection object
|
void |
getGroups(AsyncCallback<List<List<Window>>> groupHandler,
AckListener callback)
Retrieves an array of active window groups for all of the application's windows.
|
void |
getInfo(AsyncCallback<org.json.JSONObject> callback,
AckListener listener)
Retrieves information about the application.
|
void |
getManifest(AckListener listener)
Retrieves the JSON manifest that was used to create the application.
|
ApplicationOptions |
getOptions()
Get the ApplicationOptions object for the application
|
void |
getParentUuid(AsyncCallback<String> callback,
AckListener listener)
Retrieves UUID of the application that launches this application.
|
void |
getTrayIconInfo(AsyncCallback<org.json.JSONObject> callback,
AckListener listener)
Retrieves information about the custom icon the application previously set in the system tray via setTrayIcon().
|
String |
getUuid()
Get UUID of this Application
|
Window |
getWindow()
Returns an instance to the main Window of the application.
|
void |
isRunning(AsyncCallback<Boolean> callback,
AckListener listener)
Determines if the application is currently running.
|
void |
registerUser(String username,
String appName,
AckListener listener)
Manually registers a user with the licensing service.
|
void |
removeEventListener(String type,
EventListener listener,
AckListener callback)
Removes a previously registered event listener from the specified event
|
void |
removeTrayIcon(AckListener callback)
Removes the application’s icon from the tray.
|
void |
restart()
Restarts the application
|
void |
restart(AckListener listener)
Restarts the application with a listener that gets called if the method succeeds
|
void |
run()
Runs the application
|
void |
run(AckListener listener)
Runs the application with a listener that gets called if the method succeeds
|
CompletableFuture<Application> |
runAsync() |
void |
setTrayIcon(String iconUrl,
EventListener listener,
AckListener callback)
Adds a customizable icon in the system tray and notifies the application when clicked
|
void |
terminate()
Closes the application by terminating its process.
|
void |
terminate(AckListener listener)
Closes the application by terminating its process.
|
void |
waitFor()
Waits for a hanging application.
|
void |
waitFor(AckListener listener)
Waits for a hanging application.
|
static Application |
wrap(String uuid,
DesktopConnection connection)
Attaches an Application object to an application that already exists
|
Window |
wrapWindow(String name)
Wraps an existing window using the specified name
|
public Application(ApplicationOptions options, DesktopConnection connection, AckListener listener)
options
- Settings of the applicationconnection
- Connection object to the AppDesktop.listener
- function that is called if the method succeeds.ApplicationOptions
,
DesktopConnection
,
AckListener
public static Application wrap(String uuid, DesktopConnection connection)
uuid
- The UUID of the Application to wrapconnection
- Connection object to the AppDesktopDesktopConnection
public static CompletableFuture<Application> createApplication(ApplicationOptions options, DesktopConnection connection)
public void run() throws DesktopException
DesktopException
- if application fails to runDesktopException
public CompletableFuture<Application> runAsync()
public void run(AckListener listener)
listener
- The listener that gets called if the method succeedsAckListener
public void restart() throws DesktopException
DesktopException
- if application fails to restartDesktopException
public void restart(AckListener listener)
listener
- The listener that gets called if the method succeedsAckListener
public void close() throws DesktopException
DesktopException
- if application fails to closeDesktopException
public void close(Boolean force, AckListener listener) throws DesktopException
force
- When true the close can not be prevented through the window event 'close-requested'. If force is false, AckListener is being ignoredlistener
- The listener that gets called if the method succeedsDesktopException
- if application fails to closeAckListener
public void terminate() throws DesktopException
DesktopException
- if application fails to terminateDesktopException
public void terminate(AckListener listener)
listener
- The listener that gets called if the method succeedsAckListener
public void waitFor() throws DesktopException
DesktopException
- if application fails to wait for a hanging applicationDesktopException
public void waitFor(AckListener listener)
listener
- The listener that gets called if the method succeedsAckListener
public void getManifest(AckListener listener)
listener
- The listener that gets called if the method succeedsAckListener
public Window getWindow()
public ApplicationOptions getOptions()
public String getUuid()
public DesktopConnection getConnection()
DesktopConnection
public void addEventListener(String type, EventListener listener, AckListener callback) throws DesktopException
type
- Event typelistener
- A listener that is called whenever an event of the specified type occurscallback
- A function that is called if the method succeedsDesktopException
- if this methos fails to add event listenerEventListener
,
ActionEvent
public void removeEventListener(String type, EventListener listener, AckListener callback) throws DesktopException
type
- Event typelistener
- A listener to removecallback
- AckListener for the requestDesktopException
- if this methd fails to remove an event listenerEventListener
,
ActionEvent
public void setTrayIcon(String iconUrl, EventListener listener, AckListener callback) throws DesktopException
iconUrl
- Image URL to be used as the iconlistener
- will be called whenever an event of the specified type occurs. It is passed an event object containing information related to the eventcallback
- AckListener for the requestDesktopException
- if this methed fails to set tray iconEventListener
,
ActionEvent
public void removeTrayIcon(AckListener callback) throws DesktopException
callback
- AckListener for the requestDesktopException
- if this method fails to remove tray icnpublic void createChildWindow(WindowOptions windowOptions, AckListener callback) throws DesktopException
windowOptions
- WindowOptions object for the requested child window.callback
- AckListener for the requestDesktopException
- if this method fails to create a child windowpublic void getGroups(AsyncCallback<List<List<Window>>> groupHandler, AckListener callback)
groupHandler
- A class that receives a list of wrapped windows in the same group.callback
- AckListener for the requestAsyncCallback
,
AckListener
public Window wrapWindow(String name)
name
- The name of the window that is being wrappedWindow
public static CompletableFuture<Application> createFromManifestAsync(String manifestUrl, DesktopConnection connection)
manifestUrl
- connection
- public static void createFromManifest(String manifestUrl, AsyncCallback<Application> callback, AckListener listener, DesktopConnection connection) throws DesktopException
manifestUrl
- The URL of app's manifestcallback
- The callback that receives the wrapped Application
objectlistener
- The AckListener for the requestconnection
- The connection to openfin RuntimeDesktopException
- if application fails to be createdAsyncCallback
,
AckListener
,
DesktopException
public void getChildWindows(AsyncCallback<List<Window>> callback, AckListener listener)
callback
- The callback that receives a list of wrapped Window
objectslistener
- AckListener for the requestAsyncCallback
,
AckListener
public CompletableFuture<List<Window>> getChildWindows()
public void getInfo(AsyncCallback<org.json.JSONObject> callback, AckListener listener)
callback
- The callback that receives the information about the applicationlistener
- AckListener for the requestAsyncCallback
,
AckListener
public void getParentUuid(AsyncCallback<String> callback, AckListener listener)
callback
- The UUID of the parent applicationlistener
- AckListener for the requestAsyncCallback
,
AckListener
public void getTrayIconInfo(AsyncCallback<org.json.JSONObject> callback, AckListener listener)
callback
- tray icon infolistener
- AckListener for the requestAsyncCallback
,
AckListener
public void isRunning(AsyncCallback<Boolean> callback, AckListener listener)
callback
- if the application is currently runninglistener
- AckListener for the requestAsyncCallback
,
AckListener
public void registerUser(String username, String appName, AckListener listener)
username
- username to be passed to the RVM.appName
- app name to be passed to the RVM.listener
- AckListener for the requestAckListener
Copyright © 2022. All rights reserved.