From c011b284e7f473c7d6295d1b7d4ecb35193de1ce Mon Sep 17 00:00:00 2001 From: jendave Date: Tue, 1 Nov 2011 17:36:35 +0000 Subject: [PATCH] checkstyle --- src/main/java/arcane/ui/CardPanel.java | 4 +- src/main/java/forge/GuiDisplay4.java | 64 +-- .../generate/GenerateConstructedDeck.java | 4 +- .../GenerateConstructedMultiColorDeck.java | 8 +- src/main/java/forge/error/BugzReporter.java | 16 +- .../forge/gui/deckeditor/CardPanelHeavy.java | 2 +- .../forge/gui/deckeditor/CardPanelLite.java | 2 +- .../gui/deckeditor/DeckEditorCommon.java | 4 +- .../forge/gui/deckeditor/DeckEditorQuest.java | 8 +- .../forge/gui/deckeditor/DeckEditorShop.java | 8 +- .../java/forge/gui/deckeditor/DeckImport.java | 2 +- .../forge/gui/deckeditor/TableWithCards.java | 2 +- .../java/forge/gui/game/CardDetailPanel.java | 2 +- src/main/java/forge/model/FModel.java | 8 +- .../forge/properties/ForgePreferences.java | 542 +++++++++++++++--- .../forge/view/swing/ApplicationView.java | 28 +- .../java/forge/view/swing/Gui_HomeScreen.java | 42 +- src/main/java/forge/view/swing/Main.java | 2 +- .../java/forge/view/swing/OldGuiNewGame.java | 40 +- 19 files changed, 583 insertions(+), 205 deletions(-) diff --git a/src/main/java/arcane/ui/CardPanel.java b/src/main/java/arcane/ui/CardPanel.java index b00b03811c8..6dbf36798b0 100644 --- a/src/main/java/arcane/ui/CardPanel.java +++ b/src/main/java/arcane/ui/CardPanel.java @@ -595,7 +595,7 @@ public class CardPanel extends JPanel implements CardContainer { * a {@link forge.Card} object. */ public final void setText(final Card card) { - if ((card == null) || !Singletons.getModel().getPreferences().cardOverlay) { + if ((card == null) || !Singletons.getModel().getPreferences().isCardOverlay()) { return; } @@ -645,7 +645,7 @@ public class CardPanel extends JPanel implements CardContainer { final Insets i = this.getInsets(); final Image image = card == null ? null : ImageCache.getImage(card, this.getWidth() - i.left - i.right, this.getHeight() - i.top - i.bottom); - if ((this.getGameCard() != null) && Singletons.getModel().getPreferences().cardOverlay) { + if ((this.getGameCard() != null) && Singletons.getModel().getPreferences().isCardOverlay()) { this.setText(this.getGameCard()); } diff --git a/src/main/java/forge/GuiDisplay4.java b/src/main/java/forge/GuiDisplay4.java index 910e09c6ef5..c9d5c12ad07 100644 --- a/src/main/java/forge/GuiDisplay4.java +++ b/src/main/java/forge/GuiDisplay4.java @@ -861,7 +861,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo private void initComponents() { // Preparing the Frame setTitle(ForgeProps.getLocalized(Lang.PROGRAM_NAME)); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { setFont(new Font("Times New Roman", 0, 16)); } getContentPane().setLayout(new BorderLayout()); @@ -993,7 +993,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo // adding the individual parts - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { initFonts(pane); } @@ -1186,7 +1186,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo oppPCLabel.setForeground(greenColor); JLabel oppHandLabel = new JLabel(ForgeProps.getLocalized(ComputerHand.BUTTON), SwingConstants.TRAILING); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { oppHandLabel.setFont(statFont); } @@ -1194,7 +1194,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo oppGraveButton.setText((String) computerGraveyardAction.getValue("buttonText")); oppGraveButton.setMargin(new Insets(0, 0, 0, 0)); oppGraveButton.setHorizontalAlignment(SwingConstants.TRAILING); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { oppGraveButton.setFont(statFont); } @@ -1205,7 +1205,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo oppRemovedButton.setText((String) computerRemovedAction.getValue("buttonText")); oppRemovedButton.setMargin(new Insets(0, 0, 0, 0)); // removedButton.setHorizontalAlignment(SwingConstants.TRAILING); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { oppRemovedButton.setFont(statFont); } @@ -1280,12 +1280,12 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo playerPCLabel.setForeground(greenColor); JLabel playerLibraryLabel = new JLabel(ForgeProps.getLocalized(HumanLibrary.BUTTON), SwingConstants.TRAILING); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { playerLibraryLabel.setFont(statFont); } JLabel playerHandLabel = new JLabel(ForgeProps.getLocalized(HumanHand.TITLE), SwingConstants.TRAILING); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { playerHandLabel.setFont(statFont); } @@ -1295,7 +1295,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo playerGraveButton.setText((String) humanGraveyardAction.getValue("buttonText")); playerGraveButton.setMargin(new Insets(0, 0, 0, 0)); playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { playerGraveButton.setFont(statFont); } @@ -1303,7 +1303,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo playerFlashBackButton.setText((String) humanFlashbackAction.getValue("buttonText")); playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0)); playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { playerFlashBackButton.setFont(statFont); } @@ -1317,7 +1317,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo playerRemovedButton.setText((String) humanRemovedACtion.getValue("buttonText")); playerRemovedButton.setMargin(new Insets(0, 0, 0, 0)); // removedButton.setHorizontalAlignment(SwingConstants.TRAILING); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { playerRemovedButton.setFont(statFont); } @@ -1465,19 +1465,19 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo public final boolean loadPrefs() { ForgePreferences fp = Singletons.getModel().getPreferences(); - cbAIUpkeep.setSelected(fp.bAIUpkeep); - cbAIDraw.setSelected(fp.bAIDraw); - cbAIEndOfTurn.setSelected(fp.bAIEOT); - cbAIBeginCombat.setSelected(fp.bAIBeginCombat); - cbAIEndCombat.setSelected(fp.bAIEndCombat); + cbAIUpkeep.setSelected(fp.isbAIUpkeep()); + cbAIDraw.setSelected(fp.isbAIDraw()); + cbAIEndOfTurn.setSelected(fp.isbAIEOT()); + cbAIBeginCombat.setSelected(fp.isbAIBeginCombat()); + cbAIEndCombat.setSelected(fp.isbAIEndCombat()); - cbHumanUpkeep.setSelected(fp.bHumanUpkeep); - cbHumanDraw.setSelected(fp.bHumanDraw); - cbHumanEndOfTurn.setSelected(fp.bHumanEOT); - cbHumanBeginCombat.setSelected(fp.bHumanBeginCombat); - cbHumanEndCombat.setSelected(fp.bHumanEndCombat); + cbHumanUpkeep.setSelected(fp.isbHumanUpkeep()); + cbHumanDraw.setSelected(fp.isbHumanDraw()); + cbHumanEndOfTurn.setSelected(fp.isbHumanEOT()); + cbHumanBeginCombat.setSelected(fp.isbHumanBeginCombat()); + cbHumanEndCombat.setSelected(fp.isbHumanEndCombat()); - canLoseByDecking.setSelected(fp.millingLossCondition); + canLoseByDecking.setSelected(fp.isMillingLossCondition()); return true; } @@ -1493,19 +1493,19 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo Constant.Runtime.MILL[0] = canLoseByDecking.isSelected(); ForgePreferences fp = Singletons.getModel().getPreferences(); - fp.bAIUpkeep = cbAIUpkeep.isSelected(); - fp.bAIDraw = cbAIDraw.isSelected(); - fp.bAIEOT = cbAIEndOfTurn.isSelected(); - fp.bAIBeginCombat = cbAIBeginCombat.isSelected(); - fp.bAIEndCombat = cbAIEndCombat.isSelected(); + fp.setbAIUpkeep(cbAIUpkeep.isSelected()); + fp.setbAIDraw(cbAIDraw.isSelected()); + fp.setbAIEOT(cbAIEndOfTurn.isSelected()); + fp.setbAIBeginCombat(cbAIBeginCombat.isSelected()); + fp.setbAIEndCombat(cbAIEndCombat.isSelected()); - fp.bHumanUpkeep = cbHumanUpkeep.isSelected(); - fp.bHumanDraw = cbHumanDraw.isSelected(); - fp.bHumanEOT = cbHumanEndOfTurn.isSelected(); - fp.bHumanBeginCombat = cbHumanBeginCombat.isSelected(); - fp.bHumanEndCombat = cbHumanEndCombat.isSelected(); + fp.setbHumanUpkeep(cbHumanUpkeep.isSelected()); + fp.setbHumanDraw(cbHumanDraw.isSelected()); + fp.setbHumanEOT(cbHumanEndOfTurn.isSelected()); + fp.setbHumanBeginCombat(cbHumanBeginCombat.isSelected()); + fp.setbHumanEndCombat(cbHumanEndCombat.isSelected()); - fp.millingLossCondition = canLoseByDecking.isSelected(); + fp.setMillingLossCondition(canLoseByDecking.isSelected()); return true; } diff --git a/src/main/java/forge/deck/generate/GenerateConstructedDeck.java b/src/main/java/forge/deck/generate/GenerateConstructedDeck.java index 45c7744a710..92cf6cb26fc 100644 --- a/src/main/java/forge/deck/generate/GenerateConstructedDeck.java +++ b/src/main/java/forge/deck/generate/GenerateConstructedDeck.java @@ -165,7 +165,7 @@ public class GenerateConstructedDeck { // is this really a colorless artifact and not something // weird like Sarcomite Myr which is a colored artifact return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS) - && !Singletons.getModel().getPreferences().deckGenRmvArtifacts; + && !Singletons.getModel().getPreferences().isDeckGenRmvArtifacts(); } }); out.addAll(artifact); @@ -173,7 +173,7 @@ public class GenerateConstructedDeck { out = out.filter(new CardListFilter() { @Override public boolean addCard(final Card c) { - if (c.isCreature() && (c.getNetAttack() <= 1) && Singletons.getModel().getPreferences().deckGenRmvSmall) { + if (c.isCreature() && (c.getNetAttack() <= 1) && Singletons.getModel().getPreferences().isDeckGenRmvSmall()) { return false; } diff --git a/src/main/java/forge/deck/generate/GenerateConstructedMultiColorDeck.java b/src/main/java/forge/deck/generate/GenerateConstructedMultiColorDeck.java index 39bf897c72d..716e7057378 100644 --- a/src/main/java/forge/deck/generate/GenerateConstructedMultiColorDeck.java +++ b/src/main/java/forge/deck/generate/GenerateConstructedMultiColorDeck.java @@ -364,7 +364,7 @@ public class GenerateConstructedMultiColorDeck { // is this really a colorless artifact and not something // wierd like Sarcomite Myr which is a colored artifact return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS) - && !Singletons.getModel().getPreferences().deckGenRmvArtifacts; + && !Singletons.getModel().getPreferences().isDeckGenRmvArtifacts(); } }); out.addAll(artifact); @@ -372,7 +372,7 @@ public class GenerateConstructedMultiColorDeck { out = out.filter(new CardListFilter() { @Override public boolean addCard(final Card c) { - if (c.isCreature() && (c.getNetAttack() <= 1) && Singletons.getModel().getPreferences().deckGenRmvSmall) { + if (c.isCreature() && (c.getNetAttack() <= 1) && Singletons.getModel().getPreferences().isDeckGenRmvSmall()) { return false; } @@ -418,7 +418,7 @@ public class GenerateConstructedMultiColorDeck { // is this really a colorless artifact and not something // wierd like Sarcomite Myr which is a colored artifact return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS) - && !Singletons.getModel().getPreferences().deckGenRmvArtifacts; + && !Singletons.getModel().getPreferences().isDeckGenRmvArtifacts(); } }); out.addAll(artifact); @@ -426,7 +426,7 @@ public class GenerateConstructedMultiColorDeck { out = out.filter(new CardListFilter() { @Override public boolean addCard(final Card c) { - if (c.isCreature() && (c.getNetAttack() <= 1) && Singletons.getModel().getPreferences().deckGenRmvSmall) { + if (c.isCreature() && (c.getNetAttack() <= 1) && Singletons.getModel().getPreferences().isDeckGenRmvSmall()) { return false; } diff --git a/src/main/java/forge/error/BugzReporter.java b/src/main/java/forge/error/BugzReporter.java index 1f464d6678a..7ffb0ed8775 100644 --- a/src/main/java/forge/error/BugzReporter.java +++ b/src/main/java/forge/error/BugzReporter.java @@ -169,9 +169,9 @@ public class BugzReporter extends JDialog { this.txtUserName.setColumns(4); try { this.prefs = new ForgePreferences("forge.preferences"); - if (!this.prefs.bugzName.equals("")) { - this.txtUserName.setText(this.prefs.bugzName); - this.txtPassword.setText(this.prefs.bugzPwd); + if (!this.prefs.getBugzName().equals("")) { + this.txtUserName.setText(this.prefs.getBugzName()); + this.txtPassword.setText(this.prefs.getBugzPwd()); this.chkReportAnonymously.setSelected(false); } else { this.chkReportAnonymously.setSelected(true); @@ -189,9 +189,9 @@ public class BugzReporter extends JDialog { BugzReporter.this.txtUserName.setText("ForgeGUI"); BugzReporter.this.txtPassword.setText("vi2ccTbfBUu^"); } else { - if (!BugzReporter.this.prefs.bugzName.equals("")) { - BugzReporter.this.txtUserName.setText(BugzReporter.this.prefs.bugzName); - BugzReporter.this.txtPassword.setText(BugzReporter.this.prefs.bugzPwd); + if (!BugzReporter.this.prefs.getBugzName().equals("")) { + BugzReporter.this.txtUserName.setText(BugzReporter.this.prefs.getBugzName()); + BugzReporter.this.txtPassword.setText(BugzReporter.this.prefs.getBugzPwd()); } } } @@ -440,8 +440,8 @@ public class BugzReporter extends JDialog { break Report; } - this.prefs.bugzName = this.txtUserName.getText(); - this.prefs.bugzPwd = String.valueOf(this.txtPassword.getPassword()); + this.prefs.setBugzName(this.txtUserName.getText()); + this.prefs.setBugzPwd(String.valueOf(this.txtPassword.getPassword())); try { this.prefs.save(); } catch (final Exception e) { diff --git a/src/main/java/forge/gui/deckeditor/CardPanelHeavy.java b/src/main/java/forge/gui/deckeditor/CardPanelHeavy.java index d0d3d77b8b3..7dfa30e429c 100644 --- a/src/main/java/forge/gui/deckeditor/CardPanelHeavy.java +++ b/src/main/java/forge/gui/deckeditor/CardPanelHeavy.java @@ -64,7 +64,7 @@ public class CardPanelHeavy extends CardPanelBase { CardPanelHeavy.this.changeStateButtonActionPerformed(e); } }); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.changeStateButton.setFont(new java.awt.Font("Dialog", 0, 10)); } diff --git a/src/main/java/forge/gui/deckeditor/CardPanelLite.java b/src/main/java/forge/gui/deckeditor/CardPanelLite.java index 8f5556d8c50..975029d7632 100644 --- a/src/main/java/forge/gui/deckeditor/CardPanelLite.java +++ b/src/main/java/forge/gui/deckeditor/CardPanelLite.java @@ -39,7 +39,7 @@ public class CardPanelLite extends CardPanelBase { CardPanelLite.this.bChangeStateActionPerformed(e); } }); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.bChangeState.setFont(new java.awt.Font("Dialog", 0, 10)); } diff --git a/src/main/java/forge/gui/deckeditor/DeckEditorCommon.java b/src/main/java/forge/gui/deckeditor/DeckEditorCommon.java index f2458f70b16..21d0577d421 100644 --- a/src/main/java/forge/gui/deckeditor/DeckEditorCommon.java +++ b/src/main/java/forge/gui/deckeditor/DeckEditorCommon.java @@ -151,7 +151,7 @@ public final class DeckEditorCommon extends DeckEditorBase { private void jbInit() { - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { final Font fButtons = new java.awt.Font("Dialog", 0, 13); this.removeButton.setFont(fButtons); this.addButton.setFont(fButtons); @@ -200,7 +200,7 @@ public final class DeckEditorCommon extends DeckEditorBase { // Type filtering final Font f = new Font("Tahoma", Font.PLAIN, 10); for (final JCheckBox box : this.getFilterBoxes().getAllTypes()) { - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { box.setFont(f); } box.setOpaque(false); diff --git a/src/main/java/forge/gui/deckeditor/DeckEditorQuest.java b/src/main/java/forge/gui/deckeditor/DeckEditorQuest.java index 0cde1139e9a..35a2869b827 100644 --- a/src/main/java/forge/gui/deckeditor/DeckEditorQuest.java +++ b/src/main/java/forge/gui/deckeditor/DeckEditorQuest.java @@ -197,7 +197,7 @@ public final class DeckEditorQuest extends DeckEditorBase implements NewConstant this.removeButton.setBounds(new Rectangle(180, 403, 146, 49)); // removeButton.setIcon(upIcon); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.removeButton.setFont(new java.awt.Font("Dialog", 0, 13)); } this.removeButton.setText("Remove Card"); @@ -215,7 +215,7 @@ public final class DeckEditorQuest extends DeckEditorBase implements NewConstant } }); // addButton.setIcon(downIcon); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.addButton.setFont(new java.awt.Font("Dialog", 0, 13)); } this.addButton.setBounds(new Rectangle(23, 403, 146, 49)); @@ -227,7 +227,7 @@ public final class DeckEditorQuest extends DeckEditorBase implements NewConstant DeckEditorQuest.this.analysisButtonActionPerformed(e); } }); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.analysisButton.setFont(new java.awt.Font("Dialog", 0, 13)); } this.analysisButton.setBounds(new Rectangle(578, 426, 166, 25)); @@ -245,7 +245,7 @@ public final class DeckEditorQuest extends DeckEditorBase implements NewConstant final Font f = new Font("Tahoma", Font.PLAIN, 10); for (final JCheckBox box : this.getFilterBoxes().getAllTypes()) { - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { box.setFont(f); } box.setOpaque(false); diff --git a/src/main/java/forge/gui/deckeditor/DeckEditorShop.java b/src/main/java/forge/gui/deckeditor/DeckEditorShop.java index 9903208d889..8520523b764 100644 --- a/src/main/java/forge/gui/deckeditor/DeckEditorShop.java +++ b/src/main/java/forge/gui/deckeditor/DeckEditorShop.java @@ -211,7 +211,7 @@ public final class DeckEditorShop extends DeckEditorBase { this.sellButton.setBounds(new Rectangle(180, 403, 146, 49)); // removeButton.setIcon(upIcon); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.sellButton.setFont(new java.awt.Font("Dialog", 0, 13)); } this.sellButton.setText("Sell Card"); @@ -229,7 +229,7 @@ public final class DeckEditorShop extends DeckEditorBase { } }); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.buyButton.setFont(new java.awt.Font("Dialog", 0, 13)); } this.buyButton.setBounds(new Rectangle(23, 403, 146, 49)); @@ -241,12 +241,12 @@ public final class DeckEditorShop extends DeckEditorBase { this.creditsLabel.setBounds(new Rectangle(19, 365, 720, 31)); this.creditsLabel.setText("Total credits: " + this.questData.getCredits()); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.creditsLabel.setFont(new java.awt.Font("Dialog", 0, 14)); } this.sellPercentageLabel.setBounds(new Rectangle(350, 403, 450, 31)); this.sellPercentageLabel.setText("(Sell percentage: " + this.multiplier + ")"); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.sellPercentageLabel.setFont(new java.awt.Font("Dialog", 0, 14)); } this.jLabel1.setText("Click on the column name (like name or color) to sort the cards"); diff --git a/src/main/java/forge/gui/deckeditor/DeckImport.java b/src/main/java/forge/gui/deckeditor/DeckImport.java index 6d7a3eb341f..137955c188c 100644 --- a/src/main/java/forge/gui/deckeditor/DeckImport.java +++ b/src/main/java/forge/gui/deckeditor/DeckImport.java @@ -89,7 +89,7 @@ public class DeckImport extends JDialog { this.setResizable(false); this.setTitle("Deck Import (wip)"); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { final Font fButtons = new java.awt.Font("Dialog", 0, 13); this.cmdAccept.setFont(fButtons); this.cmdCancel.setFont(fButtons); diff --git a/src/main/java/forge/gui/deckeditor/TableWithCards.java b/src/main/java/forge/gui/deckeditor/TableWithCards.java index 46c0d5d561e..3d95313f1b2 100644 --- a/src/main/java/forge/gui/deckeditor/TableWithCards.java +++ b/src/main/java/forge/gui/deckeditor/TableWithCards.java @@ -116,7 +116,7 @@ public final class TableWithCards { this.jScrollPane.setToolTipText(tableToolTip); this.jScrollPane.getViewport().add(this.table, null); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.statsLabel.setFont(new java.awt.Font("Dialog", 0, 13)); } this.statsLabel.setText("Total: 0, Creatures: 0, Land: 0"); diff --git a/src/main/java/forge/gui/game/CardDetailPanel.java b/src/main/java/forge/gui/game/CardDetailPanel.java index 20a00c872dd..19dfbc3a75e 100644 --- a/src/main/java/forge/gui/game/CardDetailPanel.java +++ b/src/main/java/forge/gui/game/CardDetailPanel.java @@ -103,7 +103,7 @@ public class CardDetailPanel extends JPanel implements CardContainer { this.cdArea.setLineWrap(true); this.cdArea.setWrapStyleWord(true); - if (!Singletons.getModel().getPreferences().lafFonts) { + if (!Singletons.getModel().getPreferences().isLafFonts()) { this.nameCostLabel.setFont(new java.awt.Font("Dialog", 0, 14)); this.typeLabel.setFont(new java.awt.Font("Dialog", 0, 14)); this.powerToughnessLabel.setFont(new java.awt.Font("Dialog", 0, 14)); diff --git a/src/main/java/forge/model/FModel.java b/src/main/java/forge/model/FModel.java index 2c36f863d0c..3c1503a3619 100644 --- a/src/main/java/forge/model/FModel.java +++ b/src/main/java/forge/model/FModel.java @@ -73,10 +73,10 @@ public class FModel { // PM } - Constant.Runtime.MILL[0] = this.preferences.millingLossCondition; - Constant.Runtime.DEV_MODE[0] = this.preferences.developerMode; - Constant.Runtime.UPLOAD_DRAFT[0] = this.preferences.uploadDraftAI; - Constant.Runtime.RANDOM_FOIL[0] = this.preferences.randCFoil; + Constant.Runtime.MILL[0] = this.preferences.isMillingLossCondition(); + Constant.Runtime.DEV_MODE[0] = this.preferences.isDeveloperMode(); + Constant.Runtime.UPLOAD_DRAFT[0] = this.preferences.isUploadDraftAI(); + Constant.Runtime.RANDOM_FOIL[0] = this.preferences.isRandCFoil(); final HttpUtil pinger = new HttpUtil(); if (pinger.getURL("http://cardforge.org/draftAI/ping.php").equals("pong")) { diff --git a/src/main/java/forge/properties/ForgePreferences.java b/src/main/java/forge/properties/ForgePreferences.java index 4e0d0940022..ab67c5d2a26 100644 --- a/src/main/java/forge/properties/ForgePreferences.java +++ b/src/main/java/forge/properties/ForgePreferences.java @@ -19,89 +19,89 @@ import java.util.List; public class ForgePreferences extends Preferences { /** The new gui. */ - public boolean newGui; + private boolean newGui; /** The stack ai land. */ - public boolean stackAiLand; + private boolean stackAiLand; /** The milling loss condition. */ - public boolean millingLossCondition; + private boolean millingLossCondition; /** The developer mode. */ - public boolean developerMode; + private boolean developerMode; /** The upload draft ai. */ - public boolean uploadDraftAI; + private boolean uploadDraftAI; /** The rand c foil. */ - public boolean randCFoil; + private boolean randCFoil; /** The skin. */ - public String skin; + private String skin; /** The laf. */ - public String laf; + private String laf; /** The laf fonts. */ - public boolean lafFonts; + private boolean lafFonts; /** The stack offset. */ - public StackOffsetType stackOffset; + private StackOffsetType stackOffset; /** The max stack size. */ - public int maxStackSize; + private int maxStackSize; /** The card size. */ - public CardSizeType cardSize; + private CardSizeType cardSize; /** The card overlay. */ - public boolean cardOverlay; + private boolean cardOverlay; /** The scale larger than original. */ - public boolean scaleLargerThanOriginal; + private boolean scaleLargerThanOriginal; /** The deck gen rmv artifacts. */ - public boolean deckGenRmvArtifacts; + private boolean deckGenRmvArtifacts; /** The deck gen rmv small. */ - public boolean deckGenRmvSmall; + private boolean deckGenRmvSmall; /** The Bugz name. */ - public String bugzName; + private String bugzName; /** The Bugz pwd. */ - public String bugzPwd; + private String bugzPwd; // Phases /** The b ai upkeep. */ - public boolean bAIUpkeep; + private boolean bAIUpkeep; /** The b ai draw. */ - public boolean bAIDraw; + private boolean bAIDraw; /** The b aieot. */ - public boolean bAIEOT; + private boolean bAIEOT; /** The b ai begin combat. */ - public boolean bAIBeginCombat; + private boolean bAIBeginCombat; /** The b ai end combat. */ - public boolean bAIEndCombat; + private boolean bAIEndCombat; /** The b human upkeep. */ - public boolean bHumanUpkeep; + private boolean bHumanUpkeep; /** The b human draw. */ - public boolean bHumanDraw; + private boolean bHumanDraw; /** The b human eot. */ - public boolean bHumanEOT; + private boolean bHumanEOT; /** The b human begin combat. */ - public boolean bHumanBeginCombat; + private boolean bHumanBeginCombat; /** The b human end combat. */ - public boolean bHumanEndCombat; + private boolean bHumanEndCombat; private final List saveListeners = new ArrayList(); private final String fileName; @@ -133,41 +133,41 @@ public class ForgePreferences extends Preferences { } this.newGui = this.getBoolean("gui.new", true); - this.stackAiLand = this.getBoolean("AI.stack.land", false); - this.millingLossCondition = this.getBoolean("loss.condition.milling", true); - this.developerMode = this.getBoolean("developer.mode", false); + this.setStackAiLand(this.getBoolean("AI.stack.land", false)); + this.setMillingLossCondition(this.getBoolean("loss.condition.milling", true)); + this.setDeveloperMode(this.getBoolean("developer.mode", false)); - this.uploadDraftAI = this.getBoolean("upload.Draft.AI", true); + this.setUploadDraftAI(this.getBoolean("upload.Draft.AI", true)); - this.randCFoil = this.getBoolean("rand.C.Foil", true); + this.setRandCFoil(this.getBoolean("rand.C.Foil", true)); - this.laf = this.get("gui.laf", ""); - this.lafFonts = this.getBoolean("gui.laf.fonts", false); - this.skin = this.get("gui.skin", "default"); + this.setLaf(this.get("gui.laf", "")); + this.setLafFonts(this.getBoolean("gui.laf.fonts", false)); + this.setSkin(this.get("gui.skin", "default")); - this.cardOverlay = this.getBoolean("card.overlay", true); - this.cardSize = CardSizeType.valueOf(this.get("card.images.size", "medium")); - this.stackOffset = StackOffsetType.valueOf(this.get("stack.offset", "tiny")); - this.maxStackSize = this.getInt("stack.max.size", 3); - this.scaleLargerThanOriginal = this.getBoolean("card.scale.larger.than.original", true); + this.setCardOverlay(this.getBoolean("card.overlay", true)); + this.setCardSize(CardSizeType.valueOf(this.get("card.images.size", "medium"))); + this.setStackOffset(StackOffsetType.valueOf(this.get("stack.offset", "tiny"))); + this.setMaxStackSize(this.getInt("stack.max.size", 3)); + this.setScaleLargerThanOriginal(this.getBoolean("card.scale.larger.than.original", true)); - this.deckGenRmvArtifacts = this.getBoolean("deck.gen.rmv.artifacts", false); - this.deckGenRmvSmall = this.getBoolean("deck.gen.rmv.small", false); + this.setDeckGenRmvArtifacts(this.getBoolean("deck.gen.rmv.artifacts", false)); + this.setDeckGenRmvSmall(this.getBoolean("deck.gen.rmv.small", false)); - this.bugzName = this.get("bugz.user.name", ""); - this.bugzPwd = this.get("bugz.user.pwd", ""); + this.setBugzName(this.get("bugz.user.name", "")); + this.setBugzPwd(this.get("bugz.user.pwd", "")); // Stop at Phases - this.bAIUpkeep = this.getBoolean("phase.ai.upkeep", true); - this.bAIDraw = this.getBoolean("phase.ai.draw", true); - this.bAIEOT = this.getBoolean("phase.ai.eot", true); - this.bAIBeginCombat = this.getBoolean("phase.ai.beginCombat", true); - this.bAIEndCombat = this.getBoolean("phase.ai.endCombat", true); - this.bHumanUpkeep = this.getBoolean("phase.human.upkeep", true); - this.bHumanDraw = this.getBoolean("phase.human.draw", true); - this.bHumanEOT = this.getBoolean("phase.human.eot", true); - this.bHumanBeginCombat = this.getBoolean("phase.human.beginCombat", true); - this.bHumanEndCombat = this.getBoolean("phase.human.endCombat", true); + this.setbAIUpkeep(this.getBoolean("phase.ai.upkeep", true)); + this.setbAIDraw(this.getBoolean("phase.ai.draw", true)); + this.setbAIEOT(this.getBoolean("phase.ai.eot", true)); + this.setbAIBeginCombat(this.getBoolean("phase.ai.beginCombat", true)); + this.setbAIEndCombat(this.getBoolean("phase.ai.endCombat", true)); + this.setbHumanUpkeep(this.getBoolean("phase.human.upkeep", true)); + this.setbHumanDraw(this.getBoolean("phase.human.draw", true)); + this.setbHumanEOT(this.getBoolean("phase.human.eot", true)); + this.setbHumanBeginCombat(this.getBoolean("phase.human.beginCombat", true)); + this.setbHumanEndCombat(this.getBoolean("phase.human.endCombat", true)); } /** @@ -182,42 +182,42 @@ public class ForgePreferences extends Preferences { this.set("gui.new", this.newGui); - this.set("AI.stack.land", this.stackAiLand); - this.set("loss.condition.milling", this.millingLossCondition); - this.set("developer.mode", this.developerMode); - this.set("upload.Draft.AI", this.uploadDraftAI); + this.set("AI.stack.land", this.isStackAiLand()); + this.set("loss.condition.milling", this.isMillingLossCondition()); + this.set("developer.mode", this.isDeveloperMode()); + this.set("upload.Draft.AI", this.isUploadDraftAI()); - this.set("rand.C.Foil", this.randCFoil); + this.set("rand.C.Foil", this.isRandCFoil()); - this.set("gui.skin", this.skin); - this.set("gui.laf", this.laf); - this.set("gui.laf.fonts", this.lafFonts); + this.set("gui.skin", this.getSkin()); + this.set("gui.laf", this.getLaf()); + this.set("gui.laf.fonts", this.isLafFonts()); - this.set("card.overlay", this.cardOverlay); - this.set("card.images.size", this.cardSize); - this.set("stack.offset", this.stackOffset); - this.set("stack.max.size", this.maxStackSize); - this.set("card.scale.larger.than.original", this.scaleLargerThanOriginal); + this.set("card.overlay", this.isCardOverlay()); + this.set("card.images.size", this.getCardSize()); + this.set("stack.offset", this.getStackOffset()); + this.set("stack.max.size", this.getMaxStackSize()); + this.set("card.scale.larger.than.original", this.isScaleLargerThanOriginal()); for (final SavePreferencesListener listeners : this.saveListeners) { listeners.savePreferences(); } - this.set("deck.gen.rmv.artifacts", this.deckGenRmvArtifacts); - this.set("deck.gen.rmv.small", this.deckGenRmvSmall); + this.set("deck.gen.rmv.artifacts", this.isDeckGenRmvArtifacts()); + this.set("deck.gen.rmv.small", this.isDeckGenRmvSmall()); - this.set("bugz.user.name", this.bugzName); - this.set("bugz.user.pwd", this.bugzPwd); + this.set("bugz.user.name", this.getBugzName()); + this.set("bugz.user.pwd", this.getBugzPwd()); - this.set("phase.ai.upkeep", this.bAIUpkeep); - this.set("phase.ai.draw", this.bAIDraw); - this.set("phase.ai.eot", this.bAIEOT); - this.set("phase.ai.beginCombat", this.bAIBeginCombat); - this.set("phase.ai.endCombat", this.bAIEndCombat); - this.set("phase.human.upkeep", this.bHumanUpkeep); - this.set("phase.human.draw", this.bHumanDraw); - this.set("phase.human.eot", this.bHumanEOT); - this.set("phase.human.beginCombat", this.bHumanBeginCombat); - this.set("phase.human.endCombat", this.bHumanEndCombat); + this.set("phase.ai.upkeep", this.isbAIUpkeep()); + this.set("phase.ai.draw", this.isbAIDraw()); + this.set("phase.ai.eot", this.isbAIEOT()); + this.set("phase.ai.beginCombat", this.isbAIBeginCombat()); + this.set("phase.ai.endCombat", this.isbAIEndCombat()); + this.set("phase.human.upkeep", this.isbHumanUpkeep()); + this.set("phase.human.draw", this.isbHumanDraw()); + this.set("phase.human.eot", this.isbHumanEOT()); + this.set("phase.human.beginCombat", this.isbHumanBeginCombat()); + this.set("phase.human.endCombat", this.isbHumanEndCombat()); try { final FileOutputStream stream = new FileOutputStream(this.fileName); @@ -240,6 +240,384 @@ public class ForgePreferences extends Preferences { this.saveListeners.add(listener); } + /** + * @return the stackAiLand + */ + public boolean isStackAiLand() { + return stackAiLand; + } + + /** + * @param stackAiLand the stackAiLand to set + */ + public void setStackAiLand(boolean stackAiLand) { + this.stackAiLand = stackAiLand; // TODO: Add 0 to parameter's name. + } + + /** + * @return the millingLossCondition + */ + public boolean isMillingLossCondition() { + return millingLossCondition; + } + + /** + * @param millingLossCondition the millingLossCondition to set + */ + public void setMillingLossCondition(boolean millingLossCondition) { + this.millingLossCondition = millingLossCondition; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bAIBeginCombat + */ + public boolean isbAIBeginCombat() { + return bAIBeginCombat; + } + + /** + * @param bAIBeginCombat the bAIBeginCombat to set + */ + public void setbAIBeginCombat(boolean bAIBeginCombat) { + this.bAIBeginCombat = bAIBeginCombat; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bAIEndCombat + */ + public boolean isbAIEndCombat() { + return bAIEndCombat; + } + + /** + * @param bAIEndCombat the bAIEndCombat to set + */ + public void setbAIEndCombat(boolean bAIEndCombat) { + this.bAIEndCombat = bAIEndCombat; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bAIUpkeep + */ + public boolean isbAIUpkeep() { + return bAIUpkeep; + } + + /** + * @param bAIUpkeep the bAIUpkeep to set + */ + public void setbAIUpkeep(boolean bAIUpkeep) { + this.bAIUpkeep = bAIUpkeep; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bAIDraw + */ + public boolean isbAIDraw() { + return bAIDraw; + } + + /** + * @param bAIDraw the bAIDraw to set + */ + public void setbAIDraw(boolean bAIDraw) { + this.bAIDraw = bAIDraw; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bAIEOT + */ + public boolean isbAIEOT() { + return bAIEOT; + } + + /** + * @param bAIEOT the bAIEOT to set + */ + public void setbAIEOT(boolean bAIEOT) { + this.bAIEOT = bAIEOT; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bHumanBeginCombat + */ + public boolean isbHumanBeginCombat() { + return bHumanBeginCombat; + } + + /** + * @param bHumanBeginCombat the bHumanBeginCombat to set + */ + public void setbHumanBeginCombat(boolean bHumanBeginCombat) { + this.bHumanBeginCombat = bHumanBeginCombat; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bHumanDraw + */ + public boolean isbHumanDraw() { + return bHumanDraw; + } + + /** + * @param bHumanDraw the bHumanDraw to set + */ + public void setbHumanDraw(boolean bHumanDraw) { + this.bHumanDraw = bHumanDraw; // TODO: Add 0 to parameter's name. + } + + /** + * @return the uploadDraftAI + */ + public boolean isUploadDraftAI() { + return uploadDraftAI; + } + + /** + * @param uploadDraftAI the uploadDraftAI to set + */ + public void setUploadDraftAI(boolean uploadDraftAI) { + this.uploadDraftAI = uploadDraftAI; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bHumanEndCombat + */ + public boolean isbHumanEndCombat() { + return bHumanEndCombat; + } + + /** + * @param bHumanEndCombat the bHumanEndCombat to set + */ + public void setbHumanEndCombat(boolean bHumanEndCombat) { + this.bHumanEndCombat = bHumanEndCombat; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bHumanEOT + */ + public boolean isbHumanEOT() { + return bHumanEOT; + } + + /** + * @param bHumanEOT the bHumanEOT to set + */ + public void setbHumanEOT(boolean bHumanEOT) { + this.bHumanEOT = bHumanEOT; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bHumanUpkeep + */ + public boolean isbHumanUpkeep() { + return bHumanUpkeep; + } + + /** + * @param bHumanUpkeep the bHumanUpkeep to set + */ + public void setbHumanUpkeep(boolean bHumanUpkeep) { + this.bHumanUpkeep = bHumanUpkeep; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bugzName + */ + public String getBugzName() { + return bugzName; + } + + /** + * @param bugzName the bugzName to set + */ + public void setBugzName(String bugzName) { + this.bugzName = bugzName; // TODO: Add 0 to parameter's name. + } + + /** + * @return the bugzPwd + */ + public String getBugzPwd() { + return bugzPwd; + } + + /** + * @param bugzPwd the bugzPwd to set + */ + public void setBugzPwd(String bugzPwd) { + this.bugzPwd = bugzPwd; // TODO: Add 0 to parameter's name. + } + + /** + * @return the randCFoil + */ + public boolean isRandCFoil() { + return randCFoil; + } + + /** + * @param randCFoil the randCFoil to set + */ + public void setRandCFoil(boolean randCFoil) { + this.randCFoil = randCFoil; // TODO: Add 0 to parameter's name. + } + + /** + * @return the developerMode + */ + public boolean isDeveloperMode() { + return developerMode; + } + + /** + * @param developerMode the developerMode to set + */ + public void setDeveloperMode(boolean developerMode) { + this.developerMode = developerMode; // TODO: Add 0 to parameter's name. + } + + /** + * @return the laf + */ + public String getLaf() { + return laf; + } + + /** + * @param laf the laf to set + */ + public void setLaf(String laf) { + this.laf = laf; // TODO: Add 0 to parameter's name. + } + + /** + * @return the skin + */ + public String getSkin() { + return skin; + } + + /** + * @param skin the skin to set + */ + public void setSkin(String skin) { + this.skin = skin; // TODO: Add 0 to parameter's name. + } + + /** + * @return the lafFonts + */ + public boolean isLafFonts() { + return lafFonts; + } + + /** + * @param lafFonts the lafFonts to set + */ + public void setLafFonts(boolean lafFonts) { + this.lafFonts = lafFonts; // TODO: Add 0 to parameter's name. + } + + /** + * @return the scaleLargerThanOriginal + */ + public boolean isScaleLargerThanOriginal() { + return scaleLargerThanOriginal; + } + + /** + * @param scaleLargerThanOriginal the scaleLargerThanOriginal to set + */ + public void setScaleLargerThanOriginal(boolean scaleLargerThanOriginal) { + this.scaleLargerThanOriginal = scaleLargerThanOriginal; // TODO: Add 0 to parameter's name. + } + + /** + * @return the cardOverlay + */ + public boolean isCardOverlay() { + return cardOverlay; + } + + /** + * @param cardOverlay the cardOverlay to set + */ + public void setCardOverlay(boolean cardOverlay) { + this.cardOverlay = cardOverlay; // TODO: Add 0 to parameter's name. + } + + /** + * @return the deckGenRmvArtifacts + */ + public boolean isDeckGenRmvArtifacts() { + return deckGenRmvArtifacts; + } + + /** + * @param deckGenRmvArtifacts the deckGenRmvArtifacts to set + */ + public void setDeckGenRmvArtifacts(boolean deckGenRmvArtifacts) { + this.deckGenRmvArtifacts = deckGenRmvArtifacts; // TODO: Add 0 to parameter's name. + } + + /** + * @return the deckGenRmvSmall + */ + public boolean isDeckGenRmvSmall() { + return deckGenRmvSmall; + } + + /** + * @param deckGenRmvSmall the deckGenRmvSmall to set + */ + public void setDeckGenRmvSmall(boolean deckGenRmvSmall) { + this.deckGenRmvSmall = deckGenRmvSmall; // TODO: Add 0 to parameter's name. + } + + /** + * @return the cardSize + */ + public CardSizeType getCardSize() { + return cardSize; + } + + /** + * @param cardSize the cardSize to set + */ + public void setCardSize(CardSizeType cardSize) { + this.cardSize = cardSize; // TODO: Add 0 to parameter's name. + } + + /** + * @return the stackOffset + */ + public StackOffsetType getStackOffset() { + return stackOffset; + } + + /** + * @param stackOffset the stackOffset to set + */ + public void setStackOffset(StackOffsetType stackOffset) { + this.stackOffset = stackOffset; // TODO: Add 0 to parameter's name. + } + + /** + * @return the maxStackSize + */ + public int getMaxStackSize() { + return maxStackSize; + } + + /** + * @param maxStackSize the maxStackSize to set + */ + public void setMaxStackSize(int maxStackSize) { + this.maxStackSize = maxStackSize; // TODO: Add 0 to parameter's name. + } + /** * The Enum CardSizeType. */ diff --git a/src/main/java/forge/view/swing/ApplicationView.java b/src/main/java/forge/view/swing/ApplicationView.java index f85ba1082aa..1de1a4e13db 100644 --- a/src/main/java/forge/view/swing/ApplicationView.java +++ b/src/main/java/forge/view/swing/ApplicationView.java @@ -94,23 +94,23 @@ public class ApplicationView implements FView { final ForgePreferences preferences = model.getPreferences(); - OldGuiNewGame.useLAFFonts.setSelected(preferences.lafFonts); + OldGuiNewGame.useLAFFonts.setSelected(preferences.isLafFonts()); // newGuiCheckBox.setSelected(preferences.newGui); - OldGuiNewGame.smoothLandCheckBox.setSelected(preferences.stackAiLand); - OldGuiNewGame.devModeCheckBox.setSelected(preferences.developerMode); - OldGuiNewGame.cardOverlay.setSelected(preferences.cardOverlay); + OldGuiNewGame.smoothLandCheckBox.setSelected(preferences.isStackAiLand()); + OldGuiNewGame.devModeCheckBox.setSelected(preferences.isDeveloperMode()); + OldGuiNewGame.cardOverlay.setSelected(preferences.isCardOverlay()); // FindBugs doesn't like the next line. - ImageCache.setScaleLargerThanOriginal(preferences.scaleLargerThanOriginal); + ImageCache.setScaleLargerThanOriginal(preferences.isScaleLargerThanOriginal()); - OldGuiNewGame.cardScale.setSelected(preferences.scaleLargerThanOriginal); - CardStackOffsetAction.set(preferences.stackOffset); - CardStackAction.setVal(preferences.maxStackSize); - CardSizesAction.set(preferences.cardSize); - OldGuiNewGame.upldDrftCheckBox.setSelected(preferences.uploadDraftAI); - OldGuiNewGame.foilRandomCheckBox.setSelected(preferences.randCFoil); + OldGuiNewGame.cardScale.setSelected(preferences.isScaleLargerThanOriginal()); + CardStackOffsetAction.set(preferences.getStackOffset()); + CardStackAction.setVal(preferences.getMaxStackSize()); + CardSizesAction.set(preferences.getCardSize()); + OldGuiNewGame.upldDrftCheckBox.setSelected(preferences.isUploadDraftAI()); + OldGuiNewGame.foilRandomCheckBox.setSelected(preferences.isRandCFoil()); - AllZone.setSkin(new FSkin(preferences.skin)); + AllZone.setSkin(new FSkin(preferences.getSkin())); } catch (Exception exn) { Log.error("Error loading preferences: " + exn); @@ -123,10 +123,10 @@ public class ApplicationView implements FView { final ForgePreferences finalPreferences = model.getPreferences(); try { - if ("".equals(finalPreferences.laf)) { + if ("".equals(finalPreferences.getLaf())) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } else { - UIManager.setLookAndFeel(finalPreferences.laf); + UIManager.setLookAndFeel(finalPreferences.getLaf()); } } catch (Exception ex) { ErrorViewer.showError(ex); diff --git a/src/main/java/forge/view/swing/Gui_HomeScreen.java b/src/main/java/forge/view/swing/Gui_HomeScreen.java index 5aef2fbd4be..ce9007f7cab 100644 --- a/src/main/java/forge/view/swing/Gui_HomeScreen.java +++ b/src/main/java/forge/view/swing/Gui_HomeScreen.java @@ -587,28 +587,28 @@ public class Gui_HomeScreen { pnlSettingsA.add(lblBasic); chkDeveloperMode.setOpaque(false); chkDeveloperMode.setBackground(clrScrollBackground); - chkDeveloperMode.setSelected(Singletons.getModel().getPreferences().developerMode); + chkDeveloperMode.setSelected(Singletons.getModel().getPreferences().isDeveloperMode()); chkDeveloperMode.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().developerMode = chkDeveloperMode.isSelected(); + Singletons.getModel().getPreferences().setDeveloperMode(chkDeveloperMode.isSelected()); } }); pnlSettingsA.add(chkDeveloperMode); chkStackAiLand.setOpaque(false); chkStackAiLand.setBackground(clrScrollBackground); - chkStackAiLand.setSelected(Singletons.getModel().getPreferences().stackAiLand); + chkStackAiLand.setSelected(Singletons.getModel().getPreferences().isStackAiLand()); chkStackAiLand.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().stackAiLand = chkStackAiLand.isSelected(); + Singletons.getModel().getPreferences().setStackAiLand(chkStackAiLand.isSelected()); } }); pnlSettingsA.add(chkStackAiLand); chkUploadDraftData.setBackground(clrScrollBackground); chkUploadDraftData.setOpaque(false); - chkUploadDraftData.setSelected(Singletons.getModel().getPreferences().uploadDraftAI); + chkUploadDraftData.setSelected(Singletons.getModel().getPreferences().isUploadDraftAI()); chkUploadDraftData.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().uploadDraftAI = chkUploadDraftData.isSelected(); + Singletons.getModel().getPreferences().setUploadDraftAI(chkUploadDraftData.isSelected()); } }); pnlSettingsA.add(chkUploadDraftData); @@ -617,19 +617,19 @@ public class Gui_HomeScreen { pnlSettingsA.add(lblGraphs); chkMana.setOpaque(false); chkMana.setBackground(clrScrollBackground); - chkMana.setSelected(Singletons.getModel().getPreferences().cardOverlay); + chkMana.setSelected(Singletons.getModel().getPreferences().isCardOverlay()); chkMana.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().cardOverlay = chkMana.isSelected(); + Singletons.getModel().getPreferences().setCardOverlay(chkMana.isSelected()); } }); pnlSettingsA.add(chkMana); chkFoil.setOpaque(false); chkFoil.setBackground(clrScrollBackground); - chkFoil.setSelected(Singletons.getModel().getPreferences().randCFoil); + chkFoil.setSelected(Singletons.getModel().getPreferences().isRandCFoil()); chkFoil.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().randCFoil = chkFoil.isSelected(); + Singletons.getModel().getPreferences().setRandCFoil(chkFoil.isSelected()); } }); pnlSettingsA.add(chkFoil); @@ -646,10 +646,10 @@ public class Gui_HomeScreen { pnlSettingsA.add(cmdLAF); chkLAF.setOpaque(false); chkLAF.setBackground(clrScrollBackground); - chkLAF.setSelected(Singletons.getModel().getPreferences().lafFonts); + chkLAF.setSelected(Singletons.getModel().getPreferences().isLafFonts()); chkLAF.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().lafFonts = chkLAF.isSelected(); + Singletons.getModel().getPreferences().setLafFonts(chkLAF.isSelected()); } }); pnlSettingsA.add(chkLAF); @@ -663,10 +663,10 @@ public class Gui_HomeScreen { pnlSettingsA.add(cmdSize); chkScale.setOpaque(false); chkScale.setBackground(clrScrollBackground); - chkScale.setSelected(Singletons.getModel().getPreferences().scaleLargerThanOriginal); + chkScale.setSelected(Singletons.getModel().getPreferences().isScaleLargerThanOriginal()); chkScale.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().scaleLargerThanOriginal = chkScale.isSelected(); + Singletons.getModel().getPreferences().setScaleLargerThanOriginal(chkScale.isSelected()); } }); pnlSettingsA.add(chkScale); @@ -683,19 +683,19 @@ public class Gui_HomeScreen { pnlSettingsA.add(lblGenGraphs); chkRemoveArtifacts.setOpaque(false); chkRemoveArtifacts.setBackground(clrScrollBackground); - chkRemoveArtifacts.setSelected(Singletons.getModel().getPreferences().deckGenRmvArtifacts); + chkRemoveArtifacts.setSelected(Singletons.getModel().getPreferences().isDeckGenRmvArtifacts()); chkRemoveArtifacts.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().deckGenRmvArtifacts = chkRemoveArtifacts.isSelected(); + Singletons.getModel().getPreferences().setDeckGenRmvArtifacts(chkRemoveArtifacts.isSelected()); } }); pnlSettingsA.add(chkRemoveArtifacts); chkRemoveSmall.setOpaque(false); chkRemoveSmall.setBackground(clrScrollBackground); - chkRemoveSmall.setSelected(Singletons.getModel().getPreferences().deckGenRmvSmall); + chkRemoveSmall.setSelected(Singletons.getModel().getPreferences().isDeckGenRmvSmall()); chkRemoveSmall.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().deckGenRmvSmall = chkRemoveSmall.isSelected(); + Singletons.getModel().getPreferences().setDeckGenRmvSmall(chkRemoveSmall.isSelected()); } }); pnlSettingsA.add(chkRemoveSmall); @@ -1337,7 +1337,7 @@ public class Gui_HomeScreen { return; } // UIManager.setLookAndFeel(info[index].getClassName()); - Singletons.getModel().getPreferences().laf = LAFMap.get(name); + Singletons.getModel().getPreferences().setLaf(LAFMap.get(name)); UIManager.setLookAndFeel(LAFMap.get(name)); // SwingUtilities.updateComponentTreeUI(NG2); @@ -1360,7 +1360,7 @@ public class Gui_HomeScreen { return; } - Singletons.getModel().getPreferences().cardSize = CardSizeType.valueOf(keys[index].toLowerCase()); + Singletons.getModel().getPreferences().setCardSize(CardSizeType.valueOf(keys[index].toLowerCase())); Constant.Runtime.WIDTH[0] = widths[index]; Constant.Runtime.HEIGHT[0] = heights[index]; @@ -1381,7 +1381,7 @@ public class Gui_HomeScreen { if (index == -1) { return; } - Singletons.getModel().getPreferences().stackOffset = StackOffsetType.valueOf(keys[index].toLowerCase()); + Singletons.getModel().getPreferences().setStackOffset(StackOffsetType.valueOf(keys[index].toLowerCase())); Constant.Runtime.STACK_OFFSET[0] = offsets[index]; } catch (Exception ex) { diff --git a/src/main/java/forge/view/swing/Main.java b/src/main/java/forge/view/swing/Main.java index 08e53961e1b..f14f7484b57 100644 --- a/src/main/java/forge/view/swing/Main.java +++ b/src/main/java/forge/view/swing/Main.java @@ -31,7 +31,7 @@ public final class Main { final FModel model = new FModel(null); Singletons.setModel(model); - FSkin skin = new FSkin(model.getPreferences().skin); + FSkin skin = new FSkin(model.getPreferences().getSkin()); final FView view = new ApplicationView(skin); Singletons.setView(view); diff --git a/src/main/java/forge/view/swing/OldGuiNewGame.java b/src/main/java/forge/view/swing/OldGuiNewGame.java index 5b33c66a8ab..dbd08b77b43 100644 --- a/src/main/java/forge/view/swing/OldGuiNewGame.java +++ b/src/main/java/forge/view/swing/OldGuiNewGame.java @@ -263,14 +263,14 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. generatedDeck.add(removeSmallCreatures); removeSmallCreatures.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().deckGenRmvSmall = removeSmallCreatures.isSelected(); + Singletons.getModel().getPreferences().setDeckGenRmvSmall(removeSmallCreatures.isSelected()); } }); generatedDeck.add(removeArtifacts); removeArtifacts.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { - Singletons.getModel().getPreferences().deckGenRmvArtifacts = removeArtifacts.isSelected(); + Singletons.getModel().getPreferences().setDeckGenRmvArtifacts(removeArtifacts.isSelected()); } }); @@ -534,7 +534,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. devModeCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(final ActionEvent e) { Constant.Runtime.DEV_MODE[0] = devModeCheckBox.isSelected(); - Singletons.getModel().getPreferences().developerMode = Constant.Runtime.DEV_MODE[0]; + Singletons.getModel().getPreferences().setDeveloperMode(Constant.Runtime.DEV_MODE[0]); } }); @@ -546,7 +546,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. upldDrftCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(final ActionEvent e) { Constant.Runtime.UPLOAD_DRAFT[0] = upldDrftCheckBox.isSelected(); - Singletons.getModel().getPreferences().uploadDraftAI = Constant.Runtime.UPLOAD_DRAFT[0]; + Singletons.getModel().getPreferences().setUploadDraftAI(Constant.Runtime.UPLOAD_DRAFT[0]); } }); @@ -555,7 +555,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. foilRandomCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(final ActionEvent e) { Constant.Runtime.RANDOM_FOIL[0] = foilRandomCheckBox.isSelected(); - Singletons.getModel().getPreferences().randCFoil = Constant.Runtime.RANDOM_FOIL[0]; + Singletons.getModel().getPreferences().setRandCFoil(Constant.Runtime.RANDOM_FOIL[0]); } }); @@ -1058,7 +1058,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. return; } // UIManager.setLookAndFeel(info[index].getClassName()); - Singletons.getModel().getPreferences().laf = LAFMap.get(name); + Singletons.getModel().getPreferences().setLaf(LAFMap.get(name)); UIManager.setLookAndFeel(LAFMap.get(name)); SwingUtilities.updateComponentTreeUI(c); @@ -1322,7 +1322,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. * the index */ public static void set(final int index) { - Singletons.getModel().getPreferences().cardSize = CardSizeType.valueOf(keys[index].toLowerCase()); + Singletons.getModel().getPreferences().setCardSize(CardSizeType.valueOf(keys[index].toLowerCase())); Constant.Runtime.WIDTH[0] = widths[index]; Constant.Runtime.HEIGHT[0] = (int) Math.round((widths[index] * (3.5 / 2.5))); } @@ -1334,7 +1334,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. * the s */ public static void set(final CardSizeType s) { - Singletons.getModel().getPreferences().cardSize = s; + Singletons.getModel().getPreferences().setCardSize(s); int index = 0; for (String str : keys) { if (str.toLowerCase().equals(s.toString())) { @@ -1401,7 +1401,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. * the index */ public static void set(final int index) { - Singletons.getModel().getPreferences().maxStackSize = values[index]; + Singletons.getModel().getPreferences().setMaxStackSize(values[index]); Constant.Runtime.STACK_SIZE[0] = values[index]; } @@ -1412,7 +1412,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. * the new val */ public static void setVal(final int val) { - Singletons.getModel().getPreferences().maxStackSize = val; + Singletons.getModel().getPreferences().setMaxStackSize(val); Constant.Runtime.STACK_SIZE[0] = val; } } @@ -1468,7 +1468,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. * the index */ public static void set(final int index) { - Singletons.getModel().getPreferences().stackOffset = StackOffsetType.valueOf(keys[index].toLowerCase()); + Singletons.getModel().getPreferences().setStackOffset(StackOffsetType.valueOf(keys[index].toLowerCase())); Constant.Runtime.STACK_OFFSET[0] = offsets[index]; } @@ -1479,7 +1479,7 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. * the s */ public static void set(final StackOffsetType s) { - Singletons.getModel().getPreferences().stackOffset = s; + Singletons.getModel().getPreferences().setStackOffset(s); int index = 0; for (String str : keys) { if (str.toLowerCase().equals(s.toString())) { @@ -1621,15 +1621,15 @@ public class OldGuiNewGame extends JFrame implements NewConstants, NewConstants. public final boolean exit() { try { ForgePreferences preferences = Singletons.getModel().getPreferences(); - preferences.laf = UIManager.getLookAndFeel().getClass().getName(); - preferences.lafFonts = useLAFFonts.isSelected(); + preferences.setLaf(UIManager.getLookAndFeel().getClass().getName()); + preferences.setLafFonts(useLAFFonts.isSelected()); // preferences.newGui = newGuiCheckBox.isSelected(); - preferences.stackAiLand = smoothLandCheckBox.isSelected(); - preferences.millingLossCondition = Constant.Runtime.MILL[0]; - preferences.developerMode = Constant.Runtime.DEV_MODE[0]; - preferences.cardOverlay = cardOverlay.isSelected(); - preferences.scaleLargerThanOriginal = ImageCache.isScaleLargerThanOriginal(); - preferences.uploadDraftAI = Constant.Runtime.UPLOAD_DRAFT[0]; + preferences.setStackAiLand(smoothLandCheckBox.isSelected()); + preferences.setMillingLossCondition(Constant.Runtime.MILL[0]); + preferences.setDeveloperMode(Constant.Runtime.DEV_MODE[0]); + preferences.setCardOverlay(cardOverlay.isSelected()); + preferences.setScaleLargerThanOriginal(ImageCache.isScaleLargerThanOriginal()); + preferences.setUploadDraftAI(Constant.Runtime.UPLOAD_DRAFT[0]); preferences.save(); } catch (Exception ex) { int result = JOptionPane.showConfirmDialog(this,