mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* UI: added cell hints to current and finished tables;
This commit is contained in:
parent
fcdfb40a96
commit
0833f8b914
3 changed files with 34 additions and 10 deletions
|
@ -4,6 +4,7 @@ import mage.client.util.GUISizeHelper;
|
|||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableColumn;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
|
@ -13,6 +14,10 @@ public class MageTable extends JTable {
|
|||
|
||||
private TableInfo tableInfo;
|
||||
|
||||
public MageTable() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public MageTable(TableInfo tableInfo) {
|
||||
this.tableInfo = tableInfo;
|
||||
}
|
||||
|
@ -43,11 +48,19 @@ public class MageTable extends JTable {
|
|||
// html tooltip
|
||||
java.awt.Point p = e.getPoint();
|
||||
int index = columnModel.getColumnIndexAtX(p.x);
|
||||
int realIndex = columnModel.getColumn(index).getModelIndex();
|
||||
TableColumn col = columnModel.getColumn(index);
|
||||
int realIndex = col.getModelIndex();
|
||||
|
||||
String tip = tableInfo.getColumnByIndex(realIndex).getHeaderHint();
|
||||
if (tip == null) {
|
||||
tip = tableInfo.getColumnByIndex(realIndex).getHeaderName();
|
||||
String tip;
|
||||
if (tableInfo != null) {
|
||||
// custom hint from table info
|
||||
tip = tableInfo.getColumnByIndex(realIndex).getHeaderHint();
|
||||
if (tip == null) {
|
||||
tip = tableInfo.getColumnByIndex(realIndex).getHeaderName();
|
||||
}
|
||||
} else {
|
||||
// default hint from header
|
||||
tip = col.getHeaderValue().toString();
|
||||
}
|
||||
|
||||
return GUISizeHelper.textToHtmlWithSize(tip, GUISizeHelper.tableFont);
|
||||
|
|
|
@ -810,9 +810,9 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
jPanelTables = new javax.swing.JPanel();
|
||||
jSplitPaneTables = new javax.swing.JSplitPane();
|
||||
jScrollPaneTablesActive = new javax.swing.JScrollPane();
|
||||
tableTables = new javax.swing.JTable();
|
||||
tableTables = new MageTable();
|
||||
jScrollPaneTablesFinished = new javax.swing.JScrollPane();
|
||||
tableCompleted = new javax.swing.JTable();
|
||||
tableCompleted = new MageTable();
|
||||
chatPanelMain = new mage.client.table.PlayersChatPanel();
|
||||
jPanelBottom = new javax.swing.JPanel();
|
||||
jButtonFooterNext = new javax.swing.JButton();
|
||||
|
@ -1351,8 +1351,8 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
private javax.swing.JToolBar.Separator jSeparator5;
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private javax.swing.JSplitPane jSplitPaneTables;
|
||||
private javax.swing.JTable tableCompleted;
|
||||
private javax.swing.JTable tableTables;
|
||||
private MageTable tableCompleted;
|
||||
private MageTable tableTables;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
|
|
@ -12,8 +12,19 @@ import java.util.Date;
|
|||
|
||||
public class TablesTableModel extends AbstractTableModel {
|
||||
|
||||
final ImageIcon tourneyIcon = new ImageIcon(getClass().getResource("/tables/tourney_icon.png"));
|
||||
final ImageIcon matchIcon = new ImageIcon(getClass().getResource("/tables/match_icon.png"));
|
||||
// icons with tostring for tables hints
|
||||
final ImageIcon tourneyIcon = new ImageIcon(getClass().getResource("/tables/tourney_icon.png")) {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Tourney";
|
||||
}
|
||||
};
|
||||
final ImageIcon matchIcon = new ImageIcon(getClass().getResource("/tables/match_icon.png")) {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Match";
|
||||
}
|
||||
};
|
||||
|
||||
public static final int COLUMN_ICON = 0;
|
||||
public static final int COLUMN_DECK_TYPE = 1; // column the deck type is located (starting with 0) Start string is used to check for Limited
|
||||
|
|
Loading…
Reference in a new issue