Package com.openfin.desktop
Class Window
- java.lang.Object
-
- com.openfin.desktop.WebContent
-
- com.openfin.desktop.Window
-
public class Window extends WebContent
An object representing a window that can be controlled by the AppDesktop API.
-
-
Field Summary
-
Fields inherited from class com.openfin.desktop.WebContent
connection, identity
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedWindow(Application application)Window constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddEventListener(java.lang.String type, EventListener listener, AckListener callback)Registers an event listener on the specified event.voidanimate(AnimationTransitions transitions, AnimationOptions options, AckListener listener)Performs the specified window transitionsvoidauthenticate(java.lang.String username, java.lang.String password, boolean cancel, AckListener listener)authenticate a user.voidblur()Removes focus to the windowvoidblur(AckListener listener)Removes focus to the windowvoidbringToFront()Brings the window to the front of the window stackvoidbringToFront(AckListener listener)Brings the window to the front of the window stackvoidclose()Closes the windowvoidclose(AckListener listener)Closes the windowvoidclose(java.lang.Boolean force, AckListener ackListener)Closes the windowjava.util.concurrent.CompletableFuture<Ack>closeAsync(java.lang.Boolean force)voiddisableFrame(AckListener listener)Deprecated.use disableUserMovement() instead.voiddisableUserMovement(AckListener listener)Prevents a user from changing a window's size/position when using the window's framevoidembedComponentSizeChange(int width, int height)Update width and height of parent window for embedded windowvoidembedComponentSizeChange(int left, int top, int width, int height)Update width and height of parent window for embedded windowvoidembedInto(long parentHwndId, int left, int top, int width, int height, AckListener callback)Embeds a window in a target windowvoidembedInto(long parentHwndId, int width, int height, AckListener callback)Embeds a window in a target windowvoidenableFrame(AckListener listener)Allows a user from changing a window's size/position when using the window's framevoidexecuteJavaScript(java.lang.String code, AsyncCallback<java.lang.Object> callback, AckListener listener)Executes Javascript on the window, restricted to windows you own or windows owned by applications you have created.voidflash(AckListener callback)Draws attention to the window by flashing the taskbar and window caption.voidfocus()Gives focus to the windowvoidfocus(AckListener listener)Gives focus to the windowvoidgetBounds(AsyncCallback<WindowBounds> callback, AckListener listener)Gets the current bounds (top, left, width, height) of the windowprotected java.lang.StringgetEventTopicName()voidgetGroup(AsyncCallback<java.util.List<Window>> groupHandler, AckListener listener)Passes a list of wrapped windows in the same group An empty list is returned if the window is not in a group.voidgetInfo(java.lang.String code, AsyncCallback<org.json.JSONObject> callback, AckListener listener)Gets the window informationvoidgetNativeId(AckListener listener)Gets HWND of the current windowvoidgetOptions(AsyncCallback<WindowOptions> callback, AckListener listener)Returns the current options as stored in the desktopApplicationgetParentApplication()Returns the wrapped application that this window belongs toWindowgetParentWindow()Get parent windowvoidgetSnapshot(AckListener callback)Gets a base64 encoded PN snapshot of the windowvoidgetState(AckListener listener)Gets the current state ("minimized", "maximized", or "restored") of the windowvoidgetZoomLevel(AsyncCallback<java.lang.Double> callback, AckListener listener)Gets the current zoom level of the windowvoidhide()Hides the window if it is shownvoidhide(AckListener listener)Hides the window if it is shownvoidisShowing(AckListener listener)Determines if the window is currently showingvoidjoinGroup(Window window)Joins the same window group as the specified window When windows are joined, if the user moves one of the windows, all other windows in the same group move too.voidjoinGroup(Window window, AckListener listener)Joins the same window group as the specified windowvoidleaveGroup()Leaves the current window group so that the window can be move independently of those in the group.voidleaveGroup(AckListener listener)Leaves the current window group so that the window can be move independently of those in the group.voidmaximize()Maximizes the windowvoidmaximize(AckListener listener)Maximizes the windowvoidmergeGroups(Window window)Merges the instance's window group with the same window group as the specified window.voidmergeGroups(Window window, AckListener listener)Merges the instance's window group with the same window group as the specified window.voidminimize()Minimizes the windowvoidminimize(AckListener listener)Minimizes the windowvoidmoveBy(int deltaLeft, int deltaTop)Moves the window by a specified amountvoidmoveBy(int deltaLeft, int deltaTop, AckListener listener)Moves the window by a specified amountvoidmoveTo(int left, int top)Moves the window to a specified locationvoidmoveTo(int left, int top, AckListener listener)Moves the window to a specified locationvoidnavigate(java.lang.String url, AckListener listener)Navigates the Widnow to the specified addressvoidnavigateBack(AckListener listener)Navigates the window back one page.voidnavigateForward(AckListener listener)Navigates the window forward one page.voidreload(boolean ignoreCache, AckListener listener)Reloads the window current pagevoidremoveEventListener(java.lang.String type, EventListener listener, AckListener callback)Removes a previously registered event listener from the specified eventvoidresizeBy(int deltaWidth, int deltaHeight, java.lang.String anchor)Resizes the window by the specified amountvoidresizeBy(int deltaWidth, int deltaHeight, java.lang.String anchor, AckListener listener)Resizes the window by the specified amountvoidresizeTo(int width, int height, AckListener listener)Resizes the window to the specified dimensionsvoidresizeTo(int width, int height, java.lang.String anchor)Resizes the window to the specified dimensionsvoidresizeTo(int width, int height, java.lang.String anchor, AckListener listener)Resizes the window to the specified dimensionsvoidrestore()Restores the windowvoidrestore(AckListener listener)Restores the windowvoidsetAsForeground(AckListener listener)Set's the window as the foreground window The window is activated(focused) and brought to frontvoidsetBounds(int left, int top, int width, int height, AckListener listener)Sets the current bounds (top, left, width, height) of the windowvoidsetZoomLevel(double level, AckListener listener)Sets the zoom level of the windowvoidshow()Shows the window if it is hiddenvoidshow(AckListener listener)Shows the window if it is hiddenvoidshowAt(int left, int top, boolean toggle)Shows the window if it is hidden at the specified locationvoidshowAt(int left, int top, boolean toggle, AckListener listener)Shows the window if it is hidden at the specified locationvoidshowDeveloperTools(AckListener listener)Shows window's developer toolsvoidstopFlashing(AckListener callback)Stops flashing of taskbar and window captionvoidstopWindowNavigation(AckListener listener)Stops window navigation.voidupdateOptions(WindowOptions options, AckListener listener)Changes a window's options that were defined upon creationvoidupdateOptions(org.json.JSONObject options)Changes a window's options that were defined upon creationstatic Windowwrap(java.lang.String applicationUuid, java.lang.String windowName, DesktopConnection connection)Attaches a Window object to an application Window that already exists-
Methods inherited from class com.openfin.desktop.WebContent
addEventListener, executeJavaScript, findInPage, focusAsync, getConnection, getIdentity, getName, getPrinters, getUuid, getZoomLevel, navigate, navigateBack, navigateForward, printAsync, reloadAsync, removeEventListener, setZoomLevel, showDeveloperTools, stopFindInPage, stopNavigation
-
-
-
-
Constructor Detail
-
Window
protected Window(Application application)
Window constructor- Parameters:
application- Parent Application
-
-
Method Detail
-
getEventTopicName
protected java.lang.String getEventTopicName()
- Specified by:
getEventTopicNamein classWebContent
-
getParentApplication
public Application getParentApplication()
Returns the wrapped application that this window belongs to- Returns:
- Parent application
-
getParentWindow
public Window getParentWindow()
Get parent window- Returns:
- Parent window
-
getSnapshot
public void getSnapshot(AckListener callback)
Gets a base64 encoded PN snapshot of the window- Parameters:
callback- AckListener for the request- See Also:
AckListener
-
show
public void show() throws DesktopExceptionShows the window if it is hidden- Throws:
DesktopException- if the window fails to show- See Also:
DesktopException
-
show
public void show(AckListener listener)
Shows the window if it is hidden- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
hide
public void hide() throws DesktopExceptionHides the window if it is shown- Throws:
DesktopException- if the window fails to hide- See Also:
DesktopException
-
hide
public void hide(AckListener listener)
Hides the window if it is shown- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
close
public void close() throws DesktopExceptionCloses the window- Throws:
DesktopException- if the window fails to close- See Also:
DesktopException
-
close
public void close(AckListener listener)
Closes the window- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
close
public void close(java.lang.Boolean force, AckListener ackListener)Closes the window- Parameters:
force- Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for the windowackListener- AckListener for the request- See Also:
AckListener
-
closeAsync
public java.util.concurrent.CompletableFuture<Ack> closeAsync(java.lang.Boolean force)
-
minimize
public void minimize() throws DesktopExceptionMinimizes the window- Throws:
DesktopException- if the window fails to minimize- See Also:
DesktopException
-
minimize
public void minimize(AckListener listener)
Minimizes the window- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
maximize
public void maximize() throws DesktopExceptionMaximizes the window- Throws:
DesktopException- if the window fails to maximize- See Also:
DesktopException
-
maximize
public void maximize(AckListener listener)
Maximizes the window- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
restore
public void restore() throws DesktopExceptionRestores the window- Throws:
DesktopException- if the window fails to restore- See Also:
DesktopException
-
restore
public void restore(AckListener listener)
Restores the window- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
focus
public void focus() throws DesktopExceptionGives focus to the window- Throws:
DesktopException- if the windw fails to gain focus- See Also:
DesktopException
-
focus
public void focus(AckListener listener)
Gives focus to the window- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
blur
public void blur() throws DesktopExceptionRemoves focus to the window- Throws:
DesktopException- if the window fails to lose focus- See Also:
DesktopException
-
blur
public void blur(AckListener listener)
Removes focus to the window- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
flash
public void flash(AckListener callback)
Draws attention to the window by flashing the taskbar and window caption. This effect continues until the window receives focus.- Parameters:
callback- AckListener for the request- See Also:
AckListener
-
stopFlashing
public void stopFlashing(AckListener callback)
Stops flashing of taskbar and window caption- Parameters:
callback- AckListener for the request- See Also:
AckListener
-
showAt
public void showAt(int left, int top, boolean toggle) throws DesktopExceptionShows the window if it is hidden at the specified location- Parameters:
left- The left position of the windowtop- The right position of the windowtoggle- If true, the window will alternate between showing and hiding in subsequent calls- Throws:
DesktopException- if the window fails to show- See Also:
DesktopException
-
showAt
public void showAt(int left, int top, boolean toggle, AckListener listener) throws DesktopExceptionShows the window if it is hidden at the specified location- Parameters:
left- The left position of the windowtop- The right position of the windowtoggle- If true, the window will alternate between showing and hiding in subsequent callslistener- AckListener for the request- Throws:
DesktopException- if the window fails to show- See Also:
AckListener,DesktopException
-
moveTo
public void moveTo(int left, int top) throws DesktopExceptionMoves the window to a specified location- Parameters:
left- The left position of the windowtop- The right position of the window- Throws:
DesktopException- if the window fails to move- See Also:
DesktopException
-
moveTo
public void moveTo(int left, int top, AckListener listener) throws DesktopExceptionMoves the window to a specified location- Parameters:
left- The left position of the windowtop- The right position of the windowlistener- AckListener for the request- Throws:
DesktopException- if the window fails to move- See Also:
AckListener,DesktopException
-
moveBy
public void moveBy(int deltaLeft, int deltaTop) throws DesktopExceptionMoves the window by a specified amount- Parameters:
deltaLeft- The change in the left position of the windowdeltaTop- The change in the top position of the window- Throws:
DesktopException- if the window fails to move- See Also:
DesktopException
-
moveBy
public void moveBy(int deltaLeft, int deltaTop, AckListener listener) throws DesktopExceptionMoves the window by a specified amount- Parameters:
deltaLeft- The change in the left position of the windowdeltaTop- The change in the top position of the windowlistener- AckListener for the request- Throws:
DesktopException- if the window fails to move- See Also:
AckListener,DesktopException
-
resizeTo
public void resizeTo(int width, int height, java.lang.String anchor) throws DesktopExceptionResizes the window to the specified dimensions- Parameters:
width- Width of the windowheight- Height of the windowanchor- Specifies a corner to remain fixed during the resize. Can take the values: "top-left" "top-right" "bottom-left" "bottom-right" If undefined, the default is "top-left".- Throws:
DesktopException- if the windw fails to resize- See Also:
DesktopException
-
resizeTo
public void resizeTo(int width, int height, java.lang.String anchor, AckListener listener) throws DesktopExceptionResizes the window to the specified dimensions- Parameters:
width- Width of the windowheight- Height of the windowanchor- Specifies a corner to remain fixed during the resize. Can take the values: "top-left" "top-right" "bottom-left" "bottom-right" If undefined, the default is "top-left".listener- AckListener for the request- Throws:
DesktopException- if the window fails to resize- See Also:
AckListener,DesktopException
-
resizeTo
public void resizeTo(int width, int height, AckListener listener) throws DesktopExceptionResizes the window to the specified dimensions- Parameters:
width- Width of the windowheight- Height of the windowlistener- AckListener for the request- Throws:
DesktopException- if the window fails to resize- See Also:
AckListener,DesktopException
-
resizeBy
public void resizeBy(int deltaWidth, int deltaHeight, java.lang.String anchor) throws DesktopExceptionResizes the window by the specified amount- Parameters:
deltaWidth- Width delta of the windowdeltaHeight- Height delta of the windowanchor- Specifies a corner to remain fixed during the resize. Please check resizeTo method for more information- Throws:
DesktopException- if the window fails to resize- See Also:
DesktopException
-
resizeBy
public void resizeBy(int deltaWidth, int deltaHeight, java.lang.String anchor, AckListener listener) throws DesktopExceptionResizes the window by the specified amount- Parameters:
deltaWidth- Width delta of the windowdeltaHeight- Height delta of the windowanchor- Specifies a corner to remain fixed during the resize. Please check resizeTo method for more informationlistener- AckListener for the request- Throws:
DesktopException- if the window fails to resize- See Also:
AckListener,DesktopException
-
getState
public void getState(AckListener listener)
Gets the current state ("minimized", "maximized", or "restored") of the window- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
bringToFront
public void bringToFront(AckListener listener)
Brings the window to the front of the window stack- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
isShowing
public void isShowing(AckListener listener)
Determines if the window is currently showing- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
getBounds
public void getBounds(AsyncCallback<WindowBounds> callback, AckListener listener)
Gets the current bounds (top, left, width, height) of the window- Parameters:
callback- A function that is called if the method succeedslistener- A function that is called if the method fails- See Also:
AsyncCallback,AckListener
-
setBounds
public void setBounds(int left, int top, int width, int height, AckListener listener)Sets the current bounds (top, left, width, height) of the window- Parameters:
left- The left position of the window.top- The top position of the window.width- The width position of the window.height- The height position of the window.listener- AckListener for the request- See Also:
AckListener
-
bringToFront
public void bringToFront() throws DesktopExceptionBrings the window to the front of the window stack- Throws:
DesktopException- if the window fails to be brought to front- See Also:
DesktopException
-
updateOptions
public void updateOptions(WindowOptions options, AckListener listener)
Changes a window's options that were defined upon creation- Parameters:
options- The window options to changelistener- AckListener for the request- See Also:
WindowOptions,AckListener
-
getOptions
public void getOptions(AsyncCallback<WindowOptions> callback, AckListener listener)
Returns the current options as stored in the desktop- Parameters:
callback- A function that is called if the method succeedslistener- A function that is called if the method fails- See Also:
AsyncCallback,AckListener
-
setAsForeground
public void setAsForeground(AckListener listener)
Set's the window as the foreground window The window is activated(focused) and brought to front- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
enableFrame
public void enableFrame(AckListener listener)
Allows a user from changing a window's size/position when using the window's frame- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
disableFrame
public void disableFrame(AckListener listener)
Deprecated.use disableUserMovement() instead.Prevents a user from changing a window's size/position when using the window's frame- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
disableUserMovement
public void disableUserMovement(AckListener listener)
Prevents a user from changing a window's size/position when using the window's frame- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
updateOptions
public void updateOptions(org.json.JSONObject options) throws DesktopExceptionChanges a window's options that were defined upon creation- Parameters:
options- The window options to change- Throws:
DesktopException- if this method fails to update window options
-
getNativeId
public void getNativeId(AckListener listener)
Gets HWND of the current window- Parameters:
listener- A function that is called if the method fails- See Also:
AsyncCallback,AckListener
-
wrap
public static Window wrap(java.lang.String applicationUuid, java.lang.String windowName, DesktopConnection connection)
Attaches a Window object to an application Window that already exists- Parameters:
applicationUuid- UUID of the parent ApplicationwindowName- name of the Windowconnection- Connection object to the AppDesktop- Returns:
- Window instance
-
joinGroup
public void joinGroup(Window window) throws DesktopException
Joins the same window group as the specified window When windows are joined, if the user moves one of the windows, all other windows in the same group move too. This function is to be used when docking to other windows. If the window is already within a group, it will leave that group to join the new one. Windows must be owned by the same application in order to be joined.- Parameters:
window- The window whose group is to be joined- Throws:
DesktopException- if this window fails to join a group
-
joinGroup
public void joinGroup(Window window, AckListener listener)
Joins the same window group as the specified window- Parameters:
window- The window whose group is to be joinedlistener- AckListener for the request- See Also:
AckListener
-
mergeGroups
public void mergeGroups(Window window) throws DesktopException
Merges the instance's window group with the same window group as the specified window. When windows are joined, if the user moves one of the windows, all other windows in the same group move too. This function is to be used when docking to other windows. If the window is already within a group, The two groups are joined to create a new one. Windows must be owned by the same application in order to be joined.- Parameters:
window- The window whose group is to be merged- Throws:
DesktopException- if this window fails to merge into a group- See Also:
DesktopException
-
mergeGroups
public void mergeGroups(Window window, AckListener listener)
Merges the instance's window group with the same window group as the specified window. When windows are joined, if the user moves one of the windows, all other windows in the same group move too. This function is to be used when docking to other windows. If the window is already within a group, The two groups are joined to create a new one. Windows must be owned by the same application in order to be joined.- Parameters:
window- The window whose group is to be mergedlistener- AckListener for the request- See Also:
AckListener
-
leaveGroup
public void leaveGroup() throws DesktopExceptionLeaves the current window group so that the window can be move independently of those in the group.- Throws:
DesktopException- if this window fails to leave a group
-
leaveGroup
public void leaveGroup(AckListener listener)
Leaves the current window group so that the window can be move independently of those in the group.- Parameters:
listener- AckListener for the request- See Also:
AckListener
-
animate
public void animate(AnimationTransitions transitions, AnimationOptions options, AckListener listener)
Performs the specified window transitions- Parameters:
transitions- Describes the animations to preformoptions- Options for the animationlistener- AckListener for the request- See Also:
AnimationTransitions,AnimationOptions,AckListener
-
getGroup
public void getGroup(AsyncCallback<java.util.List<Window>> groupHandler, AckListener listener)
Passes a list of wrapped windows in the same group An empty list is returned if the window is not in a group. The calling window is included in the resulting List.- Parameters:
groupHandler- A class that receives a list of wrapped windows in the same group.listener- AckListener for the request- See Also:
AsyncCallback,AckListener
-
addEventListener
public void addEventListener(java.lang.String type, EventListener listener, AckListener callback)Registers an event listener on the specified event. Supported window event types can be found at https://developer.openfin.co/docs/javascript/stable/tutorial-Window.EventEmitter.html.- Parameters:
type- Event typelistener- Listener for the eventcallback- AckListener for the request- See Also:
EventListener,AckListener
-
removeEventListener
public void removeEventListener(java.lang.String type, EventListener listener, AckListener callback)Removes a previously registered event listener from the specified event- Parameters:
type- Event typelistener- Listener for the eventcallback- AckListener for the request- See Also:
EventListener,AckListener
-
embedInto
public void embedInto(long parentHwndId, int width, int height, AckListener callback)Embeds a window in a target window- Parameters:
parentHwndId- This will be the parent window handlewidth- width of parent windowheight- height of parent windowcallback- AckListener for the request- See Also:
AckListener
-
embedInto
public void embedInto(long parentHwndId, int left, int top, int width, int height, AckListener callback)Embeds a window in a target window- Parameters:
parentHwndId- This will be the parent window handleleft- The new position of the left side of the window.top- The new position of the top of the window.width- width of parent windowheight- height of parent windowcallback- AckListener for the request- See Also:
AckListener
-
executeJavaScript
public void executeJavaScript(java.lang.String code, AsyncCallback<java.lang.Object> callback, AckListener listener)Executes Javascript on the window, restricted to windows you own or windows owned by applications you have created.- Parameters:
code- JavaScript code to be executed on the windowcallback- A function that is called if the method succeedslistener- A function that is called if the method fails- See Also:
AsyncCallback,AckListener
-
showDeveloperTools
public void showDeveloperTools(AckListener listener)
Shows window's developer tools- Parameters:
listener- A function that is called if the method fails- See Also:
AckListener
-
navigate
public void navigate(java.lang.String url, AckListener listener)Navigates the Widnow to the specified address- Parameters:
url- The URL that you want to navigate tolistener- A function that is called if the method fails- See Also:
AckListener
-
navigateForward
public void navigateForward(AckListener listener)
Navigates the window forward one page.- Parameters:
listener- A function that is called if the method fails- See Also:
AckListener
-
navigateBack
public void navigateBack(AckListener listener)
Navigates the window back one page.- Parameters:
listener- A function that is called if the method fails- See Also:
AckListener
-
stopWindowNavigation
public void stopWindowNavigation(AckListener listener)
Stops window navigation.- Parameters:
listener- A function that is called if the method fails- See Also:
AckListener
-
authenticate
public void authenticate(java.lang.String username, java.lang.String password, boolean cancel, AckListener listener)authenticate a user.- Parameters:
username- user namepassword- passwprdcancel- true to cancel the requestlistener- A function that is called if the method fails
-
getInfo
public void getInfo(java.lang.String code, AsyncCallback<org.json.JSONObject> callback, AckListener listener)Gets the window information- Parameters:
code- JavaScript code to be executed on the windowcallback- A function that is called if the method succeedslistener- A function that is called if the method fails- See Also:
AsyncCallback,AckListener
-
embedComponentSizeChange
public void embedComponentSizeChange(int width, int height)Update width and height of parent window for embedded window- Parameters:
width- width of parent windowheight- height of parent window
-
embedComponentSizeChange
public void embedComponentSizeChange(int left, int top, int width, int height)Update width and height of parent window for embedded window- Parameters:
left- The new position of the left side of the window.top- The new position of the top of the window.width- width of parent windowheight- height of parent window
-
getZoomLevel
public void getZoomLevel(AsyncCallback<java.lang.Double> callback, AckListener listener)
Gets the current zoom level of the window- Parameters:
callback- A function that is called if the method succeedslistener- A function that is called if the method fails- See Also:
AsyncCallback,AckListener
-
setZoomLevel
public void setZoomLevel(double level, AckListener listener)Sets the zoom level of the window- Parameters:
level- The zoom level.listener- AckListener for the request- See Also:
AckListener
-
reload
public void reload(boolean ignoreCache, AckListener listener)Reloads the window current page- Parameters:
ignoreCache- Specifies if the cache should be ignored during page reloadlistener- AckListener for the request- See Also:
AckListener
-
-