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

ViewModel managing menu options UI state and accessibility strings. More...

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

Public Member Functions

 MenuOptionsViewModel (AudioService audioService, AsyncFileProcessorService asyncFileProcessorService, PlayerStateHolder playerStateHolder, OptionsService optionsService, ToasterService toasterService)
 Initializes the MenuOptionsViewModel with necessary infrastructure and reactive bindings.
void applyAndPersistIfNeededBackgroundImage (File selectedFile, GridPane sudokuFX, boolean shouldPersist)
 Applies a background image to the specified GridPane.
void applyAndPersistIfNeededOptionsColor (GridPane sudokuFX, Color color, boolean shouldPersist)
 Applies the given color as the background of the specified GridPane.
ReadOnlyBooleanProperty gridOpacityProperty ()
void init (GridPane sudokuFX)
 Initializes the menu options UI state for the current player, including:
StringBinding optionsAccessibleTextProperty ()
StringBinding optionsClearSongAccessibleTextProperty ()
StringBinding optionsClearSongRoleDescriptionProperty ()
StringBinding optionsClearSongTooltipProperty ()
StringBinding optionsColorAccessibleTextProperty ()
ObjectProperty< Color > optionsColorProperty ()
 Returns the options color property, allowing UI components to bind to or observe changes in the selected color.
StringBinding optionsColorRoleDescriptionProperty ()
StringBinding optionsColorTooltipProperty ()
StringBinding optionsImageAccessibleTextProperty ()
StringBinding optionsImageRoleDescriptionProperty ()
StringBinding optionsImageTextProperty ()
StringBinding optionsImageTooltipProperty ()
StringBinding optionsMenuMaxiAccessibleTextProperty ()
StringBinding optionsMenuMaxiRoleDescriptionProperty ()
StringBinding optionsMenuMaxiTextProperty ()
StringBinding optionsMenuMaxiTooltipProperty ()
StringBinding optionsMuteAccessibleTextProperty ()
StringBinding optionsMuteIconProperty ()
StringBinding optionsMuteRoleDescriptionProperty ()
StringBinding optionsMuteTextProperty ()
StringBinding optionsMuteTooltipProperty ()
StringBinding optionsOpacityAccessibleTextProperty ()
StringBinding optionsOpacityIconProperty ()
StringBinding optionsOpacityRoleDescriptionProperty ()
StringBinding optionsOpacityTextProperty ()
StringBinding optionsOpacityTooltipProperty ()
StringBinding optionsReduceAccessibleTextProperty ()
StringBinding optionsReduceTextProperty ()
StringBinding optionsReduceTooltipProperty ()
StringBinding optionsRoleDescriptionProperty ()
StringBinding optionsSongAccessibleTextProperty ()
StringBinding optionsSongRoleDescriptionProperty ()
StringBinding optionsSongTextProperty ()
StringBinding optionsSongTooltipProperty ()
StringBinding optionsTextProperty ()
StringBinding optionsTooltipProperty ()
void resetSongPath ()
 Resets the song path by clearing the current selection, persisting the change, and showing a toast notification.
void restoreCurrentOptions (GridPane sudokuFX)
void saveSong (File file)
 Saves the provided song file path to the database and shows a confirmation toast.
ReadOnlyBooleanProperty songIsBlankProperty ()
boolean toggleGridOpacityAndPersist ()
 Toggles the grid opacity mode, persists the new state in the database, updates
gridOpacityProperty
, and returns the actual updated value.
void toggleMuteAndPersist ()
 Toggles the audio mute state, persists the new value in OptionsDto, updates the AudioService, and reflects the change in muteProperty.

Static Public Attributes

static final int HEXCOLOR_BEGIN_INDEX = 2
static final int HEXCOLOR_END_INDEX = 10
static final String SUDOKU_FX_MUST_NOT_BE_NULL = "sudokuFX must not be null"

Private Member Functions

void applyOptionsToUI (OptionsDto options, GridPane sudokuFX)
 Applies visual options to the sudokuFX component.
void checkInitialized ()
 Checks whether the MenuOptionsViewModel has been initialized via init(GridPane).
Observable[] concatDependencies (Observable... dependencies)
 Utility: always observe the locale in addition to custom dependencies.
StringBinding createFormattedAndConcatenatedBinding (Supplier< String > keySupplier, Supplier< String > argSupplier, String suffixKey, Observable... dependencies)
 Creates a localized binding combining a formatted message and a suffix.
StringBinding createFormattedBinding (String key, String suffixKey)
 Creates a StringBinding that returns the concatenation of two localized strings (main key and suffix key), updating automatically when the locale changes.
StringBinding createFormattedBinding (Supplier< String > keySupplier, Supplier< String > argSupplier, Observable... dependencies)
 Creates a formatted localized binding with one dynamic argument.
StringBinding createStringBinding (String key)
 Creates a StringBinding that returns the localized string for the given key, updating automatically when the locale changes.
String gridOpacityText (boolean isOpaque)
 Returns the localized text corresponding to the grid opacity state.
StringBinding initMuteAccessibleText ()
 Creates the accessibility label for the mute button, based on the current mute state.
StringBinding initMuteIcon ()
 Creates the icon name for the mute button, depending on whether mute is active or not.
StringBinding initMuteText ()
 Creates the visible label for the mute button, reflecting the current mute state.
StringBinding initMuteTooltip ()
 Creates the tooltip for the mute button, combining dynamic mute info and submenu role.
StringBinding initOpacityAccessibleText ()
 Creates the accessibility label for the opacity button, based on the inverse of the current grid opacity state.
StringBinding initOpacityIcon ()
 Creates the icon name for the opacity button, depending on whether opacity is enabled or not.
StringBinding initOpacityText ()
 Creates the visible label for the opacity button, reflecting the current grid opacity value.
StringBinding initOpacityTooltip ()
 Creates the tooltip for the opacity button, combining dynamic label and submenu role.
StringBinding initSongAccessibleText ()
 Creates the accessibility label for the song button, depending on whether the song field is empty.
StringBinding initSongText ()
 Creates the visible label for the song button, adapting to whether a song is present or not.
StringBinding initSongTooltip ()
 Creates the tooltip for the song button, combining dynamic song info and submenu role.
String muteInfo (boolean isMuted)
 Returns the localized information about the current mute state.
String muteText (boolean isMuted)
 Returns the localized text corresponding to the mute state.
void persistImagePath (String imagePath)
 Persists the given image path in the current player's OptionsDto if it differs from the existing path, then refreshes the player.
void persistSongPath (String absolutePath, String name)
 Persists the audio file path (songPath) in the current player's options.
void updateSongNameFromPath (String rawPath)
 Updates the song display name by extracting the filename from the provided path.

Private Attributes

final AsyncFileProcessorService asyncFileProcessorService
final AudioService audioService
final AudioUtils audioUtils
Task<?> currentTask
final ReadOnlyBooleanWrapper gridOpacityProperty = new ReadOnlyBooleanWrapper(false)
final ImageUtils imageUtils
boolean initialized = false
final ReadOnlyBooleanWrapper muteProperty = new ReadOnlyBooleanWrapper(true)
final StringBinding optionsAccessibleText
final StringBinding optionsClearSongAccessibleText
final StringBinding optionsClearSongRoleDescription
final StringBinding optionsClearSongTooltip
final StringBinding optionsColorAccessibleText
final ObjectProperty< Color > optionsColorProperty
final StringBinding optionsColorRoleDescription
final StringBinding optionsColorTooltip
final StringBinding optionsImageAccessibleText
final StringBinding optionsImageRoleDescription
final StringBinding optionsImageText
final StringBinding optionsImageTooltip
final StringBinding optionsMenuMaxiAccessibleText
final StringBinding optionsMenuMaxiRoleDescription
final StringBinding optionsMenuMaxiText
final StringBinding optionsMenuMaxiTooltip
final StringBinding optionsMuteAccessibleText
final StringBinding optionsMuteIcon
final StringBinding optionsMuteRoleDescription
final StringBinding optionsMuteText
final StringBinding optionsMuteTooltip
final StringBinding optionsOpacityAccessibleText
final StringBinding optionsOpacityIcon
final StringBinding optionsOpacityRoleDescription
final StringBinding optionsOpacityText
final StringBinding optionsOpacityTooltip
final StringBinding optionsReduceAccessibleText
final StringBinding optionsReduceText
final StringBinding optionsReduceTooltip
final StringBinding optionsRoleDescription
final OptionsService optionsService
final StringBinding optionsSongAccessibleText
final StringBinding optionsSongRoleDescription
final StringBinding optionsSongText
final StringBinding optionsSongTooltip
final StringBinding optionsText
final StringBinding optionsTooltip
final PlayerStateHolder playerStateHolder
final ReadOnlyBooleanWrapper songIsBlankProperty = new ReadOnlyBooleanWrapper(true)
final ReadOnlyStringWrapper songProperty = new ReadOnlyStringWrapper("")
final ToasterService toasterService

Static Private Attributes

static final String ICON_MUTE_OFF = "\ue04f"
static final String ICON_MUTE_ON = "\ue050"
static final String ICON_OPACITY_OFF = "\ue0c4"
static final String ICON_OPACITY_ON = "\ue891"
static final Logger LOG = LoggerFactory.getLogger(MenuOptionsViewModel.class)
static final String ROLE_CLOSED = "menu.accessibility.role.description.closed"
static final String ROLE_OPENED = "menu.accessibility.role.description.opened"
static final String ROLE_SUBMENU_OPTION

Detailed Description

ViewModel managing menu options UI state and accessibility strings.

Provides localized StringBindings for button labels, tooltips, and roles, updating automatically on locale changes. Supports options color and image initialization and updates, including asynchronous image loading with user feedback.

Constructor & Destructor Documentation

◆ MenuOptionsViewModel()

fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.MenuOptionsViewModel ( AudioService audioService,
AsyncFileProcessorService asyncFileProcessorService,
PlayerStateHolder playerStateHolder,
OptionsService optionsService,
ToasterService toasterService )

Initializes the MenuOptionsViewModel with necessary infrastructure and reactive bindings.

Configures i18n-aware StringBindings for UI labels, tooltips, and accessibility roles.

Parameters
audioServiceservice for audio playback control
asyncFileProcessorServiceservice for background file and image processing
playerStateHolderholder for persistent player preferences
optionsServiceservice for loading and saving user options
toasterServiceservice for displaying transient UI notifications
Here is the call graph for this function:

Member Function Documentation

◆ applyAndPersistIfNeededBackgroundImage()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.applyAndPersistIfNeededBackgroundImage ( File selectedFile,
GridPane sudokuFX,
boolean shouldPersist )

Applies a background image to the specified GridPane.

Validates the file before starting an asynchronous task. On success, updates the background. Persistence of the image path occurs only if shouldPersist is true. All UI feedback and persistence are managed through thread-safe services.

Parameters
selectedFilethe image file to load; may be null
sudokuFXthe GridPane to update; must not be null
shouldPersisttrue to save the file path to the player's options, false to update UI only
Here is the call graph for this function:

◆ applyAndPersistIfNeededOptionsColor()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.applyAndPersistIfNeededOptionsColor ( GridPane sudokuFX,
Color color,
boolean shouldPersist )

Applies the given color as the background of the specified GridPane.

Optionally persists the color in the current player's options.

The color is converted to a hex string (RRGGBBAA). If persistence is enabled, the update only occurs if the color differs from the currently stored value.

Parameters
sudokuFXthe GridPane to update; must not be null
colorthe color to apply; must not be null
shouldPersisttrue to save to database, false for UI update only
Exceptions
NullPointerExceptionif sudokuFX or color is null
Here is the call graph for this function:

◆ applyOptionsToUI()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.applyOptionsToUI ( OptionsDto options,
GridPane sudokuFX )
private

Applies visual options to the sudokuFX component.

This is a refactored utility method that contains NO persistence logic.

Parameters
optionsthe visual options DTO containing colors, background, and UI settings
sudokuFXthe target grid component to which the styles are applied
Here is the call graph for this function:

◆ checkInitialized()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.checkInitialized ( )
private

Checks whether the MenuOptionsViewModel has been initialized via init(GridPane).

If the menu options have not been initialized, this method throws an exception to prevent operations on an uninitialized state.

Exceptions
IllegalStateExceptionif init(GridPane) has not been called

◆ concatDependencies()

Observable[] fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.concatDependencies ( Observable... dependencies)
private

Utility: always observe the locale in addition to custom dependencies.

◆ createFormattedAndConcatenatedBinding()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.createFormattedAndConcatenatedBinding ( Supplier< String > keySupplier,
Supplier< String > argSupplier,
String suffixKey,
Observable... dependencies )
private

Creates a localized binding combining a formatted message and a suffix.

Updates when locale or any of the given dependencies change.

Here is the call graph for this function:

◆ createFormattedBinding() [1/2]

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.createFormattedBinding ( String key,
String suffixKey )
private

Creates a StringBinding that returns the concatenation of two localized strings (main key and suffix key), updating automatically when the locale changes.

Parameters
keythe main i18n translation key
suffixKeythe suffix i18n translation key to append
Returns
a StringBinding with the concatenated localized string value

◆ createFormattedBinding() [2/2]

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.createFormattedBinding ( Supplier< String > keySupplier,
Supplier< String > argSupplier,
Observable... dependencies )
private

Creates a formatted localized binding with one dynamic argument.

Updates when locale or any of the given dependencies change.

Here is the call graph for this function:

◆ createStringBinding()

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

Creates a StringBinding that returns the localized string for the given key, updating automatically when the locale changes.

Parameters
keythe i18n translation key
Returns
a StringBinding with the localized string value

◆ gridOpacityProperty()

ReadOnlyBooleanProperty fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.gridOpacityProperty ( )

◆ gridOpacityText()

String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.gridOpacityText ( boolean isOpaque)
private

Returns the localized text corresponding to the grid opacity state.

Parameters
isOpaquetrue for "opaque" text, false for "transparent" text
Returns
localized string for the given opacity state

◆ init()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.init ( GridPane sudokuFX)

Initializes the menu options UI state for the current player, including:

  • Background color or image
  • Grid opacity mode
  • Audio mute state
  • Selected song

This method synchronizes the UI components with the current player's options and prepares the necessary properties for bindings. The ViewModel is marked as initialized at the start of this method to allow called methods (like applyAndPersistBackgroundImage) to safely check the initialization state.

Parameters
sudokuFXthe GridPane to apply background settings; must not be null
Exceptions
NullPointerExceptionif sudokuFX is null
Here is the call graph for this function:

◆ initMuteAccessibleText()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initMuteAccessibleText ( )
private

Creates the accessibility label for the mute button, based on the current mute state.

Here is the call graph for this function:

◆ initMuteIcon()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initMuteIcon ( )
private

Creates the icon name for the mute button, depending on whether mute is active or not.

◆ initMuteText()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initMuteText ( )
private

Creates the visible label for the mute button, reflecting the current mute state.

Here is the call graph for this function:

◆ initMuteTooltip()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initMuteTooltip ( )
private

Creates the tooltip for the mute button, combining dynamic mute info and submenu role.

Here is the call graph for this function:

◆ initOpacityAccessibleText()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initOpacityAccessibleText ( )
private

Creates the accessibility label for the opacity button, based on the inverse of the current grid opacity state.

Here is the call graph for this function:

◆ initOpacityIcon()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initOpacityIcon ( )
private

Creates the icon name for the opacity button, depending on whether opacity is enabled or not.

◆ initOpacityText()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initOpacityText ( )
private

Creates the visible label for the opacity button, reflecting the current grid opacity value.

Here is the call graph for this function:

◆ initOpacityTooltip()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initOpacityTooltip ( )
private

Creates the tooltip for the opacity button, combining dynamic label and submenu role.

Here is the call graph for this function:

◆ initSongAccessibleText()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initSongAccessibleText ( )
private

Creates the accessibility label for the song button, depending on whether the song field is empty.

Here is the call graph for this function:

◆ initSongText()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initSongText ( )
private

Creates the visible label for the song button, adapting to whether a song is present or not.

Here is the call graph for this function:

◆ initSongTooltip()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initSongTooltip ( )
private

Creates the tooltip for the song button, combining dynamic song info and submenu role.

Here is the call graph for this function:

◆ muteInfo()

String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.muteInfo ( boolean isMuted)
private

Returns the localized information about the current mute state.

This text is intended for tooltips or accessibility purposes, indicating whether the audio is currently muted or unmuted.

Parameters
isMutedtrue if audio is currently muted, false if unmuted
Returns
localized string representing the current audio state

◆ muteText()

String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.muteText ( boolean isMuted)
private

Returns the localized text corresponding to the mute state.

Parameters
isMutedtrue for "muted" audio, false for "unmuted" audio
Returns
localized string for the given mute state

◆ optionsAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsAccessibleTextProperty ( )
Here is the call graph for this function:

◆ optionsClearSongAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsClearSongAccessibleTextProperty ( )
Here is the call graph for this function:

◆ optionsClearSongRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsClearSongRoleDescriptionProperty ( )
Here is the call graph for this function:

◆ optionsClearSongTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsClearSongTooltipProperty ( )
Here is the call graph for this function:

◆ optionsColorAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorAccessibleTextProperty ( )
Here is the call graph for this function:

◆ optionsColorProperty()

ObjectProperty< Color > fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorProperty ( )

Returns the options color property, allowing UI components to bind to or observe changes in the selected color.

Returns
the ObjectProperty managing the options color

◆ optionsColorRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorRoleDescriptionProperty ( )
Here is the call graph for this function:

◆ optionsColorTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorTooltipProperty ( )
Here is the call graph for this function:

◆ optionsImageAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageAccessibleTextProperty ( )
Here is the call graph for this function:

◆ optionsImageRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageRoleDescriptionProperty ( )
Here is the call graph for this function:

◆ optionsImageTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageTextProperty ( )
Here is the call graph for this function:

◆ optionsImageTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageTooltipProperty ( )
Here is the call graph for this function:

◆ optionsMenuMaxiAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiAccessibleTextProperty ( )
Here is the call graph for this function:

◆ optionsMenuMaxiRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiRoleDescriptionProperty ( )
Here is the call graph for this function:

◆ optionsMenuMaxiTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiTextProperty ( )
Here is the call graph for this function:

◆ optionsMenuMaxiTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiTooltipProperty ( )
Here is the call graph for this function:

◆ optionsMuteAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteAccessibleTextProperty ( )
Here is the call graph for this function:

◆ optionsMuteIconProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteIconProperty ( )
Here is the call graph for this function:

◆ optionsMuteRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteRoleDescriptionProperty ( )
Here is the call graph for this function:

◆ optionsMuteTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteTextProperty ( )
Here is the call graph for this function:

◆ optionsMuteTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteTooltipProperty ( )
Here is the call graph for this function:

◆ optionsOpacityAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityAccessibleTextProperty ( )
Here is the call graph for this function:

◆ optionsOpacityIconProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityIconProperty ( )
Here is the call graph for this function:

◆ optionsOpacityRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityRoleDescriptionProperty ( )
Here is the call graph for this function:

◆ optionsOpacityTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityTextProperty ( )
Here is the call graph for this function:

◆ optionsOpacityTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityTooltipProperty ( )
Here is the call graph for this function:

◆ optionsReduceAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsReduceAccessibleTextProperty ( )
Here is the call graph for this function:

◆ optionsReduceTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsReduceTextProperty ( )
Here is the call graph for this function:

◆ optionsReduceTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsReduceTooltipProperty ( )
Here is the call graph for this function:

◆ optionsRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsRoleDescriptionProperty ( )
Here is the call graph for this function:

◆ optionsSongAccessibleTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongAccessibleTextProperty ( )
Here is the call graph for this function:

◆ optionsSongRoleDescriptionProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongRoleDescriptionProperty ( )
Here is the call graph for this function:

◆ optionsSongTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongTextProperty ( )
Here is the call graph for this function:

◆ optionsSongTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongTooltipProperty ( )
Here is the call graph for this function:

◆ optionsTextProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsTextProperty ( )
Here is the call graph for this function:

◆ optionsTooltipProperty()

StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsTooltipProperty ( )
Here is the call graph for this function:

◆ persistImagePath()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.persistImagePath ( String imagePath)
private

Persists the given image path in the current player's OptionsDto if it differs from the existing path, then refreshes the player.

If persisting the path succeeds, the current player is refreshed. If an exception occurs, the error is logged and an error toast is displayed to the user.

Parameters
imagePaththe image path to persist; may be empty to indicate no background image

◆ persistSongPath()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.persistSongPath ( String absolutePath,
String name )
private

Persists the audio file path (songPath) in the current player's options.

A copy of the current OptionsDto is created with the new path and persisted via OptionsService#updateOptions(OptionsDto). On success, the current player is refreshed, songProperty is updated, and an info toast is shown. On failure, the exception is logged and an error toast with details is displayed.

Parameters
absolutePaththe new audio file absolute path
namethe file name, used in toast messages

◆ resetSongPath()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.resetSongPath ( )

Resets the song path by clearing the current selection, persisting the change, and showing a toast notification.

Here is the call graph for this function:

◆ restoreCurrentOptions()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.restoreCurrentOptions ( GridPane sudokuFX)
Here is the call graph for this function:

◆ saveSong()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.saveSong ( File file)

Saves the provided song file path to the database and shows a confirmation toast.

The method validates that the file is non-null, exists, and has a supported audio format (MP3, WAV, AAC, M4A, AIF, AIFF). If valid, it updates the database and songProperty; otherwise, it logs an error and shows an error toast via ToasterVBox.

Parameters
filethe audio file to save; must not be null, must exist, and be a valid audio file
Here is the call graph for this function:

◆ songIsBlankProperty()

ReadOnlyBooleanProperty fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.songIsBlankProperty ( )

◆ toggleGridOpacityAndPersist()

boolean fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.toggleGridOpacityAndPersist ( )

Toggles the grid opacity mode, persists the new state in the database, updates
gridOpacityProperty
, and returns the actual updated value.

On success, an info toast indicates the new state. On failure, the exception is logged, an error toast is shown, and the property is restored to its previous value.

Returns
true if opaque mode is now active, false if transparent
Here is the call graph for this function:

◆ toggleMuteAndPersist()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.toggleMuteAndPersist ( )

Toggles the audio mute state, persists the new value in OptionsDto, updates the AudioService, and reflects the change in muteProperty.

On success, a user-friendly toast indicates the new mute state. On failure, the exception is logged and an error toast with details is displayed.

Here is the call graph for this function:

◆ updateSongNameFromPath()

void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.updateSongNameFromPath ( String rawPath)
private

Updates the song display name by extracting the filename from the provided path.

Parameters
rawPaththe full file path string; may be blank or null

Member Data Documentation

◆ asyncFileProcessorService

final AsyncFileProcessorService fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.asyncFileProcessorService
private

◆ audioService

final AudioService fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.audioService
private

◆ audioUtils

final AudioUtils fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.audioUtils
private

◆ currentTask

Task<?> fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.currentTask
private

◆ gridOpacityProperty

final ReadOnlyBooleanWrapper fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.gridOpacityProperty = new ReadOnlyBooleanWrapper(false)
private

◆ HEXCOLOR_BEGIN_INDEX

final int fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.HEXCOLOR_BEGIN_INDEX = 2
static

◆ HEXCOLOR_END_INDEX

final int fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.HEXCOLOR_END_INDEX = 10
static

◆ ICON_MUTE_OFF

final String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.ICON_MUTE_OFF = "\ue04f"
staticprivate

◆ ICON_MUTE_ON

final String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.ICON_MUTE_ON = "\ue050"
staticprivate

◆ ICON_OPACITY_OFF

final String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.ICON_OPACITY_OFF = "\ue0c4"
staticprivate

◆ ICON_OPACITY_ON

final String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.ICON_OPACITY_ON = "\ue891"
staticprivate

◆ imageUtils

final ImageUtils fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.imageUtils
private

◆ initialized

boolean fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.initialized = false
private

◆ LOG

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

◆ muteProperty

final ReadOnlyBooleanWrapper fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.muteProperty = new ReadOnlyBooleanWrapper(true)
private

◆ optionsAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsAccessibleText
private

◆ optionsClearSongAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsClearSongAccessibleText
private

◆ optionsClearSongRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsClearSongRoleDescription
private

◆ optionsClearSongTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsClearSongTooltip
private

◆ optionsColorAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorAccessibleText
private

◆ optionsColorProperty

final ObjectProperty<Color> fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorProperty
private
Initial value:
=
new SimpleObjectProperty<>(Color.WHITE)

◆ optionsColorRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorRoleDescription
private

◆ optionsColorTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorTooltip
private

◆ optionsImageAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageAccessibleText
private

◆ optionsImageRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageRoleDescription
private

◆ optionsImageText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageText
private

◆ optionsImageTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageTooltip
private

◆ optionsMenuMaxiAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiAccessibleText
private

◆ optionsMenuMaxiRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiRoleDescription
private

◆ optionsMenuMaxiText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiText
private

◆ optionsMenuMaxiTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiTooltip
private

◆ optionsMuteAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteAccessibleText
private

◆ optionsMuteIcon

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteIcon
private

◆ optionsMuteRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteRoleDescription
private

◆ optionsMuteText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteText
private

◆ optionsMuteTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteTooltip
private

◆ optionsOpacityAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityAccessibleText
private

◆ optionsOpacityIcon

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityIcon
private

◆ optionsOpacityRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityRoleDescription
private

◆ optionsOpacityText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityText
private

◆ optionsOpacityTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityTooltip
private

◆ optionsReduceAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsReduceAccessibleText
private

◆ optionsReduceText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsReduceText
private

◆ optionsReduceTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsReduceTooltip
private

◆ optionsRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsRoleDescription
private

◆ optionsService

final OptionsService fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsService
private

◆ optionsSongAccessibleText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongAccessibleText
private

◆ optionsSongRoleDescription

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongRoleDescription
private

◆ optionsSongText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongText
private

◆ optionsSongTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongTooltip
private

◆ optionsText

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsText
private

◆ optionsTooltip

final StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsTooltip
private

◆ playerStateHolder

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

◆ ROLE_CLOSED

final String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.ROLE_CLOSED = "menu.accessibility.role.description.closed"
staticprivate

◆ ROLE_OPENED

final String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.ROLE_OPENED = "menu.accessibility.role.description.opened"
staticprivate

◆ ROLE_SUBMENU_OPTION

final String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.ROLE_SUBMENU_OPTION
staticprivate
Initial value:
=
"menu.accessibility.role.description.submenu.option"

◆ songIsBlankProperty

final ReadOnlyBooleanWrapper fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.songIsBlankProperty = new ReadOnlyBooleanWrapper(true)
private

◆ songProperty

final ReadOnlyStringWrapper fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.songProperty = new ReadOnlyStringWrapper("")
private

◆ SUDOKU_FX_MUST_NOT_BE_NULL

final String fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.SUDOKU_FX_MUST_NOT_BE_NULL = "sudokuFX must not be null"
static

◆ toasterService

final ToasterService fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.toasterService
private

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