Class ViewGUIControllerRooms

java.lang.Object
it.polimi.ingsw.am13.client.view.gui.ViewGUIController
it.polimi.ingsw.am13.client.view.gui.ViewGUIControllerRooms

public class ViewGUIControllerRooms extends ViewGUIController
Controller of the 'Rooms' scene, where the rooms are listed and the user can create/join/reconnect to a room
  • Field Details

    • roomsTable

      private javafx.scene.control.TableView<RoomIF> roomsTable
    • nicknameField

      private javafx.scene.control.TextField nicknameField
    • colorBox

      private javafx.scene.control.ChoiceBox<ColorToken> colorBox
    • roomId

      private javafx.scene.control.TableColumn<RoomIF,Integer> roomId
    • roomStatus

      private javafx.scene.control.TableColumn<RoomIF,String> roomStatus
    • roomP1

      private javafx.scene.control.TableColumn<RoomIF,String> roomP1
    • roomP2

      private javafx.scene.control.TableColumn<RoomIF,String> roomP2
    • roomP3

      private javafx.scene.control.TableColumn<RoomIF,String> roomP3
    • roomP4

      private javafx.scene.control.TableColumn<RoomIF,String> roomP4
    • roomNP

      private javafx.scene.control.TableColumn<RoomIF,String> roomNP
    • nPlayersSpinner

      private javafx.scene.control.Spinner<Integer> nPlayersSpinner
  • Constructor Details

    • ViewGUIControllerRooms

      public ViewGUIControllerRooms()
  • Method Details

    • setThisPlayer

      public void setThisPlayer(PlayerLobby player)
      Description copied from class: ViewGUIController
      Method that sets the player
      Specified by:
      setThisPlayer in class ViewGUIController
      Parameters:
      player - the player associated to this ViewGUIController
    • setGameState

      public void setGameState(GameState state)
      Description copied from class: ViewGUIController
      Method that sets the gameState
      Specified by:
      setGameState in class ViewGUIController
      Parameters:
      state - the representation of the state of the game
    • getSceneTitle

      public String getSceneTitle()
      Specified by:
      getSceneTitle in class ViewGUIController
      Returns:
      the title of the scene
    • showException

      public void showException(Exception e)
      Description copied from class: ViewGUIController
      Shows a generic exception in the view (specific exception could be handled in different ways, also depending on the phase or the state of game)
      Specified by:
      showException in class ViewGUIController
      Parameters:
      e - Exception to be shown
    • showPlayerDisconnected

      public void showPlayerDisconnected(PlayerLobby player)
      Description copied from class: ViewGUIController
      It shows that a player disconnected from an ongoing game by calling the corresponding method on ViewGUIController.
      Specified by:
      showPlayerDisconnected in class ViewGUIController
      Parameters:
      player - Player who disconnected
    • showPlayerReconnected

      public void showPlayerReconnected(PlayerLobby player)
      Description copied from class: ViewGUIController
      It shows that a player reconnected to an ongoing game by calling the corresponding method on ViewGUIController.
      Specified by:
      showPlayerReconnected in class ViewGUIController
      Parameters:
      player - Player who reconnected
    • forceCloseApp

      public void forceCloseApp()
      Force closing the app. It should be used to end the app for anomalous reasons
      Specified by:
      forceCloseApp in class ViewGUIController
    • showStartupScreen

      public void showStartupScreen()
    • chooseColorByToken

      private javafx.scene.paint.Color chooseColorByToken(Token token)
      Create a color object, choosing the color according to the given token
      Parameters:
      token - Token used to choose the color
      Returns:
      Color corresponding to the token
    • createShownPlayerString

      private String createShownPlayerString(RoomIF room, int col)
      Generates the string for the one of the 4 player columns for the rooms table. It shows the player's nickname and if they are disconnected
      Parameters:
      room - Room of the considered row
      col - Index of the column. Only 0, 1, 2, 3 is accepted
      Returns:
      String for the player. "-" if the column exceeds the number of players
    • showRooms

      public void showRooms(List<RoomIF> rooms)
    • findFreeNickname

      private String findFreeNickname(List<RoomIF> rooms)
    • onCreateRoomButtonClick

      public void onCreateRoomButtonClick()
    • onJoinRoomButtonClick

      public void onJoinRoomButtonClick()
    • onRefreshRoomButtonClick

      public void onRefreshRoomButtonClick()
    • onReconnectMatchButtonClick

      public void onReconnectMatchButtonClick()
    • errorAlert

      private void errorAlert(String message)