Class 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.
    • Constructor Detail

      • ExternalWindowObserver

        public ExternalWindowObserver​(int port,
                                      java.lang.String parentAppUuid,
                                      java.lang.String name,
                                      java.awt.Window window,
                                      AckListener listener)
                               throws DesktopException
        Establishes a connection and registers the window identified by hWnd with the Runtime.
        Parameters:
        port - The host that the desktop is running on
        parentAppUuid - The UUID of the application to create register this window as a child of
        name - The unique name for this window as a child window
        window - The HWND of the window to control/observe
        listener - AckListener for external registering
        Throws:
        DesktopException - if registration fails
    • Method Detail

      • 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

        public void setWindowOptions​(WindowOptions windowOptions)
        Set options for the window
        Parameters:
        windowOptions - options
      • dispose

        public void dispose()
                     throws DesktopException
        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 handle
        hasFrame - hasFrame
      • onMoving

        public boolean onMoving​(WindowBounds bounds,
                                java.awt.Point mousePosition)
        Simulate WM_MOVING event
        Parameters:
        bounds - current window bounds
        mousePosition - 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
      • onClose

        public void onClose​(java.lang.String error)
        DesktopStateListener.onClose
        Specified by:
        onClose in interface DesktopStateListener
        Parameters:
        error - Error message. null for normal close
      • onError

        public void onError​(java.lang.String reason)
        DesktopStateListener.onError
        Specified by:
        onError in interface DesktopStateListener
        Parameters:
        reason - Error message
      • onMessage

        public void onMessage​(java.lang.String message)
        DesktopStateListener.onMessage
        Specified by:
        onMessage in interface DesktopStateListener
        Parameters:
        message - Message text
      • onOutgoingMessage

        public void onOutgoingMessage​(java.lang.String message)
        DesktopStateListener.onOutgoingMessage
        Specified by:
        onOutgoingMessage in interface DesktopStateListener
        Parameters:
        message - Message text