![]() |
SudokuFX
|
Main view class of the Sudoku application. More...
Inheritance diagram for fr.softsf.sudokufx.view.main.MainView:
Collaboration diagram for fr.softsf.sudokufx.view.main.MainView:Public Member Functions | |
| MainView (ActiveMenuOrSubmenuViewModel activeMenuOrSubmenuViewModel, Coordinator coordinator, HelpViewModel helpViewModel, MenuHiddenViewModel menuHiddenViewModel, MenuMiniViewModel menuMiniViewModel, MenuLevelViewModel menuLevelViewModel, MenuMaxiViewModel menuMaxiViewModel, MenuPlayerViewModel menuPlayerViewModel, MenuSaveViewModel menuSaveViewModel, MenuSolveViewModel menuSolveViewModel, MenuOptionsViewModel menuOptionsViewModel, MenuNewViewModel menuNewViewModel, GridViewModel gridViewModel, AudioService audioService, FileChooserService fileChooserService, BindingConfigurator bindingConfigurator, GenericListViewFactory genericListViewFactory, ToasterService toasterService) | |
| void | handleDifficultLevelShow () |
| Applies the DIFFICULT difficulty level, updates the grid and level view models accordingly. | |
| void | handleEasyLevelShow () |
| Applies the EASY difficulty level, updates the grid and level view models accordingly. | |
| void | handleMediumLevelShow () |
| Applies the MEDIUM difficulty level, updates the grid and level view models accordingly. | |
| void | handleMenuBackupShow () |
| Activates the BACKUP menu, refreshes the backup list to ensure the displayed data is up-to-date, and sets focus on the save button to facilitate keyboard navigation and accessibility. | |
| void | handleMenuHelpShow () |
| Displays the Help menu dialog with game rules and the application log path. | |
| void | handleMenuMaxiShow (ActionEvent event) |
| Activates the MAXI menu and sets focus on the corresponding button based on the event source. | |
| void | handleMenuMiniShow () |
| Activates the MINI menu and starts a timer to auto-hide it after N seconds if it remains active and the "menuMiniButtonShow" button still has focus. | |
| void | handleMenuNewShow () |
| Opens GitHub releases URL via the Coordinator. | |
| void | handleMenuOptionsShow () |
| Activates the OPTIONS menu and sets focus on the options button. | |
| void | handleMenuPlayerShow () |
| Activates the PLAYER menu, refreshes the player list to reflect potential localization changes, and sets focus on the player button to assist keyboard and accessibility navigation. | |
| void | handleMenuSolveShow () |
| Activates the SOLVE menu, focuses the solve button, and updates the selected level if a solved grid is available. | |
| void | handleMute () |
| Called when the mute button is pressed. | |
| void | handleRestoreGridAndMenuMaxiShow (ActionEvent event) |
| Restores the grid and shows the MAXI menu. | |
| void | handleRestoreGridAndMenuMiniShow () |
| Restores the grid and shows the MINI menu. | |
| void | handleSolveClearGrid () |
| Clear the grid in solve submenu. | |
| void | handleSongClear () |
| Clears the song, shows a toast, and refocuses the song button. | |
| void | handleToggleLanguage () |
| Switches language. | |
| void | openingMainStage (final ISplashScreenView iSplashScreenView) |
| Opens the main stage and handles the transition from splash screen to full menu. | |
Private Member Functions | |
| void | activeMenuManagerInitialization () |
| Initializes bindings between each menu pane's visibility and managed state and the corresponding value of the active menu from ActiveMenuOrSubmenuViewModel. | |
| void | applyOpaqueMode (boolean opaque) |
Applies opaque or transparent styling to the sudoku grid and its cells by setting the pseudo-class. | |
| void | bindLevel (DifficultyLevel level, PossibilityStarsHBox starsBox, Button maxi, Label label, Button mini) |
| Binds UI components related to a specific difficulty level in both the maxi and mini menus. | |
| void | bindLevelAccessibility (DifficultyLevel level, PossibilityStarsHBox starsBox, Button maxi, Button mini) |
| Binds accessibility properties (accessible text and role description) for the specified difficulty level's buttons. | |
| void | bindLevelLabelText (DifficultyLevel level, Label label) |
| Binds the label's text to the localized name of the specified difficulty level. | |
| void | bindLevelSelectedStyling (DifficultyLevel level, Button maxi, Button mini) |
| Binds the pseudo-class ":selected" state of the given buttons to the specified difficulty level. | |
| void | bindLevelStarsVisibility (DifficultyLevel level, PossibilityStarsHBox starsBox) |
| Binds the visibility of the stars box to whether the specified difficulty level is selected. | |
| void | bindLevelTooltipText (DifficultyLevel level, PossibilityStarsHBox starsBox, Button maxi, Button mini) |
| Binds the tooltip text properties of both buttons to the accessible text corresponding to the specified difficulty level to ensure consistency and improve user experience. | |
| void | bindVisibleAndManaged (Region menu, ActiveMenuOrSubmenuViewModel.ActiveMenu menuType) |
| void | gridInitialization () |
| Initializes the 9x9 Sudoku grid UI and loads the current grid values from the model if they exist. | |
| void | handleFileImageChooser () |
| Opens a file chooser for a background image and passes the selected file to the ViewModel for asynchronous loading. | |
| void | handleFileSongChooser () |
| Opens a file chooser for a song and passes the selected file to the ViewModel for saving the path. | |
| void | handleGridOpacity () |
| Handles grid transparency toggle button action. | |
| void | hiddenMenuInitialization () |
| Initializes the hidden menu by binding its show button's accessible text and tooltip to the ViewModel. | |
| Timeline | hideMiniMenuTimelineInitialization () |
Initializes a Timeline that hides the MINI menu after milliseconds if it is still active and the "menuMiniButtonShow" button retains focus. | |
| void | initialize () |
| Initializes the main view. | |
| void | levelsMenuInitialization () |
| Initializes each difficulty level section in the menu by binding UI components to ViewModel properties for EASY, MEDIUM, and DIFFICULT levels. | |
| void | maxiMenuInitialization () |
| Initializes the maxi menu components by binding their labels, accessible texts, and tooltips to the corresponding properties in the ViewModel. | |
| void | miniMenuInitialization () |
| Initializes the mini menu by binding all buttons' texts and tooltips to their respective ViewModel properties. | |
| void | newMenuInitialization () |
| Binds "New" menu UI elements to the ViewModel for text, accessibility, visibility, and tooltips, and shows toast notifications on status message updates. | |
| void | openingConfigureStage () |
| Configures the primary stage for the full menu view. | |
| void | openingFadeIn (final Node node) |
| Applies a fade-in effect to the given node. | |
| void | openingMaximizePrimaryStage () |
| Maximizes the primary stage to fill the primary screen. | |
| void | openingShowStage () |
| Shows the primary stage. | |
| void | optionsMenuInitialization () |
Initializes and binds all UI components of the options menu to the MenuOptionsViewModel. | |
| void | playerMenuInitialization () |
| Initializes bindings and event listeners for the player menu components. | |
| void | restoreCurrentGridLevelFromModel () |
| Loads the current user-entered grid from the model and updates the selected level and completion percentage in the menu. | |
| void | saveMenuInitialization () |
| Initializes bindings and event listeners for the save menu components. | |
| void | solveMenuInitialization () |
| Sets up bindings between the solve menu UI components and menuSolveViewModel. | |
| void | stopAudioOnExitInitialization () |
| Registers a listener on the primary stage to stop all audio when the application window is closed. | |
| void | toasterInitialization () |
| Initializes the toaster by subscribing to the ToasterService. | |
Static Private Attributes | |
| static final int | AUTO_HIDE_MINI_MENU_DELAY_MS = 5_000 |
| static final PseudoClass | DIFFICULTY_LEVEL_PSEUDO_SELECTED |
| static final double | FADE_IN_IN_SECONDS_AFTER_SPLASHSCREEN = 0.3 |
| static final Logger | LOG = LoggerFactory.getLogger(MainView.class) |
| static final int | MAX_STARS_PERCENTAGE = 100 |
| static final PseudoClass | OPAQUE_MODE_PSEUDO_SELECTED |
| static final PseudoClass | REDUCED_SONG_PSEUDO_SELECTED |
Main view class of the Sudoku application.
This class is responsible for displaying and managing the UI.
| fr.softsf.sudokufx.view.main.MainView.MainView | ( | ActiveMenuOrSubmenuViewModel | activeMenuOrSubmenuViewModel, |
| Coordinator | coordinator, | ||
| HelpViewModel | helpViewModel, | ||
| MenuHiddenViewModel | menuHiddenViewModel, | ||
| MenuMiniViewModel | menuMiniViewModel, | ||
| MenuLevelViewModel | menuLevelViewModel, | ||
| MenuMaxiViewModel | menuMaxiViewModel, | ||
| MenuPlayerViewModel | menuPlayerViewModel, | ||
| MenuSaveViewModel | menuSaveViewModel, | ||
| MenuSolveViewModel | menuSolveViewModel, | ||
| MenuOptionsViewModel | menuOptionsViewModel, | ||
| MenuNewViewModel | menuNewViewModel, | ||
| GridViewModel | gridViewModel, | ||
| AudioService | audioService, | ||
| FileChooserService | fileChooserService, | ||
| BindingConfigurator | bindingConfigurator, | ||
| GenericListViewFactory | genericListViewFactory, | ||
| ToasterService | toasterService ) |
|
private |
Initializes bindings between each menu pane's visibility and managed state and the corresponding value of the active menu from ActiveMenuOrSubmenuViewModel.
Ensures that only the currently active menu is visible and participates in layout calculations.
Here is the call graph for this function:
|
private |
Applies opaque or transparent styling to the sudoku grid and its cells by setting the pseudo-class.
OPAQUE_MODE_PSEUDO_SELECTED
| opaque | true for opaque styling, false for transparent |
|
private |
Binds UI components related to a specific difficulty level in both the maxi and mini menus.
This method sets up the following behaviors:
| level | the difficulty level to bind |
| starsBox | the UI component displaying possibility stars for this level |
| maxi | the button in the maxi menu for this level |
| label | the label showing the difficulty level name in the maxi menu |
| mini | the button in the mini menu for this level |
Here is the call graph for this function:
|
private |
Binds accessibility properties (accessible text and role description) for the specified difficulty level's buttons.
| level | the difficulty level whose accessibility properties are bound |
| starsBox | the stars box used for calculating accessible text |
| maxi | the button in the maxi menu |
| mini | the button in the mini menu |
|
private |
Binds the label's text to the localized name of the specified difficulty level.
| level | the difficulty level whose label text to bind |
| label | the label to bind |
|
private |
Binds the pseudo-class ":selected" state of the given buttons to the specified difficulty level.
Updates styling immediately and whenever the selected level changes.
| level | the difficulty level to track |
| maxi | the button in the maxi menu |
| mini | the button in the mini menu |
|
private |
Binds the visibility of the stars box to whether the specified difficulty level is selected.
| level | the difficulty level whose selection state controls visibility |
| starsBox | the stars box to show or hide |
|
private |
Binds the tooltip text properties of both buttons to the accessible text corresponding to the specified difficulty level to ensure consistency and improve user experience.
| level | the difficulty level whose tooltip text is bound |
| starsBox | the stars UI component used to compute accessible text |
| maxi | the button in the maxi menu |
| mini | the button in the mini menu |
|
private |
|
private |
Initializes the 9x9 Sudoku grid UI and loads the current grid values from the model if they exist.
Here is the call graph for this function:| void fr.softsf.sudokufx.view.main.MainView.handleDifficultLevelShow | ( | ) |
Applies the DIFFICULT difficulty level, updates the grid and level view models accordingly.
Here is the call graph for this function:| void fr.softsf.sudokufx.view.main.MainView.handleEasyLevelShow | ( | ) |
Applies the EASY difficulty level, updates the grid and level view models accordingly.
Here is the call graph for this function:
|
private |
Opens a file chooser for a background image and passes the selected file to the ViewModel for asynchronous loading.
|
private |
Opens a file chooser for a song and passes the selected file to the ViewModel for saving the path.
|
private |
Handles grid transparency toggle button action.
Here is the call graph for this function:| void fr.softsf.sudokufx.view.main.MainView.handleMediumLevelShow | ( | ) |
Applies the MEDIUM difficulty level, updates the grid and level view models accordingly.
Here is the call graph for this function:| void fr.softsf.sudokufx.view.main.MainView.handleMenuBackupShow | ( | ) |
Activates the BACKUP menu, refreshes the backup list to ensure the displayed data is up-to-date, and sets focus on the save button to facilitate keyboard navigation and accessibility.
| void fr.softsf.sudokufx.view.main.MainView.handleMenuHelpShow | ( | ) |
Displays the Help menu dialog with game rules and the application log path.
| void fr.softsf.sudokufx.view.main.MainView.handleMenuMaxiShow | ( | ActionEvent | event | ) |
Activates the MAXI menu and sets focus on the corresponding button based on the event source.
Stops the MINI menu auto-hide timer if running.
| event | the event triggered by a submenu button click |
| void fr.softsf.sudokufx.view.main.MainView.handleMenuMiniShow | ( | ) |
Activates the MINI menu and starts a timer to auto-hide it after N seconds if it remains active and the "menuMiniButtonShow" button still has focus.
| void fr.softsf.sudokufx.view.main.MainView.handleMenuNewShow | ( | ) |
Opens GitHub releases URL via the Coordinator.
| void fr.softsf.sudokufx.view.main.MainView.handleMenuOptionsShow | ( | ) |
Activates the OPTIONS menu and sets focus on the options button.
| void fr.softsf.sudokufx.view.main.MainView.handleMenuPlayerShow | ( | ) |
Activates the PLAYER menu, refreshes the player list to reflect potential localization changes, and sets focus on the player button to assist keyboard and accessibility navigation.
| void fr.softsf.sudokufx.view.main.MainView.handleMenuSolveShow | ( | ) |
Activates the SOLVE menu, focuses the solve button, and updates the selected level if a solved grid is available.
| void fr.softsf.sudokufx.view.main.MainView.handleMute | ( | ) |
Called when the mute button is pressed.
Toggles the audio mute state via the ViewModel.
| void fr.softsf.sudokufx.view.main.MainView.handleRestoreGridAndMenuMaxiShow | ( | ActionEvent | event | ) |
Restores the grid and shows the MAXI menu.
Here is the call graph for this function:| void fr.softsf.sudokufx.view.main.MainView.handleRestoreGridAndMenuMiniShow | ( | ) |
Restores the grid and shows the MINI menu.
Here is the call graph for this function:| void fr.softsf.sudokufx.view.main.MainView.handleSolveClearGrid | ( | ) |
Clear the grid in solve submenu.
Here is the call graph for this function:| void fr.softsf.sudokufx.view.main.MainView.handleSongClear | ( | ) |
Clears the song, shows a toast, and refocuses the song button.
| void fr.softsf.sudokufx.view.main.MainView.handleToggleLanguage | ( | ) |
Switches language.
|
private |
Initializes the hidden menu by binding its show button's accessible text and tooltip to the ViewModel.
|
private |
Initializes a Timeline that hides the MINI menu after milliseconds if it is still active and the "menuMiniButtonShow" button retains focus.
AUTO_HIDE_MINI_MENU_DELAY_MS
Timeline responsible for automatically hiding the MINI menu
|
private |
Initializes the main view.
This method is automatically called by JavaFX after loading the FXML. It performs the following actions:
Here is the call graph for this function:
|
private |
Initializes each difficulty level section in the menu by binding UI components to ViewModel properties for EASY, MEDIUM, and DIFFICULT levels.
Here is the call graph for this function:
|
private |
Initializes the maxi menu components by binding their labels, accessible texts, and tooltips to the corresponding properties in the ViewModel.
|
private |
Initializes the mini menu by binding all buttons' texts and tooltips to their respective ViewModel properties.
|
private |
Binds "New" menu UI elements to the ViewModel for text, accessibility, visibility, and tooltips, and shows toast notifications on status message updates.
|
private |
Configures the primary stage for the full menu view.
|
private |
Applies a fade-in effect to the given node.
| node | The node to apply the fade-in effect to |
| void fr.softsf.sudokufx.view.main.MainView.openingMainStage | ( | final ISplashScreenView | iSplashScreenView | ) |
Opens the main stage and handles the transition from splash screen to full menu.
| iSplashScreenView | The splash screen view interface |
Implements fr.softsf.sudokufx.common.interfaces.IMainView.
Here is the call graph for this function:
|
private |
Maximizes the primary stage to fill the primary screen.
|
private |
Shows the primary stage.
|
private |
Initializes and binds all UI components of the options menu to the MenuOptionsViewModel.
Loads saved options from the database and applies them to the corresponding UI controls.
This method performs the following tasks:
Here is the call graph for this function:
|
private |
Initializes bindings and event listeners for the player menu components.
Binds accessible texts, tooltips, and displayed texts to the ViewModel. Synchronizes selected player state between the ListView and ViewModel. Sets up the player ListView with custom cells and refreshes UI state.
|
private |
Loads the current user-entered grid from the model and updates the selected level and completion percentage in the menu.
Used to synchronize the ViewModel with the latest grid state stored in the model.
|
private |
Initializes bindings and event listeners for the save menu components.
Binds accessibility texts, tooltips, and labels to the ViewModel. Synchronizes the selected backup between the ListView and the ViewModel. Sets up the ListView with custom backup cells and refreshes UI state.
|
private |
Sets up bindings between the solve menu UI components and menuSolveViewModel.
Binds accessibility texts, tooltips, role descriptions, and labels, and synchronizes stars percentage from menuLevelViewModel to menuSolveViewModel (bindBidirectional).
|
private |
Registers a listener on the primary stage to stop all audio when the application window is closed.
|
private |
Initializes the toaster by subscribing to the ToasterService.
When a new fr.softsf.sudokufx.dto.ToastData is published via ToasterService#toastRequestProperty(), this method adds the toast to the ToasterVBox. It also listens to ToasterService#removeToastRequestProperty() to remove the currently displayed toast when requested.
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |