consolidate duplicate sub-class code into CardsTablePanel.
parent
69a603477e
commit
761e2e8240
|
@ -15,9 +15,7 @@ import javax.swing.table.TableColumnModel;
|
|||
import magic.data.GeneralConfig;
|
||||
import magic.model.MagicCardDefinition;
|
||||
import magic.ui.FontsAndBorders;
|
||||
import magic.ui.widget.M.MScrollPane;
|
||||
import magic.ui.widget.TitleBar;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class CardTablePanelA extends CardsTablePanel {
|
||||
|
@ -29,12 +27,7 @@ public class CardTablePanelA extends CardsTablePanel {
|
|||
public static final String CP_CARD_RCLICKED = "575ebbc6-c67b-45b5-9f3e-e03ae1d879be";
|
||||
public static final String CP_CARD_DCLICKED = "d3a081c1-a66c-402a-814e-819678257d3b";
|
||||
|
||||
private final MigLayout migLayout = new MigLayout();
|
||||
private final MScrollPane scrollpane = new MScrollPane();
|
||||
private final CardTableModel tableModel;
|
||||
private CardsJTable table;
|
||||
private final TitleBar titleBar;
|
||||
private List<MagicCardDefinition> lastSelectedCards;
|
||||
private boolean isAdjusting = false;
|
||||
private int lastSelectedRow = -1;
|
||||
|
||||
|
@ -43,10 +36,10 @@ public class CardTablePanelA extends CardsTablePanel {
|
|||
}
|
||||
|
||||
public CardTablePanelA(final List<MagicCardDefinition> defs, final String title) {
|
||||
super(defs);
|
||||
|
||||
this.lastSelectedCards = new ArrayList<>();
|
||||
|
||||
this.tableModel = new CardTableModel(defs);
|
||||
this.table = new CardsJTable(tableModel);
|
||||
|
||||
if (!GeneralConfig.getInstance().isPreviewCardOnSelect()) {
|
||||
|
|
|
@ -18,20 +18,13 @@ import magic.data.GeneralConfig;
|
|||
import magic.model.MagicCardDefinition;
|
||||
import magic.model.MagicRandom;
|
||||
import magic.ui.FontsAndBorders;
|
||||
import magic.ui.widget.M.MScrollPane;
|
||||
import magic.ui.widget.TitleBar;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class CardTablePanelB extends CardsTablePanel
|
||||
implements ListSelectionListener {
|
||||
|
||||
private final MigLayout migLayout = new MigLayout();
|
||||
private final MScrollPane scrollpane = new MScrollPane();
|
||||
private final CardTableModel tableModel;
|
||||
private final CardsJTable table;
|
||||
private TitleBar titleBar;
|
||||
private List<MagicCardDefinition> lastSelectedCards;
|
||||
private final List<ICardSelectionListener> cardSelectionListeners = new ArrayList<>();
|
||||
private final boolean isDeck;
|
||||
|
||||
|
@ -40,11 +33,11 @@ public class CardTablePanelB extends CardsTablePanel
|
|||
}
|
||||
|
||||
public CardTablePanelB(final List<MagicCardDefinition> defs, final String title, final boolean isDeck) {
|
||||
super(defs);
|
||||
|
||||
this.isDeck = isDeck;
|
||||
this.lastSelectedCards = new ArrayList<>();
|
||||
|
||||
this.tableModel = new CardTableModel(defs);
|
||||
this.table = new CardsJTable(tableModel);
|
||||
|
||||
if (!GeneralConfig.getInstance().isPreviewCardOnSelect()) {
|
||||
|
|
|
@ -1,8 +1,22 @@
|
|||
package magic.ui.widget.cards.table;
|
||||
|
||||
import java.util.List;
|
||||
import magic.model.MagicCardDefinition;
|
||||
import magic.ui.widget.M.MScrollPane;
|
||||
import magic.ui.widget.TexturedPanel;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class CardsTablePanel extends TexturedPanel {
|
||||
|
||||
protected final MScrollPane scrollpane = new MScrollPane();
|
||||
|
||||
protected CardsJTable table;
|
||||
protected final MigLayout migLayout = new MigLayout();
|
||||
protected final CardTableModel tableModel;
|
||||
protected List<MagicCardDefinition> lastSelectedCards;
|
||||
|
||||
public CardsTablePanel(List<MagicCardDefinition> defs) {
|
||||
tableModel = new CardTableModel(defs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,7 @@ import magic.data.GeneralConfig;
|
|||
import magic.model.MagicCardDefinition;
|
||||
import magic.model.MagicDeck;
|
||||
import magic.ui.FontsAndBorders;
|
||||
import magic.ui.widget.M.MScrollPane;
|
||||
import magic.ui.widget.TitleBar;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class DeckTablePanel extends CardsTablePanel {
|
||||
|
@ -29,22 +27,16 @@ public class DeckTablePanel extends CardsTablePanel {
|
|||
public static final String CP_CARD_LCLICKED = "d1b4df60-feb9-4bfe-88e2-49cd823efeb0";
|
||||
public static final String CP_CARD_RCLICKED = "0c0fc5c6-3be3-40f4-9b79-ded9e304a96d";
|
||||
|
||||
private final MigLayout migLayout = new MigLayout();
|
||||
private final MScrollPane scrollpane = new MScrollPane();
|
||||
private final CardTableModel tableModel;
|
||||
private CardsJTable table;
|
||||
|
||||
private final TitleBar titleBar;
|
||||
private List<MagicCardDefinition> lastSelectedCards;
|
||||
private boolean isAdjusting = false;
|
||||
private int lastSelectedRow = -1;
|
||||
private final ListSelectionListener listSelListener;
|
||||
|
||||
public DeckTablePanel(final List<MagicCardDefinition> defs, final String title) {
|
||||
super(defs);
|
||||
|
||||
this.lastSelectedCards = new ArrayList<>();
|
||||
|
||||
this.tableModel = new CardTableModel(defs);
|
||||
this.table = new CardsJTable(tableModel);
|
||||
|
||||
if (!GeneralConfig.getInstance().isPreviewCardOnSelect()) {
|
||||
|
|
Loading…
Reference in New Issue