Class LeaderboardFXMLController

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

public class LeaderboardFXMLController extends Object
FXML controller for the end-of-game leaderboard scene.

Displays the final player rankings and a winner/game-over banner.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Runnable
    Action run when the player returns to the login screen (disconnect + scene switch).
    Client controller for fetching game state and sending actions.
    private static final Map<String, javafx.scene.image.Image>
    Shared image cache to avoid reloading resources multiple times.
    private javafx.scene.layout.VBox
    Main vertical container holding the outcome label and ranking rows.
    private javafx.stage.Popup
    Auto-hiding popup that shows detailed player card information.
    private javafx.scene.layout.VBox
    Content container inside popup.
    private javafx.scene.layout.VBox
    Vertical list populated with one HBox row per ranked player.
    private javafx.scene.layout.StackPane
    Root pane of the leaderboard scene; used to set the background and anchor the popup.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    addHoverZoom(javafx.scene.Node node)
    Scales node to 1.02× on hover and sets a hand cursor.
    private void
    addShadow(javafx.scene.Node node)
    Applies a static drop-shadow to node.
    private javafx.scene.layout.HBox
    createPlayerRow(int position, Player player)
    Builds a styled leaderboard row showing rank, totem, username, stats, and prestige for player.
    private javafx.scene.layout.HBox
    createStatItem(String iconPath, String value, double iconHeight)
    Creates a single icon + label widget for one stat type.
    private javafx.scene.layout.HBox
    Creates a compact icon+count stats strip for all card types of player.
    getPlayerCards(String username, String type)
    Returns a copy of the named card collection for username.
    void
    Initializes the scene: loads fonts, sets up the background, and initializes the popup.
    private void
    Creates and configures the auto-hiding player-detail popup.
    private javafx.scene.image.Image
    Returns a cached Image for the given classpath path, loading it on first access.
    private void
    Disconnects the client and invokes the post-game action to return to the login scene.
    private void
    Opens the player-detail popup showing all cards held by player, grouped by type.
    void
    Populates the ranking list with the final player standings and shows the outcome banner.
    private void
    Sets the full-cover background image on the root pane.
    void
    Injects the client controller, a post-game action, and the login scene reference.

    Methods inherited from class Object

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

    • rootPane

      private javafx.scene.layout.StackPane rootPane
      Root pane of the leaderboard scene; used to set the background and anchor the popup.
    • mainVBox

      private javafx.scene.layout.VBox mainVBox
      Main vertical container holding the outcome label and ranking rows.
    • rankingList

      private javafx.scene.layout.VBox rankingList
      Vertical list populated with one HBox row per ranked player.
    • controller

      private ClientController controller
      Client controller for fetching game state and sending actions.
    • popupContent

      private javafx.scene.layout.VBox popupContent
      Content container inside popup.
    • imageCache

      private static final Map<String, javafx.scene.image.Image> imageCache
      Shared image cache to avoid reloading resources multiple times.
    • action

      private Runnable action
      Action run when the player returns to the login screen (disconnect + scene switch).
  • Constructor Details

    • LeaderboardFXMLController

      public LeaderboardFXMLController()
  • Method Details

    • loadImage

      private javafx.scene.image.Image loadImage(String path)
      Returns a cached Image for the given classpath path, loading it on first access.
    • setController

      public void setController(ClientController controller, Runnable action)
      Injects the client controller, a post-game action, and the login scene reference.
      Parameters:
      controller - the client controller.
      action - the action to run when the player returns to the login screen.
    • initialize

      public void initialize()
      Initializes the scene: loads fonts, sets up the background, and initializes the popup.
    • render

      public void render()
      Populates the ranking list with the final player standings and shows the outcome banner.
    • addHoverZoom

      private void addHoverZoom(javafx.scene.Node node)
      Scales node to 1.02× on hover and sets a hand cursor.
    • addShadow

      private void addShadow(javafx.scene.Node node)
      Applies a static drop-shadow to node.
    • createPlayerRow

      private javafx.scene.layout.HBox createPlayerRow(int position, Player player)
      Builds a styled leaderboard row showing rank, totem, username, stats, and prestige for player.
    • createStatsBox

      private javafx.scene.layout.HBox createStatsBox(Player player)
      Creates a compact icon+count stats strip for all card types of player.
    • createStatItem

      private javafx.scene.layout.HBox createStatItem(String iconPath, String value, double iconHeight)
      Creates a single icon + label widget for one stat type.
    • initPopup

      private void initPopup()
      Creates and configures the auto-hiding player-detail popup.
    • openPlayerPopup

      private void openPlayerPopup(Player player)
      Opens the player-detail popup showing all cards held by player, grouped by type.
    • getPlayerCards

      private ArrayList<PlayableCard> getPlayerCards(String username, String type)
      Returns a copy of the named card collection for username.
    • renderBackground

      private void renderBackground()
      Sets the full-cover background image on the root pane.
    • onNewGame

      private void onNewGame()
      Disconnects the client and invokes the post-game action to return to the login scene.