Package View

Class BoardController

java.lang.Object
View.BoardController

public class BoardController extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The gameOver function is called when the game ends.
    void
    The initWindow function initializes the window by calling the initBinding, initBoard, and addListeners functions.
    void
    The resetButton function resets the board to its previous state.
    void
    setStage(javafx.stage.Stage stage)
    The setStage function is used to set the stage of the application.
    void
    The setViewModel function is used to set the view model of the class.
    void
    The shuffleTiles function shuffles the tiles in the player's hand.
    void
    The skipTurn function is called when the user clicks on the "Skip Turn" button.
    void
    The submitWord function is called when the submit button is clicked.

    Methods inherited from class java.lang.Object

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

    • BoardController

      public BoardController()
  • Method Details

    • setViewModel

      public void setViewModel(ScrabbleViewModel vm)
      The setViewModel function is used to set the view model of the class.
      Parameters:
      vm - Set the view model for this class
    • initWindow

      public void initWindow()
      The initWindow function initializes the window by calling the initBinding, initBoard, and addListeners functions.
    • gameOver

      public void gameOver()
      The gameOver function is called when the game ends. It loads the GameOverPageController and sets its stage, vm, playersList and scene. The scene is then set to be full screen.
    • submitWord

      public void submitWord()
      The submitWord function is called when the submit button is clicked. It checks if it's the player's turn, and if so, calls vm.submitWord() to check whether or not a word has been submitted. If a word has been submitted, then it resets all of the tiles in playerTiles to be blank tiles (i.e., no letter).
    • skipTurn

      public void skipTurn() throws IOException, InterruptedException
      The skipTurn function is called when the user clicks on the "Skip Turn" button. It sends a message to the server that it is skipping its turn, and then sets myTurn to false so that no more moves can be made until it becomes this player's turn again.
      Throws:
      IOException
      InterruptedException
    • shuffleTiles

      public void shuffleTiles()
      The shuffleTiles function shuffles the tiles in the player's hand.
    • resetButton

      public void resetButton()
      The resetButton function resets the board to its previous state. It does this by clearing the playerTiles ListView and adding back all of the original tiles. Then it clears the board GridPane and sets it equal to vm's prevBoard, which is a copy of what was on the board before resetButton was called.
    • setStage

      public void setStage(javafx.stage.Stage stage)
      The setStage function is used to set the stage of the application.
      Parameters:
      stage - Set the stage