java.lang.Object
it.polimi.ingsw.eriantys.client.gui.controllers.Controller
All Implemented Interfaces:
javafx.fxml.Initializable
Direct Known Subclasses:
AssistantCardsController, BoardController, CharacterCardsController, LobbiesController, LoginController, SchoolBoardController, TowersController, WaitingRoomController, WizardsController

public abstract class Controller extends Object implements javafx.fxml.Initializable
A class representing a GUI application controller which can manage *.fxml files and display data accordingly inside them. Every element of SceneName or PopupName enumerations should have a corresponding declaration as a subclass of this non-specific controller.
See Also:
  • Initializable
  • Field Details

  • Constructor Details

    • Controller

      public Controller()
  • Method Details

    • setApp

      public void setApp(GraphicalApplication app)
      Sets an internal reference to the GUI application.
      Parameters:
      app - the target app reference
      See Also:
    • setClient

      public void setClient(Client client)
      Sets an internal reference to the client who launched the GUI application.
      Parameters:
      client - the target client reference
      See Also:
    • setShowInfo

      public void setShowInfo(Consumer<String> showInfo)
      Sets the information show process coded within a Consumer.
      Parameters:
      showInfo - the functional interface which stores the show process behaviour
    • setShowError

      public void setShowError(Consumer<String> showError)
      Sets the error show process coded within a Consumer.
      Parameters:
      showError - the functional interface which stores the show process behaviour
    • roundBorders

      public void roundBorders(javafx.scene.image.ImageView img, double arcSize)
      A helper method to round borders of an image.
      Parameters:
      img - the target image reference
      arcSize - the desired size for the arc of the borders
    • applyGrayscale

      public void applyGrayscale(javafx.scene.image.ImageView img)
      A helper method to apply a grayscale filter on an image. The method could be used to visualize an item which cannot be selected.
      Parameters:
      img - the target image reference
    • applyGreenShade

      public void applyGreenShade(javafx.scene.image.ImageView img)
      A helper method to apply a green shade filter on an image. The method could be used to visualize an item which has been selected.
      Parameters:
      img - the target image reference
    • onChangeScene

      public void onChangeScene()
      Encloses the workflow of this on a scene change event. The method is called before the implementation of the controller itself to pre-process eventual data. The default behaviour of the method returns immediately. Any controller should override the method if necessary.
    • getTopLevelPane

      public abstract javafx.scene.layout.Pane getTopLevelPane()
      A getter for the Pane object associated with the FXML tag of highest level in the *.fxml file associated with this. The method is called in order to process a popup. Any controller should override the method if necessary.
      Returns:
      the highest level Pane