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.
|
getView
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getView
private 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()
IJoinGameController
start
in interface IJoinGameController
private void refreshGameList()
public void startCreateNewGame()
IJoinGameController
startCreateNewGame
in interface IJoinGameController
public void cancelCreateNewGame()
IJoinGameController
cancelCreateNewGame
in interface IJoinGameController
public void createNewGame()
IJoinGameController
createNewGame
in interface IJoinGameController
public void startJoinGame(GameInfo game)
IJoinGameController
startJoinGame
in interface IJoinGameController
game
- The game that the user is joiningpublic void cancelJoinGame()
IJoinGameController
cancelJoinGame
in interface IJoinGameController
public void joinGame(CatanColor color)
IJoinGameController
joinGame
in interface IJoinGameController
color
- The color selected by the userpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener