Updated selected sets for "Standard" and "Selected". Added blocks to selectable Formats. Made all formats selectable in card selector, mage book and automated deck generation.

This commit is contained in:
LevelX2 2012-10-14 10:08:16 +02:00
parent 6619c21d6b
commit cf88bb5ac3
5 changed files with 380 additions and 88 deletions

View file

@ -157,9 +157,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
this.btnBooster.setVisible(true);
this.btnClear.setVisible(true);
this.cbExpansionSet.setVisible(true);
cbExpansionSet.setModel(new DefaultComboBoxModel(Sets.getInstance().getSortedByReleaseDate()));
cbExpansionSet.insertItemAt("-- All sets", 0);
cbExpansionSet.insertItemAt("-- Standard", 1);
cbExpansionSet.setModel(new DefaultComboBoxModel(ConstructedFormats.getTypes()));
cbExpansionSet.setSelectedIndex(0);
filterCards();
@ -216,14 +214,15 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
String name = jTextFieldSearch.getText().trim();
filter.add(new CardTextPredicate(name));
if (this.cbExpansionSet.getSelectedItem() instanceof ExpansionSet) {
filter.add(new ExpansionSetPredicate(((ExpansionSet) this.cbExpansionSet.getSelectedItem()).getCode()));
} else if (this.cbExpansionSet.getSelectedItem().equals("-- Standard")) {
ArrayList<Predicate<Card>> expansionPredicates = new ArrayList<Predicate<Card>>();
for (String setCode : ConstructedFormats.getSetsByFormat("Standard")) {
expansionPredicates.add(new ExpansionSetPredicate(setCode));
if (this.cbExpansionSet.isVisible()) {
String expansionSelection = this.cbExpansionSet.getSelectedItem().toString();
if (!expansionSelection.equals("- All Sets")) {
ArrayList<Predicate<Card>> expansionPredicates = new ArrayList<Predicate<Card>>();
for (String setCode : ConstructedFormats.getSetsByFormat(expansionSelection)) {
expansionPredicates.add(new ExpansionSetPredicate(setCode));
}
filter.add(Predicates.or(expansionPredicates));
}
filter.add(Predicates.or(expansionPredicates));
}
}
@ -411,7 +410,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
});
tbColor.add(rdoColorless);
cbExpansionSet.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Item 1", "Item 2", "Item 3", "Item 4"}));
cbExpansionSet.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
cbExpansionSet.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbExpansionSetActionPerformed(evt);
@ -539,7 +538,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
});
tbTypes.add(chkPiles);
cbSortBy.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"Item 1", "Item 2", "Item 3", "Item 4"}));
cbSortBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
cbSortBy.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbSortByActionPerformed(evt);
@ -605,8 +604,10 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
}
});
cardCountLabel.setForeground(java.awt.SystemColor.textHighlightText);
cardCountLabel.setText("Card count:");
cardCount.setForeground(java.awt.SystemColor.text);
cardCount.setText("0");
jButtonRemoveFromMain.setText("-");
@ -649,7 +650,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
.addComponent(cardCountLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cardCount, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(186, Short.MAX_VALUE))
.addContainerGap(121, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -690,7 +691,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
}// </editor-fold>//GEN-END:initComponents

View file

@ -69,20 +69,23 @@ public final class CollectionViewerPanel extends JPanel {
JLabel label1 = new JLabel("Choose format:");
label1.setAlignmentX(Component.LEFT_ALIGNMENT);
label1.setForeground(Color.white);
jPanel1.add(label1);
formats = new JComboBox(ConstructedFormats.getTypes());
formats.setSelectedItem(ConstructedFormats.getDefault());
formats.setPreferredSize(new Dimension(100, 25));
formats.setMaximumSize(new Dimension(100, 25));
formats.setPreferredSize(new Dimension(250, 25));
formats.setMaximumSize(new Dimension(250, 25));
formats.setAlignmentX(Component.LEFT_ALIGNMENT);
jPanel1.add(formats);
JLabel label2 = new JLabel("Choose size:");
label2.setAlignmentX(Component.LEFT_ALIGNMENT);
label2.setForeground(Color.white);
jPanel1.add(label2);
small3x3 = new JRadioButton("3x3");
small3x3.setForeground(Color.white);
boolean selected3x3 = MageFrame.getPreferences().get(LAYOYT_CONFIG_KEY, MageBook.LAYOUT_3x3).equals(MageBook.LAYOUT_3x3);
small3x3.setSelected(selected3x3);
small3x3.addActionListener(new ActionListener() {
@ -96,6 +99,7 @@ public final class CollectionViewerPanel extends JPanel {
jPanel1.add(small3x3);
big4x4 = new JRadioButton("4x4");
big4x4.setForeground(Color.white);
big4x4.setSelected(!selected3x3);
big4x4.addActionListener(new ActionListener() {
@Override
@ -109,6 +113,7 @@ public final class CollectionViewerPanel extends JPanel {
JLabel label3 = new JLabel("Switch tabs:");
label3.setAlignmentX(Component.LEFT_ALIGNMENT);
label3.setForeground(Color.white);
jPanel1.add(label3);
JPanel buttonPanel = new JPanel();

View file

@ -291,6 +291,7 @@ public class MageBook extends JComponent {
this.setsToDisplay = CardsStorage.getSetCodes();
}
addSetTabs();
tabs.get(0).execute();
}
public void next() {