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

ViewModel for managing difficulty level selection in the menu. More...

+ Collaboration diagram for fr.softsf.sudokufx.viewmodel.MenuLevelViewModel:

Public Member Functions

StringBinding accessibleTextBinding (PossibilityStarsHBox starsBox, String key)
 Creates a StringBinding for the accessibility text of the stars UI component associated with a difficulty level.
 
String getAccessibilityKeyForLevel (DifficultyLevel level)
 Returns the i18n key used for accessibility descriptions of a given difficulty level.
 
BooleanBinding isSelectedBinding (DifficultyLevel level)
 Returns a reactive BooleanBinding indicating whether the given difficulty level is currently selected.
 
StringBinding labelTextBinding (DifficultyLevel level)
 Creates a StringBinding for the localized label text of the specified difficulty level.
 
IntegerProperty percentageProperty ()
 Returns the property representing the stars completion percentage.
 
ObjectProperty< DifficultyLevelselectedLevelProperty ()
 Returns the property representing the currently selected difficulty level.
 
StringBinding selectedRoleDescriptionBinding ()
 Returns a StringBinding for the localized role description text used for accessibility, describing the selected difficulty level.
 
void setPercentage (int value)
 Sets the stars completion percentage.
 
void updateSelectedLevel (DifficultyLevel level, int stars)
 Updates the selected difficulty level and its associated stars percentage.
 

Private Member Functions

String getLevelNameKey (DifficultyLevel level)
 Returns the i18n key used for the display text of a given difficulty level.
 

Private Attributes

final ObjectProperty< DifficultyLevelselectedLevel = new SimpleObjectProperty<>(null)
 
final IntegerProperty starsPercentage = new SimpleIntegerProperty(100)
 

Detailed Description

ViewModel for managing difficulty level selection in the menu.

Manages the currently selected difficulty level and related UI bindings including labels, accessibility texts, and stars completion percentage. Provides reactive properties and bindings to facilitate JavaFX UI updates in response to state changes.

Member Function Documentation

◆ accessibleTextBinding()

StringBinding fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.accessibleTextBinding ( PossibilityStarsHBox starsBox,
String key )

Creates a StringBinding for the accessibility text of the stars UI component associated with a difficulty level.

The binding reacts to changes in selection, stars percentage, and locale.

Parameters
starsBoxthe stars UI component providing formatted text
keythe localization key for the accessibility text
Returns
a StringBinding providing the accessible description for screen readers
+ Here is the call graph for this function:

◆ getAccessibilityKeyForLevel()

String fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.getAccessibilityKeyForLevel ( DifficultyLevel level)

Returns the i18n key used for accessibility descriptions of a given difficulty level.

Parameters
levelthe difficulty level
Returns
the localization key string for accessibility description

◆ getLevelNameKey()

String fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.getLevelNameKey ( DifficultyLevel level)
private

Returns the i18n key used for the display text of a given difficulty level.

Parameters
levelthe difficulty level
Returns
the localization key string for the level display text

◆ isSelectedBinding()

BooleanBinding fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.isSelectedBinding ( DifficultyLevel level)

Returns a reactive BooleanBinding indicating whether the given difficulty level is currently selected.

Parameters
levelthe difficulty level to test
Returns
a BooleanBinding reflecting the selection state of the level

◆ labelTextBinding()

StringBinding fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.labelTextBinding ( DifficultyLevel level)

Creates a StringBinding for the localized label text of the specified difficulty level.

This binding updates automatically when the application locale changes.

Parameters
levelthe difficulty level
Returns
a StringBinding providing the localized label text
+ Here is the call graph for this function:

◆ percentageProperty()

IntegerProperty fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.percentageProperty ( )

Returns the property representing the stars completion percentage.

Returns
the stars completion percentage property

◆ selectedLevelProperty()

ObjectProperty< DifficultyLevel > fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.selectedLevelProperty ( )

Returns the property representing the currently selected difficulty level.

Returns
the selected difficulty level property

◆ selectedRoleDescriptionBinding()

StringBinding fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.selectedRoleDescriptionBinding ( )

Returns a StringBinding for the localized role description text used for accessibility, describing the selected difficulty level.

Returns
a StringBinding providing the role description text

◆ setPercentage()

void fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.setPercentage ( int value)

Sets the stars completion percentage.

Parameters
valuethe new percentage value to set

◆ updateSelectedLevel()

void fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.updateSelectedLevel ( DifficultyLevel level,
int stars )

Updates the selected difficulty level and its associated stars percentage.

Parameters
levelthe new difficulty level (must not be null)
starsthe completion percentage
Exceptions
IllegalArgumentExceptionif level is null

Member Data Documentation

◆ selectedLevel

final ObjectProperty<DifficultyLevel> fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.selectedLevel = new SimpleObjectProperty<>(null)
private

◆ starsPercentage

final IntegerProperty fr.softsf.sudokufx.viewmodel.MenuLevelViewModel.starsPercentage = new SimpleIntegerProperty(100)
private

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