Class TotemFXMLController

java.lang.Object
it.polimi.ingsw.gc14.View.GUI.TotemFXMLController

public class TotemFXMLController extends Object
FXML controller for the totem selection scene.

Displays the available totems and lets the current player choose one; other players see a waiting banner.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private javafx.scene.image.ImageView
    Background image displayed behind the totem selection grid.
    private javafx.scene.control.Button
    Button that submits the selected totem to the server.
    Client controller for sending the totem choice.
    private javafx.scene.layout.HBox
    HBox containing the totem card widgets.
    private javafx.scene.layout.StackPane
    The StackPane frame of the currently selected totem card, or null.
    private int
    Index of the currently selected totem, or -1 if none selected.
    private javafx.scene.control.Label
    Banner label showing whose turn it is to choose a totem.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private javafx.scene.layout.VBox
    buildCard(Totems totem, int idx, boolean interactive)
    Builds a totem card widget; if interactive, wires click/hover handlers and selection logic.
    private String
    Returns the totem name with only the first letter capitalized.
    private String
    frameStyle(boolean selected)
    Returns the CSS style string for the totem card frame, highlighting it when selected.
    void
    Initializes the scene: sets the background image to fill the screen.
    private String
    nameStyle(boolean selected)
    Returns the CSS style string for the totem name label, brightening it when selected.
    private void
    Submits the selected totem index to the controller when the confirm button is clicked.
    void
    Renders the totem selection cards with entry animations.
    void
    Injects the client controller into this FXML controller.
    private void
    updateBanner(String chooser, boolean myTurn)
    Updates the turn banner text and style based on whether it is the local player's turn.
    private void
    updateConfirmButton(boolean enabled)
    Enables or disables the confirm button and updates its visual opacity to reflect the state.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • backgroundImage

      private javafx.scene.image.ImageView backgroundImage
      Background image displayed behind the totem selection grid.
    • mainHBox

      private javafx.scene.layout.HBox mainHBox
      HBox containing the totem card widgets.
    • turnBanner

      private javafx.scene.control.Label turnBanner
      Banner label showing whose turn it is to choose a totem.
    • confirmButton

      private javafx.scene.control.Button confirmButton
      Button that submits the selected totem to the server.
    • controller

      private ClientController controller
      Client controller for sending the totem choice.
    • selectedIndex

      private int selectedIndex
      Index of the currently selected totem, or -1 if none selected.
    • selectedFrame

      private javafx.scene.layout.StackPane selectedFrame
      The StackPane frame of the currently selected totem card, or null.
  • Constructor Details

    • TotemFXMLController

      public TotemFXMLController()
  • Method Details

    • setController

      public void setController(ClientController controller)
      Injects the client controller into this FXML controller.
      Parameters:
      controller - the client controller to use.
    • initialize

      public void initialize()
      Initializes the scene: sets the background image to fill the screen.
    • render

      public void render()
      Renders the totem selection cards with entry animations. Disables interaction for players who are not the current chooser.
    • updateBanner

      private void updateBanner(String chooser, boolean myTurn)
      Updates the turn banner text and style based on whether it is the local player's turn.
    • buildCard

      private javafx.scene.layout.VBox buildCard(Totems totem, int idx, boolean interactive)
      Builds a totem card widget; if interactive, wires click/hover handlers and selection logic.
    • updateConfirmButton

      private void updateConfirmButton(boolean enabled)
      Enables or disables the confirm button and updates its visual opacity to reflect the state.
    • frameStyle

      private String frameStyle(boolean selected)
      Returns the CSS style string for the totem card frame, highlighting it when selected.
    • nameStyle

      private String nameStyle(boolean selected)
      Returns the CSS style string for the totem name label, brightening it when selected.
    • capitalize

      private String capitalize(Totems t)
      Returns the totem name with only the first letter capitalized.
    • onConfirm

      private void onConfirm()
      Submits the selected totem index to the controller when the confirm button is clicked.