ViewModel managing player menu UI state and localized accessibility texts. More...
Public Member Functions | |
| MenuPlayerViewModel (PlayerStateHolder playerStateHolder, PlayerService playerService) | |
| void | cancelNewPlayer () |
| Clears the text field and stops editing when focus is lost. | |
| StringBinding | cellButtonAccessibleTextProperty () |
| StringBinding | cellConfirmationMessageProperty () |
| StringBinding | cellConfirmationTitleProperty () |
| void | createNewPlayerByName () |
| Validates and sets the player name into the state holder ONLY on Enter key. | |
| void | deletePlayer (PlayerDto playerDto) |
| Deletes the specified player from the system and refreshes the UI state. | |
| StringBinding | editAccessibleTextProperty () |
| ReadOnlyBooleanProperty | editingProperty () |
| StringBinding | editRoleDescriptionProperty () |
| StringBinding | editTooltipProperty () |
| TextFormatter.Change | filterPlayerNameInput (TextFormatter.Change change) |
| Filters input changes to enforce character and length constraints. | |
| ObservableList< PlayerDto > | getPlayers () |
| StringBinding | maxiPlayerRoleDescriptionProperty () |
| StringBinding | maxiPlayerTooltipProperty () |
| StringBinding | newAccessibleTextProperty () |
| StringBinding | newRoleDescriptionProperty () |
| StringBinding | newTextProperty () |
| StringBinding | newTooltipProperty () |
| StringBinding | playerAccessibleTextProperty () |
| Property< String > | playerNameInputProperty () |
| Returns the property for the new player name input. | |
| ReadOnlyObjectProperty< PlayerNameStatus > | playerNameStatusProperty () |
| StringBinding | playerRoleDescriptionProperty () |
| ReadOnlyBooleanProperty | playerSwitchedSignalProperty () |
| StringBinding | playerTooltipProperty () |
| void | prepareNewPlayer () |
| Prepares the text field for a new player. | |
| StringBinding | reduceAccessibleTextProperty () |
| StringBinding | reduceTextProperty () |
| StringBinding | reduceTooltipProperty () |
| ObjectProperty< PlayerDto > | selectedPlayerProperty () |
| void | validatePlayerName (String currentText) |
| Validates the input player name against formatting and availability constraints. | |
Static Public Attributes | |
| static final String | MENU_PLAYER_BUTTON_NEW_PLAYER_TEXT |
Private Member Functions | |
| StringBinding | createAppendedStringBinding () |
| Creates a localized binding by concatenating two keys. | |
| StringBinding | createFormattedAndConcatenatedBinding (String key, String suffixKey) |
| Creates a localized binding combining a formatted message and suffix. | |
| StringBinding | createFormattedBinding (String key, Supplier< String > argSupplier) |
| Creates a formatted localized binding with player name argument. | |
| StringBinding | createStringBinding (String key) |
| Creates a simple localized binding for a given key. | |
| void | loadPlayers () |
| Loads players into the observable list. | |
| String | playerName () |
| Returns the name of the currently selected player. | |
| void | refreshUI () |
| Refreshes the UI state by synchronizing the current player, toggling the switched signal, and reloading the player list. | |
| void | runGuarded (Runnable action) |
| Executes the provided action within a guarded block to prevent reentrant updates and state corruption. | |
| void | setSelectedPlayer () |
| Sets the selected player to the one marked as selected or first in the list. | |
Private Attributes | |
| final StringBinding | cellButtonAccessibleText |
| final StringBinding | cellConfirmationMessage |
| final StringBinding | cellConfirmationTitle |
| final StringBinding | editAccessibleText |
| final ReadOnlyBooleanWrapper | editing = new ReadOnlyBooleanWrapper(false) |
| final StringBinding | editRoleDescription |
| final StringBinding | editTooltip |
| boolean | isLockedWhileUpdating = false |
| final StringBinding | maxiPlayerRoleDescription |
| final StringBinding | maxiPlayerTooltip |
| final StringBinding | newAccessibleText |
| final StringBinding | newRoleDescription |
| final StringBinding | newText |
| final StringBinding | newTooltip |
| final StringBinding | playerAccessibleText |
| final StringProperty | playerNameInput |
| final ReadOnlyObjectWrapper< PlayerNameStatus > | playerNameStatus |
| final StringBinding | playerRoleDescription |
| final ObservableList< PlayerDto > | players = FXCollections.observableArrayList() |
| final PlayerService | playerService |
| final PlayerStateHolder | playerStateHolder |
| final ReadOnlyBooleanWrapper | playerSwitchedSignal = new ReadOnlyBooleanWrapper(false) |
| final StringBinding | playerTooltip |
| final StringBinding | reduceAccessibleText |
| final StringBinding | reduceText |
| final StringBinding | reduceTooltip |
Static Private Attributes | |
| static final int | MAX_NAME_LENGTH = 50 |
| static final String | MENU_ACCESSIBILITY_ROLE_DESCRIPTION_CLOSED |
| static final String | MENU_ACCESSIBILITY_ROLE_DESCRIPTION_OPENED |
| static final String | MENU_ACCESSIBILITY_ROLE_DESCRIPTION_SUBMENU_OPTION |
| static final String | MENU_PLAYER_BUTTON_PLAYER_ACCESSIBILITY |
ViewModel managing player menu UI state and localized accessibility texts.
Provides observable players list and reactive StringBindings for UI labels, tooltips, and roles, updated on locale or selection changes.
Assumes selected player has a valid non-blank name as enforced upstream.
| fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.MenuPlayerViewModel | ( | PlayerStateHolder | playerStateHolder, |
| PlayerService | playerService ) |
| void fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.cancelNewPlayer | ( | ) |
Clears the text field and stops editing when focus is lost.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.cellButtonAccessibleTextProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.cellConfirmationMessageProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.cellConfirmationTitleProperty | ( | ) |
|
private |
Creates a localized binding by concatenating two keys.
Updates when locale changes.
|
private |
Creates a localized binding combining a formatted message and suffix.
Updates when locale or selected player changes.
|
private |
Creates a formatted localized binding with player name argument.
Updates when locale or selected player changes.
| void fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.createNewPlayerByName | ( | ) |
Validates and sets the player name into the state holder ONLY on Enter key.
|
private |
Creates a simple localized binding for a given key.
Updates when locale changes.
| void fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.deletePlayer | ( | PlayerDto | playerDto | ) |
Deletes the specified player from the system and refreshes the UI state.
| playerDto | the player to delete; must not be null |
| IllegalArgumentException | if playerDto is null |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.editAccessibleTextProperty | ( | ) |
| ReadOnlyBooleanProperty fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.editingProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.editRoleDescriptionProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.editTooltipProperty | ( | ) |
| TextFormatter.Change fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.filterPlayerNameInput | ( | TextFormatter.Change | change | ) |
Filters input changes to enforce character and length constraints.
| change | the JavaFX text formatter change context |
| ObservableList< PlayerDto > fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.getPlayers | ( | ) |
|
private |
Loads players into the observable list.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.maxiPlayerRoleDescriptionProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.maxiPlayerTooltipProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.newAccessibleTextProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.newRoleDescriptionProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.newTextProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.newTooltipProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.playerAccessibleTextProperty | ( | ) |
|
private |
Returns the name of the currently selected player.
| Property< String > fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.playerNameInputProperty | ( | ) |
Returns the property for the new player name input.
| ReadOnlyObjectProperty< PlayerNameStatus > fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.playerNameStatusProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.playerRoleDescriptionProperty | ( | ) |
| ReadOnlyBooleanProperty fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.playerSwitchedSignalProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.playerTooltipProperty | ( | ) |
| void fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.prepareNewPlayer | ( | ) |
Prepares the text field for a new player.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.reduceAccessibleTextProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.reduceTextProperty | ( | ) |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.reduceTooltipProperty | ( | ) |
|
private |
Refreshes the UI state by synchronizing the current player, toggling the switched signal, and reloading the player list.
|
private |
Executes the provided action within a guarded block to prevent reentrant updates and state corruption.
| action | the action to execute |
| ObjectProperty< PlayerDto > fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.selectedPlayerProperty | ( | ) |
|
private |
Sets the selected player to the one marked as selected or first in the list.
| void fr.softsf.sudokufx.viewmodel.MenuPlayerViewModel.validatePlayerName | ( | String | currentText | ) |
Validates the input player name against formatting and availability constraints.
Updates the status property to:
PlayerNameStatus#EMPTY: if text is null or blank. PlayerNameStatus#INVALID: if length exceeds 50 or pattern mismatches. PlayerNameStatus#UNAVAILABLE: if name matches current player, the anonymous token "—", or an existing player. PlayerNameStatus#VALID: if all checks pass. | currentText | the raw text input from the view |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
static |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |