java.lang.Object
it.polimi.ingsw.am13.client.view.gui.ViewGUIController
- Direct Known Subclasses:
ViewGUIControllerInit
,ViewGUIControllerJoinedRoom
,ViewGUIControllerMatch
,ViewGUIControllerRooms
,ViewGUIControllerWinner
Abstract class for the GUI controllers (the classes implementing the logic behind the various scenes)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected NetworkHandler
The network handler which is used to communicate with the serverprotected javafx.scene.Scene
The scene that this controller managesprotected javafx.stage.Stage
The stage on which the application is displayed -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Force closing the app.javafx.scene.Scene
getScene()
abstract String
abstract void
setGameState
(GameState state) Method that sets the gameStatevoid
setNetworkHandler
(NetworkHandler networkHandler) Method that sets the network handlervoid
setScene
(javafx.scene.Scene scene) Method that sets the scenevoid
setStage
(javafx.stage.Stage stage) Method that sets the stageabstract void
setThisPlayer
(PlayerLobby player) Method that sets the playerabstract void
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)abstract void
showPlayerDisconnected
(PlayerLobby player) It shows that a player disconnected from an ongoing game by calling the corresponding method onViewGUIController
.abstract void
showPlayerReconnected
(PlayerLobby player) It shows that a player reconnected to an ongoing game by calling the corresponding method onViewGUIController
.void
Shows the scene associated to this controller, setting also the scene title
-
Field Details
-
stage
protected javafx.stage.Stage stageThe stage on which the application is displayed -
scene
protected javafx.scene.Scene sceneThe scene that this controller manages -
networkHandler
The network handler which is used to communicate with the server
-
-
Constructor Details
-
ViewGUIController
public ViewGUIController()
-
-
Method Details
-
getScene
public javafx.scene.Scene getScene()- Returns:
- the scene that this controller manages
-
setStage
public void setStage(javafx.stage.Stage stage) Method that sets the stage- Parameters:
stage
- on which the application is displayed
-
setScene
public void setScene(javafx.scene.Scene scene) Method that sets the scene- Parameters:
scene
- the scene that this controller manages
-
setNetworkHandler
Method that sets the network handler- Parameters:
networkHandler
- the network handler which is used to communicate with the server
-
setThisPlayer
Method that sets the player- Parameters:
player
- the player associated to thisViewGUIController
-
setGameState
Method that sets the gameState- Parameters:
state
- the representation of the state of the game
-
switchToScene
public void switchToScene()Shows the scene associated to this controller, setting also the scene title -
getSceneTitle
- Returns:
- the title of the scene
-
showException
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)- Parameters:
e
- Exception to be shown
-
showPlayerDisconnected
It shows that a player disconnected from an ongoing game by calling the corresponding method onViewGUIController
.- Parameters:
player
- Player who disconnected
-
showPlayerReconnected
It shows that a player reconnected to an ongoing game by calling the corresponding method onViewGUIController
.- Parameters:
player
- Player who reconnected
-
forceCloseApp
public abstract void forceCloseApp()Force closing the app. It should be used to end the app for anomalous reasons
-