Set default view of Sideboard to cardGrid. Make it similar to MTGO setting.

This commit is contained in:
Li REN 2013-06-16 04:06:28 -04:00
parent 1749eb7ded
commit 2424c80718
2 changed files with 18 additions and 4 deletions

View file

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues> <AuxValues>
@ -35,7 +35,7 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="273" max="32767" attributes="0"/> <Component id="jScrollPane1" pref="273" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" pref="35" max="-2" attributes="0"/> <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>

View file

@ -89,7 +89,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
cardGrid = new CardGrid(); cardGrid = new CardGrid();
makeTransparent(); makeTransparent();
initListViewComponents(); initListViewComponents();
currentView = mainModel; // by default we use List View currentView = mainModel; // by default we use List View
} }
public void makeTransparent() { public void makeTransparent() {
@ -143,6 +143,20 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
} }
}); });
} }
public void switchToGrid(){
jToggleListView.setSelected(false);
jToggleCardView.setSelected(true);
currentView = cardGrid;
jScrollPane1.setViewportView(cardGrid);
cbSortBy.setEnabled(true);
chkPiles.setEnabled(true);
jButtonAddToMain.setEnabled(false);
jButtonAddToSideboard.setEnabled(false);
filterCards();
chkPiles.setSelected(true);
this.currentView.drawCards((SortBy) cbSortBy.getSelectedItem(), chkPiles.isSelected());
}
public void loadSideboard(List<Card> sideboard, BigCard bigCard) { public void loadSideboard(List<Card> sideboard, BigCard bigCard) {
this.bigCard = bigCard; this.bigCard = bigCard;
@ -154,7 +168,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
for (Card card: sideboard) { for (Card card: sideboard) {
this.cards.add(card); this.cards.add(card);
} }
switchToGrid();
filterCards(); filterCards();
} }