SudokuFX
Loading...
Searching...
No Matches
fr.softsf.sudokufx.viewmodel.MenuSaveViewModel Class Reference

ViewModel for managing backup menu UI state and accessibility texts. More...

Collaboration diagram for fr.softsf.sudokufx.viewmodel.MenuSaveViewModel:

Public Member Functions

 MenuSaveViewModel (PlayerStateHolder playerStateHolder, GameService gameService)
 Initializes the MenuSaveViewModel with necessary infrastructure and reactive bindings.
StringBinding backupAccessibleTextProperty ()
 Returns the reactive binding for the backup accessible text property.
StringBinding backupRoleDescriptionProperty ()
 Returns the reactive binding for the backup role description property.
StringBinding backupTextProperty ()
 Returns the reactive binding for the backup text property.
StringBinding backupTooltipProperty ()
 Returns the reactive binding for the backup tooltip property.
StringBinding cellConfirmationMessageProperty ()
 Returns the reactive binding for the cell confirmation message property.
StringBinding cellConfirmationTitleProperty ()
 Returns the reactive binding for the cell delete accessible text property.
StringBinding cellDeleteAccessibleTextProperty ()
 Returns the reactive binding for the cell delete accessible text property.
void createABackup ()
 Backup the player's game.
void deleteABackup (GameDto gameToDelete)
 Deletes the specified game backup and refreshes the list.
GameDto getCurrentSelectedGameDto ()
 Retrieves the currently selected game for the active player.
ObservableList< GameDto > getGames ()
 Returns the observable list of games.
StringBinding maxiBackupAccessibleTextProperty ()
 Returns the reactive binding for the maxi backup accessible text property.
StringBinding maxiBackupRoleDescriptionProperty ()
 Returns the reactive binding for the maxi backup role description property.
StringBinding maxiBackupTextProperty ()
 Returns the reactive binding for the maxi backup text property.
StringBinding maxiBackupTooltipProperty ()
 Returns the reactive binding for the maxi backup tooltip property.
StringBinding reduceAccessibleTextProperty ()
 Returns the reactive binding for the reduce button accessible text property.
StringBinding reduceTextProperty ()
 Returns the reactive binding for the reduce button text property.
StringBinding reduceTooltipProperty ()
 Returns the reactive binding for the reduce button accessible text property.
void refreshGames ()
 Refreshes the game list and re-synchronizes the selected backup.
void restoreABackup (GameDto gameToRestore)
 Restores a specific game backup.
StringBinding saveAccessibleTextProperty ()
 Returns the property for the currently selected backup.
StringBinding saveRoleDescriptionProperty ()
 Returns the reactive binding for the save tooltip property.
StringBinding saveTextProperty ()
 Returns the reactive binding for the save text property.
StringBinding saveTooltipProperty ()
 Returns the reactive binding for the save tooltip property.
ObjectProperty< GameDto > selectedBackupProperty ()
 Returns the property for the currently selected backup.

Private Member Functions

StringBinding createFormattedAndConcatenatedBinding (String key, String suffixKey)
 Creates a localized StringBinding by concatenating the value of two keys.
StringBinding createStringBinding (String key)
 Creates a simple localized StringBinding for the given key.
void loadGames ()
 Loads games into the observable list.
void setSelectedBackup ()
 Sets the selected backup to the one marked as selected, or defaults to the first in the list if none are selected.

Private Attributes

final StringBinding backupAccessibleText
final StringBinding backupRoleDescription
final StringBinding backupText
final StringBinding backupTooltip
final StringBinding cellConfirmationMessage
final StringBinding cellConfirmationTitle
final StringBinding cellDeleteAccessibleText
final ObservableList< GameDto > games = FXCollections.observableArrayList()
final GameService gameService
final StringBinding maxiBackupAccessibleText
final StringBinding maxiBackupRoleDescription
final StringBinding maxiBackupText
final StringBinding maxiBackupTooltip
final PlayerStateHolder playerStateHolder
final StringBinding reduceAccessibleText
final StringBinding reduceText
final StringBinding reduceTooltip
final StringBinding saveAccessibleText
final StringBinding saveRoleDescription
final StringBinding saveText
final StringBinding saveTooltip
final ObjectProperty< GameDto > selectedBackup = new SimpleObjectProperty<>()

Static Private Attributes

static final String MENU_ACCESSIBILITY_ROLE_DESCRIPTION_CLOSED
static final String MENU_ACCESSIBILITY_ROLE_DESCRIPTION_OPENED

Detailed Description

ViewModel for managing backup menu UI state and accessibility texts.

Holds an observable list of saved games, the currently selected backup, and provides localized StringBindings for UI labels, accessibility, tooltips, and role descriptions.

Uses I18n singleton for localization with automatic updates on locale changes.

Constructor & Destructor Documentation

◆ MenuSaveViewModel()

fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.MenuSaveViewModel ( PlayerStateHolder playerStateHolder,
GameService gameService )

Initializes the MenuSaveViewModel with necessary infrastructure and reactive bindings.

Configures i18n-aware StringBindings for UI labels, tooltips, and accessibility roles. Triggers initial game list population.

Parameters
playerStateHolderholder for persistent player state
gameServiceservice for game management operations
Here is the call graph for this function:

Member Function Documentation

◆ backupAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.backupAccessibleTextProperty ( )

Returns the reactive binding for the backup accessible text property.

Returns
the StringBinding for the backup accessible text
Here is the call graph for this function:

◆ backupRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.backupRoleDescriptionProperty ( )

Returns the reactive binding for the backup role description property.

Returns
the StringBinding for the backup role description
Here is the call graph for this function:

◆ backupTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.backupTextProperty ( )

Returns the reactive binding for the backup text property.

Returns
the StringBinding for the backup text
Here is the call graph for this function:

◆ backupTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.backupTooltipProperty ( )

Returns the reactive binding for the backup tooltip property.

Returns
the StringBinding for the backup tooltip
Here is the call graph for this function:

◆ cellConfirmationMessageProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.cellConfirmationMessageProperty ( )

Returns the reactive binding for the cell confirmation message property.

Returns
the StringBinding for the cell confirmation message
Here is the call graph for this function:

◆ cellConfirmationTitleProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.cellConfirmationTitleProperty ( )

Returns the reactive binding for the cell delete accessible text property.

Returns
the StringBinding for the cell delete accessible text
Here is the call graph for this function:

◆ cellDeleteAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.cellDeleteAccessibleTextProperty ( )

Returns the reactive binding for the cell delete accessible text property.

Returns
the StringBinding for the cell delete accessible text
Here is the call graph for this function:

◆ createABackup()

void fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.createABackup ( )

Backup the player's game.

Creates a copy of the current game state and refreshes the player's game list.

Exceptions
NullPointerExceptionif the current player or selected game is null.
Here is the call graph for this function:

◆ createFormattedAndConcatenatedBinding()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.createFormattedAndConcatenatedBinding ( String key,
String suffixKey )
private

Creates a localized StringBinding by concatenating the value of two keys.

Updates automatically when the locale changes.

Parameters
keythe base key
suffixKeythe key for the suffix to append
Returns
a StringBinding for the combined localized value

◆ createStringBinding()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.createStringBinding ( String key)
private

Creates a simple localized StringBinding for the given key.

Updates automatically when the locale changes.

Parameters
keythe i18n key
Returns
a StringBinding for the localized value

◆ deleteABackup()

void fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.deleteABackup ( GameDto gameToDelete)

Deletes the specified game backup and refreshes the list.

Parameters
gameToDeletegame backup to be removed; must not be null
Here is the call graph for this function:

◆ getCurrentSelectedGameDto()

GameDto fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.getCurrentSelectedGameDto ( )

Retrieves the currently selected game for the active player.

Returns
the active GameDto
Exceptions
NullPointerExceptionif the player or their selected game is null

◆ getGames()

ObservableList< GameDto > fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.getGames ( )

Returns the observable list of games.

Returns
the ObservableList of GameDto
Here is the call graph for this function:

◆ loadGames()

void fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.loadGames ( )
private

Loads games into the observable list.

◆ maxiBackupAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.maxiBackupAccessibleTextProperty ( )

Returns the reactive binding for the maxi backup accessible text property.

Returns
the StringBinding for the maxi backup accessible text
Here is the call graph for this function:

◆ maxiBackupRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.maxiBackupRoleDescriptionProperty ( )

Returns the reactive binding for the maxi backup role description property.

Returns
the StringBinding for the maxi backup role description
Here is the call graph for this function:

◆ maxiBackupTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.maxiBackupTextProperty ( )

Returns the reactive binding for the maxi backup text property.

Returns
the StringBinding for the maxi backup text
Here is the call graph for this function:

◆ maxiBackupTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.maxiBackupTooltipProperty ( )

Returns the reactive binding for the maxi backup tooltip property.

Returns
the StringBinding for the maxi backup tooltip
Here is the call graph for this function:

◆ reduceAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.reduceAccessibleTextProperty ( )

Returns the reactive binding for the reduce button accessible text property.

Returns
the StringBinding for the reduce button accessible text
Here is the call graph for this function:

◆ reduceTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.reduceTextProperty ( )

Returns the reactive binding for the reduce button text property.

Returns
the StringBinding for the reduce button text
Here is the call graph for this function:

◆ reduceTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.reduceTooltipProperty ( )

Returns the reactive binding for the reduce button accessible text property.

Returns
the StringBinding for the reduce button accessible text
Here is the call graph for this function:

◆ refreshGames()

void fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.refreshGames ( )

Refreshes the game list and re-synchronizes the selected backup.

Used when the active player changes to update the UI state.

Here is the call graph for this function:

◆ restoreABackup()

void fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.restoreABackup ( GameDto gameToRestore)

Restores a specific game backup.

Switches the active selection to the provided game and refreshes the inventory.

Parameters
gameToRestorethe target game to restore; must not be null.
Exceptions
NullPointerExceptionif the current player's game context is missing.
Here is the call graph for this function:

◆ saveAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.saveAccessibleTextProperty ( )

Returns the property for the currently selected backup.

Returns
the ObjectProperty for selected GameDto
Here is the call graph for this function:

◆ saveRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.saveRoleDescriptionProperty ( )

Returns the reactive binding for the save tooltip property.

Returns
the StringBinding for the save tooltip
Here is the call graph for this function:

◆ saveTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.saveTextProperty ( )

Returns the reactive binding for the save text property.

Returns
the StringBinding for the save text
Here is the call graph for this function:

◆ saveTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.saveTooltipProperty ( )

Returns the reactive binding for the save tooltip property.

Returns
the StringBinding for the save tooltip
Here is the call graph for this function:

◆ selectedBackupProperty()

ObjectProperty< GameDto > fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.selectedBackupProperty ( )

Returns the property for the currently selected backup.

Returns
the ObjectProperty for selected GameDto
Here is the call graph for this function:

◆ setSelectedBackup()

void fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.setSelectedBackup ( )
private

Sets the selected backup to the one marked as selected, or defaults to the first in the list if none are selected.

Member Data Documentation

◆ backupAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.backupAccessibleText
private

◆ backupRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.backupRoleDescription
private

◆ backupText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.backupText
private

◆ backupTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.backupTooltip
private

◆ cellConfirmationMessage

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.cellConfirmationMessage
private

◆ cellConfirmationTitle

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.cellConfirmationTitle
private

◆ cellDeleteAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.cellDeleteAccessibleText
private

◆ games

final ObservableList<GameDto> fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.games = FXCollections.observableArrayList()
private

◆ gameService

final GameService fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.gameService
private

◆ maxiBackupAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.maxiBackupAccessibleText
private

◆ maxiBackupRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.maxiBackupRoleDescription
private

◆ maxiBackupText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.maxiBackupText
private

◆ maxiBackupTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.maxiBackupTooltip
private

◆ MENU_ACCESSIBILITY_ROLE_DESCRIPTION_CLOSED

final String fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.MENU_ACCESSIBILITY_ROLE_DESCRIPTION_CLOSED
staticprivate
Initial value:
=
"menu.accessibility.role.description.closed"

◆ MENU_ACCESSIBILITY_ROLE_DESCRIPTION_OPENED

final String fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.MENU_ACCESSIBILITY_ROLE_DESCRIPTION_OPENED
staticprivate
Initial value:
=
"menu.accessibility.role.description.opened"

◆ playerStateHolder

final PlayerStateHolder fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.playerStateHolder
private

◆ reduceAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.reduceAccessibleText
private

◆ reduceText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.reduceText
private

◆ reduceTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.reduceTooltip
private

◆ saveAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.saveAccessibleText
private

◆ saveRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.saveRoleDescription
private

◆ saveText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.saveText
private

◆ saveTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.saveTooltip
private

◆ selectedBackup

final ObjectProperty<GameDto> fr.softsf.sudokufx.viewmodel.MenuSaveViewModel.selectedBackup = new SimpleObjectProperty<>()
private

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