Class SettingsController
Object
SettingsController
Controller responsible for tracking ePub specific settings and emulation
flags. It centralizes detection of device capabilities inside an ePub
reader, exposes the
--emulate CLO option used for debugging, and
keeps a single running lab when resources are constrained.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classShared settings describing the current ePub environment. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ButtonButton used to apply or open standalone lab.static final StringLabel of button to apply parameter settings.static final StringLabel of button to run in standalone mode.private final CLOptionCommand line option to mimic ePub modes and to disable device capabilities.private final LabelLabel displaying the current command-line options.private final ButtonButton used to reset parameters to default values.private final ButtonButton used to open help for command-line options.private static EvoLudoWebReference to the currently running lab in ePub mode.private static final SettingsController.SettingsGlobal settings describing the capabilities of the surrounding ePub environment.private final ButtonButton used to open the settings dialog. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanapplyUiToggles(Runnable dropHandlerRegistrar) Applies the appropriate UI toggles based on the current ePub mode.private voidDetects the capabilities of the current ePub host and updates the shared settings accordingly.Returns the--emulatecommand-line option.booleanhasKeys()Reports whether the ePub reader exposes keyboard input.booleanhasMouse()Reports whether the ePub reader exposes mouse input.booleanhasTouch()Reports whether the ePub reader exposes touch input.booleanisEPub()Reports whether the environment is an ePub reader.static booleanisReady()Reports whether no other ePub lab is currently running, allowing this lab to start execution.booleanReports whether the ePub lab runs on a standalone page instead of inline within text flow.static voidonModelRunning(EvoLudoWeb lab) Marks the supplied lab as the currently running ePub instance.static voidonModelStopped(EvoLudoWeb lab) Clears the running lab marker once execution stops.private voidupdateCLOControls(boolean editCLO) Updates the command-line option controls to reflect whether editing is allowed.
-
Field Details
-
BUTTON_STANDALONE
-
BUTTON_APPLY
-
SETTINGS
Global settings describing the capabilities of the surrounding ePub environment. -
runningLab
Reference to the currently running lab in ePub mode. Only a single lab may run at a time to avoid exhausting reader resources. -
cloField
Label displaying the current command-line options. -
applyButton
Button used to apply or open standalone lab. -
defaultButton
Button used to reset parameters to default values. -
helpButton
Button used to open help for command-line options. -
settingsButton
Button used to open the settings dialog. -
cloEmulate
Command line option to mimic ePub modes and to disable device capabilities.Note: for development/debugging only; should be disabled in production
-
-
Constructor Details
-
SettingsController
public SettingsController(Label cloField, Button applyButton, Button defaultButton, Button helpButton, Button settingsButton) Creates a new settings controller.- Parameters:
cloField- the command-line option fieldapplyButton- the apply buttondefaultButton- the default buttonhelpButton- the help buttonsettingsButton- the settings button
-
-
Method Details
-
getCloEmulate
Returns the--emulatecommand-line option.- Returns:
- CLO option controlling the emulation behaviour
-
applyUiToggles
Applies the appropriate UI toggles based on the current ePub mode. Enables or disables parameter editing widgets and registers drag-and-drop handlers when editing is permitted.- Parameters:
dropHandlerRegistrar- callback that installs drag-and-drop handlers- Returns:
trueif editing is enabled
-
isEPub
public boolean isEPub()Reports whether the environment is an ePub reader.- Returns:
truewhen running in an ePub context
-
isStandalone
public boolean isStandalone()Reports whether the ePub lab runs on a standalone page instead of inline within text flow.- Returns:
truefor standalone pages
-
hasKeys
public boolean hasKeys()Reports whether the ePub reader exposes keyboard input.- Returns:
trueif keyboard events are available
-
hasMouse
public boolean hasMouse()Reports whether the ePub reader exposes mouse input.- Returns:
trueif mouse events are available
-
hasTouch
public boolean hasTouch()Reports whether the ePub reader exposes touch input.- Returns:
trueif touch events are available
-
detectFeatures
private void detectFeatures()Detects the capabilities of the current ePub host and updates the shared settings accordingly. -
updateCLOControls
private void updateCLOControls(boolean editCLO) Updates the command-line option controls to reflect whether editing is allowed.- Parameters:
editCLO-truewhen editing is permitted
-
isReady
public static boolean isReady()Reports whether no other ePub lab is currently running, allowing this lab to start execution.- Returns:
truewhen no other ePub lab is running
-
onModelRunning
Marks the supplied lab as the currently running ePub instance. Only a single lab may run at once.- Parameters:
lab- running lab instance
-
onModelStopped
Clears the running lab marker once execution stops.- Parameters:
lab- lab that just stopped
-