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

Main JavaFX application class launching the UI and initializing the Spring context. More...

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

Public Member Functions

void start (final Stage stage)
 Initializes the application by:
 

Static Public Member Functions

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

Private Member Functions

PauseTransition createViewTransition (String fxmlName, long minimumTimelapse)
 Creates a pause before loading the specified FXML view.
 
void handleSpringContextTaskFailed (Throwable throwable)
 Handles failure of the Spring context initialization task.
 
void handleSpringContextTaskSuccess (long startTime)
 Handles the success of the Spring context initialization task.
 
void initializeCoordinator ()
 Ensures the Coordinator is initialized if not already (e.g., if Spring injection failed).
 

Static Private Member Functions

static void logSqlInvalidAuthorization (Exception e, SQLInvalidAuthorizationSpecException sqlException)
 Logs an SQLInvalidAuthorizationSpecException with optional authentication details.
 

Private Attributes

final SpringContext context = new SpringContext(this)
 
Coordinator coordinator
 
IMainView iMainView
 
ISplashScreenView iSplashScreenView
 
Stage stage
 

Static Private Attributes

static final Logger LOG = LoggerFactory.getLogger(SudoMain.class)
 
static final long MINIMUM_TRANSITION_DELAY_MS = 500L
 

Detailed Description

Main JavaFX application class launching the UI and initializing the Spring context.

Manages the splash screen, asynchronous Spring initialization, error handling, and view transitions. Handles fatal errors by showing a crash screen or exiting.

Uses a Coordinator component for view management and leverages ExceptionTools for centralized exception handling.

This class is the JavaFX entry point and controls the primary Stage lifecycle.

Member Function Documentation

◆ createViewTransition()

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

Creates a pause before loading the specified FXML view.

Parameters
fxmlNamethe FXML file name to load (must not be null or blank)
minimumTimelapsethe pause duration in milliseconds
Returns
the configured PauseTransition
Exceptions
IllegalArgumentExceptionif fxmlName is null or blank

◆ handleSpringContextTaskFailed()

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

Handles failure of the Spring context initialization task.

If throwable is null, logs and throws an IllegalArgumentException. Otherwise:

  • Initializes the Coordinator
  • Logs the exception
  • If it's an SQL authorization error, logs details and displays a crash screen
  • Otherwise, exits the application

If any exception occurs during the handling itself, it is logged and the application exits.

Parameters
throwablethe exception thrown during initialization (must not be null)
+ Here is the call graph for this function:

◆ 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 before starting the transition.
+ Here is the call graph for this function:

◆ initializeCoordinator()

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

Ensures the Coordinator is initialized if not already (e.g., if Spring injection failed).

In all cases, sets the default scene, dynamic font size handler, and HostServices.

◆ logSqlInvalidAuthorization()

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

Logs an SQLInvalidAuthorizationSpecException with optional authentication details.

Throws an IllegalArgumentException if any argument is null. Logs the exception, and if the SQL state is "28000" or "28501", logs a specific authentication message.

Parameters
ethe general exception (must not be null)
sqlExceptionthe SQL authorization exception (must not be null)
Exceptions
IllegalArgumentExceptionif either argument is null

◆ main()

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

Main entry point for the application.

Parameters
argsCommand line arguments

◆ start()

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

Initializes the application by:

  1. Setting the UI language based on the host system
  2. Displaying the splash screen
  3. Recording the initialization start time
  4. Asynchronously launching the Spring context initialization task
  5. Handling success or failure outcomes via registered callbacks
Parameters
stagethe primary JavaFX stage used to display the UI
+ Here is the call graph for this function:

Member Data Documentation

◆ context

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

◆ coordinator

Coordinator fr.softsf.sudokufx.SudoMain.coordinator
private

◆ iMainView

IMainView fr.softsf.sudokufx.SudoMain.iMainView
private

◆ iSplashScreenView

ISplashScreenView fr.softsf.sudokufx.SudoMain.iSplashScreenView
private

◆ LOG

final Logger fr.softsf.sudokufx.SudoMain.LOG = LoggerFactory.getLogger(SudoMain.class)
staticprivate

◆ MINIMUM_TRANSITION_DELAY_MS

final long fr.softsf.sudokufx.SudoMain.MINIMUM_TRANSITION_DELAY_MS = 500L
staticprivate

◆ stage

Stage fr.softsf.sudokufx.SudoMain.stage
private

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