use of games.strategy.engine.lobby.server.GameDescription in project triplea by triplea-game.
the class LobbyGameTableModelTest method updateGameWithNullGuidIsIgnored.
@Test
public void updateGameWithNullGuidIsIgnored() {
testObj.getLobbyGameBroadcaster().gameUpdated(null, new GameDescription());
TestUtil.waitForSwingThreads();
assertThat("expect row count to remain 1, null guid is bogus data", testObj.getRowCount(), is(1));
}
use of games.strategy.engine.lobby.server.GameDescription in project triplea by triplea-game.
the class LobbyGameTableModelTest method updateGame.
@Test
public void updateGame() {
final int commentColumnIndex = testObj.getColumnIndex(LobbyGameTableModel.Column.Comments);
assertThat(testObj.getValueAt(0, commentColumnIndex), nullValue());
final String newComment = "comment";
final GameDescription newDescription = new GameDescription();
newDescription.setComment(newComment);
testObj.getLobbyGameBroadcaster().gameUpdated(fakeGame.getFirst(), newDescription);
TestUtil.waitForSwingThreads();
assertThat(testObj.getRowCount(), is(1));
assertThat(testObj.getValueAt(0, commentColumnIndex), is(newComment));
}
use of games.strategy.engine.lobby.server.GameDescription in project triplea by triplea-game.
the class LobbyGamePanel method getLobbyWatcherNodeForTableRow.
private INode getLobbyWatcherNodeForTableRow(final int selectedIndex) {
final GameDescription description = gameTableModel.get(gameTable.convertRowIndexToModel(selectedIndex));
final String hostedByName = description.getHostedBy().getName();
return new Node((hostedByName.endsWith("_" + InGameLobbyWatcher.LOBBY_WATCHER_NAME) ? hostedByName : hostedByName + "_" + InGameLobbyWatcher.LOBBY_WATCHER_NAME), description.getHostedBy().getAddress(), description.getHostedBy().getPort());
}
use of games.strategy.engine.lobby.server.GameDescription in project triplea by triplea-game.
the class LobbyGameTable method prepareRenderer.
@Override
public Component prepareRenderer(final TableCellRenderer renderer, final int rowIndex, final int colIndex) {
final Component component = super.prepareRenderer(renderer, rowIndex, colIndex);
final LobbyGameTableModel lobbyGameTableModel = (LobbyGameTableModel) getModel();
final GameDescription gameDescription = lobbyGameTableModel.get(convertRowIndexToModel(rowIndex));
component.setFont(gameDescription.isBot() ? ITALIC_FONT : DEFAULT_FONT);
return component;
}
use of games.strategy.engine.lobby.server.GameDescription in project triplea by triplea-game.
the class LobbyGameTableModel method getValueAt.
@Override
public Object getValueAt(final int rowIndex, final int columnIndex) {
final Column column = Column.values()[columnIndex];
final GameDescription description = gameList.get(rowIndex).getSecond();
switch(column) {
case Host:
return description.getHostName();
case Round:
return description.getRound();
case Name:
return description.getGameName();
case Players:
return description.getPlayerCount();
case P:
return (description.getPassworded() ? "*" : "");
case B:
return description.isBot() ? "-" : "";
case GV:
return description.getGameVersion();
case EV:
return description.getEngineVersion();
case Status:
return description.getStatus();
case Comments:
return description.getComment();
case Started:
return formatBotStartTime(description.getStartDateTime());
case GUID:
return gameList.get(rowIndex).getFirst();
default:
throw new IllegalStateException("Unknown column:" + column);
}
}
Aggregations