SudokuFX
Loading...
Searching...
No Matches
fr.softsf.sudokufx.SudoMain Class Reference

The application main class. More...

+ Inheritance diagram for fr.softsf.sudokufx.SudoMain:
+ Collaboration diagram for fr.softsf.sudokufx.SudoMain:

Classes

interface  IPrimaryStageView
 Interface for the primary stage view. More...
 

Public Member Functions

void start (final Stage splashScreenStage)
 Initializes the application by setting up the splash screen and loading the main application context.
 

Static Public Member Functions

static void main (String[] args)
 Main entry point for the application.
 

Private Member Functions

Task< Void > createSpringContextTask ()
 Creates a new Task that initializes the Spring context.
 
PauseTransition getPauseTransition (String fxmlName, long minimumTimelapse)
 Creates a PauseTransition to delay loading of the next view.
 
void handleSpringContextTaskFailed (Throwable throwable)
 Handles errors that occur during the Spring context initialization task.
 
void handleSpringContextTaskSuccess (long startTime)
 Handles the success of the Spring context initialization task.
 
void initializeFxmlService ()
 Initialize the FxmlService if needed and set his DynamicFontSize.
 

Static Private Member Functions

static void initScene (Stage splashScreenStage)
 Initializes the main scene.
 
static void sqlInvalidAuthorization (Exception e, SQLInvalidAuthorizationSpecException sqlException)
 Handles SQL invalid authorization exceptions.
 

Private Attributes

final SpringContext context = new SpringContext(this)
 
FxmlService fxmlService
 
IPrimaryStageView iPrimaryStageView
 
ISplashScreenView isplashScreenView
 

Static Private Attributes

static Scene scene
 

Detailed Description

The application main class.

This class initializes the application, manages the splash screen, and handles the transition to the main application view.

Member Function Documentation

◆ createSpringContextTask()

Task< Void > fr.softsf.sudokufx.SudoMain.createSpringContextTask ( )
private

Creates a new Task that initializes the Spring context.

This task is intended to be run in a background thread to avoid blocking the JavaFX application thread.

Returns
A Task<Void> that performs the Spring context initialization.

◆ getPauseTransition()

PauseTransition fr.softsf.sudokufx.SudoMain.getPauseTransition ( String fxmlName,
long minimumTimelapse )
private

Creates a PauseTransition to delay loading of the next view.

Parameters
fxmlNameThe name of the FXML file to load
minimumTimelapseThe minimum time to pause
Returns
A PauseTransition object
+ Here is the call graph for this function:

◆ handleSpringContextTaskFailed()

void fr.softsf.sudokufx.SudoMain.handleSpringContextTaskFailed ( Throwable throwable)
private

Handles errors that occur during the Spring context initialization task.

This method is called when the initialization task fails.

It attempts to initialize the FXML service, logs the error, and manages the response based on the type of exception encountered. If the exception is related to SQL authorization, it displays an appropriate error screen; otherwise, it exits the application.

Parameters
throwableThe exception that occurred during the initialization process.

◆ handleSpringContextTaskSuccess()

void fr.softsf.sudokufx.SudoMain.handleSpringContextTaskSuccess ( long startTime)
private

Handles the success of the Spring context initialization task.

This method is called when the initialization task completes successfully.

Parameters
startTimeThe time (in milliseconds) when the initialization started. This is used to apply the minimum delay of 1s before starting the transition.

◆ initializeFxmlService()

void fr.softsf.sudokufx.SudoMain.initializeFxmlService ( )
private

Initialize the FxmlService if needed and set his DynamicFontSize.

◆ initScene()

static void fr.softsf.sudokufx.SudoMain.initScene ( Stage splashScreenStage)
staticprivate

Initializes the main scene.

Parameters
splashScreenStageThe stage used for the splash screen

◆ main()

static void fr.softsf.sudokufx.SudoMain.main ( String[] args)
static

Main entry point for the application.

Parameters
argsCommand line arguments

◆ sqlInvalidAuthorization()

static void fr.softsf.sudokufx.SudoMain.sqlInvalidAuthorization ( Exception e,
SQLInvalidAuthorizationSpecException sqlException )
staticprivate

Handles SQL invalid authorization exceptions.

Parameters
eThe general exception
sqlExceptionThe specific SQL invalid authorization exception

◆ start()

void fr.softsf.sudokufx.SudoMain.start ( final Stage splashScreenStage)

Initializes the application by setting up the splash screen and loading the main application context.

This method performs the following:

  1. Initializes the splash screen view with the provided stage.
  2. Sets up the main scene for the splash screen.
  3. Creates and starts a background task to initialize the Spring context, ensuring the JavaFX application thread remains unblocked.
  4. Sets a handler to manage actions upon successful completion of the initialization.
  5. Sets a handler to manage errors that occur during the initialization process.
Parameters
splashScreenStageThe primary stage for displaying the splash screen.

Member Data Documentation

◆ context

final SpringContext fr.softsf.sudokufx.SudoMain.context = new SpringContext(this)
private

◆ fxmlService

FxmlService fr.softsf.sudokufx.SudoMain.fxmlService
private

◆ iPrimaryStageView

IPrimaryStageView fr.softsf.sudokufx.SudoMain.iPrimaryStageView
private

◆ isplashScreenView

ISplashScreenView fr.softsf.sudokufx.SudoMain.isplashScreenView
private

◆ scene

Scene fr.softsf.sudokufx.SudoMain.scene
staticprivate

The documentation for this class was generated from the following file: