Package org.swtpra1

Class ObserverWindow


  • public class ObserverWindow
    extends java.lang.Object
    The GUI part of the observer. Manages the different views (game, tournament, overview) and switches between them.
    • Constructor Summary

      Constructors 
      Constructor Description
      ObserverWindow()
      Creates an instance of the observer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void displayError​(java.lang.String message)
      Displays a dialogue box informing the user that an error has occured.
      void displayWarning​(java.lang.String message)
      Displays a dialogue box with a warning to the user.
      javax.swing.JFrame getMainFrame()
      Retuns the instance of JFrame responsible for the window.
      void showGameView​(int gameId)
      Refreshes and then displays the game view of the game with the given id.
      void showOverview()
      Switches to the general overview of all available games.
      void showTournamentView()
      Refreshes the leaderboard and the shows the overview of the tournament participants.
      void update()
      Prompts all views to poll new data and refresh accordingly.
      • Methods inherited from class java.lang.Object

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

      • ObserverWindow

        public ObserverWindow()
        Creates an instance of the observer. Opens a new JFrame and instantiates the different views in a CardLayout
    • Method Detail

      • getMainFrame

        public javax.swing.JFrame getMainFrame()
        Retuns the instance of JFrame responsible for the window.
        Returns:
        JFrame object
      • showOverview

        public void showOverview()
        Switches to the general overview of all available games.
      • showTournamentView

        public void showTournamentView()
        Refreshes the leaderboard and the shows the overview of the tournament participants.
      • showGameView

        public void showGameView​(int gameId)
        Refreshes and then displays the game view of the game with the given id.
        Parameters:
        gameId - id of the game to be showcased
      • update

        public void update()
        Prompts all views to poll new data and refresh accordingly.
      • displayWarning

        public void displayWarning​(java.lang.String message)
        Displays a dialogue box with a warning to the user.
        Parameters:
        message - warning to be displayed
      • displayError

        public void displayError​(java.lang.String message)
        Displays a dialogue box informing the user that an error has occured.
        Parameters:
        message - the error message to be displayed