Module xaos.app

Class XAOSApplication

    • Constructor Detail

      • XAOSApplication

        public XAOSApplication()
    • Method Detail

      • getScene

        public Scene getScene()
        Returns:
        This application's Scene or null if the application is not yet started.
      • getStage

        public Stage getStage()
        Returns:
        This application's Stage or null if the application is not yet started.
      • initApplication

        protected void initApplication()
                                throws Exception
        The application initialization method.This method is called immediately after the XAOSApplication class is loaded and constructed. An application may override this method to perform initialization prior to the actual starting of the application.

        The implementation of this method provided by the XAOSApplication class does nothing.

        Note: This method is not called on the JavaFX Application Thread. An application must not construct a Scene or a Stage in this method. An application may construct other JavaFX objects in this method.

        Throws:
        Exception - If something goes wrong.
      • startApplication

        protected void startApplication​(BorderPane sceneRoot)
                                 throws Exception
        The main entry point for a XAOS application. The startApplication method is called after the initApplication() method has returned, and after the system is ready for the application to begin running.

        Inside this methods Application.notifyPreloader(PreloaderNotification) can be invoked to inform the Preloader of the current startup progress:

           notifyPreloader(new ProgressNotification(progress));

        where progress is a number between 0 (started) to 1 (completed).

        The implementation of this method provided by the XAOSApplication class does nothing.

        Note: Contrarily to the Application.start(Stage) method, this one is not called on the JavaFX Application Thread.

        Parameters:
        sceneRoot - The BorderPane root container pre-installed in the application's Scene.
        Throws:
        Exception - If something goes wrong.
      • step

        protected void step()
                     throws IllegalStateException
        Tells the Preloader the application startup process is about to start the next step of progress. It must be call at the beginning of the step to be performed.

        For example:

           stepsBegin(10);
           for ( int  i = 0; i < 10; i++ ) {
             step();
             ...
           }
           stepsComplete();
        Throws:
        IllegalStateException - If this method is called before the stepsBegin(int) one, or after stepsComplete(), or more than the number of steps stated in stepsBegin(int).
      • step

        protected void step​(int subSteps)
                     throws IllegalArgumentException,
                            IllegalStateException
        Tells the Preloader the application startup process is about to start the next step of progress, which is itself split in the given number of sub-steps. It must be call at the beginning of the step to be performed.

        For example:

           stepsBegin(10);
           for ( int  i = 0; i < 10; i++ ) {
             step(5);
             for ( int  j = 0; j < 5; j++ ) {
               subStep()
               ...
             }
           }
           stepsComplete();
        Parameters:
        subSteps - The number of sub-steps to be performed. It must be greater than or equal to 2. If no sub-steps must be performed then call step() instead.
        Throws:
        IllegalArgumentException - If subSteps is not greater than or equal to 2.
        IllegalStateException - If this method is called before the stepsBegin(int) one, or after stepsComplete().
      • stepsBegin

        protected void stepsBegin​(int steps)
                           throws IllegalArgumentException,
                                  IllegalStateException
        Tells the Preloader the application startup process is about to begin. The total number of steps is given, and the first one is about to start.

        For example:

           stepsBegin(10);
           for ( int  i = 0; i < 10; i++ ) {
             step();
             ...
           }
           stepsComplete();
        Parameters:
        steps - The number of steps to be performed. Cannot be 0. If no steps must be performed then call stepsIndeterminate() instead, and then stepsComplete() after the startup is completed.
        Throws:
        IllegalArgumentException - If steps is not a positive number.
        IllegalStateException - If this method is called more than once.
      • stepsComplete

        protected void stepsComplete()
        Tells the Preloader the application startup process is completed and the application's UI is about to be displayed.

        For example:

           stepsBegin(10);
           for ( int  i = 0; i < 10; i++ ) {
             step();
             ...
           }
           stepsComplete();
      • stepsIndeterminate

        protected void stepsIndeterminate()
        Tells the Preloader the application startup progress is indeterminate.

        It could be called instead of stepsBegin(int) if the whole startup process cannot be decomposed into a determinate number of steps:

           stepsIndeterminate();
           ...
           stepsComplete();
         

        Otherwise can be intermixed with step() when some steps require an indeterminate amount of time to be completed:

           stepsBegin(10);
           for ( int  i = 0; i < 10; i++ ) {
             step();
             ...
             if ( longTimeRequired ) {
               stepsIndeterminate();
             }
             ...
           }
           stepsComplete();
      • stopApplication

        protected void stopApplication()
                                throws Exception
        This method is called when the application should stop, and provides a convenient place to prepare for application exit and destroy resources.

        The implementation of this method provided by the XAOSApplication class does nothing.

        Note: This method is called on the JavaFX Application Thread.

        Throws:
        Exception - If something goes wrong.
      • subStep

        protected void subStep()
                        throws IllegalStateException
        Tells the Preloader the application startup process is about to start the next sub-step of progress. It must be call at the beginning of the sub-step to be performed.

        For example:

           stepsBegin(10);
           for ( int  i = 0; i < 10; i++ ) {
             step(5);
             for ( int  j = 0; j < 5; j++ ) {
               subStep()
               ...
             }
           }
           stepsComplete();
        Throws:
        IllegalStateException - If this method is called before the step(int) one, or after stepsComplete(), or more than the number of sub-steps stated in step(int).