From ee2da8d8cd3e5086bda5732c7d948446ecdbb5d9 Mon Sep 17 00:00:00 2001 From: drdev Date: Sat, 15 Feb 2014 20:01:30 +0000 Subject: [PATCH] Remove deprecated Preferences pane from Deck Editor Reorganize Deck Editor default layout --- .gitattributes | 2 - forge-gui/res/defaults/editor.xml | 5 +- .../controllers/CEditorPreferences.java | 131 -------- .../deckeditor/views/VEditorPreferences.java | 291 ------------------ .../main/java/forge/gui/framework/EDocID.java | 1 - 5 files changed, 2 insertions(+), 428 deletions(-) delete mode 100644 forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorPreferences.java delete mode 100644 forge-gui/src/main/java/forge/gui/deckeditor/views/VEditorPreferences.java diff --git a/.gitattributes b/.gitattributes index ce9e1935271..f3ae09e78fd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15465,7 +15465,6 @@ forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorCommander.java - forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorConstructed.java svneol=native#text/plain forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorDraftingProcess.java svneol=native#text/plain forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorLimited.java -text -forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorPreferences.java -text forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorQuest.java svneol=native#text/plain forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorQuestCardShop.java -text forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorVariant.java -text @@ -15479,7 +15478,6 @@ forge-gui/src/main/java/forge/gui/deckeditor/views/VAllDecks.java -text forge-gui/src/main/java/forge/gui/deckeditor/views/VCardCatalog.java -text forge-gui/src/main/java/forge/gui/deckeditor/views/VCurrentDeck.java -text forge-gui/src/main/java/forge/gui/deckeditor/views/VDeckgen.java -text -forge-gui/src/main/java/forge/gui/deckeditor/views/VEditorPreferences.java -text forge-gui/src/main/java/forge/gui/deckeditor/views/VProbabilities.java -text forge-gui/src/main/java/forge/gui/deckeditor/views/VStatistics.java -text forge-gui/src/main/java/forge/gui/download/GuiDownloadPicturesLQ.java svneol=native#text/plain diff --git a/forge-gui/res/defaults/editor.xml b/forge-gui/res/defaults/editor.xml index d1e368a72e9..ddd23b8ea34 100644 --- a/forge-gui/res/defaults/editor.xml +++ b/forge-gui/res/defaults/editor.xml @@ -2,19 +2,18 @@ CARD_PICTURE - EDITOR_PREFERENCES EDITOR_CURRENTDECK - EDITOR_ALLDECKS EDITOR_STATISTICS EDITOR_PROBABILITIES CARD_DETAIL - EDITOR_DECKGEN EDITOR_CATALOG + EDITOR_ALLDECKS + EDITOR_DECKGEN diff --git a/forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorPreferences.java b/forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorPreferences.java deleted file mode 100644 index 3bbc7a89e26..00000000000 --- a/forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorPreferences.java +++ /dev/null @@ -1,131 +0,0 @@ -package forge.gui.deckeditor.controllers; - -import forge.UiCommand; -import forge.gui.deckeditor.views.VEditorPreferences; -import forge.gui.framework.ICDoc; -import forge.gui.toolbox.itemmanager.views.ColumnDef; - -import javax.swing.*; -import java.util.HashMap; - -/** - * Controls the "analysis" panel in the deck editor UI. - * - *

(C at beginning of class name denotes a control class.) - * - */ -public enum CEditorPreferences implements ICDoc { - /** */ - SINGLETON_INSTANCE; - - //========== Overridden methods - - /* (non-Javadoc) - * @see forge.gui.framework.ICDoc#getCommandOnSelect() - */ - @Override - public UiCommand getCommandOnSelect() { - return null; - } - - /* (non-Javadoc) - * @see forge.gui.framework.ICDoc#initialize() - */ - @Override - public void initialize() { - HashMap prefsDict = new HashMap(); - - // Simplified Column Preferences - VEditorPreferences prefsInstance = VEditorPreferences.SINGLETON_INSTANCE; - - // Catalog - prefsDict.put(prefsInstance.getChbCatalogColor(), ColumnDef.COLOR); - prefsDict.put(prefsInstance.getChbCatalogRarity(), ColumnDef.RARITY); - prefsDict.put(prefsInstance.getChbCatalogCMC(), ColumnDef.CMC); - prefsDict.put(prefsInstance.getChbCatalogSet(), ColumnDef.SET); - prefsDict.put(prefsInstance.getChbCatalogAI(), ColumnDef.AI); - prefsDict.put(prefsInstance.getChbCatalogRanking(), ColumnDef.RANKING); - prefsDict.put(prefsInstance.getChbCatalogPower(), ColumnDef.POWER); - prefsDict.put(prefsInstance.getChbCatalogToughness(), ColumnDef.TOUGHNESS); - prefsDict.put(prefsInstance.getChbCatalogFavorite(), ColumnDef.FAVORITE); - prefsDict.put(prefsInstance.getChbCatalogOwned(), ColumnDef.OWNED); - - // Deck - prefsDict.put(prefsInstance.getChbDeckColor(), ColumnDef.COLOR); - prefsDict.put(prefsInstance.getChbDeckRarity(), ColumnDef.RARITY); - prefsDict.put(prefsInstance.getChbDeckCMC(), ColumnDef.CMC); - prefsDict.put(prefsInstance.getChbDeckSet(), ColumnDef.SET); - prefsDict.put(prefsInstance.getChbDeckAI(), ColumnDef.AI); - prefsDict.put(prefsInstance.getChbDeckRanking(), ColumnDef.RANKING); - prefsDict.put(prefsInstance.getChbDeckPower(), ColumnDef.POWER); - prefsDict.put(prefsInstance.getChbDeckToughness(), ColumnDef.TOUGHNESS); - - // Simplified assignments to be less verbose - /*for (JCheckBox key : prefsDict.keySet()) { - final ColumnDef name = prefsDict.get(key); - key.setSelected(SColumnUtil.getColumn(name).isShowing()); - key.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent arg0) { - ItemColumn col = SColumnUtil.getColumn(name); - final ItemManager itemManager = (col.getEnumValue().substring(0, 4).equals("DECK")) - ? CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckManager() - : CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getCatalogManager(); - SColumnUtil.toggleColumn(itemManager.getTable().getTable(), col); - SItemManagerIO.savePreferences(itemManager); - } - }); - } - - // Catalog/Deck Stats - VEditorPreferences.SINGLETON_INSTANCE.getChbCardDisplayUnique().setSelected( - SItemManagerIO.getPref(EditorPreference.display_unique_only)); - VEditorPreferences.SINGLETON_INSTANCE.getChbElasticColumns().setSelected( - SItemManagerIO.getPref(EditorPreference.elastic_columns)); - - boolean wantElastic = SItemManagerIO.getPref(EditorPreference.elastic_columns); - boolean wantUnique = SItemManagerIO.getPref(EditorPreference.display_unique_only); - ACEditorBase curEditor = CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController(); - if (curEditor != null) { - curEditor.getCatalogManager().getTable().setWantElasticColumns(wantElastic); - curEditor.getDeckManager().getTable().setWantElasticColumns(wantElastic); - curEditor.getCatalogManager().setWantUnique(wantUnique); - curEditor.getCatalogManager().updateView(true); - curEditor.getDeckManager().setWantUnique(wantUnique); - curEditor.getDeckManager().updateView(true); - } - - VEditorPreferences.SINGLETON_INSTANCE.getChbElasticColumns().addItemListener(new ItemListener() { - @Override public void itemStateChanged(final ItemEvent e) { - ACEditorBase curEditor = CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController(); - boolean wantElastic = ((JCheckBox) e.getSource()).isSelected(); - if (curEditor != null) { - curEditor.getCatalogManager().getTable().setWantElasticColumns(wantElastic); - curEditor.getDeckManager().getTable().setWantElasticColumns(wantElastic); - } - SItemManagerIO.setPref(EditorPreference.elastic_columns, wantElastic); - SItemManagerIO.savePreferences(curEditor.getCatalogManager()); } }); - - VEditorPreferences.SINGLETON_INSTANCE.getChbCardDisplayUnique().addItemListener(new ItemListener() { - @Override public void itemStateChanged(final ItemEvent e) { - ACEditorBase curEditor = CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController(); - boolean wantUnique = ((JCheckBox) e.getSource()).isSelected(); - if (curEditor != null) { - curEditor.getCatalogManager().setWantUnique(wantUnique); - curEditor.getCatalogManager().updateView(true); - curEditor.getDeckManager().setWantUnique(wantUnique); - curEditor.getDeckManager().updateView(true); - } - SItemManagerIO.setPref(EditorPreference.display_unique_only, wantUnique); - SItemManagerIO.savePreferences(curEditor.getCatalogManager()); } });*/ - } - - /* (non-Javadoc) - * @see forge.gui.framework.ICDoc#update() - */ - @Override - public void update() { - } - - //========== Other methods -} diff --git a/forge-gui/src/main/java/forge/gui/deckeditor/views/VEditorPreferences.java b/forge-gui/src/main/java/forge/gui/deckeditor/views/VEditorPreferences.java deleted file mode 100644 index a34b9699fbd..00000000000 --- a/forge-gui/src/main/java/forge/gui/deckeditor/views/VEditorPreferences.java +++ /dev/null @@ -1,291 +0,0 @@ -package forge.gui.deckeditor.views; - -import forge.gui.deckeditor.controllers.CEditorPreferences; -import forge.gui.framework.DragCell; -import forge.gui.framework.DragTab; -import forge.gui.framework.EDocID; -import forge.gui.framework.IVDoc; -import forge.gui.toolbox.FCheckBox; -import forge.gui.toolbox.FLabel; -import forge.gui.toolbox.FScrollPane; -import forge.gui.toolbox.FSkin; -import net.miginfocom.swing.MigLayout; - -import javax.swing.*; - -/** - * Assembles Swing components of deck editor analysis tab. - * - *

(V at beginning of class name denotes a view class.) - */ -public enum VEditorPreferences implements IVDoc { - /** */ - SINGLETON_INSTANCE; - - // Fields used with interface IVDoc - private DragCell parentCell; - private final DragTab tab = new DragTab("Preferences"); - - private FLabel lblStats = new FLabel.Builder() - .text("General").tooltip("Configure high-level UI components") - .fontSize(12).build(); - - private FLabel lblCatalog = new FLabel.Builder() - .text("Card Catalog Columns").tooltip("Toggle columns in card catalog panel") - .fontSize(12).build(); - - private FLabel lblDeck = new FLabel.Builder() - .text("Current Deck Columns").tooltip("Toggle columns in current deck panel") - .fontSize(12).build(); - - private FLabel lblDisplay = new FLabel.Builder() - .text("Card Catalog Options").tooltip("Toggle card catalog display options") - .fontSize(12).build(); - - private FCheckBox chbCatalogColor = new FCheckBox("Color"); - private FCheckBox chbCatalogRarity = new FCheckBox("Rarity"); - private FCheckBox chbCatalogCMC = new FCheckBox("CMC"); - private FCheckBox chbCatalogSet = new FCheckBox("Set"); - private FCheckBox chbCatalogAI = new FCheckBox("AI"); - private FCheckBox chbCatalogRanking = new FCheckBox("Ranking"); - private FCheckBox chbCatalogPower = new FCheckBox("Power"); - private FCheckBox chbCatalogToughness = new FCheckBox("Toughness"); - private FCheckBox chbCatalogFavorite = new FCheckBox("Favorite"); - private FCheckBox chbCatalogOwned = new FCheckBox("Owned (Spell shop)"); - - private FCheckBox chbDeckColor = new FCheckBox("Color"); - private FCheckBox chbDeckRarity = new FCheckBox("Rarity"); - private FCheckBox chbDeckCMC = new FCheckBox("CMC"); - private FCheckBox chbDeckSet = new FCheckBox("Set"); - private FCheckBox chbDeckAI = new FCheckBox("AI"); - private FCheckBox chbDeckRanking = new FCheckBox("Ranking"); - private FCheckBox chbDeckPower = new FCheckBox("Power"); - private FCheckBox chbDeckToughness = new FCheckBox("Toughness"); - - private FCheckBox chbElasticColumns = new FCheckBox("Use elastic resizing when changing column widths"); - - private FCheckBox chbCardDisplayUnique = new FCheckBox("Show unique cards only (only affects Constructed)"); - - private JPanel pnl = new JPanel(new MigLayout("insets 0, gap 0, wrap 2, ax left")); - private FScrollPane scroller = new FScrollPane(pnl, false); - - //========== Constructor - private VEditorPreferences() { - lblStats.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS))); - lblCatalog.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS))); - lblDeck.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS))); - lblDisplay.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS))); - - FSkin.SkinFont font = FSkin.getFont(12); - - chbCatalogColor.setFont(font); - chbCatalogRarity.setFont(font); - chbCatalogCMC.setFont(font); - chbCatalogSet.setFont(font); - chbCatalogAI.setFont(font); - chbCatalogRanking.setFont(font); - chbCatalogPower.setFont(font); - chbCatalogToughness.setFont(font); - chbCatalogFavorite.setFont(font); - chbCatalogOwned.setFont(font); - - chbDeckColor.setFont(font); - chbDeckRarity.setFont(font); - chbDeckCMC.setFont(font); - chbDeckSet.setFont(font); - chbDeckAI.setFont(font); - chbDeckRanking.setFont(font); - chbDeckPower.setFont(font); - chbDeckToughness.setFont(font); - - chbElasticColumns.setFont(font); - chbElasticColumns.setSelected(false); - - chbCardDisplayUnique.setFont(font); - chbCardDisplayUnique.setSelected(false); - - pnl.add(lblStats, "h 25px!, gap 5px 5px 5px 5px, ax left, span 2 1"); - pnl.add(chbElasticColumns, "h 25px!, gap 5px 5px 5px 5px, ax left, span 2 1"); - - final String constraints = "w 75px, h 25px!, gap 5px 5px 5px 5px, ax left"; - pnl.add(lblCatalog, constraints + ", span 2 1"); - pnl.add(chbCatalogColor, constraints); - pnl.add(chbCatalogRarity, constraints); - pnl.add(chbCatalogCMC, constraints); - pnl.add(chbCatalogSet, constraints); - pnl.add(chbCatalogPower, constraints); - pnl.add(chbCatalogToughness, constraints); - pnl.add(chbCatalogAI, constraints); - pnl.add(chbCatalogRanking, constraints); - pnl.add(chbCatalogFavorite, constraints); - pnl.add(chbCatalogOwned, constraints + ", wrap"); - - pnl.add(lblDeck, constraints + ", span 2 1"); - pnl.add(chbDeckColor, constraints); - pnl.add(chbDeckRarity, constraints); - pnl.add(chbDeckCMC, constraints); - pnl.add(chbDeckSet, constraints); - pnl.add(chbDeckPower, constraints); - pnl.add(chbDeckToughness, constraints); - pnl.add(chbDeckAI, constraints); - pnl.add(chbDeckRanking, constraints + ", wrap"); - - pnl.add(lblDisplay, constraints + ", span 2 1"); - pnl.add(chbCardDisplayUnique, "h 25px!, gap 5px 5px 5px 5px, ax center, span 2 1"); - - pnl.setOpaque(false); - scroller.getViewport().setBorder(null); - } - - //========== Overridden methods - - /* (non-Javadoc) - * @see forge.gui.framework.IVDoc#getDocumentID() - */ - @Override - public EDocID getDocumentID() { - return EDocID.EDITOR_PREFERENCES; - } - - /* (non-Javadoc) - * @see forge.gui.framework.IVDoc#getTabLabel() - */ - @Override - public DragTab getTabLabel() { - return tab; - } - - /* (non-Javadoc) - * @see forge.gui.framework.IVDoc#getLayoutControl() - */ - @Override - public CEditorPreferences getLayoutControl() { - return CEditorPreferences.SINGLETON_INSTANCE; - } - - /* (non-Javadoc) - * @see forge.gui.framework.IVDoc#setParentCell(forge.gui.framework.DragCell) - */ - @Override - public void setParentCell(final DragCell cell0) { - this.parentCell = cell0; - } - - /* (non-Javadoc) - * @see forge.gui.framework.IVDoc#getParentCell() - */ - @Override - public DragCell getParentCell() { - return this.parentCell; - } - - /* (non-Javadoc) - * @see forge.gui.framework.IVDoc#populate() - */ - @Override - public void populate() { - parentCell.getBody().setLayout(new MigLayout("insets 0, gap 0, wrap")); - parentCell.getBody().add(scroller, "w 96%!, h 96%, gap 2% 0 2% 0"); - } - - //========== Retrieval methods - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCatalogColor() { - return chbCatalogColor; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCatalogRarity() { - return chbCatalogRarity; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCatalogCMC() { - return chbCatalogCMC; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCatalogSet() { - return chbCatalogSet; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCatalogAI() { - return chbCatalogAI; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCatalogRanking() { - return chbCatalogRanking; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCatalogPower() { - return chbCatalogPower; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCatalogToughness() { - return chbCatalogToughness; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCatalogFavorite() { - return chbCatalogFavorite; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCatalogOwned() { - return chbCatalogOwned; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbDeckColor() { - return chbDeckColor; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbDeckRarity() { - return chbDeckRarity; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbDeckCMC() { - return chbDeckCMC; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbDeckSet() { - return chbDeckSet; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbDeckAI() { - return chbDeckAI; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbDeckRanking() { - return chbDeckRanking; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbDeckPower() { - return chbDeckPower; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbDeckToughness() { - return chbDeckToughness; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbElasticColumns() { - return chbElasticColumns; - } - - /** @return {@link javax.swing.JCheckBox} */ - public JCheckBox getChbCardDisplayUnique() { - return chbCardDisplayUnique; - } -} diff --git a/forge-gui/src/main/java/forge/gui/framework/EDocID.java b/forge-gui/src/main/java/forge/gui/framework/EDocID.java index 7eca4101de3..6f8e4006348 100644 --- a/forge-gui/src/main/java/forge/gui/framework/EDocID.java +++ b/forge-gui/src/main/java/forge/gui/framework/EDocID.java @@ -34,7 +34,6 @@ public enum EDocID { /** */ CARD_DETAIL (VDetail.SINGLETON_INSTANCE), /** */ CARD_ANTES (VAntes.SINGLETON_INSTANCE), /** */ - EDITOR_PREFERENCES (VEditorPreferences.SINGLETON_INSTANCE), /** */ EDITOR_ALLDECKS (VAllDecks.SINGLETON_INSTANCE), /** */ EDITOR_STATISTICS (VStatistics.SINGLETON_INSTANCE), /** */ EDITOR_PROBABILITIES (VProbabilities.SINGLETON_INSTANCE), /** */