com.asdf.client
Class LobbyModel

java.lang.Object
  extended by com.asdf.client.LobbyModel

public class LobbyModel
extends java.lang.Object

Bookkeeping class used by LobbyController. Keeps up to date information about which game is selected in lobby, which game type is selected and also the current gamelist. Also includes getter methods which are useful for getting actual class names of selected games create game panels and game clients.

Author:
asdf

Constructor Summary
LobbyModel()
          Sole constructor.
 
Method Summary
 void addGame(GameController game)
          Adds a game to the list of started game clients.
 AvailableGamesResponse getAvailableGames()
          Gets available games.
 java.lang.String getCreatePanelName(java.lang.String gameType)
          Gives the class name of the CreateGamePanel for this game type which is shown in lobby.
 java.lang.String getGameControllerName(java.lang.String gameType)
          Gives the class name of the GameController for this game type which starts the game client at client side.
 GameListResponse getGameList()
          Gets listed games.
 java.lang.String getListedCreatePanelName()
          Gives the class name of the CreateGamePanel for listed game type which is shown in lobby.
 java.lang.String getListedGameControllerName()
          Gives the class name of the GameController for listed game type which starts the game client at client side.
 java.lang.String getListedGameType()
          Gets the game type which is listed.
 java.lang.String getListedGameVariant()
          Gets the game variant which is listed.
 java.lang.String getListedServerGameName()
          Gives the class name of the Game running on server side for listed game type which is shown in lobby.
 long getSelectedGame()
          Gets the id of selected game.
 java.lang.String getServerGameName(java.lang.String gameType)
          Gives the class name of the Game running on server side for listed game type which is shown in lobby.
 User getUser()
          Gets the user object.
 void setAvailableGames(AvailableGamesResponse response)
          Sets list of available games given by server.
 void setGameList(GameListResponse response)
          Sets games listed in lobby.
 void setListedGame(java.lang.String gameName, java.lang.String variant)
          Sets the type and variant of listed game.
 void setLoggedIn(java.lang.String name, double balance, AccountType type)
          Sets user logged in.
 void setLoggedOut()
          Sets user logged out.
 void setSelectedGame(long id)
          Sets the id of selected game.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LobbyModel

public LobbyModel()
Sole constructor.

Method Detail

setListedGame

public void setListedGame(java.lang.String gameName,
                          java.lang.String variant)
Sets the type and variant of listed game.

Parameters:
gameName -
variant -

getUser

public User getUser()
Gets the user object.

Returns:
User

setSelectedGame

public void setSelectedGame(long id)
Sets the id of selected game.

Parameters:
id - GameID of selected game.

getSelectedGame

public long getSelectedGame()
Gets the id of selected game.

Returns:
GameID of selected game.

getListedGameType

public java.lang.String getListedGameType()
Gets the game type which is listed.

Returns:
Game type which is listed.

getListedGameVariant

public java.lang.String getListedGameVariant()
Gets the game variant which is listed.

Returns:
Game variant which is listed.

getListedGameControllerName

public java.lang.String getListedGameControllerName()
Gives the class name of the GameController for listed game type which starts the game client at client side.

Returns:
Class name of GameController or null, if it was not found.

getGameControllerName

public java.lang.String getGameControllerName(java.lang.String gameType)
Gives the class name of the GameController for this game type which starts the game client at client side.

Parameters:
gameType - Game type name.
Returns:
Class name of GameController or null, if it was not found.

getListedCreatePanelName

public java.lang.String getListedCreatePanelName()
Gives the class name of the CreateGamePanel for listed game type which is shown in lobby.

Returns:
Class name of CreateGamePanel or null, if it was not found.

getCreatePanelName

public java.lang.String getCreatePanelName(java.lang.String gameType)
Gives the class name of the CreateGamePanel for this game type which is shown in lobby.

Parameters:
gameType - Game type name.
Returns:
Class name of CreateGamePanel or null, if it was not found.

getListedServerGameName

public java.lang.String getListedServerGameName()
Gives the class name of the Game running on server side for listed game type which is shown in lobby.

Returns:
Class name of Game running on server side or null, if it was not found.

getServerGameName

public java.lang.String getServerGameName(java.lang.String gameType)
Gives the class name of the Game running on server side for listed game type which is shown in lobby.

Parameters:
gameType - Game type name.
Returns:
Class name of Game running on server side or null, if it was not found.

addGame

public void addGame(GameController game)
Adds a game to the list of started game clients.

Parameters:
game - Game which was started in lobby.

setLoggedIn

public void setLoggedIn(java.lang.String name,
                        double balance,
                        AccountType type)
Sets user logged in.

Parameters:
name - Account name.
balance - Account balance.
type - Account type. See AccounType enumeration for details.

setLoggedOut

public void setLoggedOut()
Sets user logged out.


setGameList

public void setGameList(GameListResponse response)
Sets games listed in lobby.

Parameters:
response - GameListResponse sent by server.

setAvailableGames

public void setAvailableGames(AvailableGamesResponse response)
Sets list of available games given by server.

Parameters:
response - AvailableGamesResponse sent by server.

getGameList

public GameListResponse getGameList()
Gets listed games.

Returns:
GameListResponse containing original gamelist sent by the server.

getAvailableGames

public AvailableGamesResponse getAvailableGames()
Gets available games.

Returns:
AvailableGamesResponse containing original available gamelist sent by the server.