* Number of wins can be set for tournaments. * Current score of running matches is shown in the table list.

This commit is contained in:
LevelX2 2013-06-10 16:25:31 +02:00
parent bbf277f17e
commit 3dbdba32e9
6 changed files with 129 additions and 52 deletions

View file

@ -120,10 +120,10 @@ public class TablesPanel extends javax.swing.JPanel {
public void actionPerformed(ActionEvent e)
{
int modelRow = Integer.valueOf( e.getActionCommand() );
UUID tableId = (UUID)tableModel.getValueAt(modelRow, 10);
UUID gameId = (UUID)tableModel.getValueAt(modelRow, 9);
UUID tableId = (UUID)tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN + 3);
UUID gameId = (UUID)tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN + 2);
String state = (String)tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN);
boolean isTournament = (Boolean)tableModel.getValueAt(modelRow, 8);
boolean isTournament = (Boolean)tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN + 1);
String owner = (String)tableModel.getValueAt(modelRow, 1);
if (state.equals("Join")) {
@ -606,9 +606,9 @@ private void chkShowCompletedActionPerformed(java.awt.event.ActionEvent evt) {//
class TableTableModel extends AbstractTableModel {
public static int ACTION_COLUMN = 7; // column the action is located (starting with 0)
public static int ACTION_COLUMN = 8; // column the action is located (starting with 0)
private String[] columnNames = new String[]{"Match Name", "Owner / Players", "Game Type", "Deck Type", "Info", "Status", "Created", "Action"};
private String[] columnNames = new String[]{"Match Name", "Owner / Players", "Game Type", "Wins", "Deck Type", "Info", "Status", "Created", "Action"};
private TableView[] tables = new TableView[0];
private static final DateFormat timeFormatter = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
@ -641,16 +641,18 @@ class TableTableModel extends AbstractTableModel {
case 1:
return tables[arg0].getControllerName();
case 2:
return tables[arg0].getGameType().toString();
return tables[arg0].getGameType();
case 3:
return tables[arg0].getDeckType().toString();
return Integer.toString(tables[arg0].getWins());
case 4:
return tables[arg0].getAdditionalInfo().toString();
return tables[arg0].getDeckType();
case 5:
return tables[arg0].getTableState().toString();
return tables[arg0].getAdditionalInfo();
case 6:
return timeFormatter.format(tables[arg0].getCreateTime());
return tables[arg0].getTableState().toString();
case 7:
return timeFormatter.format(tables[arg0].getCreateTime());
case 8:
switch (tables[arg0].getTableState()) {
case WAITING:
String owner = tables[arg0].getControllerName();
@ -678,14 +680,14 @@ class TableTableModel extends AbstractTableModel {
default:
return "";
}
case 8:
return tables[arg0].isTournament();
case 9:
return tables[arg0].isTournament();
case 10:
if (!tables[arg0].getGames().isEmpty()) {
return tables[arg0].getGames().get(0);
}
return null;
case 10:
case 11:
return tables[arg0].getTableId();
}
return "";