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.

  • Method Details

    • init

      default void init(C controller)
    • layoutParts

      void layoutParts()
      the method name says it all
    • addStylesheetFiles

      default void addStylesheetFiles(String... stylesheetFiles)
      just a convenience method to load stylesheet files
      Parameters:
      stylesheetFiles - name of the stylesheet file
    • loadFonts

      default void loadFonts(String... fonts)
      Parameters:
      fonts - just a convenience method to load additional fonts
    • getStylesheets

      List<String> getStylesheets()
    • onChangeOf

      default <V> ViewMixin.Converter<V> onChangeOf(ObservableValue<V> observableValue)
      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

      default <V> ViewMixin.ActionTrigger<V> onChangeOf(javafx.beans.property.Property<V> property)
    • onChangeOf

      default ViewMixin.ActionTrigger<Double> onChangeOf(javafx.beans.property.DoubleProperty property)
    • onChangeOf

      default ViewMixin.ActionTrigger<Integer> onChangeOf(javafx.beans.property.IntegerProperty property)
    • 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

      default void setupUiToActionBindings(C controller)
      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

      default void setupModelToUiBindings(M model)
      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

      default void startUp(C controller)
      At the Startup, this method gets called.

      Perfect, if a function in the controller or in the pui needs to be run exactly once.