mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
* The list of completed matches and tournaments shows now also columns with start and end time.
This commit is contained in:
parent
aef53bc4ce
commit
dec8f24c68
6 changed files with 75 additions and 12 deletions
|
|
@ -122,7 +122,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
int modelRow = Integer.valueOf( e.getActionCommand() );
|
||||
UUID tableId = (UUID)tableModel.getValueAt(modelRow, 10);
|
||||
UUID gameId = (UUID)tableModel.getValueAt(modelRow, 9);
|
||||
String state = (String)tableModel.getValueAt(modelRow, 7);
|
||||
String state = (String)tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN);
|
||||
boolean isTournament = (Boolean)tableModel.getValueAt(modelRow, 8);
|
||||
String owner = (String)tableModel.getValueAt(modelRow, 1);
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
int modelRow = Integer.valueOf( e.getActionCommand() );
|
||||
List<UUID> games = (List<UUID>)matchesModel.getValueAt(modelRow, 6);
|
||||
List<UUID> games = (List<UUID>)matchesModel.getValueAt(modelRow, MatchesTableModel.ACTION_COLUMN);
|
||||
if (games.size() == 1) {
|
||||
session.replayGame(games.get(0));
|
||||
}
|
||||
|
|
@ -191,9 +191,9 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
};
|
||||
|
||||
|
||||
// adds buttons (don't delete this)
|
||||
new ButtonColumn(tableTables, joinTable, 7);
|
||||
new ButtonColumn(tableCompleted, replayMatch, 5);
|
||||
// adds buttons to the table panel (don't delete this)
|
||||
new ButtonColumn(tableTables, joinTable, TableTableModel.ACTION_COLUMN);
|
||||
new ButtonColumn(tableCompleted, replayMatch, MatchesTableModel.ACTION_COLUMN);
|
||||
}
|
||||
|
||||
public Map<String, JComponent> getUIComponents() {
|
||||
|
|
@ -605,6 +605,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)
|
||||
|
||||
private String[] columnNames = new String[]{"Match Name", "Owner / Players", "Game Type", "Deck Type", "Info", "Status", "Created", "Action"};
|
||||
private TableView[] tables = new TableView[0];
|
||||
private static final DateFormat timeFormatter = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
||||
|
|
@ -706,7 +709,7 @@ class TableTableModel extends AbstractTableModel {
|
|||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
if (columnIndex != 7) {
|
||||
if (columnIndex != ACTION_COLUMN) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -807,9 +810,12 @@ class UpdatePlayersTask extends SwingWorker<Void, Collection<String>> {
|
|||
}
|
||||
|
||||
class MatchesTableModel extends AbstractTableModel {
|
||||
private String[] columnNames = new String[]{"Match Name", "Game Type", "Deck Type", "Players", "Result", "Action"};
|
||||
|
||||
public static int ACTION_COLUMN = 7; // column the action is located (starting with 0)
|
||||
|
||||
private String[] columnNames = new String[]{"Match Name", "Game Type", "Deck Type", "Players", "Result", "Start Time", "End Time","Action"};
|
||||
private MatchView[] matches = new MatchView[0];
|
||||
private static final DateFormat timeFormatter = SimpleDateFormat.getTimeInstance(SimpleDateFormat.SHORT);
|
||||
private static final DateFormat timeFormatter = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
||||
|
||||
public void loadData(Collection<MatchView> matches) throws MageRemoteException {
|
||||
this.matches = matches.toArray(new MatchView[0]);
|
||||
|
|
@ -840,8 +846,12 @@ class MatchesTableModel extends AbstractTableModel {
|
|||
case 4:
|
||||
return matches[arg0].getResult();
|
||||
case 5:
|
||||
return "None";
|
||||
return timeFormatter.format(matches[arg0].getStartTime());
|
||||
case 6:
|
||||
return timeFormatter.format(matches[arg0].getEndTime());
|
||||
case 7:
|
||||
return "None";
|
||||
case 8:
|
||||
return matches[arg0].getGames();
|
||||
}
|
||||
return "";
|
||||
|
|
@ -865,7 +875,7 @@ class MatchesTableModel extends AbstractTableModel {
|
|||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
if (columnIndex != 5) {
|
||||
if (columnIndex != ACTION_COLUMN) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue