|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.asdf.client.LobbyController
public class LobbyController
LobbyController is the centerpiece of the programs client side. It handles starting of game clients, gets available games on server, lists running games and gets details of selected games. It also handles logging in into server. It runs the whole multigame browser. It is also task of this class to send join and create game requests to the server. Commands through LobbyView are processed in this LobbyController. Communication to server is done through ConnectionHandler using XML -protocol defined by message.xsd.
Field Summary | |
---|---|
static java.lang.String |
PLUGIN_PATH
|
static java.lang.String |
TEST_PATH
|
Constructor Summary | |
---|---|
LobbyController(ConnectionHandler connection)
Sole constructor for LobbyController. |
Method Summary | |
---|---|
void |
dispose()
Called to get member frame disappear. |
ConnectionHandler |
getConnectionHandler()
Gets the ConnectionHandler used by lobby. |
long |
getID()
Returns the sessionID of this MessageHandler. |
Message |
getMessageTemplate()
Create Message already containing correct sessionID |
XMLTools |
getXMLParserInstance()
|
void |
handleRequest(Request req)
Stub method, since LobbyController does not serve any requests. |
void |
handleResponse(Response rsp)
Handle response sent by the server. |
void |
handleStateUpdate(StateUpdate stateUp)
Stub method, since LobbyController does not handle any stateUpdates. |
static void |
lobbyToFront()
Brings lobby's view to front. |
void |
requestAvailableGames()
Request a list of available games from server. |
void |
requestCreateAccount(java.lang.String account,
java.lang.String passwd,
java.lang.String accountType)
Sends a create account request to server. |
void |
requestCreateGame(CreateGameRequest greq)
Sends a create game request to server. |
void |
requestGameDetails(java.lang.String gameID)
Requests details of selected game from server. |
void |
requestGameList(java.lang.String gameType,
java.lang.String gameVariant)
Requests a list of games of the given gameType and gameVariant. |
boolean |
requestJoinGame()
Sends a join game request to server. |
void |
requestLogIn(java.lang.String account,
java.lang.String password)
Requests login from server. |
void |
requestLogOut()
Requests logout from server. |
void |
setAvailableGames(AvailableGamesResponse response)
Sets available games visible in GUI and updates LobbyModel if necessary. |
void |
setConnectionHandler(ConnectionHandler connection)
Sets a ConnectionHandler for lobby. |
void |
setCreateGameDetails()
Loads dynamically CreateGamePanel for the chosen game type (chosen in LobbyView) and sets it visible. |
void |
setEmptyGamesHidden(boolean b)
If b, then sets empty games hidden, if not b set empty games visible in LobbyView. |
void |
setFullGamesHidden(boolean b)
If b, then sets full games hidden, if not b set full games visible in LobbyView. |
void |
setGameDetails(GameDetailsResponse response)
Sets details of selected game visible in GUI or shows panel for creating games. |
void |
setGameList(GameListResponse response,
Filter filter)
Sets list of selected game visible in GUI and updates LobbyModel if necessary. |
void |
setID(long id)
Sets sessionID for lobby. |
void |
setLogin(LoginResponse response)
Sets user logged in in LobbyModel and LobbyFrame. |
void |
setLogout(GenericResponse response)
Sets user logged out in LobbyModel and LobbyFrame. |
void |
showGamesWithNameContaining(java.lang.String s)
|
void |
showGamesWithPlayers(int min,
int max)
|
void |
startGameClient(GameResponse rsp)
Loads dynamically a game client plugin of a type chosen from LobbyView, initializes it with parameters received from server, sets its connection handler and starts it. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TEST_PATH
public static final java.lang.String PLUGIN_PATH
Constructor Detail |
---|
public LobbyController(ConnectionHandler connection)
connection
- ConnectionHandler to handle communication between client's lobby and server.Method Detail |
---|
public static void lobbyToFront()
public void startGameClient(GameResponse rsp)
rsp
- Parameters used to initialize game client.public void setAvailableGames(AvailableGamesResponse response)
response
- AvailableGamesResponse sent by server.public void setGameDetails(GameDetailsResponse response)
response
- GameDetailsResponse sent by server.public void setCreateGameDetails()
public void setGameList(GameListResponse response, Filter filter)
response
- GameListResponse sent by server.public void requestAvailableGames()
public void requestGameList(java.lang.String gameType, java.lang.String gameVariant)
gameType
- Game type available on server.gameVariant
- Game variant of the given game type.public void requestGameDetails(java.lang.String gameID)
gameID
- GameID of selected game.public XMLTools getXMLParserInstance()
public void requestLogOut()
public void requestLogIn(java.lang.String account, java.lang.String password)
account
- password
- public void setLogin(LoginResponse response)
response
- Response from server to login request.public void setLogout(GenericResponse response)
response
- Response from server to logout request.public boolean requestJoinGame()
public void setFullGamesHidden(boolean b)
b
- a booleanpublic void setEmptyGamesHidden(boolean b)
b
- a booleanpublic void showGamesWithPlayers(int min, int max)
public void dispose()
public Message getMessageTemplate()
public void handleResponse(Response rsp)
handleResponse
in interface MessageHandler
rsp
- Response sent by server. Response is an object generated from
XML message using JAXB.public void requestCreateGame(CreateGameRequest greq)
greq
- Request to create a game received from CreateGamePanel.public long getID()
MessageHandler
getID
in interface MessageHandler
public void requestCreateAccount(java.lang.String account, java.lang.String passwd, java.lang.String accountType)
account
- Name of the account.passwd
- Password for the account.accountType
- Type of the account. Currently only AccountType.REGULAR_USER.public void handleRequest(Request req)
handleRequest
in interface MessageHandler
req
- Request sent by server. Request is an object generated from
XML message using JAXB.public void handleStateUpdate(StateUpdate stateUp)
handleStateUpdate
in interface MessageHandler
stateUp
- StateUpdate sent by server. StateUpdate is an object generated from
XML message using JAXB.public void setID(long id)
setID
in interface MessageHandler
id
- Semi-Unique sessionID.public void setConnectionHandler(ConnectionHandler connection)
setConnectionHandler
in interface MessageHandler
connection
- ConnectionHandler to be used.public ConnectionHandler getConnectionHandler()
getConnectionHandler
in interface MessageHandler
public void showGamesWithNameContaining(java.lang.String s)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |