# Class Dashboard

java.lang.Object
it.polimi.ingsw.is25am31.view.gui.Dashboard

public class Dashboard extends Object
Controller for the main game dashboard during flight phase 1. Displays the player's ship, rocket positions on the track, and manages game actions such as drawing cards, viewing opponent ships, and handling player elimination or abandonment.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Dashboard()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `javafx.stage.Stage`
  `getStage()`
  Gets the stage associated with this dashboard.
  `void`
  `loadRockets()`
  Loads and displays rocket images on the track based on each player's position.
  `void`
  `setGui(Gui gui)`
  Sets the GUI instance for this dashboard.
  `void`
  `setLeader(boolean isLeader)`
  Sets whether the current player is the leader and updates UI accordingly.
  `void`
  `setServerAndClient(VirtualServer server, ClientModel client)`
  Sets the virtual server and client model for this dashboard.
  `void`
  `setStage(javafx.stage.Stage stage)`
  Sets the stage associated with this dashboard.
  `void`
  `showElimination(int reasonCode)`
  Displays an elimination message and disables all interactive controls.
  `void`
  `showOpponentShip(Ship ship)`
  Opens a new window displaying the opponent's ship.
  `void`
  `showShip(Ship ship)`
  Displays the specified ship on the dashboard.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Dashboard

    public Dashboard()

- ## Method Details

  - ### setServerAndClient

    public void setServerAndClient(VirtualServer server, ClientModel client)
    Sets the virtual server and client model for this dashboard. Initializes the view ship buttons and loads rocket images.
    Parameters:
      `server` - the virtual server instance for network communication
      `client` - the client model containing game state information

  - ### showShip

    public void showShip(Ship ship)
    Displays the specified ship on the dashboard.
    Parameters:
      `ship` - the ship to display

  - ### showOpponentShip

    public void showOpponentShip(Ship ship)
    Opens a new window displaying the opponent's ship.
    Parameters:
      `ship` - the opponent's ship to display

  - ### loadRockets

    public void loadRockets()
    Loads and displays rocket images on the track based on each player's position. Clears existing rocket images before loading new ones.

  - ### setLeader

    public void setLeader(boolean isLeader)
    Sets whether the current player is the leader and updates UI accordingly. Enables/disables the draw card button and updates the notification label.
    Parameters:
      `isLeader` - true if the player is the leader, false otherwise

  - ### showElimination

    public void showElimination(int reasonCode)
    Displays an elimination message and disables all interactive controls.
    Parameters:
      `reasonCode` - the code indicating the reason for elimination: 1 - engine power is 0 2 - no crew members left 3 - lapped by another player 4 - abandoned the race

  - ### setStage

    public void setStage(javafx.stage.Stage stage)
    Sets the stage associated with this dashboard.
    Parameters:
      `stage` - the JavaFX stage

  - ### getStage

    public javafx.stage.Stage getStage()
    Gets the stage associated with this dashboard.
    Returns:
      the JavaFX stage

  - ### setGui

    public void setGui(Gui gui)
    Sets the GUI instance for this dashboard.
    Parameters:
      `gui` - the GUI instance