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
-
Constructor Summary
Constructors Modifier Constructor Description protected
Window(Application application)
Window constructor -
Method Summary
Modifier and Type Method Description void
addEventListener(java.lang.String type, EventListener listener, AckListener callback)
Registers an event listener on the specified event.void
animate(AnimationTransitions transitions, AnimationOptions options, AckListener listener)
Performs the specified window transitionsvoid
authenticate(java.lang.String username, java.lang.String password, boolean cancel, AckListener listener)
authenticate a user.void
blur()
Removes focus to the windowvoid
blur(AckListener listener)
Removes focus to the windowvoid
bringToFront()
Brings the window to the front of the window stackvoid
bringToFront(AckListener listener)
Brings the window to the front of the window stackvoid
close()
Closes the windowvoid
close(AckListener listener)
Closes the windowvoid
close(java.lang.Boolean force, AckListener ackListener)
Closes the windowjava.util.concurrent.CompletableFuture<Ack>
closeAsync(java.lang.Boolean force)
void
disableFrame(AckListener listener)
Deprecated.use disableUserMovement() instead.void
disableUserMovement(AckListener listener)
Prevents a user from changing a window's size/position when using the window's framevoid
embedComponentSizeChange(int width, int height)
Update width and height of parent window for embedded windowvoid
embedComponentSizeChange(int left, int top, int width, int height)
Update width and height of parent window for embedded windowvoid
embedInto(long parentHwndId, int left, int top, int width, int height, AckListener callback)
Embeds a window in a target windowvoid
embedInto(long parentHwndId, int width, int height, AckListener callback)
Embeds a window in a target windowvoid
enableFrame(AckListener listener)
Allows a user from changing a window's size/position when using the window's framevoid
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.void
flash(AckListener callback)
Draws attention to the window by flashing the taskbar and window caption.void
focus()
Gives focus to the windowvoid
focus(AckListener listener)
Gives focus to the windowvoid
getBounds(AsyncCallback<WindowBounds> callback, AckListener listener)
Gets the current bounds (top, left, width, height) of the windowprotected java.lang.String
getEventTopicName()
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.void
getInfo(java.lang.String code, AsyncCallback<org.json.JSONObject> callback, AckListener listener)
Gets the window informationvoid
getNativeId(AckListener listener)
Gets HWND of the current windowvoid
getOptions(AsyncCallback<WindowOptions> callback, AckListener listener)
Returns the current options as stored in the desktopApplication
getParentApplication()
Returns the wrapped application that this window belongs toWindow
getParentWindow()
Get parent windowvoid
getSnapshot(AckListener callback)
Gets a base64 encoded PN snapshot of the windowvoid
getState(AckListener listener)
Gets the current state ("minimized", "maximized", or "restored") of the windowvoid
getZoomLevel(AsyncCallback<java.lang.Double> callback, AckListener listener)
Gets the current zoom level of the windowvoid
hide()
Hides the window if it is shownvoid
hide(AckListener listener)
Hides the window if it is shownvoid
isShowing(AckListener listener)
Determines if the window is currently showingvoid
joinGroup(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.void
joinGroup(Window window, AckListener listener)
Joins the same window group as the specified windowvoid
leaveGroup()
Leaves the current window group so that the window can be move independently of those in the group.void
leaveGroup(AckListener listener)
Leaves the current window group so that the window can be move independently of those in the group.void
maximize()
Maximizes the windowvoid
maximize(AckListener listener)
Maximizes the windowvoid
mergeGroups(Window window)
Merges the instance's window group with the same window group as the specified window.void
mergeGroups(Window window, AckListener listener)
Merges the instance's window group with the same window group as the specified window.void
minimize()
Minimizes the windowvoid
minimize(AckListener listener)
Minimizes the windowvoid
moveBy(int deltaLeft, int deltaTop)
Moves the window by a specified amountvoid
moveBy(int deltaLeft, int deltaTop, AckListener listener)
Moves the window by a specified amountvoid
moveTo(int left, int top)
Moves the window to a specified locationvoid
moveTo(int left, int top, AckListener listener)
Moves the window to a specified locationvoid
navigate(java.lang.String url, AckListener listener)
Navigates the Widnow to the specified addressvoid
navigateBack(AckListener listener)
Navigates the window back one page.void
navigateForward(AckListener listener)
Navigates the window forward one page.void
reload(boolean ignoreCache, AckListener listener)
Reloads the window current pagevoid
removeEventListener(java.lang.String type, EventListener listener, AckListener callback)
Removes a previously registered event listener from the specified eventvoid
resizeBy(int deltaWidth, int deltaHeight, java.lang.String anchor)
Resizes the window by the specified amountvoid
resizeBy(int deltaWidth, int deltaHeight, java.lang.String anchor, AckListener listener)
Resizes the window by the specified amountvoid
resizeTo(int width, int height, AckListener listener)
Resizes the window to the specified dimensionsvoid
resizeTo(int width, int height, java.lang.String anchor)
Resizes the window to the specified dimensionsvoid
resizeTo(int width, int height, java.lang.String anchor, AckListener listener)
Resizes the window to the specified dimensionsvoid
restore()
Restores the windowvoid
restore(AckListener listener)
Restores the windowvoid
setAsForeground(AckListener listener)
Set's the window as the foreground window The window is activated(focused) and brought to frontvoid
setBounds(int left, int top, int width, int height, AckListener listener)
Sets the current bounds (top, left, width, height) of the windowvoid
setZoomLevel(double level, AckListener listener)
Sets the zoom level of the windowvoid
show()
Shows the window if it is hiddenvoid
show(AckListener listener)
Shows the window if it is hiddenvoid
showAt(int left, int top, boolean toggle)
Shows the window if it is hidden at the specified locationvoid
showAt(int left, int top, boolean toggle, AckListener listener)
Shows the window if it is hidden at the specified locationvoid
showDeveloperTools(AckListener listener)
Shows window's developer toolsvoid
stopFlashing(AckListener callback)
Stops flashing of taskbar and window captionvoid
stopWindowNavigation(AckListener listener)
Stops window navigation.void
updateOptions(WindowOptions options, AckListener listener)
Changes a window's options that were defined upon creationvoid
updateOptions(org.json.JSONObject options)
Changes a window's options that were defined upon creationstatic Window
wrap(java.lang.String applicationUuid, java.lang.String windowName, DesktopConnection connection)
Attaches a Window object to an application Window that already existsMethods 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 Details
-
Window
Window constructor- Parameters:
application
- Parent Application
-
-
Method Details
-
getEventTopicName
protected java.lang.String getEventTopicName()- Specified by:
getEventTopicName
in classWebContent
-
getParentApplication
Returns the wrapped application that this window belongs to- Returns:
- Parent application
-
getParentWindow
Get parent window- Returns:
- Parent window
-
getSnapshot
Gets a base64 encoded PN snapshot of the window- Parameters:
callback
- AckListener for the request- See Also:
AckListener
-
show
Shows the window if it is hidden- Throws:
DesktopException
- if the window fails to show- See Also:
DesktopException
-
show
Shows the window if it is hidden- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
hide
Hides the window if it is shown- Throws:
DesktopException
- if the window fails to hide- See Also:
DesktopException
-
hide
Hides the window if it is shown- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
close
Closes the window- Throws:
DesktopException
- if the window fails to close- See Also:
DesktopException
-
close
Closes the window- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
close
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
-
minimize
Minimizes the window- Throws:
DesktopException
- if the window fails to minimize- See Also:
DesktopException
-
minimize
Minimizes the window- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
maximize
Maximizes the window- Throws:
DesktopException
- if the window fails to maximize- See Also:
DesktopException
-
maximize
Maximizes the window- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
restore
Restores the window- Throws:
DesktopException
- if the window fails to restore- See Also:
DesktopException
-
restore
Restores the window- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
focus
Gives focus to the window- Throws:
DesktopException
- if the windw fails to gain focus- See Also:
DesktopException
-
focus
Gives focus to the window- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
blur
Removes focus to the window- Throws:
DesktopException
- if the window fails to lose focus- See Also:
DesktopException
-
blur
Removes focus to the window- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
flash
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
Stops flashing of taskbar and window caption- Parameters:
callback
- AckListener for the request- See Also:
AckListener
-
showAt
Shows 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
Moves 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
Moves 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
Moves 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
Moves 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
Resizes 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
Resizes 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
Gets the current state ("minimized", "maximized", or "restored") of the window- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
bringToFront
Brings the window to the front of the window stack- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
isShowing
Determines if the window is currently showing- Parameters:
listener
- AckListener for the request- See Also:
AckListener
-
getBounds
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
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
Brings the window to the front of the window stack- Throws:
DesktopException
- if the window fails to be brought to front- See Also:
DesktopException
-
updateOptions
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
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
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
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
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
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
Changes 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
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
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
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
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
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
Leaves 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
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
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
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
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
Shows window's developer tools- Parameters:
listener
- A function that is called if the method fails- See Also:
AckListener
-
navigate
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
Navigates the window forward one page.- Parameters:
listener
- A function that is called if the method fails- See Also:
AckListener
-
navigateBack
Navigates the window back one page.- Parameters:
listener
- A function that is called if the method fails- See Also:
AckListener
-
stopWindowNavigation
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
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
Sets the zoom level of the window- Parameters:
level
- The zoom level.listener
- AckListener for the request- See Also:
AckListener
-
reload
Reloads the window current page- Parameters:
ignoreCache
- Specifies if the cache should be ignored during page reloadlistener
- AckListener for the request- See Also:
AckListener
-