Class DesktopApplicationContext

    • Field Detail

      • DEFAULT_HOST_WINDOW_TITLE

        public static final java.lang.String DEFAULT_HOST_WINDOW_TITLE
        See Also:
        Constant Field Values
      • RESIZABLE_ARGUMENT

        public static final java.lang.String RESIZABLE_ARGUMENT
        See Also:
        Constant Field Values
      • MAXIMIZED_ARGUMENT

        public static final java.lang.String MAXIMIZED_ARGUMENT
        See Also:
        Constant Field Values
      • UNDECORATED_ARGUMENT

        public static final java.lang.String UNDECORATED_ARGUMENT
        See Also:
        Constant Field Values
      • FULL_SCREEN_ARGUMENT

        public static final java.lang.String FULL_SCREEN_ARGUMENT
        See Also:
        Constant Field Values
      • PRESERVE_SPLASH_SCREEN_ARGUMENT

        public static final java.lang.String PRESERVE_SPLASH_SCREEN_ARGUMENT
        See Also:
        Constant Field Values
      • USE_APPLICATION_INSTANCE_ARGUMENT

        public static final java.lang.String USE_APPLICATION_INSTANCE_ARGUMENT
        See Also:
        Constant Field Values
    • Constructor Detail

      • DesktopApplicationContext

        public DesktopApplicationContext()
    • Method Detail

      • isActive

        public static boolean isActive()
      • exit

        public static void exit()
        Terminates the application context. this call is the same as exit(true)
      • exit

        public static boolean exit​(boolean optional)
        Terminates the application context.
        Parameters:
        optional - If true, shutdown is optional and may be cancelled. If false, shutdown cannot be cancelled.
        Returns:
        Whether shutdown was canceled by the application.
      • main

        public static void main​(java.lang.String[] args)
        Primary application entry point.
        Parameters:
        args - application arguments
      • isFullScreen

        public static boolean isFullScreen()
        Returns the full-screen mode flag.
        Returns:
        Whether or not the application is/should be displayed full screen.
      • setFullScreen

        public static void setFullScreen​(boolean fullScreen)
        Sets the full-screen mode flag.
        Parameters:
        fullScreen - Whether to display the application full screen.
      • replaceSplashScreen

        public static void replaceSplashScreen​(Display display)
        Gets the window hosting the specified Display and makes it visible.
        This will cause a visible SplashScreen to be closed.
        It is intended to be called one time when the Pivot application has initialized its UI and the SplashScreen is ready to be dismissed, but can be safely called regardless of whether there is now, or used to be, a visible SplashScreen.
        Parameters:
        display - Display to make visible
        See Also:
        SplashScreen
      • sizeHostToFit

        public static void sizeHostToFit​(Window window)
        Sizes the window's native host frame to match its preferred size.
        Parameters:
        window - The window to size.
        Throws:
        java.lang.IllegalArgumentException - if the window parameter is null.
        java.lang.IllegalStateException - if the application is being displayed full screen.
      • createDisplay

        public static Display createDisplay​(int width,
                                            int height,
                                            int x,
                                            int y,
                                            boolean modal,
                                            boolean resizable,
                                            boolean undecorated,
                                            java.awt.Window owner,
                                            DesktopApplicationContext.DisplayListener displayCloseListener)
        Creates a new secondary display.
        Parameters:
        width - The new width for the secondary display.
        height - The height for the secondary display.
        x - The new X-position for the display.
        y - The new Y-position for the display.
        modal - Whether or not the new display is to be modal.
        resizable - Whether or not to make the new display resizable by the user.
        undecorated - Whether the new display should be undecorated (that is just a bare window) or normal.
        owner - The owner for the new display.
        displayCloseListener - The listener for the dialog being closed.
        Returns:
        The newly created display.
        Throws:
        java.lang.IllegalStateException - if the full screen flag is set.
      • main

        public static final void main​(java.lang.Class<? extends Application> applicationClass)
        Utility method to make it easier to define main() entry-points into applications. For example:
         public class MyApp implements Application {
           public static void main(String[] args) throws Exception {
             DesktopApplicationContext.main(MyApp.class);
           }
         } 
        Parameters:
        applicationClass - the class of Application entry point
      • main

        public static final void main​(java.lang.Class<? extends Application> applicationClass,
                                      java.lang.String[] applicationArgs)
        /** Utility method to make it easier to define main() entry-points into applications. For example:
         public class MyApp implements Application {
           public static void main(String[] args) throws Exception {
             DesktopApplicationContext.main(MyApp.class, args);
           }
         } 
        Parameters:
        applicationClass - the class of Application entry point
        applicationArgs - application arguments
      • main

        public static final void main​(Application applicationInstance)
        Utility method to make it easier to define main() entry-points into applications.
        This is useful if application instance has already been created, for example from a scripting environment and I set some external properties in the application for later reuse, so I must use that instance.
        But it's important to NOT call usual methods of application lifecycle before passing it here, to avoid side effects.
        Parameters:
        applicationInstance - an instance of Application entry point
      • main

        public static final void main​(Application applicationInstance,
                                      java.lang.String[] applicationArgs)
        Utility method to make it easier to define main() entry-points into applications.
        This is useful if application instance has already been created, for example from a scripting environment and I set some external properties in the application for later reuse, so I must use that instance.
        But it's important to NOT call usual methods of application lifecycle before passing it here, to avoid side effects.
        Parameters:
        applicationInstance - an instance of Application entry point
        applicationArgs - application arguments