* Fixed client filter not showing MTGO 1v1 Commander tables.

This commit is contained in:
LevelX2 2018-02-04 18:34:54 +01:00
parent ae6f177823
commit cafd251e74

View file

@ -48,7 +48,6 @@ import javax.swing.*;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer; import javax.swing.table.TableCellRenderer;
import mage.cards.decks.importer.DeckImporterUtil; import mage.cards.decks.importer.DeckImporterUtil;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.SessionHandler; import mage.client.SessionHandler;
@ -72,9 +71,9 @@ import mage.view.RoomUsersView;
import mage.view.TableView; import mage.view.TableView;
import mage.view.UserRequestMessage; import mage.view.UserRequestMessage;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.ocpsoft.prettytime.Duration;
import org.ocpsoft.prettytime.PrettyTime; import org.ocpsoft.prettytime.PrettyTime;
import org.ocpsoft.prettytime.units.JustNow; import org.ocpsoft.prettytime.units.JustNow;
import org.ocpsoft.prettytime.Duration;
/** /**
* *
@ -113,7 +112,7 @@ public class TablesPanel extends javax.swing.JPanel {
@Override @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Date d = (Date)value; Date d = (Date) value;
label.setText(timeFormater.format(d)); label.setText(timeFormater.format(d));
return label; return label;
} }
@ -124,12 +123,12 @@ public class TablesPanel extends javax.swing.JPanel {
@Override @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Long ms = (Long)value; Long ms = (Long) value;
if(ms != 0){ if (ms != 0) {
Duration dur = timeFormater.approximateDuration(new Date(ms)); Duration dur = timeFormater.approximateDuration(new Date(ms));
label.setText((timeFormater.formatDuration(dur))); label.setText((timeFormater.formatDuration(dur)));
}else{ } else {
label.setText(""); label.setText("");
} }
return label; return label;
@ -143,10 +142,10 @@ public class TablesPanel extends javax.swing.JPanel {
@Override @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Date d = (Date)value; Date d = (Date) value;
if(d != null){ if (d != null) {
label.setText(datetimeFormater.format(d)); label.setText(datetimeFormater.format(d));
}else{ } else {
label.setText(""); label.setText("");
} }
@ -194,8 +193,6 @@ public class TablesPanel extends javax.swing.JPanel {
TableUtil.setColumnWidthAndOrder(tableTables, DEFAULT_COLUMNS_WIDTH, TableUtil.setColumnWidthAndOrder(tableTables, DEFAULT_COLUMNS_WIDTH,
PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH, PreferencesDialog.KEY_TABLES_COLUMNS_ORDER); // TODO: is sort order save and restore after app restart/window open? PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH, PreferencesDialog.KEY_TABLES_COLUMNS_ORDER); // TODO: is sort order save and restore after app restart/window open?
// 2. TABLE COMPLETED // 2. TABLE COMPLETED
completedTablesSorter = new MageTableRowSorter(matchesModel); completedTablesSorter = new MageTableRowSorter(matchesModel);
tableCompleted.setRowSorter(completedTablesSorter); tableCompleted.setRowSorter(completedTablesSorter);
@ -650,7 +647,7 @@ public class TablesPanel extends javax.swing.JPanel {
formatFilterList.add(RowFilter.regexFilter("^Constructed - Vintage", TableTableModel.COLUMN_DECK_TYPE)); formatFilterList.add(RowFilter.regexFilter("^Constructed - Vintage", TableTableModel.COLUMN_DECK_TYPE));
} }
if (btnFormatCommander.isSelected()) { if (btnFormatCommander.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("^Commander|^Duel Commander|^Penny Dreadful Commander|^Freeform Commander", TableTableModel.COLUMN_DECK_TYPE)); formatFilterList.add(RowFilter.regexFilter("^Commander|^Duel Commander|^Penny Dreadful Commander|^Freeform Commander|^MTGO 1v1 Commander", TableTableModel.COLUMN_DECK_TYPE));
} }
if (btnFormatTinyLeader.isSelected()) { if (btnFormatTinyLeader.isSelected()) {
formatFilterList.add(RowFilter.regexFilter("^Tiny", TableTableModel.COLUMN_DECK_TYPE)); formatFilterList.add(RowFilter.regexFilter("^Tiny", TableTableModel.COLUMN_DECK_TYPE));
@ -1394,7 +1391,6 @@ class TableTableModel extends AbstractTableModel {
this.fireTableDataChanged(); this.fireTableDataChanged();
} }
@Override @Override
public int getRowCount() { public int getRowCount() {
return tables.length; return tables.length;
@ -1605,7 +1601,7 @@ class MatchesTableModel extends AbstractTableModel {
this.fireTableDataChanged(); this.fireTableDataChanged();
} }
MatchesTableModel(){ MatchesTableModel() {
} }
@Override @Override