public class GUI
extends javafx.application.Application
Modifier and Type | Field and Description |
---|---|
protected static javafx.scene.control.TableView<de.smarten.tsuro.shared.gamemodel.Game> |
activeGames |
protected static javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> |
addedSwapList |
protected static javafx.scene.control.CheckBox |
checkbox |
protected static javafx.collections.ObservableList<String> |
chosenConfigs |
protected static javafx.scene.control.ListView<String> |
configurations |
protected static javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> |
connectSwapList |
static EngineControl |
engineControl |
protected static javafx.scene.control.TableColumn<de.smarten.tsuro.shared.gamemodel.Game,String> |
gameName |
static GUIControl |
guiCtrl |
protected static boolean |
isMaximized |
protected static boolean |
isSingleGame |
protected static javafx.scene.control.Label |
label |
protected static String |
name |
protected static javafx.scene.control.TextField |
numberfield |
protected static javafx.scene.Scene |
scene |
protected static boolean |
sgPlayers |
protected static javafx.scene.control.ComboBox<String> |
startingConfig |
protected static javafx.scene.control.ComboBox<de.smarten.tsuro.shared.gamemodel.Client> |
startingPlayer |
protected static javafx.scene.control.TextField |
textfield |
Constructor and Description |
---|
GUI() |
Modifier and Type | Method and Description |
---|---|
void |
abortGame()
Gets the selected Game object in the "Active Games" screen and sends
the order to abort the selected game to the GUIControl.
|
void |
cancelCreation()
Cancels the creation process of single games and tournaments.
|
void |
chooseConfiguration()
opens a dialog where the user is able to load a configuration file for the
game which is about to be created
|
void |
chooseTournamentConfiguration()
opens a file dialog where the user is able to load a configuration file
for the selected level of the tournament
|
void |
continueGame()
Gets the selected Game object in the "Active Games" screen and sends
the order to continue the selected game to the GUIControl.
|
void |
engineActiveGames()
Loads the "Active Games" screen, where currently active games are displayed
and actions can be performed on selected games.
|
void |
exit()
Terminates the GameEngine.
|
void |
getListView(int mode)
Gets the listview elements which show the connected clients and either the on
to add players or spectators, depending on the "mode" parameter.
|
void |
initDragDrop(javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> from,
javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> to)
Initializes drag and drop handling on the ListView parameters in order
to add connected clients to a game or remove clients from a game
|
void |
initListView(javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> from,
javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> to,
int mode)
Initializes the ListView objects with the connected clients in the pool.
|
static void |
main(String[] args)
The main method starting the application launcher
|
void |
pauseGame()
Gets the selected Game object in the "Active Games" screen and sends
the order to pause the selected game to the GUIControl.
|
void |
removeConfiguration(javafx.scene.input.MouseEvent event)
Removes the configurationfile on which was clicked from the file-list in the
GUIControl class.
|
void |
setFirstFileContent()
Updates the content of the combobox, through which the first Configuration is selected, to be
equal with the configurationfiles which were selected by the player.
|
void |
setStartingPlayerContent()
Updates the content of the combobox, through which the starting player is selected, to be equal to the players which were added
to the game.
|
void |
sgChoosePlayers()
Switches to the "choose players" scene a creates a new game,
if the name and configuration selected in the previous scene were valid.
|
void |
sgChooseSpectators()
Switches to the "choose spectators" scene, were connected clients can be
added to the game by drag and drop.
|
void |
sgSetupScreen()
Switches to the setup-scene for a single game, where the user is able to enter
a name and choose a configuration for the game.
|
void |
showError(String errorMessage,
String errorHead,
int errorType)
Opens a popup-window with the message,header and look defined by the parameters.
|
void |
showStartupScreen()
switches the window back to the main menu window of the game engine
|
void |
start(javafx.stage.Stage stage)
Starts the engine application and open a window with the start-scene of the engine.
|
void |
startGame()
Starts the created game.
|
void |
startTournament()
Starts the created tournament.
|
void |
tournamentConfigView()
Switches to the tournament-configuration scene, if the name entered in the
previous scene wasn't empty.
|
void |
tournamentPlayerView()
Switches to the "choose players" scene, if the configurations
and the starting configuration selected in the previous screen are valid.
|
void |
tournamentSetupScreen()
Switches to the name-selection scene, where the user can enter a name
for the tournament he is about to create.
|
void |
updateWindow(String file)
Updates the engine-window with the new scene provided by a .fxml file,
which is selected through the String given on method call.
|
public static GUIControl guiCtrl
public static EngineControl engineControl
protected static javafx.scene.Scene scene
protected static javafx.scene.control.TextField textfield
protected static javafx.scene.control.TextField numberfield
protected static javafx.scene.control.CheckBox checkbox
protected static javafx.scene.control.ComboBox<de.smarten.tsuro.shared.gamemodel.Client> startingPlayer
protected static javafx.scene.control.ComboBox<String> startingConfig
protected static javafx.scene.control.Label label
protected static javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> connectSwapList
protected static javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> addedSwapList
protected static javafx.scene.control.ListView<String> configurations
protected static javafx.collections.ObservableList<String> chosenConfigs
protected static String name
protected static boolean sgPlayers
protected static boolean isMaximized
protected static boolean isSingleGame
protected static javafx.scene.control.TableView<de.smarten.tsuro.shared.gamemodel.Game> activeGames
protected static javafx.scene.control.TableColumn<de.smarten.tsuro.shared.gamemodel.Game,String> gameName
public static void main(String[] args)
args
- needed for the main methodpublic void start(javafx.stage.Stage stage) throws Exception
start
in class javafx.application.Application
Exception
public void engineActiveGames()
public void updateWindow(String file)
file
- The String which selects the .fxml file that will be loaded.IOException
- if an I/O error occurs while loading the screenpublic void sgSetupScreen() throws IOException
IOException
- if an I/O error occurs while loading the screenpublic void sgChoosePlayers() throws IOException
IOException
- if an I/O error occurs while loading the screenpublic void sgChooseSpectators() throws IOException, IncompleteInputException
IOException
- if an I/O error occurs while loading the screenIncompleteInputException
- if the client specified in the parameter is not in the player listpublic void tournamentSetupScreen() throws IOException
IOException
- if an I/O error occurs while loading the screenpublic void tournamentConfigView() throws IOException
IOException
- if an I/O error occurs while loading the screenpublic void tournamentPlayerView() throws IOException
IOException
- if an I/O error occurs while loading the screenpublic void chooseConfiguration() throws IOException
IOException
- if the configuration is invalidpublic void exit() throws IOException
IOException
- if a security manager exists and its checkExit method doesn't allow exit with the specified status.public void cancelCreation()
public void chooseTournamentConfiguration() throws Exception
Exception
- if the given configuration files are invalidpublic void removeConfiguration(javafx.scene.input.MouseEvent event)
event
- the mouse event that should be removedpublic void pauseGame()
public void continueGame()
public void abortGame()
public void setStartingPlayerContent()
public void setFirstFileContent()
public void getListView(int mode)
mode
- the players that should be addedpublic void startGame() throws Exception
Exception
- if the window can't be switched back to the main menue window of the game enginepublic void startTournament() throws Exception
Exception
- if the window can't be switched back to the main menue window of the game enginepublic void initListView(javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> from, javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> to, int mode)
from
- a ListView of clientsto
- a ListView of clientsmode
- the given modepublic void initDragDrop(javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> from, javafx.scene.control.ListView<de.smarten.tsuro.shared.gamemodel.Client> to)
from
- a ListView of clientsto
- a ListView of clientspublic void showStartupScreen() throws Exception
Exception
- if the window can't be switched back to the main menue window of the game enginepublic void showError(String errorMessage, String errorHead, int errorType)
errorMessage
- The message shown in the window.errorHead
- The header of the window.errorType
- The look of the window. [1] for "ERROR", [2] for "INFORMATION", "WARNING" on default.Copyright © 2017 smarTen. All rights reserved.