mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
* Added column hints to the headers of the list of active tables. Added some more details to the info column about rollback, spectators or planechase activated.
This commit is contained in:
parent
90c6637dc2
commit
445f824424
5 changed files with 103 additions and 11 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||
*/
|
||||
public class TableInfo {
|
||||
|
||||
private List<ColumnInfo> columns = new ArrayList<>();
|
||||
private final List<ColumnInfo> columns = new ArrayList<>();
|
||||
|
||||
|
||||
public TableInfo addColumn(Integer index, Integer width, Class colClass, String headerName, String headerHint) {
|
||||
|
|
|
@ -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",
|
||||
"<b>Basic table type</b><br>"
|
||||
+ "A symbol for match or a tournament table")
|
||||
.addColumn(1, 150, String.class, "Deck Type", null)
|
||||
.addColumn(2, 100, String.class, "Name",
|
||||
"<b>Table name</b><br>"
|
||||
+ "A name for the table the table creator has set")
|
||||
.addColumn(3, 50, String.class, "Seats",
|
||||
"<b>Seats of the table</b>"
|
||||
+ "<br>Occupied Seats / Total number of seats ")
|
||||
.addColumn(4, 120, String.class, "Owner / Players",
|
||||
"<b>Joined players</b><br>"
|
||||
+ "Owner = First name is the creator of the table<br>"
|
||||
+ "Players = Names of the other players joint to the table")
|
||||
|
||||
.addColumn(5, 180, String.class, "Game Type",null)
|
||||
.addColumn(6, 80, String.class, "Info",
|
||||
"<b>Match / Tournament settings</b>"
|
||||
+ "<br>Wins = Number of games you need to wins to win a match"
|
||||
+ "<br>Time = Time limit per player"
|
||||
+ "<br>FM: = Numbers of freee mulligans"
|
||||
+ "<br>Constr.: = Construction time for limited tournament formats"
|
||||
+ "<br>RB = Rollback allowed"
|
||||
+ "<br>PC = Planechase active"
|
||||
+ "<br>SP = Spectators allowed"
|
||||
+ "<br>Rng: Range of visibility for multiplayer matches"
|
||||
)
|
||||
.addColumn(7, 120, String.class, "Status",
|
||||
"<b>Table status</b><br>"
|
||||
+ "Information about the progress of the match or tournament")
|
||||
.addColumn(8, 80, String.class, "Password",
|
||||
"<b>Password set</b><br>"
|
||||
+ "Yes = You need the password of this table<br>"
|
||||
+ "to join the table")
|
||||
.addColumn(9, 60, Date.class, "Created / Started",
|
||||
"<b>Creation and starting time</b><br>"
|
||||
+ "When was the table created<br>"
|
||||
+ "when started the match or tournament")
|
||||
.addColumn(10, 40, SkillLevel.class, "Skill Level",
|
||||
"<b>Defined skill level</b><br>"
|
||||
+ "Expectations of the table creator<br>"
|
||||
+ "on the level of experience of the joining players")
|
||||
.addColumn(11, 40, String.class, "Rated",
|
||||
"<b>Rating status</b><br>"
|
||||
+ "Yes = The matches of this table are rated")
|
||||
.addColumn(12, 60, String.class, "Quit %",
|
||||
"<b>Needed maximal quit ratio</b><br>"
|
||||
+ "Your calculated quit ratio of your past games"
|
||||
+ "<br>needs to be below or equal to the given value"
|
||||
+ "<br>to be able to join to the table")
|
||||
.addColumn(13, 40, String.class, "Min Rating",
|
||||
"<b>Rating restriction</b><br>"
|
||||
+ "You need at least this rating"
|
||||
+ "<br> to be able to join the table")
|
||||
.addColumn(14, 80, String.class, "Action",
|
||||
"<b>Actions related to this table</b><br>"
|
||||
+ "Depending on the state of the table<br>"
|
||||
+ "the possible actions you can take<br>"
|
||||
+ "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) {
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue