public class JoinGameController extends Controller implements IJoinGameController, java.awt.event.ActionListener
| Modifier and Type | Field and Description |
|---|---|
private boolean |
createdGame |
(package private) GameInfo[] |
games |
private IAction |
joinAction |
private GameInfo |
lastGameSelected |
private IMessageView |
messageView |
private INewGameView |
newGameView |
private ISelectColorView |
selectColorView |
private javax.swing.Timer |
timer |
| Constructor and Description |
|---|
JoinGameController(IJoinGameView view,
INewGameView newGameView,
ISelectColorView selectColorView,
IMessageView messageView)
JoinGameController constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
This is the handler to respond to the timer by refreshing the game list
|
void |
cancelCreateNewGame()
Called by the new game view when the user clicks the "Cancel" button
|
void |
cancelJoinGame()
Called by the select color view when the user clicks the "Cancel" button
|
void |
createNewGame()
Called by the new game view when the user clicks the "Create Game" button
|
IAction |
getJoinAction()
Returns the action to be executed when the user joins a game
|
IJoinGameView |
getJoinGameView() |
IMessageView |
getMessageView() |
INewGameView |
getNewGameView() |
ISelectColorView |
getSelectColorView() |
void |
joinGame(CatanColor color)
Called by the select color view when the user clicks the "Join Game"
button
|
private void |
refreshGameList()
Refreshes the view's game list from the proxy
|
void |
setJoinAction(IAction value)
Sets the action to be executed when the user joins a game
|
void |
setMessageView(IMessageView messageView) |
void |
setNewGameView(INewGameView newGameView) |
void |
setSelectColorView(ISelectColorView selectColorView) |
void |
start()
Displays the join game view
|
void |
startCreateNewGame()
Called by the join game view when the user clicks "Create new game"
button.
|
void |
startJoinGame(GameInfo game)
Called by the join game view when the user clicks a "Join" or "Re-join"
button.
|
getViewclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetViewprivate INewGameView newGameView
private ISelectColorView selectColorView
private IMessageView messageView
private IAction joinAction
private javax.swing.Timer timer
GameInfo[] games
private boolean createdGame
private GameInfo lastGameSelected
public JoinGameController(IJoinGameView view, INewGameView newGameView, ISelectColorView selectColorView, IMessageView messageView)
view - Join game viewnewGameView - New game viewselectColorView - Select color viewmessageView - Message view (used to display error messages that occur while the user is joining a game)public IJoinGameView getJoinGameView()
public IAction getJoinAction()
public void setJoinAction(IAction value)
value - The action to be executed when the user joins a gamepublic INewGameView getNewGameView()
public void setNewGameView(INewGameView newGameView)
public ISelectColorView getSelectColorView()
public void setSelectColorView(ISelectColorView selectColorView)
public IMessageView getMessageView()
public void setMessageView(IMessageView messageView)
public void start()
IJoinGameControllerstart in interface IJoinGameControllerprivate void refreshGameList()
public void startCreateNewGame()
IJoinGameControllerstartCreateNewGame in interface IJoinGameControllerpublic void cancelCreateNewGame()
IJoinGameControllercancelCreateNewGame in interface IJoinGameControllerpublic void createNewGame()
IJoinGameControllercreateNewGame in interface IJoinGameControllerpublic void startJoinGame(GameInfo game)
IJoinGameControllerstartJoinGame in interface IJoinGameControllergame - The game that the user is joiningpublic void cancelJoinGame()
IJoinGameControllercancelJoinGame in interface IJoinGameControllerpublic void joinGame(CatanColor color)
IJoinGameControllerjoinGame in interface IJoinGameControllercolor - The color selected by the userpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListener