Package com.openfin.desktop.win32
Class ExternalWindowObserver
java.lang.Object
com.openfin.desktop.win32.ExternalWindowObserver
- All Implemented Interfaces:
DesktopStateListener
public class ExternalWindowObserver extends java.lang.Object implements DesktopStateListener
Integrates a window outside of the desktop for interaction and control with the API.
An integrated window is controlled in the same way as an HTML window running in the desktop.
It can be controlled and queried by the API,
generate events that are subscribed to by addEventListener,
and join/merge groups with other windows for docking.
Created by wche on 3/11/15.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ExternalWindowObserver.WINDOWPOS
static class
ExternalWindowObserver.WINDOWPOS2
Structure of WindowPosstatic class
ExternalWindowObserver.WINDOWRECT
-
Field Summary
Fields Modifier and Type Field Description static int
SIZE_MAXHIDE
static int
SIZE_MAXIMIZED
static int
SIZE_MAXSHOW
static int
SIZE_MINIMIZED
static int
SIZE_RESTORED
-
Constructor Summary
Constructors Constructor Description ExternalWindowObserver(int port, java.lang.String parentAppUuid, java.lang.String name, java.awt.Window window, AckListener listener)
Establishes a connection and registers the window identified by hWnd with the Runtime. -
Method Summary
Modifier and Type Method Description void
dispose()
Ensures this window is deregistered on disposalvoid
enterSizeMove()
Simulate WM_ENTERSIZEMOVEvoid
exitSizeMove()
Simulate WM_EXITSIZEMOVEjava.lang.String
getAppUuid()
Get UUID of parent applicationDesktopConnection
getDesktopConnection()
java.lang.String
getName()
Get name of this windowvoid
onClose(java.lang.String error)
DesktopStateListener.onClosevoid
onError(java.lang.String reason)
DesktopStateListener.onErrorvoid
onMessage(java.lang.String message)
DesktopStateListener.onMessageboolean
onMoving(WindowBounds bounds, java.awt.Point mousePosition)
Simulate WM_MOVING eventvoid
onOutgoingMessage(java.lang.String message)
DesktopStateListener.onOutgoingMessagevoid
onReady()
DesktopStateListener.onReadyvoid
setHasFrame(com.sun.jna.platform.win32.WinDef.HWND hwnd, boolean hasFrame)
Enable or disable window framevoid
setWindowOptions(WindowOptions windowOptions)
Set options for the windowvoid
start()
-
Field Details
-
SIZE_MAXHIDE
public static final int SIZE_MAXHIDE- See Also:
- Constant Field Values
-
SIZE_MAXIMIZED
public static final int SIZE_MAXIMIZED- See Also:
- Constant Field Values
-
SIZE_MAXSHOW
public static final int SIZE_MAXSHOW- See Also:
- Constant Field Values
-
SIZE_MINIMIZED
public static final int SIZE_MINIMIZED- See Also:
- Constant Field Values
-
SIZE_RESTORED
public static final int SIZE_RESTORED- See Also:
- Constant Field Values
-
-
Constructor Details
-
ExternalWindowObserver
public ExternalWindowObserver(int port, java.lang.String parentAppUuid, java.lang.String name, java.awt.Window window, AckListener listener) throws DesktopExceptionEstablishes a connection and registers the window identified by hWnd with the Runtime.- Parameters:
port
- The host that the desktop is running onparentAppUuid
- The UUID of the application to create register this window as a child ofname
- The unique name for this window as a child windowwindow
- The HWND of the window to control/observelistener
- AckListener for external registering- Throws:
DesktopException
- if registration fails
-
-
Method Details
-
start
public void start() throws java.lang.Exception- Throws:
java.lang.Exception
-
getAppUuid
public java.lang.String getAppUuid()Get UUID of parent application- Returns:
- UUID
-
getName
public java.lang.String getName()Get name of this window- Returns:
- name
-
setWindowOptions
Set options for the window- Parameters:
windowOptions
- options
-
dispose
Ensures this window is deregistered on disposal- Throws:
DesktopException
- if errors are caught during cleanup
-
setHasFrame
public void setHasFrame(com.sun.jna.platform.win32.WinDef.HWND hwnd, boolean hasFrame)Enable or disable window frame- Parameters:
hwnd
- Window handlehasFrame
- hasFrame
-
onMoving
Simulate WM_MOVING event- Parameters:
bounds
- current window boundsmousePosition
- current mouse position- Returns:
- true if the event is consumed by this class. false if the event should be processed by the caller
-
enterSizeMove
public void enterSizeMove()Simulate WM_ENTERSIZEMOVE -
exitSizeMove
public void exitSizeMove()Simulate WM_EXITSIZEMOVE -
onReady
public void onReady()DesktopStateListener.onReady- Specified by:
onReady
in interfaceDesktopStateListener
-
onClose
public void onClose(java.lang.String error)DesktopStateListener.onClose- Specified by:
onClose
in interfaceDesktopStateListener
- Parameters:
error
- Error message. null for normal close
-
onError
public void onError(java.lang.String reason)DesktopStateListener.onError- Specified by:
onError
in interfaceDesktopStateListener
- Parameters:
reason
- Error message
-
onMessage
public void onMessage(java.lang.String message)DesktopStateListener.onMessage- Specified by:
onMessage
in interfaceDesktopStateListener
- Parameters:
message
- Message text
-
onOutgoingMessage
public void onOutgoingMessage(java.lang.String message)DesktopStateListener.onOutgoingMessage- Specified by:
onOutgoingMessage
in interfaceDesktopStateListener
- Parameters:
message
- Message text
-
getDesktopConnection
-