mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Deck editor - Saved the search checkbox options to reset for next deck editor start.
This commit is contained in:
parent
21dbf89a70
commit
2fb8926432
3 changed files with 27 additions and 14 deletions
|
@ -853,7 +853,7 @@
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="selected" type="boolean" value="true"/>
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
<Property name="text" type="java.lang.String" value="Unique"/>
|
<Property name="text" type="java.lang.String" value="Unique"/>
|
||||||
<Property name="toolTipText" type="java.lang.String" value="Singleton rules."/>
|
<Property name="toolTipText" type="java.lang.String" value="Show only the first found card of every card name."/>
|
||||||
<Property name="focusable" type="boolean" value="false"/>
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
|
@ -871,7 +871,6 @@
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chkUniqueActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chkUniqueActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
|
|
||||||
<Component class="javax.swing.JButton" name="jButtonSearch">
|
<Component class="javax.swing.JButton" name="jButtonSearch">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Search"/>
|
<Property name="text" type="java.lang.String" value="Search"/>
|
||||||
|
|
|
@ -51,6 +51,10 @@ import mage.client.MageFrame;
|
||||||
import mage.client.cards.*;
|
import mage.client.cards.*;
|
||||||
import mage.client.constants.Constants.SortBy;
|
import mage.client.constants.Constants.SortBy;
|
||||||
import mage.client.deckeditor.table.TableModel;
|
import mage.client.deckeditor.table.TableModel;
|
||||||
|
import static mage.client.dialog.PreferencesDialog.KEY_DECK_EDITOR_SEARCH_NAMES;
|
||||||
|
import static mage.client.dialog.PreferencesDialog.KEY_DECK_EDITOR_SEARCH_RULES;
|
||||||
|
import static mage.client.dialog.PreferencesDialog.KEY_DECK_EDITOR_SEARCH_TYPES;
|
||||||
|
import static mage.client.dialog.PreferencesDialog.KEY_DECK_EDITOR_SEARCH_UNIQUE;
|
||||||
import mage.client.util.GUISizeHelper;
|
import mage.client.util.GUISizeHelper;
|
||||||
import mage.client.util.gui.FastSearchUtil;
|
import mage.client.util.gui.FastSearchUtil;
|
||||||
import mage.client.util.sets.ConstructedFormats;
|
import mage.client.util.sets.ConstructedFormats;
|
||||||
|
@ -144,9 +148,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
mainTable.setOpaque(false);
|
mainTable.setOpaque(false);
|
||||||
cbSortBy.setEnabled(false);
|
cbSortBy.setEnabled(false);
|
||||||
chkPiles.setEnabled(false);
|
chkPiles.setEnabled(false);
|
||||||
// chkNames.setEnabled(true);
|
|
||||||
// chkTypes.setEnabled(true);
|
chkNames.setSelected("true".equals(MageFrame.getPreferences().get(KEY_DECK_EDITOR_SEARCH_NAMES, "true")));
|
||||||
// chkRules.setEnabled(true);
|
chkTypes.setSelected("true".equals(MageFrame.getPreferences().get(KEY_DECK_EDITOR_SEARCH_TYPES, "true")));
|
||||||
|
chkRules.setSelected("true".equals(MageFrame.getPreferences().get(KEY_DECK_EDITOR_SEARCH_RULES, "true")));
|
||||||
|
chkUnique.setSelected("true".equals(MageFrame.getPreferences().get(KEY_DECK_EDITOR_SEARCH_UNIQUE, "true")));
|
||||||
|
|
||||||
mainTable.addMouseListener(new MouseAdapter() {
|
mainTable.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -172,6 +178,10 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
public void cleanUp() {
|
public void cleanUp() {
|
||||||
this.cardGrid.clear();
|
this.cardGrid.clear();
|
||||||
this.mainModel.clear();
|
this.mainModel.clear();
|
||||||
|
MageFrame.getPreferences().put(KEY_DECK_EDITOR_SEARCH_NAMES, Boolean.toString(chkNames.isSelected()));
|
||||||
|
MageFrame.getPreferences().put(KEY_DECK_EDITOR_SEARCH_RULES, Boolean.toString(chkRules.isSelected()));
|
||||||
|
MageFrame.getPreferences().put(KEY_DECK_EDITOR_SEARCH_TYPES, Boolean.toString(chkTypes.isSelected()));
|
||||||
|
MageFrame.getPreferences().put(KEY_DECK_EDITOR_SEARCH_UNIQUE, Boolean.toString(chkUnique.isSelected()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeGUISize() {
|
public void changeGUISize() {
|
||||||
|
@ -413,12 +423,12 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
try {
|
try {
|
||||||
java.util.List<Card> filteredCards = new ArrayList<>();
|
java.util.List<Card> filteredCards = new ArrayList<>();
|
||||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||||
|
|
||||||
boolean chkPD = chkPennyDreadful.isSelected();
|
boolean chkPD = chkPennyDreadful.isSelected();
|
||||||
if (chkPD) {
|
if (chkPD) {
|
||||||
generatePennyDreadfulHash();
|
generatePennyDreadfulHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limited) {
|
if (limited) {
|
||||||
for (Card card : cards) {
|
for (Card card : cards) {
|
||||||
if (filter.match(card, null)) {
|
if (filter.match(card, null)) {
|
||||||
|
@ -1063,10 +1073,10 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
chkRulesActionPerformed(evt);
|
chkRulesActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
chkUnique.setSelected(true);
|
chkUnique.setSelected(true);
|
||||||
chkUnique.setText("Unique");
|
chkUnique.setText("Unique");
|
||||||
chkUnique.setToolTipText("Singleton results only.");
|
chkUnique.setToolTipText("Show only the first found card of every card name.");
|
||||||
chkUnique.setFocusable(false);
|
chkUnique.setFocusable(false);
|
||||||
chkUnique.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
chkUnique.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
chkUnique.setMaximumSize(new java.awt.Dimension(69, 16));
|
chkUnique.setMaximumSize(new java.awt.Dimension(69, 16));
|
||||||
|
@ -1079,7 +1089,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
jButtonSearch.setText("Search");
|
jButtonSearch.setText("Search");
|
||||||
jButtonSearch.setToolTipText("Performs the search.");
|
jButtonSearch.setToolTipText("Performs the search.");
|
||||||
jButtonSearch.addActionListener(new java.awt.event.ActionListener() {
|
jButtonSearch.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
@ -1126,7 +1135,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
.addComponent(chkTypes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(chkTypes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(chkRules, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(chkRules, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addGap(5, 5, 5)
|
||||||
.addComponent(chkUnique, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(chkUnique, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(5, 5, 5)
|
.addGap(5, 5, 5)
|
||||||
.addComponent(cardCountLabel)
|
.addComponent(cardCountLabel)
|
||||||
|
@ -1357,9 +1366,9 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
}//GEN-LAST:event_chkTypesActionPerformed
|
}//GEN-LAST:event_chkTypesActionPerformed
|
||||||
|
|
||||||
private void chkRulesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkRulesActionPerformed
|
private void chkRulesActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
}//GEN-LAST:event_chkRulesActionPerformed
|
}
|
||||||
|
|
||||||
private void chkUniqueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkRulesActionPerformed
|
private void chkUniqueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkRulesActionPerformed
|
||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
|
@ -1442,8 +1451,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
private javax.swing.JCheckBox chkPennyDreadful;
|
private javax.swing.JCheckBox chkPennyDreadful;
|
||||||
private javax.swing.JCheckBox chkPiles;
|
private javax.swing.JCheckBox chkPiles;
|
||||||
private javax.swing.JCheckBox chkRules;
|
private javax.swing.JCheckBox chkRules;
|
||||||
private javax.swing.JCheckBox chkUnique;
|
|
||||||
private javax.swing.JCheckBox chkTypes;
|
private javax.swing.JCheckBox chkTypes;
|
||||||
|
private javax.swing.JCheckBox chkUnique;
|
||||||
private javax.swing.JButton jButtonAddToMain;
|
private javax.swing.JButton jButtonAddToMain;
|
||||||
private javax.swing.JButton jButtonAddToSideboard;
|
private javax.swing.JButton jButtonAddToSideboard;
|
||||||
private javax.swing.JButton jButtonClean;
|
private javax.swing.JButton jButtonClean;
|
||||||
|
|
|
@ -192,6 +192,11 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
public static final String KEY_DECK_EDITOR_LAST_SORT = "deckEditorLastSort";
|
public static final String KEY_DECK_EDITOR_LAST_SORT = "deckEditorLastSort";
|
||||||
public static final String KEY_DECK_EDITOR_LAST_SEPARATE_CREATURES = "deckEditorLastSeparateCreatures";
|
public static final String KEY_DECK_EDITOR_LAST_SEPARATE_CREATURES = "deckEditorLastSeparateCreatures";
|
||||||
|
|
||||||
|
public static final String KEY_DECK_EDITOR_SEARCH_NAMES = "deckEditorSearchNames";
|
||||||
|
public static final String KEY_DECK_EDITOR_SEARCH_TYPES = "deckEditorSearchTypes";
|
||||||
|
public static final String KEY_DECK_EDITOR_SEARCH_RULES = "deckEditorSearchRules";
|
||||||
|
public static final String KEY_DECK_EDITOR_SEARCH_UNIQUE = "deckEditorSearchUnique";
|
||||||
|
|
||||||
// positions of divider bars
|
// positions of divider bars
|
||||||
public static final String KEY_TABLES_DIVIDER_LOCATION_1 = "tablePanelDividerLocation1";
|
public static final String KEY_TABLES_DIVIDER_LOCATION_1 = "tablePanelDividerLocation1";
|
||||||
public static final String KEY_TABLES_DIVIDER_LOCATION_2 = "tablePanelDividerLocation2";
|
public static final String KEY_TABLES_DIVIDER_LOCATION_2 = "tablePanelDividerLocation2";
|
||||||
|
|
Loading…
Reference in a new issue