diff --git a/Mage.Client/src/main/java/mage/client/table/ColumnInfo.java b/Mage.Client/src/main/java/mage/client/table/ColumnInfo.java index d8a3a9ebba..fcd9aed315 100644 --- a/Mage.Client/src/main/java/mage/client/table/ColumnInfo.java +++ b/Mage.Client/src/main/java/mage/client/table/ColumnInfo.java @@ -4,11 +4,11 @@ package mage.client.table; * @author JayDi85 */ public class ColumnInfo { - private Integer index; - private Integer width; - private String headerName; - private String headerHint; - private Class colClass; + private final Integer index; + private final Integer width; + private final String headerName; + private final String headerHint; + private final Class colClass; public ColumnInfo(Integer index, Integer width, Class colClass, String headerName, String headerHint) { this.index = index; diff --git a/Mage.Client/src/main/java/mage/client/table/MageTable.java b/Mage.Client/src/main/java/mage/client/table/MageTable.java index 2162acaf3e..844ec2b69e 100644 --- a/Mage.Client/src/main/java/mage/client/table/MageTable.java +++ b/Mage.Client/src/main/java/mage/client/table/MageTable.java @@ -23,6 +23,10 @@ public class MageTable extends JTable { public MageTable(TableInfo tableInfo) { this.tableInfo = tableInfo; } + + public void setTableInfo(TableInfo tableInfo) { + this.tableInfo = tableInfo; + } @Override public String getToolTipText(MouseEvent e) { @@ -43,11 +47,15 @@ public class MageTable extends JTable { protected JTableHeader createDefaultTableHeader() { // default tooltip for headers return new JTableHeader(columnModel) { + @Override public String getToolTipText(MouseEvent e) { // html tooltip java.awt.Point p = e.getPoint(); int colIndex = columnModel.getColumnIndexAtX(p.x); TableColumn col = columnModel.getColumn(colIndex); + if (colIndex < 0) { + return ""; + } int realIndex = col.getModelIndex(); String tip; diff --git a/Mage.Client/src/main/java/mage/client/table/TableInfo.java b/Mage.Client/src/main/java/mage/client/table/TableInfo.java index a3570c4287..d1ad44cd78 100644 --- a/Mage.Client/src/main/java/mage/client/table/TableInfo.java +++ b/Mage.Client/src/main/java/mage/client/table/TableInfo.java @@ -8,7 +8,7 @@ import java.util.List; */ public class TableInfo { - private List columns = new ArrayList<>(); + private final List columns = new ArrayList<>(); public TableInfo addColumn(Integer index, Integer width, Class colClass, String headerName, String headerHint) { diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index 66ef466a1e..ff6428a47b 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -74,6 +74,68 @@ public class TablesPanel extends javax.swing.JPanel { public static final double REFRESH_TIMEOUTS_INCREASE_FACTOR = 0.8; // can increase timeouts by 80% (0.8) private final TablesTableModel tableModel; + + private static final TableInfo tableInfo = new TableInfo() // currently only the hint texts are used from this object + .addColumn(0, 35, Icon.class, "M/T", + "Basic table type
" + + "A symbol for match or a tournament table") + .addColumn(1, 150, String.class, "Deck Type", null) + .addColumn(2, 100, String.class, "Name", + "Table name
" + + "A name for the table the table creator has set") + .addColumn(3, 50, String.class, "Seats", + "Seats of the table" + + "
Occupied Seats / Total number of seats ") + .addColumn(4, 120, String.class, "Owner / Players", + "Joined players
" + + "Owner = First name is the creator of the table
" + + "Players = Names of the other players joint to the table") + + .addColumn(5, 180, String.class, "Game Type",null) + .addColumn(6, 80, String.class, "Info", + "Match / Tournament settings" + + "
Wins = Number of games you need to wins to win a match" + + "
Time = Time limit per player" + + "
FM: = Numbers of freee mulligans" + + "
Constr.: = Construction time for limited tournament formats" + + "
RB = Rollback allowed" + + "
PC = Planechase active" + + "
SP = Spectators allowed" + + "
Rng: Range of visibility for multiplayer matches" + ) + .addColumn(7, 120, String.class, "Status", + "Table status
" + + "Information about the progress of the match or tournament") + .addColumn(8, 80, String.class, "Password", + "Password set
" + + "Yes = You need the password of this table
" + + "to join the table") + .addColumn(9, 60, Date.class, "Created / Started", + "Creation and starting time
" + + "When was the table created
" + + "when started the match or tournament") + .addColumn(10, 40, SkillLevel.class, "Skill Level", + "Defined skill level
" + + "Expectations of the table creator
" + + "on the level of experience of the joining players") + .addColumn(11, 40, String.class, "Rated", + "Rating status
" + + "Yes = The matches of this table are rated") + .addColumn(12, 60, String.class, "Quit %", + "Needed maximal quit ratio
" + + "Your calculated quit ratio of your past games" + + "
needs to be below or equal to the given value" + + "
to be able to join to the table") + .addColumn(13, 40, String.class, "Min Rating", + "Rating restriction
" + + "You need at least this rating" + + "
to be able to join the table") + .addColumn(14, 80, String.class, "Action", + "Actions related to this table
" + + "Depending on the state of the table
" + + "the possible actions you can take
" + + "are shown here as buttons"); + private final MatchesTableModel matchesModel; private UUID roomId; private UpdateTablesTask updateTablesTask; @@ -230,7 +292,7 @@ public class TablesPanel extends javax.swing.JPanel { */ public TablesPanel() { - tableModel = new TablesTableModel(); + tableModel = new TablesTableModel(); matchesModel = new MatchesTableModel(); gameChooser = new GameChooser(); @@ -247,6 +309,8 @@ public class TablesPanel extends javax.swing.JPanel { // 1. TABLE CURRENT tableTables.createDefaultColumnsFromModel(); + ((MageTable)tableTables).setTableInfo(tableInfo); + activeTablesSorter = new MageTableRowSorter(tableModel) { @Override public void toggleSortOrder(int column) { diff --git a/Mage.Common/src/main/java/mage/view/TableView.java b/Mage.Common/src/main/java/mage/view/TableView.java index 11c51c5d5e..1d6d91085a 100644 --- a/Mage.Common/src/main/java/mage/view/TableView.java +++ b/Mage.Common/src/main/java/mage/view/TableView.java @@ -98,12 +98,21 @@ public class TableView implements Serializable { addInfo.append("Wins:").append(table.getMatch().getWinsNeeded()); addInfo.append(" Time: ").append(table.getMatch().getOptions().getMatchTimeLimit().toString()); if (table.getMatch().getFreeMulligans() > 0) { - addInfo.append(" Free Mul.: ").append(table.getMatch().getFreeMulligans()); + addInfo.append(" FM: ").append(table.getMatch().getFreeMulligans()); } } else { addInfo.append("Wins:").append(table.getMatch().getWinsNeeded()); addInfo.append(sbScore.toString()); } + if (table.getMatch().getOptions().isRollbackTurnsAllowed()) { + addInfo.append(" RB"); + } + if (table.getMatch().getOptions().isPlaneChase()) { + addInfo.append(" PC"); + } + if (table.getMatch().getOptions().isSpectatorsAllowed()) { + addInfo.append(" SP"); + } if (table.getNumberOfSeats() > 3) { addInfo.append(" Rng: ").append(table.getMatch().getOptions().getRange().toString()); } @@ -134,17 +143,28 @@ public class TableView implements Serializable { infoText.append(" Seats: ").append(this.seatsInfo); switch (table.getState()) { case WAITING: - stateText.append(" (").append(table.getTournament().getPlayers().size()).append('/').append(table.getNumberOfSeats()).append(')'); - break; case READY_TO_START: case STARTING: + if (TableState.WAITING.equals(table.getState())) { + stateText.append(" (").append(table.getTournament().getPlayers().size()).append('/').append(table.getNumberOfSeats()).append(')'); + } infoText.append(" Time: ").append(table.getTournament().getOptions().getMatchOptions().getMatchTimeLimit().toString()); if (table.getTournament().getOptions().getMatchOptions().getFreeMulligans() > 0) { - infoText.append(" Fr.Mul: ").append(table.getTournament().getOptions().getMatchOptions().getFreeMulligans()); + infoText.append(" FM: ").append(table.getTournament().getOptions().getMatchOptions().getFreeMulligans()); } if (table.getTournament().getTournamentType().isLimited()) { infoText.append(" Constr.: ").append(table.getTournament().getOptions().getLimitedOptions().getConstructionTime() / 60).append(" Min."); } + if (table.getTournament().getOptions().getMatchOptions().isRollbackTurnsAllowed()) { + infoText.append(" RB"); + } + if (table.getTournament().getOptions().getMatchOptions().isPlaneChase()) { + infoText.append(" PC"); + } + if (table.getTournament().getOptions().isWatchingAllowed()) { + infoText.append(" SP"); + } + break; case DUELING: stateText.append(" Round: ").append(table.getTournament().getRounds().size());