Package org.swtpra1
Class ObserverWindow
- java.lang.Object
-
- org.swtpra1.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.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
GAME_VIEW_PANEL
static java.lang.String
OVERVIEW_PANEL
static java.lang.String
TOURNAMENT_VIEW_PANEL
-
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.
-
-
-
Field Detail
-
OVERVIEW_PANEL
public static final java.lang.String OVERVIEW_PANEL
- See Also:
- Constant Field Values
-
GAME_VIEW_PANEL
public static final java.lang.String GAME_VIEW_PANEL
- See Also:
- Constant Field Values
-
TOURNAMENT_VIEW_PANEL
public static final java.lang.String TOURNAMENT_VIEW_PANEL
- See Also:
- Constant Field Values
-
-
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
-
-