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 classExternalWindowObserver.WINDOWPOSstatic classExternalWindowObserver.WINDOWPOS2Structure of WindowPosstatic classExternalWindowObserver.WINDOWRECT -
Field Summary
Fields Modifier and Type Field Description static intSIZE_MAXHIDEstatic intSIZE_MAXIMIZEDstatic intSIZE_MAXSHOWstatic intSIZE_MINIMIZEDstatic intSIZE_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 voiddispose()Ensures this window is deregistered on disposalvoidenterSizeMove()Simulate WM_ENTERSIZEMOVEvoidexitSizeMove()Simulate WM_EXITSIZEMOVEjava.lang.StringgetAppUuid()Get UUID of parent applicationDesktopConnectiongetDesktopConnection()java.lang.StringgetName()Get name of this windowvoidonClose(java.lang.String error)DesktopStateListener.onClosevoidonError(java.lang.String reason)DesktopStateListener.onErrorvoidonMessage(java.lang.String message)DesktopStateListener.onMessagebooleanonMoving(WindowBounds bounds, java.awt.Point mousePosition)Simulate WM_MOVING eventvoidonOutgoingMessage(java.lang.String message)DesktopStateListener.onOutgoingMessagevoidonReady()DesktopStateListener.onReadyvoidsetHasFrame(com.sun.jna.platform.win32.WinDef.HWND hwnd, boolean hasFrame)Enable or disable window framevoidsetWindowOptions(WindowOptions windowOptions)Set options for the windowvoidstart()
-
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:
onReadyin interfaceDesktopStateListener
-
onClose
public void onClose(java.lang.String error)DesktopStateListener.onClose- Specified by:
onClosein interfaceDesktopStateListener- Parameters:
error- Error message. null for normal close
-
onError
public void onError(java.lang.String reason)DesktopStateListener.onError- Specified by:
onErrorin interfaceDesktopStateListener- Parameters:
reason- Error message
-
onMessage
public void onMessage(java.lang.String message)DesktopStateListener.onMessage- Specified by:
onMessagein interfaceDesktopStateListener- Parameters:
message- Message text
-
onOutgoingMessage
public void onOutgoingMessage(java.lang.String message)DesktopStateListener.onOutgoingMessage- Specified by:
onOutgoingMessagein interfaceDesktopStateListener- Parameters:
message- Message text
-
getDesktopConnection
-