forked from External/mage
add exclusive color button
All checks were successful
/ example-docker-compose (push) Successful in 14m48s
All checks were successful
/ example-docker-compose (push) Successful in 14m48s
This commit is contained in:
parent
7795e06b1c
commit
f551ff8f2c
4 changed files with 76 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ public enum MageTray {
|
|||
private Image flashedImage;
|
||||
private TrayIcon trayIcon;
|
||||
|
||||
private int state = 0;
|
||||
private int state = 3;
|
||||
|
||||
public void install() {
|
||||
if (!SystemTray.isSupported()) {
|
||||
|
|
|
|||
|
|
@ -240,26 +240,44 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
|
||||
if (limited) {
|
||||
List<Predicate<MageObject>> predicates = new ArrayList<>();
|
||||
List<Predicate<MageObject>> exclusion = new ArrayList<>();
|
||||
|
||||
if (this.tbGreen.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
} else {
|
||||
exclusion.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
}
|
||||
if (this.tbRed.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.RED));
|
||||
} else {
|
||||
exclusion.add(new ColorPredicate(ObjectColor.RED));
|
||||
}
|
||||
if (this.tbBlack.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
} else {
|
||||
exclusion.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
}
|
||||
if (this.tbBlue.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
} else {
|
||||
exclusion.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
}
|
||||
if (this.tbWhite.isSelected()) {
|
||||
predicates.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
} else {
|
||||
exclusion.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
}
|
||||
|
||||
if (this.tbColorless.isSelected()) {
|
||||
predicates.add(ColorlessPredicate.instance);
|
||||
} else {
|
||||
exclusion.add(ColorlessPredicate.instance);
|
||||
}
|
||||
if (this.tbLimitColors.isSelected()) {
|
||||
filter.add(Predicates.and(Predicates.not(Predicates.or(exclusion)), Predicates.or(predicates)));
|
||||
} else {
|
||||
filter.add(Predicates.or(predicates));
|
||||
}
|
||||
filter.add(Predicates.or(predicates));
|
||||
|
||||
predicates.clear();
|
||||
if (this.tbLand.isSelected()) {
|
||||
|
|
@ -349,6 +367,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
criteria.red(this.tbRed.isSelected());
|
||||
criteria.white(this.tbWhite.isSelected());
|
||||
criteria.colorless(this.tbColorless.isSelected());
|
||||
criteria.limitColors(this.tbLimitColors.isSelected());
|
||||
|
||||
// if you add new type filter then sync it with CardType
|
||||
if (this.tbLand.isSelected()) {
|
||||
|
|
@ -562,6 +581,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
tbBlack = new javax.swing.JToggleButton();
|
||||
tbWhite = new javax.swing.JToggleButton();
|
||||
tbColorless = new javax.swing.JToggleButton();
|
||||
tbLimitColors = new javax.swing.JToggleButton();
|
||||
jSeparator1 = new javax.swing.JToolBar.Separator();
|
||||
cbExpansionSet = new javax.swing.JComboBox<>();
|
||||
btnExpansionSearch = new javax.swing.JButton();
|
||||
|
|
@ -706,6 +726,23 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
});
|
||||
tbColor.add(tbColorless);
|
||||
|
||||
tbLimitColors.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/lock.png"))); // NOI18N
|
||||
tbLimitColors.setSelected(false);
|
||||
tbLimitColors.setToolTipText("Limit results to ONLY these colors");
|
||||
tbLimitColors.setActionCommand("LimitColors");
|
||||
tbLimitColors.setFocusable(false);
|
||||
tbLimitColors.setPreferredSize(new java.awt.Dimension(28, 28));
|
||||
tbLimitColors.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
tbLimitColors.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/lock.png"))); // NOI18N
|
||||
tbLimitColors.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
tbLimitColors.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
tbLimitColorsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(tbLimitColors);
|
||||
|
||||
tbColor.add(jSeparator1);
|
||||
|
||||
reloadSetsCombobox();
|
||||
|
|
@ -1451,7 +1488,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
private void tbColorlessActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbColorlessActionPerformed
|
||||
filterCardsColor(evt.getModifiers(), evt.getActionCommand());
|
||||
}//GEN-LAST:event_tbColorlessActionPerformed
|
||||
|
||||
|
||||
private void tbLimitColorsActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbColorlessActionPerformed
|
||||
filterCards();
|
||||
}
|
||||
|
||||
private void tbCreaturesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbCreaturesActionPerformed
|
||||
filterCardsType(evt.getModifiers(), evt.getActionCommand());
|
||||
}//GEN-LAST:event_tbCreaturesActionPerformed
|
||||
|
|
@ -1667,6 +1708,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
private javax.swing.JToggleButton tbBlue;
|
||||
private javax.swing.JToolBar tbColor;
|
||||
private javax.swing.JToggleButton tbColorless;
|
||||
private javax.swing.JToggleButton tbLimitColors;
|
||||
private javax.swing.JToggleButton tbCommon;
|
||||
private javax.swing.JToggleButton tbCreatures;
|
||||
private javax.swing.JToggleButton tbEnchantments;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue