Interface ViewMixin<M,C extends ControllerBase<M>>
- All Known Implementing Classes:
AdminController
,AdminHomeController
,AdminNormalLeaderboard
,CountDownController
,CreditsController
,EdgeClickScreenController
,EndScreenController
,GamePageController
,HelpPageController
,HighscoreScreenController
,HomePageController
,LoadingScreenController
,NameInputController
public interface ViewMixin<M,C extends ControllerBase<M>>
Use this interface for all of your GUI-parts to assure implementation consistency.
It provides the basic functionality to make MVC run.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
static final record
static final record
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
addStylesheetFiles
(String... stylesheetFiles) just a convenience method to load stylesheet filesdefault void
void
completely initialize all necessary UI-elements (like buttons, text-fields, etc.default void
Everything that needs to be done to initialize the UI-part itself.void
the method name says it alldefault void
default <V> ViewMixin.Converter<V>
onChangeOf
(ObservableValue<V> observableValue) Starting point for registering an observer.default ViewMixin.ActionTrigger<Double>
onChangeOf
(javafx.beans.property.DoubleProperty property) default ViewMixin.ActionTrigger<Integer>
onChangeOf
(javafx.beans.property.IntegerProperty property) default <V> ViewMixin.ActionTrigger<V>
onChangeOf
(javafx.beans.property.Property<V> property) default void
setupModelToUiBindings
(M model) Whenever an 'ObservableValue' in 'model' changes, the UI must be updated.default void
setupUiToActionBindings
(C controller) Triggering some action on Controller if the user interacts with the UI.default void
At the Startup, this method gets called.
-
Method Details
-
init
-
layoutParts
void layoutParts()the method name says it all -
addStylesheetFiles
just a convenience method to load stylesheet files- Parameters:
stylesheetFiles
- name of the stylesheet file
-
loadFonts
- Parameters:
fonts
- just a convenience method to load additional fonts
-
getStylesheets
-
onChangeOf
Starting point for registering an observer.- Type Parameters:
V
-- Parameters:
observableValue
- the value that needs to be observed- Returns:
- a 'Converter' to specify a function converting the type of 'ObservableValue' into the type of the 'Property'
-
onChangeOf
-
onChangeOf
-
onChangeOf
-
initializeSelf
default void initializeSelf()Everything that needs to be done to initialize the UI-part itself.For GUIs loading stylesheet-files or additional fonts are typical examples.
-
initializeParts
void initializeParts()completely initialize all necessary UI-elements (like buttons, text-fields, etc. on GUI or distance sensors on PUI ) -
setupUiToActionBindings
Triggering some action on Controller if the user interacts with the UI.There's no need to have access to model for this task.
All EventHandlers will call a single method on the Controller.
If you are about to call more than one method, you should introduce a new method on Controller.
-
setupModelToUiBindings
Whenever an 'ObservableValue' in 'model' changes, the UI must be updated.There's no need to have access to controller for this task.
Register all necessary observers here.
-
startUp
At the Startup, this method gets called.Perfect, if a function in the controller or in the pui needs to be run exactly once.
-