com.openfin.desktop
Class Window

java.lang.Object
  extended by com.openfin.desktop.Window

public class Window
extends Object

An object representing a window that can be controlled by the AppDesktop API.


Constructor Summary
protected Window(Application application)
          Window constructor
 
Method Summary
 void addEventListener(String type, EventListener listener, AckListener callback)
          Registers an event listener on the specified event
 void animate(AnimationTransitions transitions, AnimationOptions options, AckListener callback)
          Performs the specified window transitions
 void blur()
          Removes focus to the window
 void blur(AckListener listener)
          Removes focus to the window
 void bringToFront()
          Brings the window to the front of the window stack
 void bringToFront(AckListener listener)
          Brings the window to the front of the window stack
 void close()
          Closes the window
 void close(AckListener listener)
          Closes the window
 void disableFrame(AckListener callback)
          Prevents a user from changing a window's size/position when using the window's frame
 void enableFrame(AckListener callback)
          Allows a user from changing a window's size/position when using the window's frame
 void flash(AckListener callback)
          Draws attention to the window by flashing the taskbar and window caption.
 void focus()
          Gives focus to the window
 void focus(AckListener listener)
          Gives focus to the window
 void getBounds(AsyncCallback<WindowBounds> callback, AckListener listener)
          Gets the current bounds (top, left, width, height) of the window
 void getGroup(AsyncCallback<List<Window>> groupHandler, AckListener callback)
          Passes a list of wrapped windows in the same group An empty list is returned if the window is not in a group.
 String getName()
          Gets name
 void getNativeId(AckListener listener)
          Gets HWND of the current window
 void getOptions(AsyncCallback<WindowOptions> callback, AckListener listener)
          Returns the current options as stored in the desktop
 Application getParentApplication()
          Returns the wrapped application that this window belongs to
 Window getParentWindow()
          Get parent window
 void getSnapshot(AckListener callback)
          Gets a base64 encoded PN snapshot of the window
 void getState(AckListener listener)
          Gets the current state ("minimized", "maximized", or "restored") of the window
 String getUuid()
          Gets UUID
 void hide()
          Hides the window if it is shown
 void hide(AckListener listener)
          Hides the window if it is shown
 void isShowing(AckListener listener)
          Determines if the window is currently showing
 void 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 callback)
          Joins the same window group as the specified window
 void leaveGroup()
          Leaves the current window group so that the window can be move independently of those in the group.
 void leaveGroup(AckListener callback)
          Leaves the current window group so that the window can be move independently of those in the group.
 void maximize()
          Maximizes the window
 void maximize(AckListener listener)
          Mazimizes the window
 void mergeGroups(Window window)
          Merges the instance's window group with the same window group as the specified window.
 void mergeGroups(Window window, AckListener callback)
          Merges the instance's window group with the same window group as the specified window.
 void minimize()
          Minimizes the window
 void minimize(AckListener listener)
          Minimizes the window
 void moveBy(int deltaLeft, int deltaTop)
          Moves the window by a specified amount
 void moveBy(int deltaLeft, int deltaTop, AckListener listener)
          Moves the window by a specified amount
 void moveTo(int left, int top)
          Moves the window to a specified location
 void moveTo(int left, int top, AckListener listener)
          Moves the window to a specified location
 void removeEventListener(String type, EventListener listener, AckListener callback)
          Removes a previously registered event listener from the specified event
 void resizeBy(int deltaWidth, int deltaHeight, String anchor)
          Resizes the window by the specified amount
 void resizeBy(int deltaWidth, int deltaHeight, String anchor, AckListener listener)
          Resizes the window by the specified amount
 void resizeTo(int width, int height, AckListener listener)
          Resizes the window to the specified dimensions
 void resizeTo(int width, int height, String anchor)
          Resizes the window to the specified dimensions
 void resizeTo(int width, int height, String anchor, AckListener listener)
          Resizes the window to the specified dimensions
 void restore()
          Restores the window
 void restore(AckListener listener)
          Restores the window
 void setAsForeground(AckListener callback)
          Set's the window as the foreground window The window is activated(focused) and brought to front
 void setBounds(int left, int top, int width, int height, AckListener listener)
          Sets the current bounds (top, left, width, height) of the window
 void show()
          Shows the window if it is hidden
 void show(AckListener listener)
          Shows the window if it is hidden
 void showAt(int left, int top, boolean toggle)
          Shows the window if it is hidden at the specified location
 void showAt(int left, int top, boolean toggle, AckListener listener)
          Shows the window if it is hidden at the specified location
 void stopFlashing(AckListener callback)
          Stops flashing of taskbar and window caption
 void updateOptions(org.json.JSONObject options)
          Changes a window's options that were defined upon creation
 void updateOptions(WindowOptions options, AckListener listener)
          Changes a window's options that were defined upon creation
static Window wrap(String applicationUuid, String windowName, DesktopConnection connection)
          Attaches a Window object to an application Window that already exists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Window

protected Window(Application application)
Window constructor

Parameters:
application - Parent Application
Method Detail

getUuid

public String getUuid()
Gets UUID

Returns:
UUID

getName

public String getName()
Gets name

Returns:
name

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 DesktopIOException,
                 DesktopException
Shows the window if it is hidden

Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, 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 DesktopIOException,
                 DesktopException
Hides the window if it is shown

Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, 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 DesktopIOException,
                  DesktopException
Closes the window

Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

close

public void close(AckListener listener)
Closes the window

Parameters:
listener - AckListener for the request
See Also:
AckListener

minimize

public void minimize()
              throws DesktopIOException,
                     DesktopException
Minimizes the window

Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

minimize

public void minimize(AckListener listener)
Minimizes the window

Parameters:
listener - AckListener for the request
See Also:
AckListener

maximize

public void maximize()
              throws DesktopIOException,
                     DesktopException
Maximizes the window

Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

maximize

public void maximize(AckListener listener)
Mazimizes the window

Parameters:
listener - AckListener for the request
See Also:
AckListener

restore

public void restore()
             throws DesktopIOException,
                    DesktopException
Restores the window

Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

restore

public void restore(AckListener listener)
Restores the window

Parameters:
listener - AckListener for the request
See Also:
AckListener

focus

public void focus()
           throws DesktopIOException,
                  DesktopException
Gives focus to the window

Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, 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 DesktopIOException,
                 DesktopException
Removes focus to the window

Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, 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 DesktopIOException,
                   DesktopException
Shows the window if it is hidden at the specified location

Parameters:
left - The left position of the window
top - The right position of the window
toggle - If true, the window will alternate between showing and hiding in subsequent calls
Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

showAt

public void showAt(int left,
                   int top,
                   boolean toggle,
                   AckListener listener)
            throws DesktopIOException,
                   DesktopException
Shows the window if it is hidden at the specified location

Parameters:
left - The left position of the window
top - The right position of the window
toggle - If true, the window will alternate between showing and hiding in subsequent calls
listener - AckListener for the request
Throws:
DesktopIOException
DesktopException
See Also:
AckListener, DesktopIOException, DesktopException

moveTo

public void moveTo(int left,
                   int top)
            throws DesktopIOException,
                   DesktopException
Moves the window to a specified location

Parameters:
left - The left position of the window
top - The right position of the window
Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

moveTo

public void moveTo(int left,
                   int top,
                   AckListener listener)
            throws DesktopIOException,
                   DesktopException
Moves the window to a specified location

Parameters:
left - The left position of the window
top - The right position of the window
listener - AckListener for the request
Throws:
DesktopIOException
DesktopException
See Also:
AckListener, DesktopIOException, DesktopException

moveBy

public void moveBy(int deltaLeft,
                   int deltaTop)
            throws DesktopIOException,
                   DesktopException
Moves the window by a specified amount

Parameters:
deltaLeft - The change in the left position of the window
deltaTop - The change in the top position of the window
Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

moveBy

public void moveBy(int deltaLeft,
                   int deltaTop,
                   AckListener listener)
            throws DesktopIOException,
                   DesktopException
Moves the window by a specified amount

Parameters:
deltaLeft - The change in the left position of the window
deltaTop - The change in the top position of the window
listener - AckListener for the request
Throws:
DesktopIOException
DesktopException
See Also:
AckListener, DesktopIOException, DesktopException

resizeTo

public void resizeTo(int width,
                     int height,
                     String anchor)
              throws DesktopIOException,
                     DesktopException
Resizes the window to the specified dimensions

Parameters:
width - Width of the window
height - Height of the window
anchor - 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:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

resizeTo

public void resizeTo(int width,
                     int height,
                     String anchor,
                     AckListener listener)
              throws DesktopException
Resizes the window to the specified dimensions

Parameters:
width - Width of the window
height - Height of the window
anchor - 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
See Also:
AckListener, DesktopException

resizeTo

public void resizeTo(int width,
                     int height,
                     AckListener listener)
              throws DesktopIOException,
                     DesktopException
Resizes the window to the specified dimensions

Parameters:
width - Width of the window
height - Height of the window
listener - AckListener for the request
Throws:
DesktopIOException
DesktopException
See Also:
AckListener, DesktopIOException, DesktopException

resizeBy

public void resizeBy(int deltaWidth,
                     int deltaHeight,
                     String anchor)
              throws DesktopIOException,
                     DesktopException
Resizes the window by the specified amount

Parameters:
deltaWidth - Width delta of the window
deltaHeight - Height delta of the window
anchor - Specifies a corner to remain fixed during the resize. Please check resizeTo method for more information
Throws:
DesktopIOException
DesktopException
See Also:
DesktopIOException, DesktopException

resizeBy

public void resizeBy(int deltaWidth,
                     int deltaHeight,
                     String anchor,
                     AckListener listener)
              throws DesktopException
Resizes the window by the specified amount

Parameters:
deltaWidth - Width delta of the window
deltaHeight - Height delta of the window
anchor - Specifies a corner to remain fixed during the resize. Please check resizeTo method for more information
listener - AckListener for the request
Throws:
DesktopException
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 succeeds
listener - 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 DesktopException,
                         DesktopIOException
Brings the window to the front of the window stack

Throws:
DesktopException
DesktopIOException
See Also:
DesktopException, DesktopIOException

updateOptions

public void updateOptions(WindowOptions options,
                          AckListener listener)
Changes a window's options that were defined upon creation

Parameters:
options - The window options to change
listener - 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 succeeds
listener - A function that is called if the method fails
See Also:
AsyncCallback, AckListener

setAsForeground

public void setAsForeground(AckListener callback)
Set's the window as the foreground window The window is activated(focused) and brought to front

Parameters:
callback - AckListener for the request
See Also:
AckListener

enableFrame

public void enableFrame(AckListener callback)
Allows a user from changing a window's size/position when using the window's frame

Parameters:
callback - AckListener for the request
See Also:
AckListener

disableFrame

public void disableFrame(AckListener callback)
Prevents a user from changing a window's size/position when using the window's frame

Parameters:
callback - AckListener for the request
See Also:
AckListener

updateOptions

public void updateOptions(org.json.JSONObject options)
                   throws DesktopException,
                          DesktopIOException
Changes a window's options that were defined upon creation

Parameters:
options - The window options to change
Throws:
DesktopException
DesktopIOException

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(String applicationUuid,
                          String windowName,
                          DesktopConnection connection)
Attaches a Window object to an application Window that already exists

Parameters:
applicationUuid - UUID of the parent Application
windowName - name of the Window
connection - Connection object to the AppDesktop
Returns:
Window instance

joinGroup

public void joinGroup(Window window)
               throws DesktopException,
                      DesktopIOException
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
DesktopIOException

joinGroup

public void joinGroup(Window window,
                      AckListener callback)
Joins the same window group as the specified window

Parameters:
window - The window whose group is to be joined
callback - AckListener for the request
See Also:
AckListener

mergeGroups

public void mergeGroups(Window window)
                 throws DesktopException,
                        DesktopIOException
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
DesktopException
DesktopIOException
See Also:
DesktopException, DesktopException

mergeGroups

public void mergeGroups(Window window,
                        AckListener callback)
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
callback - AckListener for the request
See Also:
AckListener

leaveGroup

public void leaveGroup()
                throws DesktopException,
                       DesktopIOException
Leaves the current window group so that the window can be move independently of those in the group.

Throws:
DesktopException
DesktopIOException

leaveGroup

public void leaveGroup(AckListener callback)
Leaves the current window group so that the window can be move independently of those in the group.

Parameters:
callback - AckListener for the request
See Also:
AckListener

animate

public void animate(AnimationTransitions transitions,
                    AnimationOptions options,
                    AckListener callback)
Performs the specified window transitions

Parameters:
transitions - Describes the animations to preform
options - Options for the animation
callback - AckListener for the request
See Also:
AnimationTransitions, AnimationOptions, AckListener

getGroup

public void getGroup(AsyncCallback<List<Window>> groupHandler,
                     AckListener callback)
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.
callback - AckListener for the request
See Also:
AsyncCallback, AckListener

addEventListener

public void addEventListener(String type,
                             EventListener listener,
                             AckListener callback)
Registers an event listener on the specified event
     Supported window event types are:

         app-connected       (this window is connected to Runtime with javascript API)
         app-loaded          ( HTML document finished loading )
         blurred
         bounds-changed
         bounds-changing
         closed
         close-requested
         disabled-frame-bounds-changed
         disabled-frame-bounds-changing
         focused
         frame-disabled
         frame-enabled
         group-changed
         hidden
         maximized
         minimized
         restored
         shown
 

Parameters:
type - Event type
listener - Listener for the event
callback - AckListener for the request
See Also:
EventListener, AckListener

removeEventListener

public void removeEventListener(String type,
                                EventListener listener,
                                AckListener callback)
Removes a previously registered event listener from the specified event

Parameters:
type - Event type
listener - Listener for the event
callback - AckListener for the request
See Also:
EventListener, AckListener


Copyright © 2016. All rights reserved.