Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Huge cleanup of gui and desktop code
Index: forge-gui/src/main/java/forge/interfaces/IComponent.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/interfaces/IComponent.java (revision 29317)
+++ forge-gui/src/main/java/forge/interfaces/IComponent.java (revision 29317)
@@ -0,0 +1,8 @@
+package forge.interfaces;
+
+public interface IComponent {
+ boolean isEnabled();
+ void setEnabled(boolean b0);
+ boolean isVisible();
+ void setVisible(boolean b0);
+}
Index: forge-gui/src/main/java/forge/interfaces/ITextComponent.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/interfaces/ITextComponent.java (revision 29317)
+++ forge-gui/src/main/java/forge/interfaces/ITextComponent.java (revision 29317)
@@ -0,0 +1,6 @@
+package forge.interfaces;
+
+public interface ITextComponent extends IComponent {
+ String getText();
+ void setText(String text0);
+}
Index: forge-gui/src/main/java/forge/interfaces/ILobby.java
===================================================================
--- forge-gui/src/main/java/forge/interfaces/ILobby.java (revision 29316)
+++ forge-gui/src/main/java/forge/interfaces/ILobby.java (revision 29316)
@@ -1,10 +0,0 @@
-package forge.interfaces;
-
-import forge.match.GameLobby;
-import forge.net.server.RemoteClient;
-
-public interface ILobby {
- GameLobby getState();
- int login(RemoteClient client);
- void logout(RemoteClient client);
-}
Index: forge-gui-desktop/src/main/java/forge/gui/ForgeAction.java
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/ForgeAction.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/ForgeAction.java (revision 29316)
@@ -1,37 +0,0 @@
-/*
- * Forge: Play Magic: the Gathering.
- * Copyright (C) 2011 Forge Team
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package forge.gui;
-
-import javax.swing.*;
-
-import forge.match.MatchConstants;
-
-@SuppressWarnings("serial")
-public abstract class ForgeAction extends AbstractAction {
- public ForgeAction(MatchConstants property) {
- super(property.button);
- this.putValue("buttonText", property.button);
- this.putValue("menuText", property.menu);
- }
-
- public <T extends AbstractButton> T setupButton(final T button) {
- button.setAction(this);
- button.setText((String) this.getValue(button instanceof JMenuItem ? "menuText" : "buttonText"));
- return button;
- }
-}
Index: forge-gui-desktop/src/main/java/forge/itemmanager/filters/DeckStatTypeFilter.java
===================================================================
--- forge-gui-desktop/src/main/java/forge/itemmanager/filters/DeckStatTypeFilter.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/itemmanager/filters/DeckStatTypeFilter.java (revision 29316)
@@ -1,37 +0,0 @@
-package forge.itemmanager.filters;
-
-import com.google.common.base.Predicates;
-
-import forge.deck.DeckProxy;
-import forge.item.InventoryItem;
-import forge.item.PaperCard;
-import forge.itemmanager.ItemManager;
-import forge.itemmanager.SItemManagerUtil.StatTypes;
-import forge.toolbox.FLabel;
-import forge.util.ItemPool;
-
-import java.util.Map;
-
-public abstract class DeckStatTypeFilter extends StatTypeFilter<DeckProxy> {
- public DeckStatTypeFilter(ItemManager<? super DeckProxy> itemManager0) {
- super(itemManager0);
- }
-
- @Override
- protected <U extends InventoryItem> boolean showUnsupportedItem(U item) {
- return false;
- }
-
- @Override
- public void afterFiltersApplied() {
- final ItemPool<? super DeckProxy> items = itemManager.getFilteredItems();
-
- for (Map.Entry<StatTypes, FLabel> btn : buttonMap.entrySet()) {
- if (btn.getKey().predicate != null) {
- int count = items.countAll(DeckProxy.createPredicate(Predicates.compose(btn.getKey().predicate, PaperCard.FN_GET_RULES)), DeckProxy.class);
- btn.getValue().setText(String.valueOf(count));
- }
- }
- getWidget().revalidate();
- }
-}
Index: forge-gui-desktop/src/main/java/forge/view/arcane/ViewPanel.java
===================================================================
--- forge-gui-desktop/src/main/java/forge/view/arcane/ViewPanel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/view/arcane/ViewPanel.java (revision 29316)
@@ -1,88 +0,0 @@
-/*
- * Forge: Play Magic: the Gathering.
- * Copyright (C) 2011 Nate
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package forge.view.arcane;
-
-import javax.swing.*;
-import java.awt.*;
-
-/**
- * <p>
- * ViewPanel class.
- * </p>
- *
- * @author Forge
- * @version $Id: ViewPanel.java 24769 2014-02-09 13:56:04Z Hellfish $
- */
-public class ViewPanel extends JPanel {
-
- /**
- * Instantiates a new view panel.
- */
- public ViewPanel() {
- }
-
- /** Constant <code>serialVersionUID=7016597023142963068L</code>. */
- private static final long serialVersionUID = 7016597023142963068L;
-
- /**
- * <p>
- * doLayout.
- * </p>
- *
- * @since 1.0.15
- */
- @Override
- public final void doLayout() {
- if (this.getComponentCount() == 0) {
- return;
- }
- final CardPanel panel = (CardPanel) this.getComponent(0);
- final int viewWidth = this.getWidth();
- final int viewHeight = this.getHeight();
- final int srcWidth = viewWidth;
- final int srcHeight = Math.round(viewWidth * CardPanel.ASPECT_RATIO);
- int targetWidth = Math.round(viewHeight * (srcWidth / (float) srcHeight));
- int targetHeight;
- if (targetWidth > viewWidth) {
- targetHeight = Math.round(viewWidth * (srcHeight / (float) srcWidth));
- targetWidth = viewWidth;
- } else {
- targetHeight = viewHeight;
- }
- final int x = (viewWidth / 2) - (targetWidth / 2);
- final int y = (viewHeight / 2) - (targetHeight / 2);
- panel.setCardBounds(x, y, targetWidth, targetHeight);
- }
-
- /**
- * <p>
- * setCardPanel.
- * </p>
- *
- * @param panel
- * a {@link forge.view.arcane.CardPanel} object.
- */
- public final void setCardPanel(final CardPanel panel) {
- // CardPanel newPanel = new CardPanel(panel.gameCard);
- // newPanel.setImage(panel);
- this.removeAll();
- this.add(panel, BorderLayout.CENTER);
- panel.revalidate();
- panel.repaint();
- }
-}
Index: forge-gui/src/main/java/forge/model/MultipleForgeJarsFoundError.java
===================================================================
--- forge-gui/src/main/java/forge/model/MultipleForgeJarsFoundError.java (revision 29316)
+++ forge-gui/src/main/java/forge/model/MultipleForgeJarsFoundError.java (revision 29316)
@@ -1,40 +0,0 @@
-/*
- * Forge: Play Magic: the Gathering.
- * Copyright (C) 2011 Forge Team
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package forge.model;
-
-//import java.io.IOException;
-
-/**
- * Exception thrown by model when it is trying to find a single forge jar, but
- * it finds more than one.
- */
-public class MultipleForgeJarsFoundError extends RuntimeException {
- /** Automatically generated. */
- private static final long serialVersionUID = 8899307272033517172L;
-
- /**
- * Create an exception with a message.
- *
- * @param message
- * the message, which could be the System's class path.
- */
- public MultipleForgeJarsFoundError(final String message) {
- super(message);
- }
-
-}
Index: forge-gui-desktop/src/main/java/forge/toolbox/special/CardViewer.java
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/special/CardViewer.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/special/CardViewer.java (revision 29316)
@@ -1,93 +0,0 @@
-/*
- * Forge: Play Magic: the Gathering.
- * Copyright (C) 2011 Forge Team
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package forge.toolbox.special;
-
-import java.util.Collections;
-import java.util.List;
-
-import javax.swing.AbstractListModel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import forge.game.card.CardView;
-import forge.gui.CardDetailPanel;
-import forge.gui.CardPicturePanel;
-import forge.item.PaperCard;
-import forge.toolbox.FScrollPane;
-
-/**
- * A simple JPanel that shows three columns: card list, pic, and description..
- *
- * @author Forge
- * @version $Id: ListChooser.java 9708 2011-08-09 19:34:12Z jendave $
- */
-@SuppressWarnings("serial")
-public class CardViewer extends JPanel {
- // Data and number of choices for the list
- private final List<PaperCard> list;
-
- // initialized before; listeners may be added to it
- private JList<PaperCard> jList = null;
- private final CardDetailPanel detail;
- private final CardPicturePanel picture;
-
- public CardViewer(final List<PaperCard> list) {
- this.list = Collections.unmodifiableList(list);
- this.jList = new JList<PaperCard>(new ChooserListModel());
- this.detail = new CardDetailPanel();
- this.picture = new CardPicturePanel();
-
- this.add(new FScrollPane(this.jList, true));
- this.add(this.picture);
- this.add(this.detail);
- this.setLayout(new java.awt.GridLayout(1, 3, 6, 0));
-
- // selection is here
- this.jList.getSelectionModel().addListSelectionListener(new SelListener());
- this.jList.setSelectedIndex(0);
- }
-
- private class ChooserListModel extends AbstractListModel<PaperCard> {
- private static final long serialVersionUID = 3871965346333840556L;
-
- @Override
- public int getSize() {
- return CardViewer.this.list.size();
- }
-
- @Override
- public PaperCard getElementAt(final int index) {
- return CardViewer.this.list.get(index);
- }
- }
-
- private class SelListener implements ListSelectionListener {
- @Override
- public void valueChanged(final ListSelectionEvent e) {
- final int row = CardViewer.this.jList.getSelectedIndex();
- // (String) jList.getSelectedValue();
- if ((row >= 0) && (row < CardViewer.this.list.size())) {
- final PaperCard cp = CardViewer.this.list.get(row);
- CardViewer.this.detail.setCard(CardView.getCardForUi(cp));
- CardViewer.this.picture.setCard(cp);
- }
- }
- }
-}
Index: forge-gui/src/main/java/forge/properties/SavePreferencesListener.java
===================================================================
--- forge-gui/src/main/java/forge/properties/SavePreferencesListener.java (revision 29316)
+++ forge-gui/src/main/java/forge/properties/SavePreferencesListener.java (revision 29316)
@@ -1,35 +0,0 @@
-/*
- * Forge: Play Magic: the Gathering.
- * Copyright (C) 2011 Forge Team
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package forge.properties;
-
-/**
- * <p>
- * SavePreferencesListener interface.
- * </p>
- *
- * @author Forge
- * @version $Id: SavePreferencesListener.java 12297 2011-11-28 19:56:47Z jendave $
- */
-public interface SavePreferencesListener {
- /**
- * <p>
- * savePreferences.
- * </p>
- */
- void savePreferences();
-}
Index: forge-gui/src/main/java/forge/net/GameProtocol.java
===================================================================
--- forge-gui/src/main/java/forge/net/GameProtocol.java (revision 29316)
+++ forge-gui/src/main/java/forge/net/GameProtocol.java (revision 29316)
@@ -1,181 +0,0 @@
-package forge.net;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.base.Function;
-
-import forge.assets.FSkinProp;
-import forge.deck.CardPool;
-import forge.game.GameEntityView;
-import forge.game.GameView;
-import forge.game.card.CardView;
-import forge.game.phase.PhaseType;
-import forge.game.player.DelayedReveal;
-import forge.game.player.PlayerView;
-import forge.game.spellability.SpellAbilityView;
-import forge.interfaces.IGameController;
-import forge.interfaces.IGuiGame;
-import forge.match.NextGameDecision;
-import forge.trackable.TrackableCollection;
-import forge.util.ITriggerEvent;
-import forge.util.ReflectionUtil;
-
-public final class GameProtocol {
-
- /**
- * Private constructor to prevent instantiation.
- */
- private GameProtocol() {
- }
-
- public static ProtocolMethod getProtocolMethod(final String name) {
- return ProtocolMethod.valueOf(name);
- }
-
- private enum Mode {
- SERVER(IGuiGame.class),
- CLIENT(IGameController.class);
-
- private final Class<?> toInvoke;
- private Mode(final Class<?> toInvoke) {
- this.toInvoke = toInvoke;
- }
- };
-
- /**
- * The methods that can be sent through this protocol.
- */
- public enum ProtocolMethod {
- // Server -> Client
- setGameView (Mode.SERVER, Void.TYPE, GameView.class),
- openView (Mode.SERVER, Void.TYPE, TrackableCollection/*PlayerView*/.class),
- afterGameEnd (Mode.SERVER),
- showCombat (Mode.SERVER),
- showPromptMessage (Mode.SERVER, Void.TYPE, PlayerView.class, String.class),
- updateButtons (Mode.SERVER, Void.TYPE, PlayerView.class, String.class, String.class, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE),
- flashIncorrectAction(Mode.SERVER),
- updatePhase (Mode.SERVER),
- updateTurn (Mode.SERVER, Void.TYPE, PlayerView.class),
- updatePlayerControl (Mode.SERVER),
- enableOverlay (Mode.SERVER),
- disableOverlay (Mode.SERVER),
- finishGame (Mode.SERVER),
- showManaPool (Mode.SERVER, Object.class, PlayerView.class),
- hideManaPool (Mode.SERVER, Void.TYPE, PlayerView.class),
- updateStack (Mode.SERVER),
- updateZones (Mode.SERVER, Void.TYPE, Iterable/*PlayerZoneUpdate*/.class),
- updateCards (Mode.SERVER, Void.TYPE, Iterable/*CardView*/.class),
- updateManaPool (Mode.SERVER, Void.TYPE, Iterable/*PlayerView*/.class),
- updateLives (Mode.SERVER, Void.TYPE, Iterable/*PlayerView*/.class),
- setPanelSelection (Mode.SERVER, Void.TYPE, CardView.class),
- getAbilityToPlay (Mode.SERVER, SpellAbilityView.class, CardView.class, List/*SpellAbilityView*/.class, ITriggerEvent.class),
- assignDamage (Mode.SERVER, Map.class, CardView.class, List/*CardView*/.class, Integer.TYPE, GameEntityView.class, Boolean.TYPE),
- message (Mode.SERVER, Void.TYPE, String.class, String.class),
- showErrorDialog (Mode.SERVER, Void.TYPE, String.class, String.class),
- showConfirmDialog (Mode.SERVER, Boolean.TYPE, String.class, String.class, String.class, String.class, Boolean.TYPE),
- showOptionDialog (Mode.SERVER, Integer.TYPE, String.class, String.class, FSkinProp.class, Array/*String*/.class, Integer.TYPE),
- showCardOptionDialog(Mode.SERVER, Integer.TYPE, CardView.class, String.class, String.class, FSkinProp.class, String.class, Array/*String*/.class),
- showInputDialog (Mode.SERVER, String.class, String.class, String.class, FSkinProp.class, String.class, Array/*String*/.class),
- confirm (Mode.SERVER, Boolean.TYPE, CardView.class, String.class, Boolean.TYPE, Array/*String*/.class),
- getChoices (Mode.SERVER, List.class, String.class, Integer.TYPE, Integer.TYPE, Collection.class, Object.class, Function.class),
- order (Mode.SERVER, List.class, String.class, String.class, Integer.TYPE, Integer.TYPE, List.class, List.class, CardView.class, Boolean.TYPE),
- sideboard (Mode.SERVER, List.class, CardPool.class, CardPool.class),
- chooseSingleEntityForEffect(Mode.SERVER, GameEntityView.class, String.class, TrackableCollection.class, DelayedReveal.class, Boolean.TYPE),
- setCard (Mode.SERVER, Void.TYPE, CardView.class),
- // TODO case "setPlayerAvatar":
- openZones (Mode.SERVER, Boolean.TYPE, Collection/*ZoneType*/.class, Map/*PlayerView,Object*/.class),
- restoreOldZones (Mode.SERVER, Void.TYPE, Map/*PlayerView,Object*/.class),
- isUiSetToSkipPhase (Mode.SERVER, Boolean.TYPE, PlayerView.class, PhaseType.class),
-
- // Client -> Server
- // Note: these should all return void, to avoid awkward situations in
- // which client and server wait for one another's response and block
- // the threads that're supposed to give that response
- useMana (Mode.CLIENT, Void.TYPE, Byte.TYPE),
- undoLastAction (Mode.CLIENT, Void.TYPE, Boolean.TYPE),
- selectPlayer (Mode.CLIENT, Void.TYPE, PlayerView.class, ITriggerEvent.class),
- selectCard (Mode.CLIENT, Void.TYPE, CardView.class, List.class, ITriggerEvent.class),
- selectButtonOk (Mode.CLIENT),
- selectButtonCancel (Mode.CLIENT),
- selectAbility (Mode.CLIENT, Void.TYPE, SpellAbilityView.class),
- passPriorityUntilEndOfTurn(Mode.CLIENT),
- passPriority (Mode.CLIENT),
- nextGameDecision (Mode.CLIENT, Void.TYPE, NextGameDecision.class),
- getActivateDescription (Mode.CLIENT, Void.TYPE, String.class, CardView.class),
- concede (Mode.CLIENT),
- alphaStrike (Mode.CLIENT),
- reorderHand (Mode.CLIENT, Void.TYPE, CardView.class, Integer.TYPE);
-
- private final Mode mode;
- private final Class<?> returnType;
- private final Class<?>[] args;
-
- private ProtocolMethod(final Mode mode) {
- this(mode, Void.TYPE);
- }
- private ProtocolMethod(final Mode mode, final Class<?> returnType) {
- this(mode, returnType, (Class<?>[]) null);
- }
- @SafeVarargs
- private ProtocolMethod(final Mode mode, final Class<?> returnType, final Class<?> ... args) {
- this.mode = mode;
- this.returnType = returnType;
- this.args = args == null ? new Class<?>[] {} : args;
- }
-
- public Method getMethod() {
- try {
- final Class<?> toCall = mode.toInvoke;
- final Method candidate = toCall.getMethod(name(), args);
- // Don't check Client return values for now as some use void
- // and a default return value, to improve performance
- if (mode == Mode.SERVER && !candidate.getReturnType().equals(returnType)) {
- throw new NoSuchMethodException(String.format("Wrong return type for method %s", name()));
- }
- return candidate;
- } catch (final NoSuchMethodException | SecurityException e) {
- System.err.println(String.format("Warning: class contains no accessible method named %s", name()));
- return getMethodNoArgs();
- }
- }
-
- private Method getMethodNoArgs() {
- try {
- return mode.toInvoke.getMethod(name(), (Class<?>[]) null);
- } catch (final NoSuchMethodException | SecurityException e) {
- System.err.println(String.format("Warning: class contains no accessible arg-less method named %s", name()));
- return null;
- }
- }
- public Class<?> getReturnType() {
- return returnType;
- }
- public Class<?>[] getArgTypes() {
- return args;
- }
-
- public void checkArgs(final Object[] args) {
- for (int iArg = 0; iArg < args.length; iArg++) {
- final Object arg = args[iArg];
- final Class<?> type = this.args[iArg];
- if (!ReflectionUtil.isInstance(arg, type)) {
- throw new InternalError(String.format("Protocol method %s: illegal argument (%d) of type %s, %s expected", name(), iArg, arg.getClass().getName(), type.getName()));
- }
- }
- }
-
- public void checkReturnValue(final Object value) {
- if (returnType.equals(Void.TYPE)) {
- // If void is expected, any return value is fine
- return;
- }
- if (!ReflectionUtil.isInstance(value, returnType)) {
- throw new IllegalStateException(String.format("Protocol method %s: illegal return object type %s returned by client, expected %s", name(), value.getClass().getName(), getReturnType().getName()));
- }
- }
- }
-}
Index: forge-gui/src/main/java/forge/match/MatchButtonType.java
===================================================================
--- forge-gui/src/main/java/forge/match/MatchButtonType.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/MatchButtonType.java (revision 29316)
@@ -1,6 +0,0 @@
-package forge.match;
-
-public enum MatchButtonType {
- OK,
- CANCEL;
-}
Index: forge-gui-desktop/src/main/java/forge/screens/home/EMenuItem.java
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/EMenuItem.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/EMenuItem.java (revision 29316)
@@ -1,27 +0,0 @@
-package forge.screens.home;
-
-/**
- * These are the identifiers for topics found in home screen submenus.
- *
- * <br><br><i>(E at beginning of class name denotes an enum.)</i>
- *
- */
-public enum EMenuItem { /** */
- CONSTRUCTED, /** */
- LIMITED_DRAFT, /** */
- LIMITED_SEALED, /** */
- LIMITED_WINSTON,
-
- QUEST_CHALLENGES, /** */
- QUEST_DUELS, /** */
- QUEST_DATA, /** */
- QUEST_DECKS, /** */
- QUEST_PREFS, /** */
-
- SETTINGS_PREFS, /** */
- SETTINGS_AVATARS, /** */
-
- UTILITIES_EDITOR, /** */
- UTILITIES_DOWNLOADS, /** */
- UTILITIES_EXIT
-}
Index: forge-gui-desktop/src/main/java/forge/gui/framework/IDocIdList.java
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/framework/IDocIdList.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/framework/IDocIdList.java (revision 29316)
@@ -1,12 +0,0 @@
-/**
- *
- */
-package forge.gui.framework;
-
-/**
- * This interface provides a unifying type to all enums
- * used as tab identifiers in XML and card layouts.
- *
- * <br><br><i>(I at beginning of class name denotes an interface.)</i>
- */
-public interface IDocIdList { }
Index: forge-gui-desktop/src/main/java/forge/screens/home/quest/QuestPreferencesHandler.java
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/quest/QuestPreferencesHandler.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/quest/QuestPreferencesHandler.java (revision 29316)
@@ -1,394 +0,0 @@
-package forge.screens.home.quest;
-
-import forge.assets.FSkinProp;
-import forge.model.FModel;
-import forge.quest.data.QuestPreferences;
-import forge.quest.data.QuestPreferences.QPref;
-import forge.toolbox.FLabel;
-import forge.toolbox.FSkin;
-import forge.toolbox.FSkin.SkinnedPanel;
-import forge.toolbox.FSkin.SkinnedTextField;
-import net.miginfocom.swing.MigLayout;
-
-import javax.swing.*;
-import javax.swing.border.Border;
-
-import java.awt.*;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
-
-@SuppressWarnings("serial")
-public class QuestPreferencesHandler extends SkinnedPanel {
- private final QuestPreferences prefs;
- private final JPanel pnlDifficulty, pnlBooster, pnlRewards, pnlShop;
- private final FLabel lblErrRewards, lblErrBooster, lblErrDifficulty, lblErrShop;
- private String constraints1, constraints2;
-
- private enum ErrType {
- REWARDS,
- DIFFICULTY,
- BOOSTER,
- SHOP
- }
-
- /** */
- public QuestPreferencesHandler() {
- this.setOpaque(false);
- this.setLayout(new MigLayout("insets 0, gap 0, wrap"));
- this.prefs = FModel.getQuestPreferences();
-
- pnlRewards = new JPanel();
- pnlDifficulty = new JPanel();
- pnlBooster = new JPanel();
- pnlShop = new JPanel();
-
- lblErrRewards = new FLabel.Builder().text("Rewards Error").fontStyle(Font.BOLD).build();
- lblErrDifficulty = new FLabel.Builder().text("Difficulty Error").fontStyle(Font.BOLD).build();
- lblErrBooster = new FLabel.Builder().text("Booster Error").fontStyle(Font.BOLD).build();
- lblErrShop = new FLabel.Builder().text("Shop Error").fontStyle(Font.BOLD).build();
-
- lblErrRewards.setForeground(Color.red);
- lblErrDifficulty.setForeground(Color.red);
- lblErrBooster.setForeground(Color.red);
- lblErrShop.setForeground(Color.red);
-
- // Rewards panel
- pnlRewards.setOpaque(false);
- pnlRewards.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
-
- pnlRewards.add(new FLabel.Builder().text("Rewards")
- .icon(FSkin.getImage(FSkinProp.ICO_QUEST_COIN)).build(),
- "w 100%!, h 30px!, span 2 1");
- pnlRewards.add(lblErrRewards, "w 100%!, h 30px!, span 2 1");
-
- constraints1 = "w 60px, h 26px!";
- constraints2 = "w 150px!, h 26px!";
-
- pnlRewards.add(new FLabel.Builder().text("Base winnings").build(), constraints2);
- pnlRewards.add(new PrefInput(QPref.REWARDS_BASE, ErrType.REWARDS), constraints1);
-
- pnlRewards.add(new FLabel.Builder().text("No losses").build(), constraints2);
- pnlRewards.add(new PrefInput(QPref.REWARDS_UNDEFEATED, ErrType.REWARDS), constraints1);
-
- pnlRewards.add(new FLabel.Builder().text("Poison win").build(), constraints2);
- pnlRewards.add(new PrefInput(QPref.REWARDS_POISON, ErrType.REWARDS), constraints1);
-
- pnlRewards.add(new FLabel.Builder().text("Milling win").build(), constraints2);
- pnlRewards.add(new PrefInput(QPref.REWARDS_MILLED, ErrType.REWARDS), constraints1);
-
- pnlRewards.add(new FLabel.Builder().text("Mulligan 0 win").build(), constraints2);
- pnlRewards.add(new PrefInput(QPref.REWARDS_MULLIGAN0, ErrType.REWARDS), constraints1);
-
- pnlRewards.add(new FLabel.Builder().text("Alternative win").build(), constraints2);
- pnlRewards.add(new PrefInput(QPref.REWARDS_ALTERNATIVE, ErrType.REWARDS), constraints1);
-
- pnlRewards.add(new FLabel.Builder().text("Win by turn 15").build(), constraints2);
- pnlRewards.add(new PrefInput(QPref.REWARDS_TURN15, ErrType.REWARDS), constraints1);
-
- pnlRewards.add(new FLabel.Builder().text("Win by turn 10").build(), constraints2);
- pnlRewards.add(new PrefInput(QPref.REWARDS_TURN10, ErrType.REWARDS), constraints1);
-
- pnlRewards.add(new FLabel.Builder().text("Win by turn 5").build(), constraints2);
- pnlRewards.add(new PrefInput(QPref.REWARDS_TURN5, ErrType.REWARDS), constraints1);
-
- pnlRewards.add(new FLabel.Builder().text("First turn win").build(), constraints2);
- pnlRewards.add(new PrefInput(QPref.REWARDS_TURN1, ErrType.REWARDS), constraints1);
-
- // Difficulty table panel
- pnlDifficulty.setOpaque(false);
- pnlDifficulty.setLayout(new MigLayout("insets 0, gap 0, wrap 5"));
-
- pnlDifficulty.add(new FLabel.Builder().text("Difficulty Adjustments").icon(FSkin.getImage(FSkinProp.ICO_QUEST_NOTES)).build(), "w 100%!, h 30px!, span 5 1");
- pnlDifficulty.add(lblErrDifficulty, "w 100%!, h 30px!, span 5 1");
-
- constraints1 = "w 60px!, h 26px!";
- constraints2 = "w 150px!, h 26px!";
-
- pnlDifficulty.add(new FLabel.Builder().text("").build(), constraints2);
- pnlDifficulty.add(new FLabel.Builder().text("Easy").build(), constraints1);
- pnlDifficulty.add(new FLabel.Builder().text("Medium").build(), constraints1);
- pnlDifficulty.add(new FLabel.Builder().text("Hard").build(), constraints1);
- pnlDifficulty.add(new FLabel.Builder().text("Expert").build(), constraints1);
-
- pnlDifficulty.add(new FLabel.Builder().text("Wins For Booster").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.WINS_BOOSTER_EASY, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_BOOSTER_MEDIUM, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_BOOSTER_HARD, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_BOOSTER_EXPERT, ErrType.DIFFICULTY), constraints1);
-
- pnlDifficulty.add(new FLabel.Builder().text("Wins For Rank Increase").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.WINS_RANKUP_EASY, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_RANKUP_MEDIUM, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_RANKUP_HARD, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_RANKUP_EXPERT, ErrType.DIFFICULTY), constraints1);
-
- pnlDifficulty.add(new FLabel.Builder().text("Wins For Medium AI").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.WINS_MEDIUMAI_EASY, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_MEDIUMAI_MEDIUM, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_MEDIUMAI_HARD, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_MEDIUMAI_EXPERT, ErrType.DIFFICULTY), constraints1);
-
- pnlDifficulty.add(new FLabel.Builder().text("Wins For Hard AI").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.WINS_HARDAI_EASY, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_HARDAI_MEDIUM, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_HARDAI_HARD, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_HARDAI_EXPERT, ErrType.DIFFICULTY), constraints1);
-
- pnlDifficulty.add(new FLabel.Builder().text("Wins For Expert AI").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.WINS_EXPERTAI_EASY, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_EXPERTAI_MEDIUM, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_EXPERTAI_HARD, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.WINS_EXPERTAI_EXPERT, ErrType.DIFFICULTY), constraints1);
-
- pnlDifficulty.add(new FLabel.Builder().text("Starting commons").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_COMMONS_EASY, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_COMMONS_MEDIUM, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_COMMONS_HARD, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_COMMONS_EXPERT, ErrType.DIFFICULTY), constraints1);
-
- pnlDifficulty.add(new FLabel.Builder().text("Starting uncommons").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_UNCOMMONS_EASY, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_UNCOMMONS_MEDIUM, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_UNCOMMONS_HARD, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_UNCOMMONS_EXPERT, ErrType.DIFFICULTY), constraints1);
-
- pnlDifficulty.add(new FLabel.Builder().text("Starting rares").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_RARES_EASY, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_RARES_MEDIUM, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_RARES_HARD, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_RARES_EXPERT, ErrType.DIFFICULTY), constraints1);
-
- pnlDifficulty.add(new FLabel.Builder().text("Starting credits").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_CREDITS_EASY, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_CREDITS_MEDIUM, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_CREDITS_HARD, ErrType.DIFFICULTY), constraints1);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_CREDITS_EXPERT, ErrType.DIFFICULTY), constraints1);
-
- pnlDifficulty.add(new FLabel.Builder().text("Starting basic lands").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_BASIC_LANDS, ErrType.DIFFICULTY), constraints1 + ", wrap");
-
- pnlDifficulty.add(new FLabel.Builder().text("Starting snow lands").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_SNOW_LANDS, ErrType.DIFFICULTY), constraints1 + ", wrap");
-
- pnlDifficulty.add(new FLabel.Builder().text("Color bias (1-10)").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.STARTING_POOL_COLOR_BIAS, ErrType.DIFFICULTY), constraints1 + ", wrap");
-
- pnlDifficulty.add(new FLabel.Builder().text("Penalty for loss").build(), constraints2);
- pnlDifficulty.add(new PrefInput(QPref.PENALTY_LOSS, ErrType.DIFFICULTY), constraints1 + ", wrap");
-
- // Booster breakdown panel
- pnlBooster.setOpaque(false);
- pnlBooster.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
-
- pnlBooster.add(new FLabel.Builder().text("Booster Pack Ratios")
- .icon(FSkin.getImage(FSkinProp.ICO_QUEST_BOOK)).build(),
- "w 100%!, h 30px!, span 2 1");
- pnlBooster.add(lblErrBooster, "w 100%!, h 30px!, span 2 1");
-
- constraints1 = "w 60px!, h 26px!";
- constraints2 = "w 150px!, h 26px!";
- pnlBooster.add(new FLabel.Builder().text("Common").build(), constraints2);
- pnlBooster.add(new PrefInput(QPref.BOOSTER_COMMONS, ErrType.BOOSTER), constraints1);
-
- pnlBooster.add(new FLabel.Builder().text("Uncommon").build(), constraints2);
- pnlBooster.add(new PrefInput(QPref.BOOSTER_UNCOMMONS, ErrType.BOOSTER), constraints1);
-
- pnlBooster.add(new FLabel.Builder().text("Rare").build(), constraints2);
- pnlBooster.add(new PrefInput(QPref.BOOSTER_RARES, ErrType.BOOSTER), constraints1);
-
- // Shop panel
- pnlShop.setOpaque(false);
- pnlShop.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
-
- pnlShop.add(new FLabel.Builder().text("Shop Preferences")
- .icon(FSkin.getImage(FSkinProp.ICO_QUEST_COIN)).build(), "w 100%!, h 30px!, span 2 1");
- pnlShop.add(lblErrShop, "w 100%!, h 30px!, span 2 1");
-
- constraints1 = "w 60px, h 26px!";
- constraints2 = "w 150px!, h 26px!";
-
- pnlShop.add(new FLabel.Builder().text("Maximum Packs").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.SHOP_MAX_PACKS, ErrType.SHOP), constraints1);
-
- pnlShop.add(new FLabel.Builder().text("Minimum Packs").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.SHOP_MIN_PACKS, ErrType.SHOP), constraints1);
-
- pnlShop.add(new FLabel.Builder().text("Starting Packs").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.SHOP_STARTING_PACKS, ErrType.SHOP), constraints1);
-
- pnlShop.add(new FLabel.Builder().text("Wins for Pack").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.SHOP_WINS_FOR_ADDITIONAL_PACK, ErrType.SHOP), constraints1);
-
- pnlShop.add(new FLabel.Builder().text("Wins per Set Unlock").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.WINS_UNLOCK_SET, ErrType.SHOP), constraints1);
-
- pnlShop.add(new FLabel.Builder().text("Common Singles").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.SHOP_SINGLES_COMMON, ErrType.SHOP), constraints1);
-
- pnlShop.add(new FLabel.Builder().text("Uncommon Singles").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.SHOP_SINGLES_UNCOMMON, ErrType.SHOP), constraints1);
-
- pnlShop.add(new FLabel.Builder().text("Rare Singles").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.SHOP_SINGLES_RARE, ErrType.SHOP), constraints1);
-
- pnlShop.add(new FLabel.Builder().text("Card Sale Price Cap").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.SHOP_MAX_SELLING_PRICE, ErrType.SHOP), constraints1);
-
- pnlShop.add(new FLabel.Builder().text("Wins to Uncap Sale Price").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.SHOP_WINS_FOR_NO_SELL_LIMIT, ErrType.SHOP), constraints1);
-
- pnlShop.add(new FLabel.Builder().text("Item Level Restriction").build(), constraints2);
- pnlShop.add(new PrefInput(QPref.ITEM_LEVEL_RESTRICTION, ErrType.SHOP), constraints1);
-
- constraints1 = "w 100%!, gap 0 0 20px 0";
- this.add(pnlRewards, constraints1);
- this.add(pnlDifficulty, constraints1);
- this.add(pnlBooster, constraints1);
- this.add(pnlShop, constraints1);
-
- resetErrors();
- }
-
- private class PrefInput extends SkinnedTextField {
- private final QPref qpref;
- private final ErrType err;
- private final FSkin.SkinColor clrHover, clrActive, clrText;
- private boolean isFocus = false;
- private String previousText = "";
-
- /**
- * @param qp1 &emsp; {@link forge.quest.data.QuestPreferences.QPref}
- * preferences ident enum
- * @param e0 &emsp; {@link forge.view.home.ViewQuestPreference.ErrType}
- * where error should display to
- */
- public PrefInput(QPref qp0, ErrType e0) {
- super();
-
- this.qpref = qp0;
- this.err = e0;
- this.clrHover = FSkin.getColor(FSkin.Colors.CLR_HOVER);
- this.clrActive = FSkin.getColor(FSkin.Colors.CLR_ACTIVE);
- this.clrText = FSkin.getColor(FSkin.Colors.CLR_TEXT);
-
- this.setOpaque(false);
- this.setBorder((Border)null);
- this.setFont(FSkin.getFont(13));
- this.setForeground(clrText);
- this.setCaretColor(clrText);
- this.setBackground(clrHover);
- this.setHorizontalAlignment(SwingConstants.CENTER);
- this.setText(prefs.getPref(qpref));
- this.setPreviousText(prefs.getPref(qpref));
-
- this.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseEntered(MouseEvent e) {
- if (isFocus) { return; }
- setOpaque(true);
- repaint();
- }
-
- @Override
- public void mouseExited(MouseEvent e) {
- if (isFocus) { return; }
- setOpaque(false);
- repaint();
- }
- });
-
- this.addFocusListener(new FocusAdapter() {
- @Override
- public void focusGained(FocusEvent e) {
- isFocus = true;
- setOpaque(true);
- setBackground(clrActive);
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- isFocus = false;
- setOpaque(false);
- setBackground(clrHover);
-
- // TODO for slight performance improvement
- // check if value has changed before validating
- validateAndSave(PrefInput.this);
- }
- });
- }
-
- public QPref getQPref() {
- return this.qpref;
- }
-
- public ErrType getErrType() {
- return this.err;
- }
-
- public String getPreviousText() {
- return this.previousText;
- }
-
- public void setPreviousText(String s0) {
- this.previousText = s0;
- }
- }
-
-
- /**
- * Checks validity of values entered into prefInputs.
- * @param i0 &emsp; a PrefInput object
- */
- private void validateAndSave(PrefInput i0) {
- if (i0.getText().equals(i0.getPreviousText())) { return; }
-
- int val = Integer.parseInt(i0.getText());
- resetErrors();
-
- String validationError = prefs.validatePreference(i0.getQPref(), val);
- if (validationError != null) {
- showError(i0, validationError);
- return;
- }
-
- prefs.setPref(i0.getQPref(), i0.getText());
- prefs.save();
- i0.setPreviousText(i0.getText());
- }
-
- private void showError(PrefInput i0, String s0) {
- String s = "Save failed: " + s0;
- switch(i0.getErrType()) {
- case BOOSTER:
- lblErrBooster.setVisible(true);
- lblErrBooster.setText(s);
- break;
- case DIFFICULTY:
- lblErrDifficulty.setVisible(true);
- lblErrDifficulty.setText(s);
- break;
- case REWARDS:
- lblErrRewards.setVisible(true);
- lblErrRewards.setText(s);
- break;
- case SHOP:
- lblErrShop.setVisible(true);
- lblErrShop.setText(s);
- break;
- default:
- }
-
- i0.setText(i0.getPreviousText());
- }
-
- private void resetErrors() {
- lblErrBooster.setVisible(false);
- lblErrDifficulty.setVisible(false);
- lblErrRewards.setVisible(false);
- lblErrShop.setVisible(false);
- }
-}
Index: forge-gui/src/main/java/forge/deck/io/OldDeckParser.java
===================================================================
--- forge-gui/src/main/java/forge/deck/io/OldDeckParser.java (revision 29316)
+++ forge-gui/src/main/java/forge/deck/io/OldDeckParser.java (revision 29316)
@@ -1,263 +0,0 @@
-/*
- * Forge: Play Magic: the Gathering.
- * Copyright (C) 2011 Forge Team
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package forge.deck.io;
-
-import forge.deck.Deck;
-import forge.deck.DeckGroup;
-import forge.properties.ForgeConstants;
-import forge.util.FileSection;
-import forge.util.FileUtil;
-import forge.util.gui.SOptionPane;
-import forge.util.storage.IStorage;
-
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.apache.commons.lang3.tuple.MutablePair;
-import org.apache.commons.lang3.tuple.Pair;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.TreeMap;
-
-
-public class OldDeckParser {
-
- /** Constant <code>BDKFileFilter</code>. */
- public static final FilenameFilter BDK_FILE_FILTER = new FilenameFilter() {
- @Override
- public boolean accept(final File dir, final String name) {
- return name.endsWith(".bdk");
- }
- };
-
- public OldDeckParser(final IStorage<Deck> constructed2, final IStorage<DeckGroup> draft2,
- final IStorage<DeckGroup> sealed2, final IStorage<Deck> cube2) {
- this.deckDir = new File(ForgeConstants.DECK_BASE_DIR);
- this.sealed = sealed2;
- this.constructed = constructed2;
- this.cube = cube2;
- this.draft = draft2;
- }
-
- /**
- * Gets the sealed.
- *
- * @return the sealed
- */
- protected final IStorage<DeckGroup> getSealed() {
- return this.sealed;
- }
-
- /**
- * Gets the constructed.
- *
- * @return the constructed
- */
- protected final IStorage<Deck> getConstructed() {
- return this.constructed;
- }
-
- /**
- * Gets the draft.
- *
- * @return the draft
- */
- protected final IStorage<DeckGroup> getDraft() {
- return this.draft;
- }
-
- /**
- * Gets the cube.
- *
- * @return the cube
- */
- protected final IStorage<Deck> getCube() {
- return this.cube;
- }
-
- /**
- * Gets the deck dir.
- *
- * @return the deck dir
- */
- protected final File getDeckDir() {
- return this.deckDir;
- }
-
- private final IStorage<DeckGroup> sealed;
- private final IStorage<Deck> constructed;
- private final IStorage<DeckGroup> draft;
- private final IStorage<Deck> cube;
- private final File deckDir;
-
- /**
- * TODO: Write javadoc for this method.
- */
- public void tryParse() {
- this.convertConstructedAndSealed();
- this.convertDrafts();
- }
-
- private void convertDrafts() {
- for (final File f : this.deckDir.listFiles(OldDeckParser.BDK_FILE_FILTER)) {
- boolean gotError = false;
- final Deck human = DeckSerializer.fromFile(new File(f, "0.dck"));
- final DeckGroup d = new DeckGroup(human.getName());
- d.setHumanDeck(human);
-
- for (int i = 1; i < DeckGroupSerializer.MAX_DRAFT_PLAYERS; i++) {
- final Deck nextAi = DeckSerializer.fromFile(new File(f, i + ".dck"));
- if (nextAi == null) {
- gotError = true;
- break;
- }
- d.addAiDeck(nextAi);
- }
-
- boolean mayDelete = !gotError;
- if (!gotError) {
- this.draft.add(d);
- } else {
- final String msg = String.format("Draft '%s' lacked some decks.%n%nShould it be deleted?");
- mayDelete = SOptionPane.showConfirmDialog(msg, "Draft loading error");
- }
-
- if (mayDelete) {
- for (final File f1 : f.listFiles()) {
- f1.delete();
- }
- f.delete();
- }
-
- }
- }
-
- private void convertConstructedAndSealed() {
- boolean allowDeleteUnsupportedConstructed = false;
- final Map<String, Pair<DeckGroup, MutablePair<File, File>>> sealedDecks = new TreeMap<String, Pair<DeckGroup, MutablePair<File, File>>>(
- String.CASE_INSENSITIVE_ORDER);
-
- for (final File f : this.deckDir.listFiles(DeckStorage.DCK_FILE_FILTER)) {
- boolean importedOk = false;
-
- final List<String> fileLines = FileUtil.readFile(f);
- final Map<String, List<String>> sections = FileSection.parseSections(fileLines);
- final DeckFileHeader dh = DeckSerializer.readDeckMetadata(sections);
- String name = dh.getName();
-
- if (dh.isCustomPool()) {
- try {
- this.cube.add(DeckSerializer.fromSections(sections));
- importedOk = true;
- }
- catch (final NoSuchElementException ex) {
- if (!allowDeleteUnsupportedConstructed) {
- final String msg = String
- .format("Can not convert deck '%s' for some unsupported cards it contains. %n%s%n%nMay Forge delete all such decks?",
- name, ex.getMessage());
- allowDeleteUnsupportedConstructed = SOptionPane.showConfirmDialog(msg, "Problem converting decks");
- }
- }
- if (importedOk || allowDeleteUnsupportedConstructed) {
- f.delete();
- }
- continue;
- }
-
- switch (dh.getDeckType()) {
- case Constructed:
- try {
- this.constructed.add(DeckSerializer.fromSections(sections));
- importedOk = true;
- } catch (final NoSuchElementException ex) {
- if (!allowDeleteUnsupportedConstructed) {
- final String msg = String
- .format("Can not convert deck '%s' for some unsupported cards it contains. %n%s%n%nMay Forge delete all such decks?",
- name, ex.getMessage());
- allowDeleteUnsupportedConstructed = SOptionPane.showConfirmDialog(msg, "Problem converting decks");
- }
- }
- if (importedOk || allowDeleteUnsupportedConstructed) {
- f.delete();
- }
- break;
-
- case Limited:
- name = name.startsWith("AI_") ? name.replace("AI_", "") : name;
-
- Pair<DeckGroup, MutablePair<File, File>> stored = sealedDecks.get(name);
- if (null == stored) {
- stored = ImmutablePair.of(new DeckGroup(name), MutablePair.of((File) null, (File) null));
- }
-
- final Deck deck = DeckSerializer.fromSections(sections);
- if (dh.isIntendedForAi()) {
- stored.getLeft().addAiDeck(deck);
- stored.getRight().setRight(f);
- } else {
- stored.getLeft().setHumanDeck(deck);
- stored.getRight().setLeft(f);
- }
-
- if ((stored.getLeft().getHumanDeck() != null) && !stored.getLeft().getAiDecks().isEmpty()) {
- // have both parts of sealed deck, may convert
- this.sealed.add(stored.getLeft());
- stored.getRight().getLeft().delete();
- stored.getRight().getRight().delete();
-
- // there stay only orphans
- sealedDecks.remove(name);
- } else {
- sealedDecks.put(name, stored);
- }
- break;
- default:
- break;
- }
- }
-
- // advise to kill orphaned decks
- if (!sealedDecks.isEmpty()) {
- final StringBuilder sb = new StringBuilder();
- for (final Pair<DeckGroup, MutablePair<File, File>> s : sealedDecks.values()) {
- final String missingPart = s.getRight().getLeft() == null ? "human" : "computer";
- sb.append(String.format("Sealed deck '%s' has no matching '%s' deck.%n", s.getKey().getName(),
- missingPart));
- }
- sb.append(System.getProperty("line.separator"));
- sb.append("May Forge delete these decks?");
- if (SOptionPane.showConfirmDialog(sb.toString(), "Some of your sealed decks are orphaned")) {
- for (final Pair<DeckGroup, MutablePair<File, File>> s : sealedDecks.values()) {
- if (s.getRight().getLeft() != null) {
- s.getRight().getLeft().delete();
- }
- if (s.getRight().getRight() != null) {
- s.getRight().getRight().delete();
- }
- }
- }
- }
- }
-
- /**
- * @return the deckDir
- */
-
-}
Index: forge-gui/src/main/java/forge/properties/Preferences.java
===================================================================
--- forge-gui/src/main/java/forge/properties/Preferences.java (revision 29316)
+++ forge-gui/src/main/java/forge/properties/Preferences.java (revision 29316)
@@ -1,196 +0,0 @@
-/*
- * Forge: Play Magic: the Gathering.
- * Copyright (C) 2011 Forge Team
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package forge.properties;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.*;
-
-/**
- * A collection of name/value pairs with sorted keys and utility methods.
- *
- * @author Forge
- * @version $Id: Preferences.java 24769 2014-02-09 13:56:04Z Hellfish $
- */
-public class Preferences {
-
- /** The props. */
- private final Properties props;
-
- /**
- * <p>
- * Constructor for Preferences.
- * </p>
- */
- public Preferences() {
- this.props = new Properties();
- }
-
- /**
- * <p>
- * Constructor for Preferences.
- * </p>
- *
- * @param prefs
- * a {@link forge.properties.Preferences} object.
- */
- public Preferences(final Preferences prefs) {
- this.props = prefs.props;
- }
-
- /**
- * <p>
- * keys.
- * </p>
- *
- * @return a {@link java.util.Enumeration} object.
- */
- public final synchronized Enumeration<String> keys() {
- @SuppressWarnings({ "unchecked", "rawtypes" })
- final Set<String> keysEnum = (Set) this.props.keySet();
- final Vector<String> keyList = new Vector<String>();
- keyList.addAll(keysEnum);
- Collections.sort(keyList);
- return keyList.elements();
- }
-
- /**
- * <p>
- * getInt.
- * </p>
- *
- * @param name
- * a {@link java.lang.String} object.
- * @param defaultValue
- * a int.
- * @return a int.
- */
- public final int getInt(final String name, final int defaultValue) {
- final String value = this.props.getProperty(name);
- if (value == null) {
- return defaultValue;
- }
- try {
- return Integer.parseInt(value);
- } catch (final NumberFormatException ex) {
- return defaultValue;
- }
- }
-
- /**
- * <p>
- * getBoolean.
- * </p>
- *
- * @param name
- * a {@link java.lang.String} object.
- * @param defaultValue
- * a boolean.
- * @return a boolean.
- */
- public final boolean getBoolean(final String name, final boolean defaultValue) {
- final String value = this.props.getProperty(name);
- if (value == null) {
- return defaultValue;
- }
- return Boolean.parseBoolean(value);
- }
-
- /**
- * <p>
- * getLong.
- * </p>
- *
- * @param name
- * a {@link java.lang.String} object.
- * @param defaultValue
- * a long.
- * @return a long.
- */
- public final long getLong(final String name, final long defaultValue) {
- final String value = this.props.getProperty(name);
- if (value == null) {
- return defaultValue;
- }
- return Long.parseLong(value);
- }
-
- /**
- * <p>
- * set.
- * </p>
- *
- * @param key
- * a {@link java.lang.String} object.
- * @param value
- * a {@link java.lang.Object} object.
- */
- public final void set(final String key, final Object value) {
- this.props.setProperty(key, String.valueOf(value));
- }
-
- /**
- * <p>
- * get.
- * </p>
- *
- * @param key
- * a {@link java.lang.String} object.
- * @param value
- * a {@link java.lang.Object} object.
- * @return a {@link java.lang.String} object.
- */
- public final String get(final String key, final Object value) {
- String string = null;
- if (value != null) {
- string = String.valueOf(value);
- }
- return this.props.getProperty(key, string);
- }
-
- /**
- * <p>
- * load.
- * </p>
- *
- * @param stream
- * a {@link java.io.FileInputStream} object.
- * @throws IOException
- * Signals that an I/O exception has occurred.
- */
- public final void load(final FileInputStream stream) throws IOException {
- this.props.load(stream);
- }
-
- /**
- * <p>
- * store.
- * </p>
- *
- * @param stream
- * a {@link java.io.FileOutputStream} object.
- * @param comments
- * a {@link java.lang.String} object.
- * @throws IOException
- * Signals that an I/O exception has occurred.
- */
- public final void store(final FileOutputStream stream, final String comments) throws IOException {
- this.props.store(stream, comments);
- }
-}
Index: forge-gui-desktop/src/main/java/forge/control/GuiTimer.java
===================================================================
--- forge-gui-desktop/src/main/java/forge/control/GuiTimer.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/control/GuiTimer.java (revision 29316)
@@ -1,25 +0,0 @@
-package forge.control;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.Timer;
-
-import forge.interfaces.IGuiTimer;
-
-@SuppressWarnings("serial")
-public class GuiTimer extends Timer implements IGuiTimer {
- public GuiTimer(final Runnable proc0, int interval0) {
- super(interval0, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- proc0.run();
- }
- });
- }
-
- @Override
- public void setInterval(int interval0) {
- setDelay(interval0);
- }
-}
Index: forge-gui-mobile/src/forge/animation/GuiTimer.java
===================================================================
--- forge-gui-mobile/src/forge/animation/GuiTimer.java (revision 29316)
+++ forge-gui-mobile/src/forge/animation/GuiTimer.java (revision 29316)
@@ -1,35 +0,0 @@
-package forge.animation;
-
-import com.badlogic.gdx.utils.Timer;
-
-import forge.interfaces.IGuiTimer;
-
-public class GuiTimer implements IGuiTimer {
- private float interval;
- private Timer.Task task;
-
- public GuiTimer(final Runnable proc0, int interval0) {
- interval = (float)interval0 / 1000f; //convert to seconds
- task = new Timer.Task() {
- @Override
- public void run() {
- proc0.run();
- }
- };
- }
-
- @Override
- public void start() {
- Timer.schedule(task, interval, interval);
- }
-
- @Override
- public void stop() {
- task.cancel();
- }
-
- @Override
- public void setInterval(int interval0) {
- //ignore this function since there's not a reliable way to change the interval on the fly
- }
-}
Index: forge-gui/src/main/java/forge/interfaces/IGuiTimer.java
===================================================================
--- forge-gui/src/main/java/forge/interfaces/IGuiTimer.java (revision 29316)
+++ forge-gui/src/main/java/forge/interfaces/IGuiTimer.java (revision 29316)
@@ -1,7 +0,0 @@
-package forge.interfaces;
-
-public interface IGuiTimer {
- void setInterval(int interval0);
- void start();
- void stop();
-}
Index: forge-gui/src/main/java/forge/match/MatchConstants.java
===================================================================
--- forge-gui/src/main/java/forge/match/MatchConstants.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/MatchConstants.java (revision 29316)
@@ -1,28 +0,0 @@
-package forge.match;
-
-public enum MatchConstants {
- ALWAYSACCEPT ("Always accept this trigger"),
- ALWAYSDECLINE ("Always decline this trigger"),
- ALWAYSASK ("Always ask"),
- HUMANCOMMAND ("Player's Command zone", "Command: ", "Player - View Command"),
- HUMANEXILED ("Player's Exile", "Exile:", "Player - View Exile"),
- HUMANFLASHBACK("Play card with Flashback", "Flashback:", "Player - View Cards with Flashback"),
- HUMANGRAVEYARD("Player's Graveyard", "Graveyard:", "Player - View Graveyard"),
- HUMANHAND ("Player's Hand", "Hand:", "Player - View Hand"),
- HUMANLIBRARY ("Player's Library", "Library:", "Player - View Library");
-
- public final String title;
- public final String button;
- public final String menu;
-
- private MatchConstants(String title0) {
- title = title0;
- button = title0;
- menu = title0;
- }
- private MatchConstants(String title0, String button0, String menu0) {
- title = title0;
- button = button0;
- menu = menu0;
- }
-}
Index: forge-gui/src/main/java/forge/achievement/StreakAchievement.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/achievement/StreakAchievement.java (revision 29316)
+++ forge-gui/src/main/java/forge/achievement/StreakAchievement.java (revision 29317)
@@ -8,15 +8,12 @@
public abstract class StreakAchievement extends Achievement {
private int current;
- protected StreakAchievement(String key0, String displayName0, String description0, String flavorText0) {
- super(key0, displayName0, description0, flavorText0, 0);
- }
//use this constructor for regular tiered achievements
- protected StreakAchievement(String key0, String displayName0, String sharedDesc0,
- String commonDesc0, int commonThreshold0,
- String uncommonDesc0, int uncommonThreshold0,
- String rareDesc0, int rareThreshold0,
- String mythicDesc0, int mythicThreshold0) {
+ protected StreakAchievement(final String key0, final String displayName0, final String sharedDesc0,
+ final String commonDesc0, final int commonThreshold0,
+ final String uncommonDesc0, final int uncommonThreshold0,
+ final String rareDesc0, final int rareThreshold0,
+ final String mythicDesc0, final int mythicThreshold0) {
super(key0, displayName0, sharedDesc0, 0, commonDesc0, commonThreshold0,
uncommonDesc0, uncommonThreshold0, rareDesc0, rareThreshold0,
mythicDesc0, mythicThreshold0);
@@ -25,8 +22,8 @@
protected abstract Boolean eval(Player player, Game game);
@Override
- protected final int evaluate(Player player, Game game) {
- Boolean val = eval(player, game);
+ protected final int evaluate(final Player player, final Game game) {
+ final Boolean val = eval(player, game);
if (val != null) { //null means don't increment or reset
if (val) {
current++;
@@ -48,13 +45,13 @@
}
@Override
- public void saveToXml(Element el) {
+ public void saveToXml(final Element el) {
super.saveToXml(el);
el.setAttribute("current", String.valueOf(current));
}
@Override
- public void loadFromXml(Element el) {
+ public void loadFromXml(final Element el) {
super.loadFromXml(el);
current = getIntAttribute(el, "current");
}
Index: forge-gui-desktop/src/main/java/forge/screens/match/ViewWinLose.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/match/ViewWinLose.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/ViewWinLose.java (revision 29317)
@@ -41,6 +41,7 @@
public class ViewWinLose implements IWinLoseView<FButton> {
private final ControlWinLose control;
+ private final FScrollPane scrLog;
private final FButton btnContinue, btnRestart, btnQuit;
private final SkinnedPanel pnlCustom;
@@ -86,7 +87,7 @@
if (!FModel.getGauntletMini().isGauntletDraft()) {
break;
}
- //$FALL-THROUGH$
+ //$FALL-THROUGH$
case Sealed:
control = new LimitedWinLose(this, game0, matchUI);
break;
@@ -128,14 +129,14 @@
txtLog.setFont(FSkin.getFont(14));
txtLog.setFocusable(true); // allow highlighting and copying of log
- FLabel btnCopyLog = new FLabel.ButtonBuilder().text("Copy to clipboard").build();
+ final FLabel btnCopyLog = new FLabel.ButtonBuilder().text("Copy to clipboard").build();
btnCopyLog.setCommand(new UiCommand() {
@Override
public void run() {
- StringSelection ss = new StringSelection(txtLog.getText());
+ final StringSelection ss = new StringSelection(txtLog.getText());
try {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
- } catch (IllegalStateException ex) {
+ } catch (final IllegalStateException ex) {
// ignore; may be unavailable on some platforms
}
}
@@ -172,7 +173,7 @@
pnlLeft.add(pnlButtons, "w 100%!");
final JPanel pnlLog = new JPanel(new MigLayout("insets 0, wrap, ax center"));
- final FScrollPane scrLog = new FScrollPane(txtLog, false);
+ scrLog = new FScrollPane(txtLog, false);
pnlLog.setOpaque(false);
pnlLog.add(
@@ -184,7 +185,9 @@
pnlLeft.add(pnlLog, "w 100%!");
lblTitle.setText(composeTitle(game0));
+ }
+ public final void show() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
@@ -207,7 +210,7 @@
return control;
}
- private String composeTitle(final GameView game) {
+ private static String composeTitle(final GameView game) {
final String winner = game.getWinningPlayerName();
final int winningTeam = game.getWinningTeam();
if (winner == null) {
@@ -220,16 +223,19 @@
}
/** @return {@link forge.toolbox.FButton} */
+ @Override
public FButton getBtnContinue() {
return this.btnContinue;
}
/** @return {@link forge.toolbox.FButton} */
+ @Override
public FButton getBtnRestart() {
return this.btnRestart;
}
/** @return {@link forge.toolbox.FButton} */
+ @Override
public FButton getBtnQuit() {
return this.btnQuit;
}
@@ -251,7 +257,7 @@
}
}
- private String removePlayerTypeFromLogMessage(String message) {
+ private static String removePlayerTypeFromLogMessage(final String message) {
return message.replaceAll("\\[[^\\]]*\\]", "");
}
@@ -261,12 +267,12 @@
}
@Override
- public void showRewards(Runnable runnable) {
+ public void showRewards(final Runnable runnable) {
runnable.run(); //just run on GUI thread
}
@Override
- public void showCards(String title, List<PaperCard> cards) {
+ public void showCards(final String title, final List<PaperCard> cards) {
final QuestWinLoseCardViewer cv = new QuestWinLoseCardViewer(cards);
getPnlCustom().add(new TitleLabel(title), CONSTRAINTS_TITLE);
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
@@ -278,13 +284,13 @@
}
@Override
- public void showMessage(String message, String title, FSkinProp icon) {
- SkinIcon icoTemp = FSkin.getIcon(icon).scale(0.5);
+ public void showMessage(String message, final String title, final FSkinProp icon) {
+ final SkinIcon icoTemp = FSkin.getIcon(icon).scale(0.5);
if (message.contains("\n")) { //ensure new line characters are encoded
message = "<html>" + message.replace("\n", "<br>") + "</html>";
}
- SkinnedLabel lblMessage = new SkinnedLabel(message);
+ final SkinnedLabel lblMessage = new SkinnedLabel(message);
lblMessage.setFont(FSkin.getFont(14));
lblMessage.setForeground(FORE_COLOR);
lblMessage.setHorizontalAlignment(SwingConstants.CENTER);
@@ -297,7 +303,6 @@
/**
* JLabel header between reward sections.
- *
*/
@SuppressWarnings("serial")
private class TitleLabel extends SkinnedLabel {
Index: forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletLoad.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletLoad.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletLoad.java (revision 29317)
@@ -1,5 +1,14 @@
package forge.screens.home.gauntlet;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.SwingUtilities;
+
import forge.GuiBase;
import forge.UiCommand;
import forge.deck.Deck;
@@ -15,25 +24,20 @@
import forge.model.FModel;
import forge.player.GamePlayerUtil;
-import javax.swing.*;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
+/**
* Controls the "quick gauntlet" submenu in the home UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
public enum CSubmenuGauntletLoad implements ICDoc {
SINGLETON_INSTANCE;
- private final ActionListener actStartGame = new ActionListener() { @Override
- public void actionPerformed(ActionEvent arg0) { startGame(); } };
+ private final ActionListener actStartGame = new ActionListener() {
+ @Override public final void actionPerformed(final ActionEvent arg0) {
+ startGame();
+ }
+ };
private final VSubmenuGauntletLoad view = VSubmenuGauntletLoad.SINGLETON_INSTANCE;
@@ -49,7 +53,7 @@
SwingUtilities.invokeLater(new Runnable() {
@Override public void run() {
- JButton btnStart = view.getBtnStart();
+ final JButton btnStart = view.getBtnStart();
if (btnStart.isEnabled()) {
view.getBtnStart().requestFocusInWindow();
}
@@ -94,7 +98,7 @@
final List<GauntletData> data = new ArrayList<GauntletData>();
for (final File f : files) {
- GauntletData gd = GauntletIO.loadGauntlet(f);
+ final GauntletData gd = GauntletIO.loadGauntlet(f);
if (gd != null) {
data.add(gd);
}
@@ -153,17 +157,4 @@
});
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- @SuppressWarnings("serial")
- public UiCommand getCommandOnSelect() {
- return new UiCommand() {
- @Override
- public void run() {
- updateData();
- }
- };
- }
}
Index: forge-gui-desktop/src/main/java/forge/sound/AltSoundSystem.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/sound/AltSoundSystem.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/sound/AltSoundSystem.java (revision 29317)
@@ -53,6 +53,7 @@
isSync = synced;
}
+ @Override
public void run() {
if (isSync && AsyncSoundRegistry.getNumIterations(filename) >= 1) {
return;
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CEditorQuestLimited.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CEditorQuestLimited.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CEditorQuestLimited.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -48,15 +48,13 @@
import forge.screens.home.quest.CSubmenuQuestDecks;
import forge.screens.match.controllers.CDetailPicture;
-//import forge.quest.data.QuestBoosterPack;
-
/**
* Child controller for quest deck editor UI.
* <br><br>
* Card catalog and decks are drawn from a QuestController object.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
- *
+ *
* @author Forge
* @version $Id: CEditorQuest.java 24868 2014-02-17 05:08:05Z drdev $
*/
@@ -89,7 +87,7 @@
* Child controller for quest deck editor UI.
* <br><br>
* Card catalog and decks are drawn from a QuestController object.
- *
+ *
* @param questData0 &emsp; {@link forge.quest.QuestController}
*/
public CEditorQuestLimited(final QuestController questData0, final CDetailPicture cDetailPicture) {
@@ -107,7 +105,7 @@
catalogManager.setAlwaysNonUnique(true);
deckManager.setAlwaysNonUnique(true);
-
+
this.setCatalogManager(catalogManager);
this.setDeckManager(deckManager);
@@ -117,23 +115,13 @@
return new DeckGroup("");
}
};
-
+
this.controller = new DeckController<DeckGroup>(questData0.getDraftDecks(), this, newCreator);
controller.getView().getDeckManager().setup(ItemManagerConfig.DRAFT_POOL);
controller.setModel(questData0.getDraftDecks().get(QuestEventDraft.DECK_NAME));
-
+
}
- /**
- * Adds any card to the catalog and data pool.
- *
- * @param card {@link forge.item.PaperCard}
- */
- public void addCheatCard(final PaperCard card, int qty) {
- this.getCatalogManager().addItem(card, qty);
- this.questData.getCards().getCardpool().add(card, qty);
- }
-
// fills number of decks using each card
private Map<PaperCard, Integer> countDecksForEachCard() {
final Map<PaperCard, Integer> result = new HashMap<PaperCard, Integer>();
@@ -161,8 +149,10 @@
* @see forge.gui.deckeditor.ACEditorBase#onAddItems()
*/
@Override
- protected void onAddItems(Iterable<Entry<PaperCard, Integer>> items, boolean toAlternate) {
- if (toAlternate) { return; }
+ protected void onAddItems(final Iterable<Entry<PaperCard, Integer>> items, final boolean toAlternate) {
+ if (toAlternate) {
+ return;
+ }
// update view
this.getDeckManager().addItems(items);
@@ -174,8 +164,10 @@
* @see forge.gui.deckeditor.ACEditorBase#onRemoveItems()
*/
@Override
- protected void onRemoveItems(Iterable<Entry<PaperCard, Integer>> items, boolean toAlternate) {
- if (toAlternate) { return; }
+ protected void onRemoveItems(final Iterable<Entry<PaperCard, Integer>> items, final boolean toAlternate) {
+ if (toAlternate) {
+ return;
+ }
// update view
this.getCatalogManager().addItems(items);
@@ -187,7 +179,7 @@
* @see forge.gui.deckeditor.ACEditorBase#buildAddContextMenu()
*/
@Override
- protected void buildAddContextMenu(EditorContextMenuBuilder cmb) {
+ protected void buildAddContextMenu(final EditorContextMenuBuilder cmb) {
cmb.addMoveItems("Move", "to deck");
}
@@ -195,17 +187,17 @@
* @see forge.gui.deckeditor.ACEditorBase#buildRemoveContextMenu()
*/
@Override
- protected void buildRemoveContextMenu(EditorContextMenuBuilder cmb) {
+ protected void buildRemoveContextMenu(final EditorContextMenuBuilder cmb) {
cmb.addMoveItems("Move", "to sideboard");
}
-
+
private Deck getSelectedDeck(final DeckGroup model) {
return model.getHumanDeck();
}
/*
* (non-Javadoc)
- *
+ *
* @see forge.gui.deckeditor.ACEditorBase#updateView()
*/
@Override
@@ -219,7 +211,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see forge.gui.deckeditor.ACEditorBase#getController()
*/
@Override
@@ -229,10 +221,10 @@
@Override
public void update() {
-
+
this.getCatalogManager().setup(getScreen() == FScreen.DECK_EDITOR_DRAFT ? ItemManagerConfig.DRAFT_POOL : ItemManagerConfig.SEALED_POOL);
this.getDeckManager().setup(ItemManagerConfig.DECK_EDITOR);
-
+
this.decksUsingMyCards = this.countDecksForEachCard();
final Map<ColumnDef, ItemTableColumn> colOverridesCatalog = new HashMap<ColumnDef, ItemTableColumn>();
@@ -253,7 +245,7 @@
deckGenParent = removeTab(VDeckgen.SINGLETON_INSTANCE);
allDecksParent = removeTab(VAllDecks.SINGLETON_INSTANCE);
-
+
if (this.controller.getModel() == null) {
throw new RuntimeException("Expected deck group but found none!");
}
@@ -266,7 +258,7 @@
* @see forge.gui.deckeditor.controllers.ACEditorBase#canSwitchAway()
*/
@Override
- public boolean canSwitchAway(boolean isClosing) {
+ public boolean canSwitchAway(final boolean isClosing) {
if (SEditorIO.confirmSaveChanges(FScreen.DECK_EDITOR_QUEST_TOURNAMENT, isClosing)) {
FModel.getQuest().save();
return true;
@@ -290,11 +282,4 @@
}
}
- /**
- * TODO: Write javadoc for this method.
- * @param d0
- */
- /*public void load(Deck deck) {
- controller.setModel(deck);
- }*/
}
Index: forge-gui/src/main/java/forge/interfaces/IComboBox.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/interfaces/IComboBox.java (revision 29316)
+++ forge-gui/src/main/java/forge/interfaces/IComboBox.java (revision 29317)
@@ -1,10 +1,6 @@
package forge.interfaces;
-public interface IComboBox<E> {
- boolean isEnabled();
- void setEnabled(boolean b0);
- boolean isVisible();
- void setVisible(boolean b0);
+public interface IComboBox<E> extends IComponent {
void setSelectedItem(E item);
void setSelectedIndex(int index);
void addItem(E item);
Index: forge-gui-desktop/src/main/java/forge/itemmanager/filters/CardQuestWorldFilter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/itemmanager/filters/CardQuestWorldFilter.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/itemmanager/filters/CardQuestWorldFilter.java (revision 29317)
@@ -1,22 +1,22 @@
package forge.itemmanager.filters;
+import java.util.HashSet;
+import java.util.Set;
+
import forge.game.GameFormat;
import forge.item.PaperCard;
import forge.itemmanager.ItemManager;
import forge.model.FModel;
import forge.quest.QuestWorld;
-import java.util.HashSet;
-import java.util.Set;
-
public class CardQuestWorldFilter extends CardFormatFilter {
private final Set<QuestWorld> questWorlds = new HashSet<QuestWorld>();
- public CardQuestWorldFilter(ItemManager<? super PaperCard> itemManager0) {
+ public CardQuestWorldFilter(final ItemManager<? super PaperCard> itemManager0) {
super(itemManager0);
}
- public CardQuestWorldFilter(ItemManager<? super PaperCard> itemManager0, QuestWorld questWorld0) {
+ public CardQuestWorldFilter(final ItemManager<? super PaperCard> itemManager0, final QuestWorld questWorld0) {
super(itemManager0);
this.questWorlds.add(questWorld0);
this.formats.add(getQuestWorldFormat(questWorld0));
@@ -24,9 +24,9 @@
@Override
public ItemFilter<PaperCard> createCopy() {
- CardQuestWorldFilter copy = new CardQuestWorldFilter(itemManager);
+ final CardQuestWorldFilter copy = new CardQuestWorldFilter(itemManager);
copy.questWorlds.addAll(this.questWorlds);
- for (QuestWorld w : this.questWorlds) {
+ for (final QuestWorld w : this.questWorlds) {
copy.formats.add(getQuestWorldFormat(w));
}
return copy;
@@ -38,7 +38,7 @@
super.reset();
}
- public static boolean canAddQuestWorld(QuestWorld questWorld, ItemFilter<PaperCard> existingFilter) {
+ public static boolean canAddQuestWorld(final QuestWorld questWorld, final ItemFilter<PaperCard> existingFilter) {
if (questWorld.getFormat() == null && FModel.getQuest().getMainFormat() == null) {
return false; //must have format
}
@@ -51,10 +51,10 @@
* @return true if filter merged in or to suppress adding a new filter, false to allow adding new filter
*/
@Override
- public boolean merge(ItemFilter<?> filter) {
- CardQuestWorldFilter cardQuestWorldFilter = (CardQuestWorldFilter)filter;
+ public boolean merge(final ItemFilter<?> filter) {
+ final CardQuestWorldFilter cardQuestWorldFilter = (CardQuestWorldFilter)filter;
this.questWorlds.addAll(cardQuestWorldFilter.questWorlds);
- for (QuestWorld w : cardQuestWorldFilter.questWorlds) {
+ for (final QuestWorld w : cardQuestWorldFilter.questWorlds) {
this.formats.add(getQuestWorldFormat(w));
}
return true;
@@ -72,14 +72,14 @@
@Override
protected Iterable<String> getList() {
- Set<String> strings = new HashSet<String>();
- for (QuestWorld w : this.questWorlds) {
+ final Set<String> strings = new HashSet<String>();
+ for (final QuestWorld w : this.questWorlds) {
strings.add(w.getName());
}
return strings;
}
- private GameFormat getQuestWorldFormat(QuestWorld w) {
+ private static GameFormat getQuestWorldFormat(final QuestWorld w) {
GameFormat format = w.getFormat();
if (format == null) {
//assumes that no world other than the main world will have a null format
Index: forge-gui/src/main/java/forge/quest/QuestEventDraft.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/quest/QuestEventDraft.java (revision 29316)
+++ forge-gui/src/main/java/forge/quest/QuestEventDraft.java (revision 29317)
@@ -6,22 +6,31 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.quest;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import forge.GuiBase;
import forge.card.CardEdition;
import forge.card.CardEdition.CardInSet;
import forge.card.CardRarity;
-import forge.deck.CardPool;
import forge.deck.Deck;
import forge.deck.DeckGroup;
import forge.deck.DeckSection;
@@ -38,79 +47,76 @@
import forge.util.TextUtil;
import forge.util.storage.IStorage;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
/**
* <p>
* QuestEvent.
* </p>
- *
+ *
* MODEL - A basic event instance in Quest mode. Can be extended for use in
* unique event types: battles, quests, and others.
*/
public class QuestEventDraft {
-
- public static class QuestDraftPrizes {
-
- public int credits;
- public List<BoosterPack> boosterPacks;
- public List<PaperCard> individualCards;
+
+ public static class QuestDraftPrizes {
+
+ public int credits;
+ public List<BoosterPack> boosterPacks;
+ public List<PaperCard> individualCards;
public List<PaperCard> selectRareCards;
-
- public boolean hasCredits() {
- return credits > 0;
- }
-
- public boolean hasBoosterPacks() {
- return boosterPacks != null && boosterPacks.size() > 0;
- }
-
- public boolean hasIndividualCards() {
- return individualCards != null && individualCards.size() > 0;
- }
-
+
+ public boolean hasCredits() {
+ return credits > 0;
+ }
+
+ public boolean hasBoosterPacks() {
+ return boosterPacks != null && boosterPacks.size() > 0;
+ }
+
+ public boolean hasIndividualCards() {
+ return individualCards != null && individualCards.size() > 0;
+ }
+
public boolean selectRareFromSets() { return selectRareCards != null && selectRareCards.size() > 0; }
-
+
public void addSelectedCard(final PaperCard card) {
FModel.getQuest().getCards().addSingleCard(card, 1);
}
-
- }
-
+
+ }
+
public static final String UNDETERMINED = "quest_draft_undetermined_place";
public static final String HUMAN = "quest_draft_human_place";
public static final String DECK_NAME = "Tournament Deck";
private static transient final ReadPriceList PRICE_LIST_READER = new ReadPriceList();
private static transient final Map<String, Integer> MAP_PRICES = PRICE_LIST_READER.getPriceList();
-
+
private String title = "Mystery Draft";
private String boosterConfiguration = "";
private String block = "";
-
+
private int entryFee = 0;
-
+
private String[] standings = new String[15];
private String[] aiNames = new String[7];
-
+
private int[] aiIcons = new int[7];
-
+
private boolean started = false;
private int age = FModel.getQuestPreferences().getPrefInt(QPref.WINS_NEW_DRAFT);
-
+
public QuestEventDraft(final String title) {
this.title = title;
}
-
+
public final String getTitle() {
return this.title;
}
-
+
public final String[] getBoosterConfiguration() {
return boosterConfiguration.split("/");
}
-
+
public final void setBoosterConfiguration(final String boosterConfiguration) {
this.boosterConfiguration = boosterConfiguration;
}
@@ -118,122 +124,108 @@
public final void setEntryFee(final int entryFee) {
this.entryFee = entryFee;
}
-
+
public final int getEntryFee() {
return entryFee;
}
-
+
public final void setBlock(final String block) {
this.block = block;
}
-
+
public final String getBlock() {
return block;
}
-
+
public void setTitle(final String title0) {
this.title = title0;
}
-
+
- public void setStandings(String[] standings) {
+ public void setStandings(final String[] standings) {
this.standings = standings;
}
-
+
public String[] getStandings() {
return standings;
}
-
+
public String[] getAINames() {
return aiNames;
}
-
+
public void setAINames(final String[] names) {
aiNames = names;
}
-
+
public int[] getAIIcons() {
return aiIcons;
}
-
+
public void setAIIcons(final int[] icons) {
aiIcons = icons;
}
-
+
public int getAge() {
return age;
}
-
+
public void setAge(final int age) {
this.age = age;
}
-
+
public void addWin() {
age--;
}
-
- public void saveToRegularDraft() {
+
+ public void saveToRegularDraft() {
- String tournamentName = FModel.getQuest().getName() + " Tournament Deck " + new SimpleDateFormat("EEE d MMM yyyy HH-mm-ss").format(new Date());
- DeckGroup original = FModel.getQuest().getDraftDecks().get(QuestEventDraft.DECK_NAME);
- DeckGroup output = new DeckGroup(tournamentName);
- for (Deck aiDeck : original.getAiDecks()) {
+ final String tournamentName = FModel.getQuest().getName() + " Tournament Deck " + new SimpleDateFormat("EEE d MMM yyyy HH-mm-ss").format(new Date());
+ final DeckGroup original = FModel.getQuest().getDraftDecks().get(QuestEventDraft.DECK_NAME);
+ final DeckGroup output = new DeckGroup(tournamentName);
+ for (final Deck aiDeck : original.getAiDecks()) {
- output.addAiDeck(copyDeck(aiDeck));
- }
- output.setHumanDeck(copyDeck(original.getHumanDeck(), tournamentName));
- FModel.getDecks().getDraft().add(output);
- }
-
- public void addToQuestDecks() {
+ output.addAiDeck(copyDeck(aiDeck));
+ }
+ output.setHumanDeck(copyDeck(original.getHumanDeck(), tournamentName));
+ FModel.getDecks().getDraft().add(output);
+ }
+
+ public void addToQuestDecks() {
- String deckName = "Tournament Deck " + new SimpleDateFormat("EEE d MMM yyyy HH-mm-ss").format(new Date());
+ final String deckName = "Tournament Deck " + new SimpleDateFormat("EEE d MMM yyyy HH-mm-ss").format(new Date());
- Deck tournamentDeck = FModel.getQuest().getDraftDecks().get(QuestEventDraft.DECK_NAME).getHumanDeck();
- Deck deck = new Deck(deckName);
+ final Deck tournamentDeck = FModel.getQuest().getDraftDecks().get(QuestEventDraft.DECK_NAME).getHumanDeck();
+ final Deck deck = new Deck(deckName);
- FModel.getQuest().getCards().addAllCards(tournamentDeck.getAllCardsInASinglePool().toFlatList());
+ FModel.getQuest().getCards().addAllCards(tournamentDeck.getAllCardsInASinglePool().toFlatList());
- if (tournamentDeck.get(DeckSection.Main).countAll() > 0) {
- deck.getOrCreate(DeckSection.Main).addAll(tournamentDeck.get(DeckSection.Main));
- FModel.getQuest().getMyDecks().add(deck);
- }
+ if (tournamentDeck.get(DeckSection.Main).countAll() > 0) {
+ deck.getOrCreate(DeckSection.Main).addAll(tournamentDeck.get(DeckSection.Main));
+ FModel.getQuest().getMyDecks().add(deck);
+ }
- FModel.getQuest().getDraftDecks().delete(QuestEventDraft.DECK_NAME);
- FModel.getQuest().getAchievements().endCurrentTournament(FModel.getQuest().getAchievements().getCurrentDraft().getPlayerPlacement());
- FModel.getQuest().save();
- }
+ FModel.getQuest().getDraftDecks().delete(QuestEventDraft.DECK_NAME);
+ FModel.getQuest().getAchievements().endCurrentTournament(FModel.getQuest().getAchievements().getCurrentDraft().getPlayerPlacement());
+ FModel.getQuest().save();
+ }
- private Deck copyDeck(final Deck deck) {
-
- Deck outputDeck = new Deck(deck.getName());
-
- outputDeck.putSection(DeckSection.Main, new CardPool(deck.get(DeckSection.Main)));
- outputDeck.putSection(DeckSection.Sideboard, new CardPool(deck.get(DeckSection.Sideboard)));
-
- return outputDeck;
-
+ private static Deck copyDeck(final Deck deck) {
+ return new Deck(deck);
- }
+ }
- private Deck copyDeck(final Deck deck, final String deckName) {
-
- Deck outputDeck = new Deck(deckName);
-
- outputDeck.putSection(DeckSection.Main, new CardPool(deck.get(DeckSection.Main)));
- outputDeck.putSection(DeckSection.Sideboard, new CardPool(deck.get(DeckSection.Sideboard)));
-
- return outputDeck;
-
+ private static Deck copyDeck(final Deck deck, final String deckName) {
+ return new Deck(deck, deckName);
- }
-
+ }
+
- public void setWinner(String playerName) {
+ public void setWinner(final String playerName) {
-
+
boolean isHumanPlayer = true;
-
+
- for (String name : aiNames) {
+ for (final String name : aiNames) {
if (playerName.equals(name)) {
isHumanPlayer = false;
}
}
-
+
int playerIndex = -1;
-
+
if (isHumanPlayer) {
for (int i = standings.length - 1; i >= 0; i--) {
if (standings[i].equals(HUMAN)) {
@@ -242,7 +234,7 @@
}
}
} else {
-
+
String aiIndex = "";
for (int i = aiNames.length - 1; i >= 0; i--) {
@@ -251,308 +243,307 @@
break;
}
}
-
+
for (int i = standings.length - 1; i >= 0; i--) {
if (standings[i].equals(aiIndex)) {
playerIndex = i;
break;
}
}
-
+
}
-
+
switch (playerIndex) {
- case 0:
- case 1:
- standings[8] = standings[playerIndex];
- break;
- case 2:
- case 3:
- standings[9] = standings[playerIndex];
- break;
- case 4:
- case 5:
- standings[10] = standings[playerIndex];
- break;
- case 6:
- case 7:
- standings[11] = standings[playerIndex];
- break;
- case 8:
- case 9:
- standings[12] = standings[playerIndex];
- break;
- case 10:
- case 11:
- standings[13] = standings[playerIndex];
- break;
- case 12:
- case 13:
- standings[14] = standings[playerIndex];
- break;
+ case 0:
+ case 1:
+ standings[8] = standings[playerIndex];
+ break;
+ case 2:
+ case 3:
+ standings[9] = standings[playerIndex];
+ break;
+ case 4:
+ case 5:
+ standings[10] = standings[playerIndex];
+ break;
+ case 6:
+ case 7:
+ standings[11] = standings[playerIndex];
+ break;
+ case 8:
+ case 9:
+ standings[12] = standings[playerIndex];
+ break;
+ case 10:
+ case 11:
+ standings[13] = standings[playerIndex];
+ break;
+ case 12:
+ case 13:
+ standings[14] = standings[playerIndex];
+ break;
}
-
+
}
-
+
/**
* Generates the prizes for the player and saves them to the current quest.
*/
public QuestDraftPrizes collectPrizes() {
-
+
- int place = getPlayerPlacement();
+ final int place = getPlayerPlacement();
int prizePool = entryFee * 9;
-
+
int boosterPrices = 0;
-
+
- for (String boosterSet : boosterConfiguration.split("/")) {
+ for (final String boosterSet : boosterConfiguration.split("/")) {
-
+
int value;
- String boosterName = FModel.getMagicDb().getEditions().get(boosterSet).getName() + " Booster Pack";
+ final String boosterName = FModel.getMagicDb().getEditions().get(boosterSet).getName() + " Booster Pack";
if (MAP_PRICES.containsKey(boosterName)) {
value = MAP_PRICES.get(boosterName);
} else {
value = 395;
}
-
+
boosterPrices += value;
-
+
}
prizePool -= boosterPrices * 8;
- QuestDraftPrizes prizes = null;
-
+ QuestDraftPrizes prizes = null;
+
switch (place) {
- case 1:
- prizes = generateFirstPlacePrizes(prizePool);
- break;
- case 2:
- prizes = generateSecondPlacePrizes(prizePool);
- break;
- case 3:
- prizes = generateThirdPlacePrizes();
- break;
- case 4:
- prizes = generateFourthPlacePrizes();
- break;
+ case 1:
+ prizes = generateFirstPlacePrizes(prizePool);
+ break;
+ case 2:
+ prizes = generateSecondPlacePrizes(prizePool);
+ break;
+ case 3:
+ prizes = generateThirdPlacePrizes();
+ break;
+ case 4:
+ prizes = generateFourthPlacePrizes();
+ break;
}
-
- if (prizes != null) {
+
+ if (prizes != null) {
- if (prizes.hasCredits()) {
- FModel.getQuest().getAssets().addCredits(prizes.credits);
- }
-
- if (prizes.hasBoosterPacks()) {
+ if (prizes.hasCredits()) {
+ FModel.getQuest().getAssets().addCredits(prizes.credits);
+ }
+
+ if (prizes.hasBoosterPacks()) {
- for (BoosterPack boosterPack : prizes.boosterPacks) {
+ for (final BoosterPack boosterPack : prizes.boosterPacks) {
- FModel.getQuest().getCards().addAllCards(boosterPack.getCards());
- }
- }
-
- if (prizes.hasIndividualCards()) {
- FModel.getQuest().getCards().addAllCards(prizes.individualCards);
- }
-
- return prizes;
-
- }
-
+ FModel.getQuest().getCards().addAllCards(boosterPack.getCards());
+ }
+ }
+
+ if (prizes.hasIndividualCards()) {
+ FModel.getQuest().getCards().addAllCards(prizes.individualCards);
+ }
+
+ return prizes;
+
+ }
+
return null;
-
+
}
-
+
private QuestDraftPrizes generateFirstPlacePrizes(final int prizePool) {
-
+
int credits = 2 * (prizePool / 3); //First place gets 2/3 the total prize pool
- List<PaperCard> cards = new ArrayList<>();
- List<BoosterPack> boosters = new ArrayList<>();
+ final List<PaperCard> cards = new ArrayList<>();
+ final List<BoosterPack> boosters = new ArrayList<>();
-
+
cards.add(getPromoCard());
int creditsForPacks = (credits / 2); //Spend 50% of the credits on packs
-
+
while (true) {
- BoosterPack pack = getBoosterPack();
- int price = getBoosterPrice(pack);
+ final BoosterPack pack = getBoosterPack();
+ final int price = getBoosterPrice(pack);
if (price > creditsForPacks + creditsForPacks * 0.1f) { //Add a little room for near-same price packs.
break;
}
creditsForPacks -= price;
boosters.add(pack);
}
-
+
credits = (credits / 2) + creditsForPacks; //Add the leftover credits + 50%
- QuestDraftPrizes prizes = new QuestDraftPrizes();
+ final QuestDraftPrizes prizes = new QuestDraftPrizes();
- prizes.credits = credits;
- prizes.boosterPacks = boosters;
- prizes.individualCards = cards;
+ prizes.credits = credits;
+ prizes.boosterPacks = boosters;
+ prizes.individualCards = cards;
awardSelectedRare(prizes);
-
+
return prizes;
-
+
}
-
+
private QuestDraftPrizes generateSecondPlacePrizes(final int prizePool) {
-
+
int credits = prizePool / 3; //Second place gets 1/3 the total prize pool
- List<PaperCard> cards = new ArrayList<>();
- List<BoosterPack> boosters = new ArrayList<>();
+ final List<PaperCard> cards = new ArrayList<>();
+ final List<BoosterPack> boosters = new ArrayList<>();
-
+
cards.add(getPromoCard());
int creditsForPacks = (credits / 4) * 3; //Spend 75% of the credits on packs
-
+
while (true) {
- BoosterPack pack = getBoosterPack();
- int price = getBoosterPrice(pack);
+ final BoosterPack pack = getBoosterPack();
+ final int price = getBoosterPrice(pack);
if (price > creditsForPacks + creditsForPacks * 0.1f) { //Add a little room for near-same price packs.
break;
}
creditsForPacks -= price;
boosters.add(pack);
}
-
+
credits = (credits / 4) + creditsForPacks; //Add the leftover credits + 25%
- QuestDraftPrizes prizes = new QuestDraftPrizes();
+ final QuestDraftPrizes prizes = new QuestDraftPrizes();
- prizes.credits = credits;
- prizes.boosterPacks = boosters;
- prizes.individualCards = cards;
+ prizes.credits = credits;
+ prizes.boosterPacks = boosters;
+ prizes.individualCards = cards;
awardSelectedRare(prizes);
- return prizes;
-
+ return prizes;
+
}
-
+
private QuestDraftPrizes generateThirdPlacePrizes() {
-
+
- int credits = 0;
- List<PaperCard> cards = new ArrayList<>();
+ final int credits = 0;
+ final List<PaperCard> cards = new ArrayList<>();
-
+
cards.add(getPromoCard());
-
+
- List<BoosterPack> boosters = new ArrayList<>();
+ final List<BoosterPack> boosters = new ArrayList<>();
boosters.add(getBoosterPack());
- QuestDraftPrizes prizes = new QuestDraftPrizes();
+ final QuestDraftPrizes prizes = new QuestDraftPrizes();
- prizes.credits = credits;
- prizes.boosterPacks = boosters;
- prizes.individualCards = cards;
+ prizes.credits = credits;
+ prizes.boosterPacks = boosters;
+ prizes.individualCards = cards;
- return prizes;
-
+ return prizes;
+
}
-
+
private QuestDraftPrizes generateFourthPlacePrizes() {
-
+
- int credits = 0;
- List<PaperCard> cards = new ArrayList<>();
+ final int credits = 0;
+ final List<PaperCard> cards = new ArrayList<>();
-
+
cards.add(getPromoCard());
- QuestDraftPrizes prizes = new QuestDraftPrizes();
+ final QuestDraftPrizes prizes = new QuestDraftPrizes();
- prizes.credits = credits;
- prizes.individualCards = cards;
+ prizes.credits = credits;
+ prizes.individualCards = cards;
- return prizes;
-
+ return prizes;
+
}
private void awardSelectedRare(final QuestDraftPrizes prizes) {
-
+
- List<PaperCard> possibleCards = new ArrayList<>();
+ final List<PaperCard> possibleCards = new ArrayList<>();
-
+
- for (CardEdition edition : getAllEditions()) {
- for (CardInSet card : edition.getCards()) {
+ for (final CardEdition edition : getAllEditions()) {
+ for (final CardInSet card : edition.getCards()) {
if (card.rarity == CardRarity.Rare || card.rarity == CardRarity.MythicRare) {
- PaperCard cardToAdd = FModel.getMagicDb().getCommonCards().getCard(card.name, edition.getCode());
+ final PaperCard cardToAdd = FModel.getMagicDb().getCommonCards().getCard(card.name, edition.getCode());
if (cardToAdd != null) {
possibleCards.add(cardToAdd);
}
}
}
}
-
+
prizes.selectRareCards = possibleCards;
-
+
}
-
+
private BoosterPack getBoosterPack() {
return BoosterPack.FN_FROM_SET.apply(getRandomEdition());
}
-
+
private PaperCard getPromoCard() {
-
+
- CardEdition randomEdition = getRandomEdition();
- List<CardInSet> cardsInEdition = new ArrayList<>();
+ final CardEdition randomEdition = getRandomEdition();
+ final List<CardInSet> cardsInEdition = new ArrayList<>();
-
+
- for (CardInSet card : randomEdition.getCards()) {
+ for (final CardInSet card : randomEdition.getCards()) {
if (card.rarity == CardRarity.Rare || card.rarity == CardRarity.MythicRare) {
cardsInEdition.add(card);
}
}
-
+
CardInSet randomCard;
PaperCard promo = null;
-
+
int attempts = 25;
-
+
while (promo == null && attempts-- > 0) {
randomCard = cardsInEdition.get((int) (Math.random() * cardsInEdition.size()));
promo = FModel.getMagicDb().getCommonCards().getCard(randomCard.name, randomEdition.getCode());
}
-
+
if (promo == null) {
return FModel.getQuest().getCards().addRandomRare();
}
-
+
return promo;
-
+
}
-
+
private CardEdition getRandomEdition() {
-
+
- List<CardEdition> editions = new ArrayList<>();
- for (String booster : boosterConfiguration.split("/")) {
+ final List<CardEdition> editions = new ArrayList<>();
+ for (final String booster : boosterConfiguration.split("/")) {
editions.add(FModel.getMagicDb().getEditions().get(booster));
}
-
+
return editions.get((int) (Math.random() * editions.size()));
-
+
}
private Set<CardEdition> getAllEditions() {
-
+
- Set<CardEdition> editions = new HashSet<>();
- for (String booster : boosterConfiguration.split("/")) {
+ final Set<CardEdition> editions = new HashSet<>();
+ for (final String booster : boosterConfiguration.split("/")) {
editions.add(FModel.getMagicDb().getEditions().get(booster));
}
return editions;
}
-
+
- private int getBoosterPrice(final BoosterPack booster) {
-
+ private static int getBoosterPrice(final BoosterPack booster) {
int value;
-
+
- String boosterName = booster.getName();
+ final String boosterName = booster.getName();
if (MAP_PRICES.containsKey(boosterName)) {
value = MAP_PRICES.get(boosterName);
} else {
value = 395;
}
-
+
return value;
-
+
}
-
+
public boolean playerHasMatchesLeft() {
-
+
int playerIndex = -1;
for (int i = standings.length - 1; i >= 0; i--) {
if (standings[i].equals(HUMAN)) {
@@ -560,52 +551,52 @@
break;
}
}
-
+
int nextMatchIndex;
-
+
switch (playerIndex) {
-
- case 0:
- case 1:
- nextMatchIndex = 8;
- break;
- case 2:
- case 3:
- nextMatchIndex = 9;
- break;
- case 4:
- case 5:
- nextMatchIndex = 10;
- break;
- case 6:
- case 7:
- nextMatchIndex = 11;
- break;
- case 8:
- case 9:
- nextMatchIndex = 12;
- break;
- case 10:
- case 11:
- nextMatchIndex = 13;
- break;
- case 12:
- case 13:
- nextMatchIndex = 14;
- break;
- case 14:
- default:
- nextMatchIndex = -1;
- break;
-
+
+ case 0:
+ case 1:
+ nextMatchIndex = 8;
+ break;
+ case 2:
+ case 3:
+ nextMatchIndex = 9;
+ break;
+ case 4:
+ case 5:
+ nextMatchIndex = 10;
+ break;
+ case 6:
+ case 7:
+ nextMatchIndex = 11;
+ break;
+ case 8:
+ case 9:
+ nextMatchIndex = 12;
+ break;
+ case 10:
+ case 11:
+ nextMatchIndex = 13;
+ break;
+ case 12:
+ case 13:
+ nextMatchIndex = 14;
+ break;
+ case 14:
+ default:
+ nextMatchIndex = -1;
+ break;
+
}
return nextMatchIndex != -1 && standings[nextMatchIndex].equals(UNDETERMINED);
}
-
+
public int getPlayerPlacement() {
-
+
int playerIndex = -1;
for (int i = standings.length - 1; i >= 0; i--) {
if (standings[i].equals(HUMAN)) {
@@ -613,49 +604,49 @@
break;
}
}
-
+
if (playerIndex <= 7) {
return 4;
}
-
+
if (playerIndex <= 11) {
return 3;
}
-
+
if (playerIndex <= 13) {
return 2;
}
-
+
if (playerIndex == 14) {
return 1;
}
-
+
return -1;
-
+
}
public String getPlacementString() {
-
+
- int place = getPlayerPlacement();
+ final int place = getPlayerPlacement();
String output;
switch (place) {
- case 1:
- output = "first";
- break;
- case 2:
- output = "second";
- break;
- case 3:
- output = "third";
- break;
- case 4:
- output = "fourth";
- break;
- default:
- output = "ERROR";
- break;
+ case 1:
+ output = "first";
+ break;
+ case 2:
+ output = "second";
+ break;
+ case 3:
+ output = "third";
+ break;
+ case 4:
+ output = "fourth";
+ break;
+ default:
+ output = "ERROR";
+ break;
}
return output;
@@ -663,7 +654,7 @@
}
public boolean canEnter() {
- long creditsAvailable = FModel.getQuest().getAssets().getCredits();
+ final long creditsAvailable = FModel.getQuest().getAssets().getCredits();
return creditsAvailable < getEntryFee();
}
@@ -676,12 +667,12 @@
public boolean isStarted() {
return started;
}
-
+
public void start() {
started = true;
FModel.getQuest().save();
}
-
+
public void setStarted(final boolean started) {
this.started = started;
}
@@ -690,40 +681,40 @@
public String toString() {
return title;
}
-
+
public static List<CardBlock> getAvailableBlocks(final QuestController quest) {
- List<CardBlock> possibleBlocks = new ArrayList<>();
- List<CardEdition> allowedQuestSets = new ArrayList<>();
+ final List<CardBlock> possibleBlocks = new ArrayList<>();
+ final List<CardEdition> allowedQuestSets = new ArrayList<>();
- boolean questUsesLimitedCardPool = quest.getFormat() != null;
+ final boolean questUsesLimitedCardPool = quest.getFormat() != null;
if (questUsesLimitedCardPool) {
- List<String> allowedSetCodes = quest.getFormat().getAllowedSetCodes();
+ final List<String> allowedSetCodes = quest.getFormat().getAllowedSetCodes();
- for (String setCode : allowedSetCodes) {
+ for (final String setCode : allowedSetCodes) {
allowedQuestSets.add(FModel.getMagicDb().getEditions().get(setCode));
}
}
- List<CardBlock> blocks = new ArrayList<>();
- IStorage<CardBlock> storage = FModel.getBlocks();
+ final List<CardBlock> blocks = new ArrayList<>();
+ final IStorage<CardBlock> storage = FModel.getBlocks();
- for (CardBlock b : storage) {
+ for (final CardBlock b : storage) {
if (b.getCntBoostersDraft() > 0) {
blocks.add(b);
}
}
if (questUsesLimitedCardPool) {
- for (CardBlock block : blocks) {
+ for (final CardBlock block : blocks) {
boolean blockAllowed = true;
- boolean allBlocksSanctioned = quest.getFormat().getAllowedSetCodes().isEmpty();
+ final boolean allBlocksSanctioned = quest.getFormat().getAllowedSetCodes().isEmpty();
- for (CardEdition set : block.getSets()) {
+ for (final CardEdition set : block.getSets()) {
if (!allowedQuestSets.contains(set) && !allBlocksSanctioned) {
blockAllowed = false;
break;
@@ -740,25 +731,25 @@
}
return possibleBlocks.isEmpty() ? null : possibleBlocks;
-
+
}
-
+
/**
* Generates a random draft event based on the provided quest's limitations.
* @param quest The quest used to determine set availability.
* @return The created draft or null in the event no draft could be created.
*/
public static QuestEventDraft getRandomDraftOrNull(final QuestController quest) {
-
+
- List<CardBlock> possibleBlocks = getAvailableBlocks(quest);
+ final List<CardBlock> possibleBlocks = getAvailableBlocks(quest);
-
+
if (possibleBlocks == null) {
return null;
}
-
+
Collections.shuffle(possibleBlocks);
return getDraftOrNull(quest, possibleBlocks.get(0));
-
+
}
/**
@@ -766,9 +757,9 @@
* @return The created draft or null in the event no draft could be created.
*/
public static QuestEventDraft getDraftOrNull(final QuestController quest, final CardBlock block) {
-
+
- QuestEventDraft event = new QuestEventDraft(block.getName());
+ final QuestEventDraft event = new QuestEventDraft(block.getName());
-
+
if (block.getNumberSets() == 1) {
String boosterConfiguration = "";
for (int i = 0; i < block.getCntBoostersDraft(); i++) {
@@ -779,15 +770,15 @@
event.boosterConfiguration = boosterConfiguration;
}
} else {
- List<String> possibleSetCombinations = getSetCombos(block);
+ final List<String> possibleSetCombinations = getSetCombos(block);
Collections.shuffle(possibleSetCombinations);
event.boosterConfiguration = possibleSetCombinations.get(0);
}
-
+
event.block = block.getName();
event.entryFee = calculateEntryFee(event.boosterConfiguration.split("/"));
-
+
- List<String> players = new ArrayList<>();
+ final List<String> players = new ArrayList<>();
players.add(HUMAN);
players.add("1");
players.add("2");
@@ -796,74 +787,73 @@
players.add("5");
players.add("6");
players.add("7");
-
+
Collections.shuffle(players);
-
+
for (int i = 0; i < players.size(); i++) {
event.standings[i] = players.get(i);
}
-
+
for (int i = 8; i < event.standings.length; i++) {
event.standings[i] = UNDETERMINED;
}
-
+
- List<String> usedNames = new ArrayList<>();
+ final List<String> usedNames = new ArrayList<>();
usedNames.add(GamePlayerUtil.getGuiPlayer().getName());
-
+
for (int i = 0; i < 7; i++) {
event.aiNames[i] = NameGenerator.getRandomName("Any", "Any", usedNames);
usedNames.add(event.aiNames[i]);
}
-
+
- int numberOfIcons = GuiBase.getInterface().getAvatarCount();
- List<Integer> usedIcons = new ArrayList<>();
+ final int numberOfIcons = GuiBase.getInterface().getAvatarCount();
+ final List<Integer> usedIcons = new ArrayList<>();
-
+
for (int i = 0; i < 7; i++) {
-
+
int icon;
int attempts = 50;
-
+
do {
icon = (int) Math.floor(Math.random() * numberOfIcons);
} while ((icon < 0 || usedIcons.contains(icon)) && attempts-- > 0);
-
+
event.aiIcons[i] = icon;
usedNames.add(event.aiNames[i]);
usedIcons.add(icon);
-
+
}
-
+
return event;
-
+
}
-
+
- private static int calculateEntryFee(String[] boosters) {
-
+ private static int calculateEntryFee(final String[] boosters) {
int entryFee = 0;
-
+
- for (String boosterSet : boosters) {
+ for (final String boosterSet : boosters) {
-
+
int value;
- String boosterName = FModel.getMagicDb().getEditions().get(boosterSet).getName() + " Booster Pack";
+ final String boosterName = FModel.getMagicDb().getEditions().get(boosterSet).getName() + " Booster Pack";
-
+
if (MAP_PRICES.containsKey(boosterName)) {
value = MAP_PRICES.get(boosterName);
} else {
value = 395;
}
-
+
entryFee += value;
-
+
}
-
+
return (int) (entryFee * 1.5);
-
+
}
-
+
private static List<String> getSetCombos(final CardBlock block) {
- List<String> result = new ArrayList<>();
+ final List<String> result = new ArrayList<>();
- List<CardEdition> sets = block.getSets();
+ final List<CardEdition> sets = block.getSets();
final String s0c = sets.get(0).getCode();
if (sets.size() == 1) {
result.add(String.format("%s/%s/%s", s0c, s0c, s0c));
@@ -871,13 +861,13 @@
}
final String s1c = sets.get(1).getCode();
- final String s2c = sets.size() > 2 ? sets.get(2).getCode() : null;
+ final String s2c = sets.size() > 2 ? sets.get(2).getCode() : null;
- boolean s0isLarge = sets.get(0).getCards().length > 200;
- boolean s1isLarge = sets.get(1).getCards().length > 200;
+ final boolean s0isLarge = sets.get(0).getCards().length > 200;
+ final boolean s1isLarge = sets.get(1).getCards().length > 200;
-
+
final String largerSet = s0isLarge == s1isLarge ? null : s0isLarge ? s0c : s1c;
-
+
if (s2c == null) {
if (largerSet != null ) {
result.add(String.format("%s/%s/%s", s0c, largerSet, s1c));
@@ -892,24 +882,25 @@
result.add(String.format("%s/%s/%s", s0c, s1c, s2c));
// allow separate drafts with 3rd large set (ex: ROE, AVR)
- if( sets.get(2).getCards().length > 200)
+ if( sets.get(2).getCards().length > 200) {
result.add(String.format("%s/%s/%s", s2c, s2c, s2c));
- }
+ }
+ }
// This is set to Scars of Mirrodin date to account for the fact that MBS is drafted as a part of the Scars of Mirrodin block.
// Setting it to the date of Mirrodin Besieged makes it treat all drafts that feature Scars of Mirrodin incorrectly.
- Date SOMDate = FModel.getMagicDb().getEditions().get("SOM").getDate();
- boolean openOlderPacksFirst = sets.get(0).getDate().before(SOMDate); // before Mirrodin Besieged, sets were drafted in the opposite order (old->new instead of new->old)
+ final Date SOMDate = FModel.getMagicDb().getEditions().get("SOM").getDate();
+ final boolean openOlderPacksFirst = sets.get(0).getDate().before(SOMDate); // before Mirrodin Besieged, sets were drafted in the opposite order (old->new instead of new->old)
if( !openOlderPacksFirst ){
for(int i = result.size() - 1; i >= 0; i--) {
- List<String> parts = Arrays.asList(TextUtil.split(result.get(i), '/'));
+ final List<String> parts = Arrays.asList(TextUtil.split(result.get(i), '/'));
Collections.reverse(parts);
result.set(i, TextUtil.join(parts, "/"));
}
}
-
+
return result;
}
-
+
}
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CAllDecks.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CAllDecks.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CAllDecks.java (revision 29317)
@@ -1,32 +1,24 @@
package forge.screens.deckeditor.controllers;
-import forge.UiCommand;
import forge.deck.DeckProxy;
import forge.gui.framework.ICDoc;
import forge.itemmanager.ItemManagerConfig;
import forge.screens.deckeditor.views.VAllDecks;
-/**
+/**
* Controls the "all decks" panel in the deck editor UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
public enum CAllDecks implements ICDoc {
- /** */
SINGLETON_INSTANCE;
+ private final VAllDecks view = VAllDecks.SINGLETON_INSTANCE;
+
//========== Overridden methods
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
@Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
-
- @Override
public void register() {
}
@@ -39,7 +31,7 @@
}
public void refresh() {
- VAllDecks.SINGLETON_INSTANCE.getLstDecks().setPool(DeckProxy.getAllConstructedDecks());
+ view.getLstDecks().setPool(DeckProxy.getAllConstructedDecks());
}
/* (non-Javadoc)
@@ -47,6 +39,6 @@
*/
@Override
public void update() {
- VAllDecks.SINGLETON_INSTANCE.getLstDecks().setup(ItemManagerConfig.CONSTRUCTED_DECKS);
+ view.getLstDecks().setup(ItemManagerConfig.CONSTRUCTED_DECKS);
}
}
Index: forge-gui/src/main/java/forge/error/BugReporter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/error/BugReporter.java (revision 29316)
+++ forge-gui/src/main/java/forge/error/BugReporter.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -23,8 +23,6 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.util.Map;
-import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
@@ -36,7 +34,7 @@
/**
* The class ErrorViewer. Enables showing and saving error messages that
* occurred in forge.
- *
+ *
* @author Clemens Koza
* @version V1.0 02.08.2009
*/
@@ -48,30 +46,30 @@
public static final String CONTINUE = "Continue";
public static final String EXIT = "Exit";
- public static final String HELP_TEXT =
- "A template for a post in the bug reports forum topic is shown below. Just select '" + REPORT + "' "
+ public static final String HELP_TEXT = String.format(
+ "A template for a post in the bug reports forum topic is shown below. Just select '%s' "
- + "and the template will be copied to your system clipboard and the forum page will open in your browser. "
+ + "and the template will be copied to your system clipboard and the forum page will open in your browser. "
- + "Then all you have to do is paste the text into a forum post and edit the description line.";
+ + "Then all you have to do is paste the text into a forum post and edit the description line.", REPORT);
public static final String HELP_URL_LABEL =
"Reporting bugs in Forge is very important. We sincerely thank you for your time."
- + " For help writing a solid bug report, please see:";
+ + " For help writing a solid bug report, please see:";
public static final String HELP_URL =
"http://www.slightlymagic.net/forum/viewtopic.php?f=26&p=109925#p109925";
- public static final String FORUM_URL;
+ private static final String FORUM_URL;
static {
- String forgeVersion = BuildInfo.getVersionString();
+ final String forgeVersion = BuildInfo.getVersionString();
if (StringUtils.containsIgnoreCase(forgeVersion, "svn") || StringUtils.containsIgnoreCase(forgeVersion, "snapshot")) {
FORUM_URL = "http://www.slightlymagic.net/forum/viewtopic.php?f=52&t=6333&start=54564487645#bottom";
- }
- else {
+ } else {
FORUM_URL = "http://www.slightlymagic.net/forum/viewforum.php?f=26";
}
}
/**
- * Shows exception information in a format ready to post to the forum as a crash report. Uses the exception's message
- * as the reason if message is null.
+ * Shows exception information in a format ready to post to the forum as a
+ * crash report. Uses the exception's message as the reason if message is
+ * null.
*/
public static void reportException(final Throwable ex, final String message) {
if (ex == null) {
@@ -82,20 +80,20 @@
}
System.err.print(FThreads.debugGetCurrThreadId() + " > ");
ex.printStackTrace();
-
+
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("Description: [describe what you were doing when the crash occurred]\n\n");
buildSpoilerHeader(sb, ex.getClass().getSimpleName());
sb.append("\n\n");
if (null != message && !message.isEmpty()) {
sb.append(FThreads.debugGetCurrThreadId()).append(" > ").append(message).append("\n");
}
-
+
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
- String swStr = sw.toString();
+ final String swStr = sw.toString();
if (ex instanceof StackOverflowError && swStr.length() >= STACK_OVERFLOW_MAX_MESSAGE_LEN) {
// most likely a cycle. only take first portion so the message
// doesn't grow too large to post
@@ -129,7 +127,7 @@
* Shows a forum post template for reporting a bug.
*/
public static void reportBug(final String details) {
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("Description: [describe the problem]\n\n");
buildSpoilerHeader(sb, "General bug report");
if (null != details && !details.isEmpty()) {
@@ -141,42 +139,6 @@
GuiBase.getInterface().showBugReportDialog("Report a bug", sb.toString(), false);
}
- /**
- * Shows thread stack information in a format ready to post to the forum.
- */
- public static void reportThreadStacks(final String message) {
- StringBuilder sb = new StringBuilder();
- sb.append("Description: [describe what you were doing at the time]\n\n");
- buildSpoilerHeader(sb, "Thread stack dump");
- sb.append("\n\n");
- if (null != message && !message.isEmpty()) {
- sb.append(message);
- sb.append("\n");
- }
-
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- final Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces();
- for (final Entry<Thread, StackTraceElement[]> e : traces.entrySet()) {
- pw.println();
- pw.printf("%s (%s):%n", e.getKey().getName(), e.getKey().getId());
- for (final StackTraceElement el : e.getValue()) {
- pw.println(el);
- }
- }
-
- sb.append(sw.toString());
- buildSpoilerFooter(sb);
- GuiBase.getInterface().showBugReportDialog("Thread stack dump", sb.toString(), false);
- }
-
- /**
- * Alias for reportThreadStacks(String.format(format, args))
- */
- public static void reportThreadStacks(final String format, final Object... args) {
- reportThreadStacks(String.format(format, args));
- }
-
private static StringBuilder buildSpoilerHeader(final StringBuilder sb, final String reportTitle) {
sb.append("[spoiler=").append(reportTitle).append("][code]");
sb.append("\nForge Version: ").append(GuiBase.getInterface().getCurrentVersion());
@@ -188,7 +150,7 @@
return sb;
}
- private static StringBuilder buildSpoilerFooter(StringBuilder sb) {
+ private static StringBuilder buildSpoilerFooter(final StringBuilder sb) {
sb.append("[/code][/spoiler]");
return sb;
}
@@ -198,8 +160,7 @@
// copy text to clipboard
GuiBase.getInterface().copyToClipboard(text);
GuiBase.getInterface().browseToUrl(FORUM_URL);
- }
- catch (Exception ex) {
+ } catch (final Exception ex) {
SOptionPane.showMessageDialog("Sorry, a problem occurred while opening the forum in your default browser.",
"A problem occurred", SOptionPane.ERROR_ICON);
}
@@ -207,7 +168,7 @@
public static void saveToFile(final String text) {
File f;
- long curTime = System.currentTimeMillis();
+ final long curTime = System.currentTimeMillis();
for (int i = 0;; i++) {
final String name = String.format("%TF-%02d.txt", curTime, i);
f = new File(name);
@@ -228,7 +189,10 @@
"Error saving file", SOptionPane.ERROR_ICON);
}
}
-
+
- // disable instantiation
- private BugReporter() { }
+ /**
+ * Private constructor to prevent instantiation.
+ */
+ private BugReporter() {
+ }
}
Index: forge-gui/src/main/java/forge/match/input/InputSelectCardsFromList.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/input/InputSelectCardsFromList.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/input/InputSelectCardsFromList.java (revision 29317)
@@ -10,12 +10,9 @@
public InputSelectCardsFromList(final PlayerControllerHuman controller, final int cnt, final FCollectionView<Card> validCards) {
super(controller, cnt, cnt, validCards); // to avoid hangs
}
-
+
public InputSelectCardsFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<Card> validCards) {
super(controller, min, max, validCards); // to avoid hangs
}
-
+
- public InputSelectCardsFromList(final PlayerControllerHuman controller, final FCollectionView<Card> validCards) {
- super(controller, 1, 1, validCards); // to avoid hangs
- }
}
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/gui/framework/CEmptyDoc.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/framework/CEmptyDoc.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/framework/CEmptyDoc.java (revision 29317)
@@ -1,20 +1,10 @@
package forge.gui.framework;
-import forge.UiCommand;
-
-/**
+/**
* An intentionally empty ICDoc to fill field slots unused
* by the current layout of a match UI.
*/
public class CEmptyDoc implements ICDoc {
-
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
@Override
public void register() {
Index: forge-gui-desktop/src/main/java/forge/toolbox/FHtmlViewer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FHtmlViewer.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FHtmlViewer.java (revision 29317)
@@ -1,10 +1,11 @@
package forge.toolbox;
+import javax.swing.JEditorPane;
+import javax.swing.SwingUtilities;
+
import forge.toolbox.FSkin.SkinnedEditorPane;
-import javax.swing.*;
-
-/**
+/**
* Viewer for HTML
*
*/
@@ -19,7 +20,7 @@
this.setFocusable(false);
this.setEditable(false);
this.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
- this.setContentType("text/html");
+ this.setContentType("text/html");
}
/** @param str {@java.lang.String} */
@@ -27,18 +28,19 @@
this();
this.setText(str);
}
-
+
@Override
public void setText(final String text) {
- SwingUtilities.invokeLater( new Runnable() { //need to invokeLater to avoid flicker
+ SwingUtilities.invokeLater( new Runnable() { //need to invokeLater to avoid flicker
+ @Override
public void run() {
- setSuperText(null == text ? "" : text.replaceAll("(\r\n)|(\n)", "<br>")); //replace line breaks with <br> elements
- setCaretPosition(0); //keep scrolled to top
+ setSuperText(null == text ? "" : text.replaceAll("(\r\n)|(\n)", "<br>")); //replace line breaks with <br> elements
+ setCaretPosition(0); //keep scrolled to top
}
});
}
-
+
private void setSuperText(final String text) {
- super.setText(text);
+ super.setText(text);
}
}
Index: forge-gui-desktop/src/main/java/forge/gui/MultiLineLabelUI.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/MultiLineLabelUI.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/MultiLineLabelUI.java (revision 29317)
@@ -6,23 +6,22 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.gui;
-import javax.swing.*;
-import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.LabelUI;
-import javax.swing.plaf.basic.BasicLabelUI;
-import javax.swing.text.*;
-import java.awt.*;
+import java.awt.Dimension;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.beans.PropertyChangeEvent;
@@ -30,6 +29,20 @@
import java.util.Iterator;
import java.util.List;
+import javax.swing.Icon;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.SwingConstants;
+import javax.swing.plaf.LabelUI;
+import javax.swing.plaf.basic.BasicLabelUI;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.Element;
+import javax.swing.text.PlainDocument;
+import javax.swing.text.Segment;
+import javax.swing.text.Utilities;
+import javax.swing.text.View;
+
/**
* Label UI delegate that supports multiple lines and line wrapping. Hard line
* breaks (<code>\n</code>) are preserved. If the dimensions of the label is too
@@ -42,7 +55,7 @@
* <p/>
* Example of usage:
* <p/>
- *
+ *
* <pre>
* JLabel myLabel = new JLabel();
* myLabel.setUI(MultiLineLabelUI.labelUI);
@@ -55,7 +68,7 @@
* by overriding {@link #paintEnabledText(JLabel, Graphics, String, int, int)}
* and {@link #paintDisabledText(JLabel, Graphics, String, int, int)}. This
* class is designed to be easily extended by subclasses.
- *
+ *
* @author Samuel Sjoberg, http://samuelsjoberg.com
* @version 1.3.0
*/
@@ -95,17 +108,6 @@
*/
private static int defaultSize = 4;
- /**
- * Get the shared UI instance.
- *
- * @param c
- * the c
- * @return a ComponentUI
- */
- public static ComponentUI createUI(final JComponent c) {
- return MultiLineLabelUI.getLabelUI();
- }
-
/** {@inheritDoc} */
@Override
protected void uninstallDefaults(final JLabel c) {
@@ -129,7 +131,7 @@
/**
* Clear the wrapped line cache.
- *
+ *
* @param l
* the label containing a cached value
*/
@@ -150,7 +152,7 @@
/**
* Calculate the paint rectangles for the icon and text for the passed
* label.
- *
+ *
* @param l
* a label
* @param fm
@@ -193,7 +195,7 @@
* <p>
* prepareGraphics.
* </p>
- *
+ *
* @param g
* a {@link java.awt.Graphics} object.
*/
@@ -237,7 +239,7 @@
/**
* Paint the wrapped text lines.
- *
+ *
* @param g
* graphics component to paint on
* @param label
@@ -288,7 +290,7 @@
/**
* Returns the available height to paint text on. This is the height of the
* passed component with insets subtracted.
- *
+ *
* @param l
* a component
* @return the available height
@@ -301,7 +303,7 @@
/**
* Add a clip indication to the string. It is important that the string
* length does not exceed the length or the original string.
- *
+ *
* @param text
* the to be painted
* @param fm
@@ -324,7 +326,7 @@
/**
* Establish the vertical text alignment. The default alignment is to center
* the text in the label.
- *
+ *
* @param label
* the label to paint
* @param fm
@@ -359,7 +361,7 @@
* <p>
* getAscent.
* </p>
- *
+ *
* @param fm
* a {@link java.awt.FontMetrics} object.
* @return a int.
@@ -371,7 +373,7 @@
/**
* Establish the horizontal text alignment. The default alignment is left
* aligned text.
- *
+ *
* @param label
* the label to paint
* @param fm
@@ -401,7 +403,7 @@
* Check the given string to see if it should be rendered as HTML. Code
* based on implementation found in
* <code>BasicHTML.isHTMLString(String)</code> in future JDKs.
- *
+ *
* @param s
* the string
* @return <code>true</code> if string is HTML, otherwise <code>false</code>
@@ -453,7 +455,7 @@
/**
* The preferred height of the label is the height of the lines with added
* top and bottom insets.
- *
+ *
* @param label
* the label
* @return the preferred height of the wrapped lines.
@@ -467,7 +469,7 @@
/**
* Get the lines of text contained in the text label. The prepared lines is
* cached as a client property, accessible via {@link #PROPERTY_KEY}.
- *
+ *
* @param l
* the label
* @return the text lines of the label.
@@ -509,7 +511,7 @@
/**
* Prepare the text lines for rendering. The lines are wrapped to fit in the
* current available space for text. Explicit line breaks are preserved.
- *
+ *
* @param l
* the label to render
* @return a list of text lines to render
@@ -535,7 +537,7 @@
/**
* If necessary, wrap the text into multiple lines.
- *
+ *
* @param lines
* line array in which to store the wrapped lines
* @param elem
@@ -557,7 +559,7 @@
/**
* Calculate the position on which to break (wrap) the line.
- *
+ *
* @param doc
* the document
* @param p0
@@ -583,26 +585,16 @@
/**
* Gets the label ui.
- *
+ *
* @return the labelUI
*/
public static LabelUI getLabelUI() {
return MultiLineLabelUI.labelUI;
- }
-
- /**
- * Sets the label ui.
- *
- * @param labelUI
- * the new label ui
- */
- public static void setLabelUI(final LabelUI labelUI) {
- MultiLineLabelUI.labelUI = labelUI;
}
/**
* Static singleton {@link Segment} cache.
- *
+ *
* @author Samuel Sjoberg
* @see javax.swing.text.SegmentCache
*/
@@ -627,7 +619,7 @@
/**
* Returns a <code>Segment</code>. When done, the <code>Segment</code>
* should be recycled by invoking {@link #releaseSegment(Segment)}.
- *
+ *
* @return a <code>Segment</code>.
*/
public static Segment getSegment() {
@@ -642,7 +634,7 @@
* Releases a <code>Segment</code>. A segment should not be used after
* it is released, and a segment should never be released more than
* once.
- *
+ *
* @param segment
* the segment
*/
Index: forge-gui-desktop/src/main/java/forge/gui/CardPicturePanel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/CardPicturePanel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/CardPicturePanel.java (revision 29317)
@@ -83,11 +83,11 @@
return null;
}
- private AutoSizeImageMode getAutoSizeImageMode() {
+ private static AutoSizeImageMode getAutoSizeImageMode() {
return (isUIScaleLarger() ? AutoSizeImageMode.PANEL : AutoSizeImageMode.SOURCE);
}
- private boolean isUIScaleLarger() {
+ private static boolean isUIScaleLarger() {
return FModel.getPreferences().getPrefBoolean(FPref.UI_SCALE_LARGER);
}
Index: forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemCellRenderer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemCellRenderer.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemCellRenderer.java (revision 29317)
@@ -6,28 +6,29 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.itemmanager.views;
-import forge.item.InventoryItem;
-import forge.itemmanager.ColumnDef;
-import forge.toolbox.FSkin;
+import java.awt.Component;
+import java.awt.event.MouseEvent;
-import javax.swing.*;
+import javax.swing.JLabel;
+import javax.swing.JTable;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableCellRenderer;
-import java.awt.*;
-import java.awt.event.MouseEvent;
+import forge.item.InventoryItem;
+import forge.itemmanager.ColumnDef;
+import forge.toolbox.FSkin;
/**
* Base cell renderer class for item tables
@@ -36,7 +37,7 @@
public class ItemCellRenderer extends DefaultTableCellRenderer {
private static final Border DEFAULT_BORDER = new EmptyBorder(1, 1, 1, 1);
- public static ItemCellRenderer getColumnDefRenderer(ColumnDef columnDef) {
+ public static ItemCellRenderer getColumnDefRenderer(final ColumnDef columnDef) {
switch (columnDef) {
case POWER:
case TOUGHNESS:
@@ -66,12 +67,12 @@
return false;
}
- public <T extends InventoryItem> void processMouseEvent(final MouseEvent e, final ItemListView<T> listView, final Object value, final int row, final int column) {
+ protected <T extends InventoryItem> void processMouseEvent(final MouseEvent e, final ItemListView<T> listView, final Object value, final int row, final int column) {
}
@Override
- public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
- JLabel lbl = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
+ final JLabel lbl = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
lbl.setBorder(DEFAULT_BORDER); //prevent selected cell having inner border
if (isSelected) {
lbl.setBackground(table.getSelectionBackground());
@@ -85,5 +86,5 @@
}
}
return lbl;
- }
+ }
}
Index: forge-gui-desktop/src/main/java/forge/view/FView.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/view/FView.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/view/FView.java (revision 29317)
@@ -112,7 +112,7 @@
// Frame components
frmDocument.setContentPane(lpnDocument);
lpnDocument.add(pnlInsets, (Integer) 1);
- FAbsolutePositioner.SINGLETON_INSTANCE.initialize(lpnDocument, (Integer) 2);
+ FAbsolutePositioner.SINGLETON_INSTANCE.initialize(lpnDocument, 2);
lpnDocument.add(pnlPreview, (Integer) 3);
lpnDocument.add(pnlTabOverflow, (Integer) 4);
lpnDocument.add(navigationBar, NAVIGATION_BAR_LAYER);
@@ -135,7 +135,7 @@
FOverlay.SINGLETON_INSTANCE.getPanel().setBackground(FSkin.getColor(FSkin.Colors.CLR_OVERLAY));
// Populate all drag tab components.
- this.cacheUIStates();
+ cacheUIStates();
// Does not use progress bar, due to be deprecated with battlefield refactoring.
CardFaceSymbols.loadImages();
@@ -157,35 +157,35 @@
SLayoutIO.loadWindowLayout();
frmDocument.setVisible(true);
-
+
// remove this once our userbase has been migrated to the profile layout
{
// get profile directories -- if one of them is actually under the res directory, don't
// count is as data to migrate
final Set<File> profileDirs = new HashSet<File>();
- for (String dname : ForgeConstants.PROFILE_DIRS) {
+ for (final String dname : ForgeConstants.PROFILE_DIRS) {
profileDirs.add(new File(dname));
}
final List<File> resDirs = new ArrayList<File>();
- for (String resDir : Lists.newArrayList("decks", "gauntlet", "layouts", "pics", "preferences", "quest/data")) {
+ for (final String resDir : Lists.newArrayList("decks", "gauntlet", "layouts", "pics", "preferences", "quest/data")) {
resDirs.add(new File("res", resDir));
}
final Set<File> doNotDeleteDirs = new HashSet<File>();
- for (String dir : Lists.newArrayList("decks", "decks/constructed", "decks/draft", "decks/plane", "decks/scheme", "decks/sealed", "gauntlet", "layouts", "pics", "preferences", "quest/data")) {
+ for (final String dir : Lists.newArrayList("decks", "decks/constructed", "decks/draft", "decks/plane", "decks/scheme", "decks/sealed", "gauntlet", "layouts", "pics", "preferences", "quest/data")) {
doNotDeleteDirs.add(new File("res", dir));
}
-
+
// if we have any data to migrate, pop up the migration dialog
if (_addRemainingFiles(null, resDirs, profileDirs, doNotDeleteDirs)) {
new ImportDialog("res", new Runnable() {
@Override public void run() {
// remove known cruft files, yes this is ugly, but it's also temporary
- for (String cruftFile : Lists.newArrayList("decks/SkieraCube-cards_not_supported_yet.txt", "decks/cube/ArabianExtended.dck", "decks/cube/GtcGuildBoros.dck", "decks/cube/GtcGuildDimir.dck", "decks/cube/GtcGuildGruul.dck", "decks/cube/GtcGuildOrzhov.dck", "decks/cube/GtcGuildSimic.dck", "decks/cube/GtcPromoBoros.dck", "decks/cube/GtcPromoDimir.dck", "decks/cube/GtcPromoGruul.dck", "decks/cube/GtcPromoOrzhov.dck", "decks/cube/GtcPromoSimic.dck", "decks/cube/JuzamjediCube.dck", "decks/cube/RtRGuildAzorius.dck", "decks/cube/RtRGuildGolgari.dck", "decks/cube/RtRGuildIzzet.dck", "decks/cube/RtRGuildRakdos.dck", "decks/cube/RtRGuildSelesnya.dck", "decks/cube/RtRPromoAzorius.dck", "decks/cube/RtRPromoGolgari.dck", "decks/cube/RtRPromoIzzet.dck", "decks/cube/RtRPromoRakdos.dck", "decks/cube/RtRPromoSelesnya.dck", "decks/cube/SkieraCube.dck", "gauntlet/LOCKED_DotP Preconstructed.dat", "gauntlet/LOCKED_Swimming With Sharks.dat", "layouts/editor_default.xml", "layouts/home_default.xml", "layouts/match_default.xml", "pics/snow_covered_forest1.jpg", "pics/snow_covered_forest2.jpg", "pics/snow_covered_forest3.jpg", "pics/snow_covered_island1.jpg", "pics/snow_covered_island2.jpg", "pics/snow_covered_island3.jpg", "pics/snow_covered_mountain1.jpg", "pics/snow_covered_mountain2.jpg", "pics/snow_covered_mountain3.jpg", "pics/snow_covered_plains1.jpg", "pics/snow_covered_plains2.jpg", "pics/snow_covered_plains3.jpg", "pics/snow_covered_swamp1.jpg", "pics/snow_covered_swamp2.jpg", "pics/snow_covered_swamp3.jpg", "pics/VAN/Birds of Paradise Avatar.full.jpg", "pics/VAN/Erhnam Djinn Avatar.full.jpg", "pics/VAN/Goblin Warchief Avatar.full.jpg", "pics/VAN/Grinning Demon Avatar.full.jpg", "pics/VAN/Platinum Angel Avatar.full.jpg", "pics/VAN/Prodigal Sorcerer Avatar.full.jpg", "pics/VAN/Rith, the Awakener Avatar.full.jpg", "pics/VAN/Royal Assassin Avatar.full.jpg", "pics/VAN/Serra Angel Avatar.full.jpg", "pics/VAN/Tradewind Rider Avatar.full.jpg", "pics_product/10E.jpg", "pics_product/2ED.jpg", "pics_product/3ED.jpg", "pics_product/4ED.jpg", "pics_product/5DN.jpg", "pics_product/5ED.jpg", "pics_product/6ED.jpg", "pics_product/7ED.jpg", "pics_product/8ED.jpg", "pics_product/9ED.jpg", "pics_product/ALA.jpg", "pics_product/ALL.jpg", "pics_product/APC.jpg", "pics_product/ARB.jpg", "pics_product/ARN.jpg", "pics_product/ATQ.jpg", "pics_product/BOK.jpg", "pics_product/CFX.jpg", "pics_product/CHK.jpg", "pics_product/CHR.jpg", "pics_product/CSP.jpg", "pics_product/DIS.jpg", "pics_product/DKA.jpg", "pics_product/DRK.jpg", "pics_product/DST.jpg", "pics_product/EVE.jpg", "pics_product/EXO.jpg", "pics_product/FEM.jpg", "pics_product/FUT.jpg", "pics_product/GPT.jpg", "pics_product/HML.jpg", "pics_product/ICE.jpg", "pics_product/INV.jpg", "pics_product/ISD.jpg", "pics_product/JUD.jpg", "pics_product/LEA.jpg", "pics_product/LEB.jpg", "pics_product/LEG.jpg", "pics_product/LGN.jpg", "pics_product/LRW.jpg", "pics_product/M10.jpg", "pics_product/M11.jpg", "pics_product/M12.jpg", "pics_product/MBS.jpg", "pics_product/MIR.jpg", "pics_product/MMQ.jpg", "pics_product/MOR.jpg", "pics_product/MRD.jpg", "pics_product/NMS.jpg", "pics_product/NPH.jpg", "pics_product/ODY.jpg", "pics_product/ONS.jpg", "pics_product/PCY.jpg", "pics_product/PLC.jpg", "pics_product/PLS.jpg", "pics_product/PO2.jpg", "pics_product/POR.jpg", "pics_product/PTK.jpg", "pics_product/RAV.jpg", "pics_product/ROE.jpg", "pics_product/S99.jpg", "pics_product/SCG.jpg", "pics_product/SHM.jpg", "pics_product/SOK.jpg", "pics_product/SOM.jpg", "pics_product/STH.jpg", "pics_product/TMP.jpg", "pics_product/TOR.jpg", "pics_product/TSP.jpg", "pics_product/UDS.jpg", "pics_product/ULG.jpg", "pics_product/USG.jpg", "pics_product/VIS.jpg", "pics_product/WTH.jpg", "pics_product/WWK.jpg", "pics_product/ZEN.jpg", "pics_product/booster/7E.png", "pics_product/booster/AP.png", "pics_product/booster/DPA.png", "pics_product/booster/EX.png", "pics_product/booster/IN.png", "pics_product/booster/MI.png", "pics_product/booster/OD.png", "pics_product/booster/PS.png", "pics_product/booster/ST.png", "pics_product/booster/TE.png", "pics_product/booster/UD.png", "pics_product/booster/UL.png", "pics_product/booster/UZ.png", "pics_product/booster/VI.png", "pics_product/booster/WL.png", "preferences/.project", "preferences/editor.default.preferences", "preferences/main.properties", "quest/quest.preferences", "quest/quest.properties")) {
+ for (final String cruftFile : Lists.newArrayList("decks/SkieraCube-cards_not_supported_yet.txt", "decks/cube/ArabianExtended.dck", "decks/cube/GtcGuildBoros.dck", "decks/cube/GtcGuildDimir.dck", "decks/cube/GtcGuildGruul.dck", "decks/cube/GtcGuildOrzhov.dck", "decks/cube/GtcGuildSimic.dck", "decks/cube/GtcPromoBoros.dck", "decks/cube/GtcPromoDimir.dck", "decks/cube/GtcPromoGruul.dck", "decks/cube/GtcPromoOrzhov.dck", "decks/cube/GtcPromoSimic.dck", "decks/cube/JuzamjediCube.dck", "decks/cube/RtRGuildAzorius.dck", "decks/cube/RtRGuildGolgari.dck", "decks/cube/RtRGuildIzzet.dck", "decks/cube/RtRGuildRakdos.dck", "decks/cube/RtRGuildSelesnya.dck", "decks/cube/RtRPromoAzorius.dck", "decks/cube/RtRPromoGolgari.dck", "decks/cube/RtRPromoIzzet.dck", "decks/cube/RtRPromoRakdos.dck", "decks/cube/RtRPromoSelesnya.dck", "decks/cube/SkieraCube.dck", "gauntlet/LOCKED_DotP Preconstructed.dat", "gauntlet/LOCKED_Swimming With Sharks.dat", "layouts/editor_default.xml", "layouts/home_default.xml", "layouts/match_default.xml", "pics/snow_covered_forest1.jpg", "pics/snow_covered_forest2.jpg", "pics/snow_covered_forest3.jpg", "pics/snow_covered_island1.jpg", "pics/snow_covered_island2.jpg", "pics/snow_covered_island3.jpg", "pics/snow_covered_mountain1.jpg", "pics/snow_covered_mountain2.jpg", "pics/snow_covered_mountain3.jpg", "pics/snow_covered_plains1.jpg", "pics/snow_covered_plains2.jpg", "pics/snow_covered_plains3.jpg", "pics/snow_covered_swamp1.jpg", "pics/snow_covered_swamp2.jpg", "pics/snow_covered_swamp3.jpg", "pics/VAN/Birds of Paradise Avatar.full.jpg", "pics/VAN/Erhnam Djinn Avatar.full.jpg", "pics/VAN/Goblin Warchief Avatar.full.jpg", "pics/VAN/Grinning Demon Avatar.full.jpg", "pics/VAN/Platinum Angel Avatar.full.jpg", "pics/VAN/Prodigal Sorcerer Avatar.full.jpg", "pics/VAN/Rith, the Awakener Avatar.full.jpg", "pics/VAN/Royal Assassin Avatar.full.jpg", "pics/VAN/Serra Angel Avatar.full.jpg", "pics/VAN/Tradewind Rider Avatar.full.jpg", "pics_product/10E.jpg", "pics_product/2ED.jpg", "pics_product/3ED.jpg", "pics_product/4ED.jpg", "pics_product/5DN.jpg", "pics_product/5ED.jpg", "pics_product/6ED.jpg", "pics_product/7ED.jpg", "pics_product/8ED.jpg", "pics_product/9ED.jpg", "pics_product/ALA.jpg", "pics_product/ALL.jpg", "pics_product/APC.jpg", "pics_product/ARB.jpg", "pics_product/ARN.jpg", "pics_product/ATQ.jpg", "pics_product/BOK.jpg", "pics_product/CFX.jpg", "pics_product/CHK.jpg", "pics_product/CHR.jpg", "pics_product/CSP.jpg", "pics_product/DIS.jpg", "pics_product/DKA.jpg", "pics_product/DRK.jpg", "pics_product/DST.jpg", "pics_product/EVE.jpg", "pics_product/EXO.jpg", "pics_product/FEM.jpg", "pics_product/FUT.jpg", "pics_product/GPT.jpg", "pics_product/HML.jpg", "pics_product/ICE.jpg", "pics_product/INV.jpg", "pics_product/ISD.jpg", "pics_product/JUD.jpg", "pics_product/LEA.jpg", "pics_product/LEB.jpg", "pics_product/LEG.jpg", "pics_product/LGN.jpg", "pics_product/LRW.jpg", "pics_product/M10.jpg", "pics_product/M11.jpg", "pics_product/M12.jpg", "pics_product/MBS.jpg", "pics_product/MIR.jpg", "pics_product/MMQ.jpg", "pics_product/MOR.jpg", "pics_product/MRD.jpg", "pics_product/NMS.jpg", "pics_product/NPH.jpg", "pics_product/ODY.jpg", "pics_product/ONS.jpg", "pics_product/PCY.jpg", "pics_product/PLC.jpg", "pics_product/PLS.jpg", "pics_product/PO2.jpg", "pics_product/POR.jpg", "pics_product/PTK.jpg", "pics_product/RAV.jpg", "pics_product/ROE.jpg", "pics_product/S99.jpg", "pics_product/SCG.jpg", "pics_product/SHM.jpg", "pics_product/SOK.jpg", "pics_product/SOM.jpg", "pics_product/STH.jpg", "pics_product/TMP.jpg", "pics_product/TOR.jpg", "pics_product/TSP.jpg", "pics_product/UDS.jpg", "pics_product/ULG.jpg", "pics_product/USG.jpg", "pics_product/VIS.jpg", "pics_product/WTH.jpg", "pics_product/WWK.jpg", "pics_product/ZEN.jpg", "pics_product/booster/7E.png", "pics_product/booster/AP.png", "pics_product/booster/DPA.png", "pics_product/booster/EX.png", "pics_product/booster/IN.png", "pics_product/booster/MI.png", "pics_product/booster/OD.png", "pics_product/booster/PS.png", "pics_product/booster/ST.png", "pics_product/booster/TE.png", "pics_product/booster/UD.png", "pics_product/booster/UL.png", "pics_product/booster/UZ.png", "pics_product/booster/VI.png", "pics_product/booster/WL.png", "preferences/.project", "preferences/editor.default.preferences", "preferences/main.properties", "quest/quest.preferences", "quest/quest.properties")) {
new File("res", cruftFile).delete();
}
-
+
// assemble a list of remaining files.
final List<File> remainingFiles = new LinkedList<File>();
_addRemainingFiles(remainingFiles, resDirs, profileDirs, doNotDeleteDirs);
@@ -198,22 +198,22 @@
if (remainingFiles.isEmpty()) {
p.add(new FLabel.Builder().text("<html>You're done! It looks like everything went smoothly." +
- " Now just restart Forge to load the data from its new home! Note that there is more data available" +
- " from the downloaders now. You might want to run through the content downloaders to check for new files.</html>").build());
+ " Now just restart Forge to load the data from its new home! Note that there is more data available" +
+ " from the downloaders now. You might want to run through the content downloaders to check for new files.</html>").build());
} else {
p.add(new FLabel.Builder().text("<html>There seem to be a few files left over in your old data" +
- " directories. They should be deleted or moved somewhere else to avoid having the data" +
- " migration prompt pop up again!</html>").build());
-
+ " directories. They should be deleted or moved somewhere else to avoid having the data" +
+ " migration prompt pop up again!</html>").build());
+
- JTextArea files = new JTextArea(StringUtils.join(remainingFiles, '\n'));
+ final JTextArea files = new JTextArea(StringUtils.join(remainingFiles, '\n'));
files.setFont(new Font("Monospaced", Font.PLAIN, 10));
files.setOpaque(false);
files.setWrapStyleWord(true);
files.setLineWrap(true);
files.setEditable(false);
- FScrollPane scroller = new FScrollPane(files, true);
+ final FScrollPane scroller = new FScrollPane(files, true);
p.add(scroller, "w 600:100%:100%, h 100:100%:100%, gaptop 10");
-
+
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
@@ -223,10 +223,10 @@
}
});
}
-
+
final FButton btnOk = new FButton(remainingFiles.isEmpty() ? "Restart Forge" : "Close Forge");
btnOk.addActionListener(new ActionListener() {
- @Override public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(final ActionEvent e) {
if (remainingFiles.isEmpty()) {
RestartUtil.restartApplication(null);
} else {
@@ -236,18 +236,20 @@
});
p.add(btnOk, "center, w pref+64!, h pref+12!, gaptop 20");
- JPanel overlay = FOverlay.SINGLETON_INSTANCE.getPanel();
+ final JPanel overlay = FOverlay.SINGLETON_INSTANCE.getPanel();
overlay.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center, ay center"));
overlay.add(p, "w 100::80%, h 50::90%");
SOverlayUtils.showOverlay();
-
+
SwingUtilities.invokeLater(new Runnable() {
- @Override public void run() { btnOk.requestFocusInWindow(); }
- });
+ @Override public void run() {
+ btnOk.requestFocusInWindow();
- }
- });
- }
+ }
+ });
+ }
+ }).show();
- }
+ }
+ }
//start background music
SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS);
@@ -257,9 +259,9 @@
// been added to remainingFiles (or would have been added if remainingFiles is null)
// directories listed in profileDirs will not be searched
// removes empty directories to reduce tree conflicts
- private static boolean _addRemainingFiles(List<File> remainingFiles, List<File> dirRoots, Set<File> profileDirs, Set<File> doNotDeleteDirs) {
- Deque<File> stack = new LinkedList<File>(dirRoots);
- Set<File> seenDirs = new HashSet<File>();
+ private static boolean _addRemainingFiles(final List<File> remainingFiles, final List<File> dirRoots, final Set<File> profileDirs, final Set<File> doNotDeleteDirs) {
+ final Deque<File> stack = new LinkedList<File>(dirRoots);
+ final Set<File> seenDirs = new HashSet<File>();
boolean ret = false;
while (!stack.isEmpty()) {
File cur = stack.peek();
@@ -268,7 +270,7 @@
stack.pop();
continue;
}
-
+
if (seenDirs.contains(cur)) {
cur = stack.pop();
if (cur.exists() && !doNotDeleteDirs.contains(cur)) {
@@ -277,13 +279,13 @@
}
continue;
}
-
+
seenDirs.add(cur);
- File[] curListing = cur.listFiles();
+ final File[] curListing = cur.listFiles();
if (null == curListing) {
continue;
}
- for (File f : curListing) {
+ for (final File f : curListing) {
if (f.isDirectory()) {
if (!".svn".equals(f.getName())) {
stack.push(f);
@@ -315,7 +317,7 @@
public SkinnedLayeredPane getLpnDocument() {
return lpnDocument;
}
-
+
/** @return {@link forge.view.FNavigationBar} */
public FNavigationBar getNavigationBar() {
return navigationBar;
@@ -389,19 +391,18 @@
}
}
- /** */
- private void cacheUIStates() {
+ private static void cacheUIStates() {
VHomeUI.SINGLETON_INSTANCE.instantiate();
VDeckEditorUI.SINGLETON_INSTANCE.instantiate();
VBazaarUI.SINGLETON_INSTANCE.instantiate();
}
-
+
- public void incrementSplashProgessBar(int value) {
+ public void incrementSplashProgessBar(final int value) {
if (this.frmSplash == null) { return; }
this.frmSplash.getProgressBar().setValueThreadSafe(value);
}
- public void setSplashProgessBarMessage(final String message) {
+ public void setSplashProgessBarMessage(final String message) {
setSplashProgessBarMessage(message, 0);
}
public void setSplashProgessBarMessage(final String message, final int cnt) {
@@ -422,8 +423,8 @@
});
}
- public void refreshAllCellLayouts(boolean showTabs) {
- for (DragCell cell : allCells) {
+ public void refreshAllCellLayouts(final boolean showTabs) {
+ for (final DragCell cell : allCells) {
cell.doCellLayout(showTabs);
}
}
Index: forge-gui-desktop/src/main/java/forge/screens/match/controllers/CDock.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/match/controllers/CDock.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/controllers/CDock.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -36,7 +36,7 @@
/**
* Controls the dock panel in the match UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*/
public class CDock implements ICDoc {
@@ -111,14 +111,6 @@
while (arcStateIterator.next() != arcState) { /* Put the iterator to the correct value */ };
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
-
@Override
public void register() {
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/FScrollPanel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FScrollPanel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FScrollPanel.java (revision 29317)
@@ -17,16 +17,20 @@
*/
package forge.toolbox;
-import javax.swing.*;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.LayoutManager;
+import java.awt.MenuComponent;
+import java.awt.PopupMenu;
+import javax.swing.JPanel;
+import javax.swing.ScrollPaneConstants;
+
-/**
+/**
* An extension of FScrollPane that can be used as a panel
- *
*/
@SuppressWarnings("serial")
public class FScrollPanel extends FScrollPane {
- private JPanel innerPanel;
+ private final JPanel innerPanel;
public FScrollPanel() {
this(null);
@@ -34,10 +38,10 @@
public FScrollPanel(final LayoutManager layout) {
this(layout, false);
}
- public FScrollPanel(final LayoutManager layout, boolean useArrowButtons0) {
+ public FScrollPanel(final LayoutManager layout, final boolean useArrowButtons0) {
this(layout, useArrowButtons0, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
}
- public FScrollPanel(final LayoutManager layout, boolean useArrowButtons0, final int vertical0, final int horizontal0) {
+ public FScrollPanel(final LayoutManager layout, final boolean useArrowButtons0, final int vertical0, final int horizontal0) {
super(new JPanel(layout), false, useArrowButtons0, vertical0, horizontal0);
innerPanel = (JPanel)getViewport().getView();
innerPanel.setOpaque(false);
@@ -45,7 +49,7 @@
//relay certain methods to the inner panel if it has been initialized
@Override
- public Component add(Component comp) {
+ public Component add(final Component comp) {
if (innerPanel != null) {
return innerPanel.add(comp);
}
@@ -53,7 +57,7 @@
}
@Override
- public void add(PopupMenu popup) {
+ public void add(final PopupMenu popup) {
if (innerPanel != null) {
innerPanel.add(popup);
return;
@@ -62,7 +66,7 @@
}
@Override
- public void add(Component comp, Object constraints) {
+ public void add(final Component comp, final Object constraints) {
if (innerPanel != null) {
innerPanel.add(comp, constraints);
return;
@@ -71,7 +75,7 @@
}
@Override
- public Component add(Component comp, int index) {
+ public Component add(final Component comp, final int index) {
if (innerPanel != null) {
return innerPanel.add(comp, index);
}
@@ -79,7 +83,7 @@
}
@Override
- public void add(Component comp, Object constraints, int index) {
+ public void add(final Component comp, final Object constraints, final int index) {
if (innerPanel != null) {
innerPanel.add(comp, constraints, index);
return;
@@ -88,7 +92,7 @@
}
@Override
- public Component add(String name, Component comp) {
+ public Component add(final String name, final Component comp) {
if (innerPanel != null) {
return innerPanel.add(name, comp);
}
@@ -96,7 +100,7 @@
}
@Override
- public void remove(Component comp) {
+ public void remove(final Component comp) {
if (innerPanel != null) {
innerPanel.remove(comp);
return;
@@ -105,7 +109,7 @@
}
@Override
- public void remove(int index) {
+ public void remove(final int index) {
if (innerPanel != null) {
innerPanel.remove(index);
return;
@@ -114,7 +118,7 @@
}
@Override
- public void remove(MenuComponent popup) {
+ public void remove(final MenuComponent popup) {
if (innerPanel != null) {
innerPanel.remove(popup);
return;
Index: forge-gui-desktop/src/main/java/forge/view/FNavigationBar.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/view/FNavigationBar.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/view/FNavigationBar.java (revision 29317)
@@ -56,7 +56,7 @@
private Timer incrementRevealTimer, checkForRevealChangeTimer;
private boolean hidden;
- public FNavigationBar(FFrame f) {
+ public FNavigationBar(final FFrame f) {
super(f);
this.setBorder(new FSkin.MatteSkinBorder(0, 0, 2, 0, bottomEdgeColor));
this.setLocation(0, -visibleHeight); //hide by default
@@ -130,7 +130,7 @@
return null;
}
- public boolean canSwitch(FScreen toScreen) {
+ public boolean canSwitch(final FScreen toScreen) {
return (selectedTab == null || selectedTab.screen.onSwitching(toScreen));
}
@@ -155,14 +155,14 @@
closeTab(selectedTab);
}
- public void closeTab(FScreen screen) {
- NavigationTab tab = getTab(screen);
+ public void closeTab(final FScreen screen) {
+ final NavigationTab tab = getTab(screen);
if (tab != null) {
closeTab(tab);
}
}
- private void closeTab(NavigationTab tab) {
+ private void closeTab(final NavigationTab tab) {
if (tab == null) { return; }
if (!tab.screen.onClosing()) { return; } //give screen a chance to perform special close handling and/or cancel closing tab
@@ -172,7 +172,7 @@
this.selectedTab = null; //prevent raising onSwitching for tab being closed
Singletons.getControl().setCurrentScreen(FScreen.HOME_SCREEN, true);
}
- int index = tabs.indexOf(tab);
+ final int index = tabs.indexOf(tab);
if (index != -1) {
tabs.remove(index);
remove(tab);
@@ -199,7 +199,7 @@
private void addForgeButtonListeners() {
btnForge.addMouseListener(new MouseAdapter() {
@Override
- public void mousePressed(MouseEvent e) {
+ public void mousePressed(final MouseEvent e) {
if (btnForge.isEnabled() && System.currentTimeMillis() - timeMenuHidden > 250) { //time comparsion needed clicking button a second time to hide menu
showForgeMenu(true);
}
@@ -207,7 +207,7 @@
});
}
- public void showForgeMenu(boolean hideIfAlreadyShown) {
+ public void showForgeMenu(final boolean hideIfAlreadyShown) {
if (!btnForge.isToggled() && forgeMenu.getPopupMenu().isEnabled()) {
btnForge.setToggled(true);
forgeMenu.getPopupMenu().show(this, 1, this.getHeight());
@@ -229,19 +229,21 @@
pnlReveal.setOpaque(false);
pnlReveal.addMouseListener(new MouseAdapter() {
@Override
- public void mouseEntered(MouseEvent e) {
+ public void mouseEntered(final MouseEvent e) {
if (revealDir == 0) {
startReveal();
}
}
});
incrementRevealTimer = new Timer(revealSpeed / visibleHeight, new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(final ActionEvent e) {
incrementReveal();
}
});
checkForRevealChangeTimer = new Timer(revealDelay, new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(final ActionEvent e) {
checkForRevealChange();
}
});
@@ -270,25 +272,25 @@
private void incrementReveal() {
int newY = this.getLocation().y + revealDir * 2;
switch (revealDir) {
- case 0:
- incrementRevealTimer.stop();
- return;
- case 1:
- if (newY >= 0) {
- newY = 0;
- revealDir = 0;
- incrementRevealTimer.stop();
- checkForRevealChangeTimer.setInitialDelay(0);
- checkForRevealChangeTimer.start(); //once open fully, start another timer to check when mouse moves away
- }
- break;
- case -1:
- if (newY <= -visibleHeight) {
- newY = -visibleHeight;
- revealDir = 0;
- incrementRevealTimer.stop();
- }
- break;
+ case 0:
+ incrementRevealTimer.stop();
+ return;
+ case 1:
+ if (newY >= 0) {
+ newY = 0;
+ revealDir = 0;
+ incrementRevealTimer.stop();
+ checkForRevealChangeTimer.setInitialDelay(0);
+ checkForRevealChangeTimer.start(); //once open fully, start another timer to check when mouse moves away
+ }
+ break;
+ case -1:
+ if (newY <= -visibleHeight) {
+ newY = -visibleHeight;
+ revealDir = 0;
+ incrementRevealTimer.stop();
+ }
+ break;
}
this.setLocation(0, newY);
checkForRevealChange();
@@ -306,22 +308,22 @@
}
}
- public void setMenuShortcutsEnabled(boolean enabled0) {
+ public void setMenuShortcutsEnabled(final boolean enabled0) {
forgeMenu.getPopupMenu().setEnabled(enabled0);
}
@Override
- public void setEnabled(boolean enabled0) {
+ public void setEnabled(final boolean enabled0) {
btnForge.setEnabled(enabled0);
setMenuShortcutsEnabled(enabled0);
- for (NavigationTab tab : tabs) {
+ for (final NavigationTab tab : tabs) {
tab.setEnabled(enabled0);
}
btnClose.setEnabled(enabled0); //don't allow closing screens using Close button while disabled
}
@Override
- public void setVisible(boolean visible) {
+ public void setVisible(final boolean visible) {
hidden = !visible;
if (pnlReveal != null) { //check needed because FTitleBarBase constructor calls this
revealDir = 0;
@@ -339,7 +341,7 @@
}
@Override
- public void setSize(int width, int height) {
+ public void setSize(final int width, final int height) {
super.setSize(width, height);
pnlReveal.setSize(width, 1);
}
@@ -349,11 +351,11 @@
}
@Override
- public void setTitle(String title) {
+ public void setTitle(final String title) {
}
@Override
- public void setIconImage(Image image) {
+ public void setIconImage(final Image image) {
}
public void updateTitle(final FScreen screen) {
@@ -387,7 +389,7 @@
btnClose = new CloseButton();
btnClose.setToolTipText(screen.getCloseButtonTooltip());
closeButtonOffset = btnClose.getPreferredSize().width;
- SpringLayout tabLayout = new SpringLayout();
+ final SpringLayout tabLayout = new SpringLayout();
setLayout(tabLayout);
add(btnClose);
tabLayout.putConstraint(SpringLayout.WEST, btnClose, 4, SpringLayout.EAST, this);
@@ -401,7 +403,7 @@
addMouseListener(new MouseAdapter() {
@Override
- public void mousePressed(MouseEvent e) {
+ public void mousePressed(final MouseEvent e) {
if (!NavigationTab.this.isEnabled()) { return; }
if (SwingUtilities.isLeftMouseButton(e)) {
if (!selected) {
@@ -413,13 +415,13 @@
}
}
@Override
- public void mouseEntered(MouseEvent e) {
+ public void mouseEntered(final MouseEvent e) {
if (!NavigationTab.this.isEnabled()) { return; }
hovered = true;
repaintSelf();
}
@Override
- public void mouseExited(MouseEvent e) {
+ public void mouseExited(final MouseEvent e) {
if (hovered && (btnClose == null || !btnClose.getBounds().contains(e.getPoint()))) { //ensure mouse didn't simply move onto close button
hovered = false;
repaintSelf();
@@ -437,8 +439,8 @@
}
@Override
- public void setIcon(Icon icon) {
- ImageIcon imageIcon = ReflectionUtil.safeCast(icon, ImageIcon.class);
+ public void setIcon(final Icon icon) {
+ final ImageIcon imageIcon = ReflectionUtil.safeCast(icon, ImageIcon.class);
if (imageIcon != null) {
super.setIcon(new ImageIcon(imageIcon.getImage().getScaledInstance(20, 20, Image.SCALE_AREA_AVERAGING)));
}
@@ -448,7 +450,7 @@
}
@Override
- public void setEnabled(boolean enabled0) {
+ public void setEnabled(final boolean enabled0) {
if (!enabled0 && hovered) {
hovered = false; //ensure hovered reset if disabled
}
@@ -470,10 +472,10 @@
@Override
public void paintComponent(final Graphics g) {
- Graphics2D g2d = (Graphics2D)g;
- int width = getWidth() - 1;
- int height = visibleHeight - 1;
- int radius = 6;
+ final Graphics2D g2d = (Graphics2D)g;
+ final int width = getWidth() - 1;
+ final int height = visibleHeight - 1;
+ final int radius = 6;
backColor = this.selected ? bottomEdgeColor : (this.hovered ? buttonHoverColor : buttonHoverColor.alphaColor(unhoveredAlpha));
FSkin.setGraphicsGradientPaint(g2d, 0, 0, backColor.stepColor(30), 0, height, backColor);
g.fillRoundRect(0, 0, width, height, radius, radius);
@@ -493,7 +495,7 @@
setPreferredSize(new Dimension(17, 17));
addMouseListener(new MouseAdapter() {
@Override
- public void mousePressed(MouseEvent e) {
+ public void mousePressed(final MouseEvent e) {
if (!CloseButton.this.isEnabled()) { return; }
if (SwingUtilities.isLeftMouseButton(e)) {
pressed = true;
@@ -501,7 +503,7 @@
}
}
@Override
- public void mouseReleased(MouseEvent e) {
+ public void mouseReleased(final MouseEvent e) {
if (pressed && SwingUtilities.isLeftMouseButton(e)) {
pressed = false;
if (hovered) { //only handle click if mouse released over button
@@ -511,13 +513,13 @@
}
}
@Override
- public void mouseEntered(MouseEvent e) {
+ public void mouseEntered(final MouseEvent e) {
if (!CloseButton.this.isEnabled()) { return; }
hovered = true;
repaintSelf();
}
@Override
- public void mouseExited(MouseEvent e) {
+ public void mouseExited(final MouseEvent e) {
if (hovered) {
hovered = false;
repaintSelf();
@@ -527,7 +529,7 @@
}
@Override
- public void setEnabled(boolean enabled0) {
+ public void setEnabled(final boolean enabled0) {
if (!enabled0 && hovered) {
hovered = false; //ensure hovered reset if disabled
}
@@ -541,7 +543,7 @@
}
@Override
- public void paintComponent(Graphics g) {
+ public void paintComponent(final Graphics g) {
super.paintComponent(g);
if (hovered) {
@@ -556,14 +558,14 @@
}
}
- int thickness = 2;
- int offset = 4;
- int x1 = offset;
- int y1 = offset;
- int x2 = getWidth() - offset - 1;
- int y2 = getHeight() - offset - 1;
+ final int thickness = 2;
+ final int offset = 4;
+ final int x1 = offset;
+ final int y1 = offset;
+ final int x2 = getWidth() - offset - 1;
+ final int y2 = getHeight() - offset - 1;
- Graphics2D g2d = (Graphics2D) g;
+ final Graphics2D g2d = (Graphics2D) g;
SkinColor iconColor = NavigationTab.this.getSkin().getForeground();
if (!NavigationTab.this.isEnabled()) {
iconColor = iconColor.alphaColor(100);
Index: forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletBuild.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletBuild.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletBuild.java (revision 29317)
@@ -1,5 +1,16 @@
package forge.screens.home.gauntlet;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JFileChooser;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingUtilities;
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.commons.lang3.ArrayUtils;
+
import forge.UiCommand;
import forge.deck.Deck;
import forge.gauntlet.GauntletData;
@@ -8,18 +19,9 @@
import forge.properties.ForgeConstants;
import forge.toolbox.FOptionPane;
-import org.apache.commons.lang3.ArrayUtils;
-
-import javax.swing.*;
-import javax.swing.filechooser.FileFilter;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
+/**
* Controls the "build gauntlet" submenu in the home UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -30,7 +32,7 @@
private final VSubmenuGauntletBuild view = VSubmenuGauntletBuild.SINGLETON_INSTANCE;
private final List<Deck> workingDecks = new ArrayList<Deck>();
- private File openStartDir = new File(ForgeConstants.GAUNTLET_DIR.userPrefLoc);
+ private final File openStartDir = new File(ForgeConstants.GAUNTLET_DIR.userPrefLoc);
private final FileFilter filterDAT = new FileFilter() {
@Override
@@ -39,7 +41,7 @@
return true;
}
- String filename = f.getName();
+ final String filename = f.getName();
return (!filename.startsWith(GauntletIO.PREFIX_QUICK) && filename.endsWith(GauntletIO.SUFFIX_DATA));
}
@@ -49,30 +51,42 @@
}
};
- //private final KeyAdapter kadSearch = new KeyAdapter() { @Override
- //public void keyPressed(final KeyEvent e) { search(); } };
+ private final UiCommand cmdAddDeck = new UiCommand() {
+ @Override public void run() {
+ addDeck();
+ }
+ };
+ private final UiCommand cmdRemoveDeck = new UiCommand() {
+ @Override public void run() {
+ removeDeck();
+ }
+ };
+ private final UiCommand cmdDeckUp = new UiCommand() {
+ @Override public void run() {
+ deckUp();
+ }
+ };
+ private final UiCommand cmdDeckDown = new UiCommand() {
+ @Override public void run() {
+ deckDown();
+ }
+ };
+ private final UiCommand cmdSave = new UiCommand() {
+ @Override public void run() {
+ saveGauntlet();
+ }
+ };
+ private final UiCommand cmdNew = new UiCommand() {
+ @Override public void run() {
+ newGauntlet();
+ }
+ };
+ private final UiCommand cmdOpen = new UiCommand() {
+ @Override public void run() {
+ openGauntlet();
+ }
+ };
- private final UiCommand cmdAddDeck = new UiCommand() { @Override
- public void run() { addDeck(); } };
-
- private final UiCommand cmdRemoveDeck = new UiCommand() { @Override
- public void run() { removeDeck(); } };
-
- private final UiCommand cmdDeckUp = new UiCommand() { @Override
- public void run() { deckUp(); } };
-
- private final UiCommand cmdDeckDown = new UiCommand() { @Override
- public void run() { deckDown(); } };
-
- private final UiCommand cmdSave = new UiCommand() { @Override
- public void run() { saveGauntlet(); } };
-
- private final UiCommand cmdNew = new UiCommand() { @Override
- public void run() { newGauntlet(); } };
-
- private final UiCommand cmdOpen = new UiCommand() { @Override
- public void run() { openGauntlet(); } };
-
/* (non-Javadoc)
* @see forge.gui.home.ICSubmenu#initialize()
*/
@@ -102,23 +116,16 @@
view.getBtnSave().setCommand(cmdSave);
view.getBtnOpen().setCommand(cmdOpen);
view.getBtnNew().setCommand(cmdNew);
-
+
view.getLstLeft().initialize();
-// updateDecks();
+ // updateDecks();
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
-
-
private void addDeck() {
final Deck deckToAdd = view.getLstLeft().getPlayer().getDeck();
- if ( null == deckToAdd ) return;
+ if ( null == deckToAdd ) {
+ return;
+ }
workingDecks.add(deckToAdd);
view.getLblSave().setVisible(false);
dumpDecksIntoList();
@@ -189,7 +196,7 @@
if (f.exists()) {
if (!FOptionPane.showConfirmDialog(
"There is already a gauntlet named '" + name + "'.\n"
- + "All progress and data will be overwritten. Continue?",
+ + "All progress and data will be overwritten. Continue?",
"Overwrite Gauntlet?")) { return false; }
gd = GauntletIO.loadGauntlet(f);
Index: forge-gui-desktop/src/main/java/forge/screens/home/quest/CSubmenuQuestPrefs.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/quest/CSubmenuQuestPrefs.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/quest/CSubmenuQuestPrefs.java (revision 29317)
@@ -4,7 +4,6 @@
import com.google.common.primitives.Ints;
-import forge.UiCommand;
import forge.gui.framework.ICDoc;
import forge.model.FModel;
import forge.quest.data.QuestPreferences;
@@ -43,7 +42,7 @@
/**
* Checks validity of values entered into quest preference input text
* fields.
- *
+ *
* @param i0
* the input.
*/
@@ -102,11 +101,4 @@
view.getLblErrShop().setVisible(false);
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
}
Index: forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletContests.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletContests.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletContests.java (revision 29317)
@@ -1,7 +1,14 @@
package forge.screens.home.gauntlet;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.SwingUtilities;
+
import forge.GuiBase;
-import forge.UiCommand;
import forge.deck.Deck;
import forge.game.GameType;
import forge.game.player.RegisteredPlayer;
@@ -13,22 +20,13 @@
import forge.model.FModel;
import forge.player.GamePlayerUtil;
-import javax.swing.*;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
+/**
* Controls the "gauntlet contests" submenu in the home UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
-@SuppressWarnings("serial")
public enum CSubmenuGauntletContests implements ICDoc {
/** */
SINGLETON_INSTANCE;
@@ -37,7 +35,7 @@
private final ActionListener actStartGame = new ActionListener() {
@Override
- public void actionPerformed(ActionEvent arg0) {
+ public void actionPerformed(final ActionEvent arg0) {
startGame();
}
};
@@ -73,7 +71,7 @@
final File[] files = GauntletIO.getGauntletFilesLocked();
final List<GauntletData> data = new ArrayList<GauntletData>();
for (final File f : files) {
- GauntletData gd = GauntletIO.loadGauntlet(f);
+ final GauntletData gd = GauntletIO.loadGauntlet(f);
if (gd != null) {
data.add(gd);
}
@@ -124,16 +122,4 @@
});
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return new UiCommand() {
- @Override
- public void run() {
- updateData();
- }
- };
- }
}
Index: forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuAchievements.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuAchievements.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuAchievements.java (revision 29317)
@@ -1,11 +1,10 @@
package forge.screens.home.settings;
-import forge.UiCommand;
import forge.gui.framework.ICDoc;
/**
* Controls the achievements submenu in the home UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -31,11 +30,4 @@
public void update() {
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/FLabel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FLabel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FLabel.java (revision 29317)
@@ -1,5 +1,32 @@
package forge.toolbox;
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Composite;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.SwingConstants;
+import javax.swing.Timer;
+import javax.swing.event.AncestorEvent;
+import javax.swing.event.AncestorListener;
+
import forge.UiCommand;
import forge.assets.FSkinProp;
import forge.gui.framework.ILocalRepaint;
@@ -9,14 +36,7 @@
import forge.toolbox.FSkin.SkinImage;
import forge.toolbox.FSkin.SkinnedLabel;
-import javax.swing.*;
-import javax.swing.event.AncestorEvent;
-import javax.swing.event.AncestorListener;
-
-import java.awt.*;
-import java.awt.event.*;
-
-/**
+/**
* Uses the Builder pattern to facilitate/encourage inline styling.
* Credit to Effective Java 2 (Joshua Bloch).
* Methods in builder can be chained. To declare:
@@ -33,21 +53,21 @@
*/
@SuppressWarnings("serial")
public class FLabel extends SkinnedLabel implements ILocalRepaint, IButton {
- /**
+ /**
* Uses the Builder pattern to facilitate/encourage inline styling.
* Credit to Effective Java 2 (Joshua Bloch).
* Methods in builder can be chained. To declare:
* <code>new FLabel.Builder().method1(foo).method2(bar).method3(baz)...</code>
* <br>and then call build() to make the label (don't forget that part).
- */
+ */
public static class Builder {
//========== Default values for FLabel are set here.
- private double bldIconScaleFactor = 0.8;
+ private double bldIconScaleFactor = 0.8;
- private int bldFontStyle = Font.PLAIN;
+ private int bldFontStyle = Font.PLAIN;
- private int bldFontSize = 14;
+ private int bldFontSize = 14;
- private float bldUnhoveredAlpha = 0.7f;
+ private float bldUnhoveredAlpha = 0.7f;
- private int bldIconAlignX = SwingConstants.LEFT;
+ private int bldIconAlignX = SwingConstants.LEFT;
- private Point bldIconInsets = new Point(0, 0);
+ private final Point bldIconInsets = new Point(0, 0);
private boolean bldSelectable = false;
private boolean bldSelected = false;
@@ -151,11 +171,6 @@
* SwingConstants.HORIZONTAL .VERTICAL or .CENTER
* @return {@link forge.gui.toolbox.Builder} */
public Builder iconAlignX(final int i0) { this.bldIconAlignX = i0; return this; }
-
- /**@param i0 &emsp; Point. Only available for background icon.
- * Additional padding to top left corner of icon, after alignX.
- * @return {@link forge.gui.toolbox.Builder} */
- public Builder iconInsets(final Point i0) { this.bldIconInsets = i0; return this; }
}
// sets better defaults for button labels
@@ -207,8 +222,8 @@
});
this.addFocusListener(new FocusListener() {
- @Override public void focusLost(FocusEvent arg0) { repaintSelf(); }
- @Override public void focusGained(FocusEvent arg0) { repaintSelf(); }
+ @Override public void focusLost(final FocusEvent arg0) { repaintSelf(); }
+ @Override public void focusGained(final FocusEvent arg0) { repaintSelf(); }
});
}
@@ -241,12 +256,20 @@
// Custom properties, assigned either at realization (using builder)
// or dynamically (using methods below).
- private double iconScaleFactor;
- private int fontStyle, iconAlignX;
+ private final double iconScaleFactor;
+ private int fontStyle;
+ private final int iconAlignX;
private int iw, ih;
- private boolean selectable, selected, hoverable, hovered, pressed, opaque,
- iconInBackground, iconScaleAuto, reactOnMouseDown;
- private Point iconInsets;
+ private final boolean selectable;
+ private boolean selected;
+ private boolean hoverable;
+ private boolean hovered;
+ private boolean pressed;
+ private boolean opaque;
+ private final boolean iconInBackground;
+ private final boolean iconScaleAuto;
+ private boolean reactOnMouseDown;
+ private final Point iconInsets;
// Various variables used in image rendering.
private Image img;
@@ -277,11 +300,11 @@
}
@Override
- public void ancestorMoved(AncestorEvent arg0) {
+ public void ancestorMoved(final AncestorEvent arg0) {
}
@Override
- public void ancestorRemoved(AncestorEvent arg0) {
+ public void ancestorRemoved(final AncestorEvent arg0) {
}
};
@@ -301,17 +324,17 @@
// Mouse event handler
private final FMouseAdapter madEvents = new FMouseAdapter() {
@Override
- public void onMouseEnter(MouseEvent e) {
+ public void onMouseEnter(final MouseEvent e) {
setHovered(true);
}
@Override
- public void onMouseExit(MouseEvent e) {
+ public void onMouseExit(final MouseEvent e) {
setHovered(false);
}
@Override
- public void onLeftMouseDown(MouseEvent e) {
+ public void onLeftMouseDown(final MouseEvent e) {
if (reactOnMouseDown) {
_doMouseAction(); //for best responsiveness, do action before repainting for pressed state
}
@@ -319,19 +342,19 @@
}
@Override
- public void onLeftMouseUp(MouseEvent e) {
+ public void onLeftMouseUp(final MouseEvent e) {
setPressed(false);
}
@Override
- public void onLeftClick(MouseEvent e) {
+ public void onLeftClick(final MouseEvent e) {
if (!reactOnMouseDown) {
_doMouseAction();
}
}
@Override
- public void onRightClick(MouseEvent e) {
+ public void onRightClick(final MouseEvent e) {
_doRightClickAction();
}
};
@@ -358,23 +381,25 @@
else { this.addMouseListener(madEvents); }
}
- protected void setHovered(boolean hovered0) {
+ protected void setHovered(final boolean hovered0) {
this.hovered = hovered0;
repaintSelf();
}
- protected void setPressed(boolean pressed0) {
+ protected void setPressed(final boolean pressed0) {
this.pressed = pressed0;
repaintSelf();
}
/** @param b0 &emsp; boolean */
// Must be public.
+ @Override
public void setSelected(final boolean b0) {
this.selected = b0;
repaintSelf();
}
+ @Override
public boolean isSelected() {
return this.selected;
}
@@ -389,9 +414,9 @@
public void setFontSize(final int i0) {
switch(this.fontStyle) {
- case Font.BOLD: this.setFont(FSkin.getBoldFont(i0)); break;
- case Font.ITALIC: this.setFont(FSkin.getItalicFont(i0)); break;
- default: this.setFont(FSkin.getFont(i0));
+ case Font.BOLD: this.setFont(FSkin.getBoldFont(i0)); break;
+ case Font.ITALIC: this.setFont(FSkin.getItalicFont(i0)); break;
+ default: this.setFont(FSkin.getFont(i0));
}
}
@@ -419,7 +444,7 @@
public int getAutoSizeWidth() {
int width = 0;
if (this.getText() != null && !this.getText().isEmpty()) {
- FontMetrics metrics = this.getFontMetrics(this.getFont());
+ final FontMetrics metrics = this.getFontMetrics(this.getFont());
width = metrics.stringWidth(this.getText());
}
if (this.getIcon() != null) {
@@ -435,7 +460,7 @@
* To prevent this label from recalculating on each increment, a timer
* is run to check that the the "sliding" is finished. To resize this label
* explicitly, retrieve this timer and start it. It will stop automatically.
- *
+ *
* @return {@link javax.swing.Timer}
*/
public Timer getResizeTimer() {
@@ -447,16 +472,16 @@
return this.cmdClick;
}
- /** @return {@link forge.UiCommand} */
+ /** @return {@link forge.UiCommand} */
public Runnable getRightClickCommand() {
return this.cmdRightClick;
}
protected int getMaxTextWidth() {
- int w = getWidth();
- int h = getHeight();
- int sh = (int) (h * iconScaleFactor);
- int sw = (int) (sh * iar);
+ final int w = getWidth();
+ final int h = getHeight();
+ final int sh = (int) (h * iconScaleFactor);
+ final int sw = (int) (sh * iar);
return w - sw;
}
@@ -489,12 +514,12 @@
this.cmdClick = c0;
}
- /** @param c0 &emsp; {@link forge.UiCommand} on right-click */
+ /** @param c0 &emsp; {@link forge.UiCommand} on right-click */
public void setRightClickCommand(final Runnable c0) {
this.cmdRightClick = c0;
}
- public void setReactOnMouseDown(boolean b0) {
+ public void setReactOnMouseDown(final boolean b0) {
this.reactOnMouseDown = b0;
}
@@ -514,18 +539,18 @@
@Override
public void paintComponent(final Graphics g) {
- Graphics2D g2d = (Graphics2D) g;
+ final Graphics2D g2d = (Graphics2D) g;
- int w = getWidth();
- int h = getHeight();
+ final int w = getWidth();
+ final int h = getHeight();
- boolean paintWithHover = hoverable && hovered && isEnabled();
- Composite oldComp = g2d.getComposite();
+ final boolean paintWithHover = hoverable && hovered && isEnabled();
+ final Composite oldComp = g2d.getComposite();
if (hoverable) {
g2d.setComposite(paintWithHover ? alphaStrong : alphaDim);
}
- boolean paintPressedState = pressed && hovered && isEnabled() && (opaque || selectable);
+ final boolean paintPressedState = pressed && hovered && isEnabled() && (opaque || selectable);
if (paintPressedState) {
paintPressed(g2d, w, h);
}
@@ -557,23 +582,23 @@
}
}
- protected void paintContent(final Graphics2D g, int w, int h, final boolean paintPressedState) {
+ protected void paintContent(final Graphics2D g, final int w, final int h, final boolean paintPressedState) {
if (paintPressedState) { //while pressed, translate graphics so icon and text appear shifted down and to the right
g.translate(1, 1);
}
// Icon in background
if (iconInBackground) {
- int sh = (int) (h * iconScaleFactor);
- int sw = (int) (sh * iar);
+ final int sh = (int) (h * iconScaleFactor);
+ final int sw = (int) (sh * iar);
- int x = iconAlignX == SwingConstants.CENTER
+ final int x = iconAlignX == SwingConstants.CENTER
- ? (int) ((w - sw) / 2 + iconInsets.getX())
- : (int) iconInsets.getX();
+ ? (int) ((w - sw) / 2 + iconInsets.getX())
+ : (int) iconInsets.getX();
- int y = (int) (((h - sh) / 2) + iconInsets.getY());
+ final int y = (int) (((h - sh) / 2) + iconInsets.getY());
- g.drawImage(img, x, y, sw + x, sh + y, 0, 0, iw, ih, null);
+ g.drawImage(img, x, y, sw + x, sh + y, 0, 0, iw, ih, null);
}
super.paintComponent(g);
@@ -583,14 +608,14 @@
}
}
- private void paintFocus(final Graphics2D g, int w, int h) {
+ private static void paintFocus(final Graphics2D g, final int w, final int h) {
FSkin.setGraphicsColor(g, clrHover);
g.drawRect(0, 0, w - 2, h - 2);
FSkin.setGraphicsColor(g, l30);
g.drawRect(1, 1, w - 4, h - 4);
}
- private void paintPressed(final Graphics2D g, int w, int h) {
+ private static void paintPressed(final Graphics2D g, final int w, final int h) {
FSkin.setGraphicsGradientPaint(g, 0, h, d50, 0, 0, d10);
g.fillRect(0, 0, w - 1, h - 1);
@@ -600,7 +625,7 @@
g.drawRect(1, 1, w - 4, h - 4);
}
- private void paintUp(final Graphics2D g, int w, int h) {
+ private static void paintUp(final Graphics2D g, final int w, final int h) {
FSkin.setGraphicsGradientPaint(g, 0, h, d10, 0, 0, l20);
g.fillRect(0, 0, w, h);
@@ -610,14 +635,14 @@
g.drawRect(1, 1, w - 4, h - 4);
}
- private void paintBorder(final Graphics2D g, int w, int h) {
+ private static void paintBorder(final Graphics2D g, final int w, final int h) {
FSkin.setGraphicsColor(g, l10);
g.drawRect(0, 0, w - 2, h - 2);
FSkin.setGraphicsColor(g, l30);
g.drawRect(1, 1, w - 4, h - 4);
}
- private void paintDown(final Graphics2D g, int w, int h) {
+ private static void paintDown(final Graphics2D g, final int w, final int h) {
FSkin.setGraphicsGradientPaint(g, 0, h, d30, 0, 0, l10);
g.fillRect(0, 0, w - 1, h - 1);
@@ -630,8 +655,8 @@
protected void resetIcon() {
// Non-background icon
if (img != null && iconScaleAuto && !iconInBackground) {
- int h = (int) (getHeight() * iconScaleFactor);
- int w = (int) (h * iar);
+ final int h = (int) (getHeight() * iconScaleFactor);
+ final int w = (int) (h * iar);
if (w == 0 || h == 0) { return; }
super.setIcon(new ImageIcon(img.getScaledInstance(w, h, Image.SCALE_SMOOTH)));
@@ -639,17 +664,17 @@
}
@Override
- public void setCommand(UiCommand command0) {
+ public void setCommand(final UiCommand command0) {
cmdClick = command0;
}
@Override
- public void setImage(FSkinProp color) {
+ public void setImage(final FSkinProp color) {
setForeground(FSkin.getColor(Colors.fromSkinProp(color)));
}
@Override
- public void setTextColor(int r, int g, int b) {
+ public void setTextColor(final int r, final int g, final int b) {
setForeground(new Color(r, g, b));
}
}
Index: forge-gui/src/main/java/forge/limited/BoosterDraft.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/limited/BoosterDraft.java (revision 29316)
+++ forge-gui/src/main/java/forge/limited/BoosterDraft.java (revision 29317)
@@ -6,17 +6,29 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.limited;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.NoSuchElementException;
+import java.util.Stack;
+import java.util.TreeMap;
+
+import org.apache.commons.lang3.ArrayUtils;
+
import com.google.common.base.Supplier;
import forge.card.CardEdition;
@@ -30,8 +42,8 @@
import forge.item.SealedProduct;
import forge.model.CardBlock;
import forge.model.FModel;
-import forge.properties.ForgePreferences;
import forge.properties.ForgeConstants;
+import forge.properties.ForgePreferences;
import forge.util.FileUtil;
import forge.util.HttpUtil;
import forge.util.ItemPool;
@@ -39,16 +51,8 @@
import forge.util.gui.SOptionPane;
import forge.util.storage.IStorage;
-import org.apache.commons.lang3.ArrayUtils;
-
-import java.io.File;
-import java.util.*;
-import java.util.Map.Entry;
-
/**
- *
* Booster Draft Format.
- *
*/
public class BoosterDraft implements IBoosterDraft {
private final BoosterDraftAI draftAI = new BoosterDraftAI();
@@ -67,7 +71,7 @@
protected final List<Supplier<List<PaperCard>>> product = new ArrayList<Supplier<List<PaperCard>>>();
public static BoosterDraft createDraft(final LimitedPoolType draftType) {
- BoosterDraft draft = new BoosterDraft(draftType);
+ final BoosterDraft draft = new BoosterDraft(draftType);
if (!draft.generateProduct()) { return null; }
return draft;
}
@@ -75,7 +79,7 @@
protected boolean generateProduct() {
switch (this.draftFormat) {
case Full: // Draft from all cards in Forge
- Supplier<List<PaperCard>> s = new UnOpenedProduct(SealedProduct.Template.genericBooster);
+ final Supplier<List<PaperCard>> s = new UnOpenedProduct(SealedProduct.Template.genericBooster);
for (int i = 0; i < 3; i++) {
this.product.add(s);
@@ -85,11 +89,12 @@
case Block: // Draft from cards by block or set
case FantasyBlock:
- List<CardBlock> blocks = new ArrayList<CardBlock>();
- IStorage<CardBlock> storage = this.draftFormat == LimitedPoolType.Block
- ? FModel.getBlocks() : FModel.getFantasyBlocks();
+ final List<CardBlock> blocks = new ArrayList<CardBlock>();
+ final IStorage<CardBlock> storage = this.draftFormat == LimitedPoolType.Block
+ ? FModel.getBlocks()
+ : FModel.getFantasyBlocks();
- for (CardBlock b : storage) {
+ for (final CardBlock b : storage) {
if (b.getCntBoostersDraft() > 0) {
blocks.add(b);
}
@@ -109,7 +114,7 @@
sets.add(cardSets.get(k).getCode());
}
- for (String setCode : block.getMetaSetNames()) {
+ for (final String setCode : block.getMetaSetNames()) {
if (block.getMetaSet(setCode).isDraftable()) {
sets.push(setCode); // to the beginning
}
@@ -127,7 +132,7 @@
}
}
else {
- IUnOpenedProduct product1 = block.getBooster(sets.get(0));
+ final IUnOpenedProduct product1 = block.getBooster(sets.get(0));
for (int i = 0; i < nPacks; i++) {
this.product.add(product1);
@@ -138,7 +143,7 @@
break;
case Custom:
- final List<CustomLimited> myDrafts = this.loadCustomDrafts();
+ final List<CustomLimited> myDrafts = loadCustomDrafts();
if (myDrafts.isEmpty()) {
SOptionPane.showMessageDialog("No custom draft files found.");
@@ -159,9 +164,9 @@
return true;
}
- public static BoosterDraft createDraft(final LimitedPoolType draftType, final CardBlock block, final String[] boosters) {
+ public static BoosterDraft createDraft(final LimitedPoolType draftType, final CardBlock block, final String[] boosters) {
- BoosterDraft draft = new BoosterDraft(draftType);
+ final BoosterDraft draft = new BoosterDraft(draftType);
-
+
final int nPacks = boosters.length;
for (int i = 0; i < nPacks; i++) {
@@ -198,7 +203,7 @@
final SealedProduct.Template tpl = draft.getSealedProductTemplate();
- UnOpenedProduct toAdd = new UnOpenedProduct(tpl, dPool);
+ final UnOpenedProduct toAdd = new UnOpenedProduct(tpl, dPool);
toAdd.setLimitedPool(draft.isSingleton());
for (int i = 0; i < draft.getNumPacks(); i++) {
this.product.add(toAdd);
@@ -208,7 +213,7 @@
}
/** Looks for draft files, reads them, returns a list. */
- private List<CustomLimited> loadCustomDrafts() {
+ private static List<CustomLimited> loadCustomDrafts() {
String[] dList;
final ArrayList<CustomLimited> customs = new ArrayList<CustomLimited>();
@@ -237,7 +242,7 @@
* <p>
* nextChoice.
* </p>
- *
+ *
* @return a {@link forge.deck.CardPool} object.
*/
@Override
@@ -247,7 +252,7 @@
}
this.computerChoose();
- CardPool result = new CardPool();
+ final CardPool result = new CardPool();
result.addAllFlat(this.pack.get(this.getCurrentBoosterIndex()));
return result;
}
@@ -256,7 +261,7 @@
* <p>
* get8BoosterPack.
* </p>
- *
+ *
* @return an array of {@link forge.deck.CardPool} objects.
*/
public List<List<PaperCard>> get8BoosterPack() {
@@ -281,7 +286,7 @@
* <p>
* getDecks.
* </p>
- *
+ *
* @return an array of {@link forge.deck.Deck} objects.
*/
@Override
@@ -305,7 +310,7 @@
} // computerChoose()
/**
- *
+ *
* Get the current booster index.
* @return int
*/
@@ -317,7 +322,7 @@
* <p>
* hasNextChoice.
* </p>
- *
+ *
* @return a boolean.
*/
@Override
@@ -374,8 +379,8 @@
return;
}
- ArrayList<String> outDraftData = new ArrayList<String>();
- for (Entry<String, Float> key : draftPicks.entrySet()) {
+ final List<String> outDraftData = new ArrayList<String>();
+ for (final Entry<String, Float> key : draftPicks.entrySet()) {
outDraftData.add(key.getValue() + "|" + key.getKey());
}
Collections.sort(outDraftData);
@@ -388,8 +393,8 @@
}
private static List<String> getSetCombos(final List<String> setz) {
- String[] sets = setz.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
- List<String> setCombos = new ArrayList<String>();
+ final String[] sets = setz.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
+ final List<String> setCombos = new ArrayList<String>();
if (sets.length >= 2) {
setCombos.add(String.format("%s/%s/%s", sets[0], sets[0], sets[0]));
setCombos.add(String.format("%s/%s/%s", sets[0], sets[0], sets[1]));
Index: forge-gui-desktop/src/main/java/forge/view/FDialog.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/view/FDialog.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/view/FDialog.java (revision 29317)
@@ -57,8 +57,8 @@
private static final boolean antiAliasBorder;
static {
- GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsDevice gd = ge.getDefaultScreenDevice();
+ final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ final GraphicsDevice gd = ge.getDefaultScreenDevice();
isSetShapeSupported = gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSPARENT);
//only apply anti-aliasing to border on Windows, as it creates issues on Linux
@@ -78,7 +78,7 @@
this(true, false, "dialog");
}
- public FDialog(boolean modal0, boolean allowResize0, String insets) {
+ public FDialog(final boolean modal0, final boolean allowResize0, final String insets) {
super(JOptionPane.getRootFrame(), modal0);
allowResize = allowResize0;
setUndecorated(true);
@@ -120,7 +120,7 @@
addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(final ComponentEvent e) { //must update shape whenever dialog is resized
- int arc = cornerDiameter - 4; //leave room for border aliasing
+ final int arc = cornerDiameter - 4; //leave room for border aliasing
FDialog.this.setShape(new RoundRectangle2D.Float(0, 0, FDialog.this.getWidth(), FDialog.this.getHeight(), arc, arc));
}
});
@@ -129,10 +129,10 @@
//Make Escape key close dialog if allowed
@Override
- public boolean dispatchKeyEvent(KeyEvent e) {
+ public boolean dispatchKeyEvent(final KeyEvent e) {
if (e.getID() == KeyEvent.KEY_PRESSED) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
- WindowEvent wev = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
+ final WindowEvent wev = new WindowEvent(this, WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev);
return true;
}
@@ -141,7 +141,7 @@
}
@Override
- public void paint(Graphics g) {
+ public void paint(final Graphics g) {
super.paint(g);
if (allowResize) { return; }
@@ -167,7 +167,7 @@
}
@Override
- public void setVisible(boolean visible) {
+ public void setVisible(final boolean visible) {
if (isVisible() == visible) { return; }
if (visible) {
@@ -201,12 +201,12 @@
super.setVisible(visible);
}
- public void setDefaultFocus(JComponent comp) {
+ public void setDefaultFocus(final JComponent comp) {
defaultFocus = comp;
}
@Override
- public void setTitle(String title) {
+ public void setTitle(final String title) {
super.setTitle(title);
if (titleBar != null) {
titleBar.setTitle(title);
@@ -214,7 +214,7 @@
}
@Override
- public void setIconImage(Image image) {
+ public void setIconImage(final Image image) {
super.setIconImage(image);
if (titleBar != null) {
titleBar.setIconImage(image);
@@ -231,7 +231,7 @@
//relay certain methods to the inner panel if it has been initialized
@Override
- public void setContentPane(Container contentPane) {
+ public void setContentPane(final Container contentPane) {
if (innerPanel != null) {
innerPanel.add(contentPane, "w 100%!, h 100%!");
}
@@ -239,15 +239,15 @@
}
@Override
- public Component add(Component comp) {
+ public Component add(final Component comp) {
if (innerPanel != null) {
return innerPanel.add(comp);
}
return super.add(comp);
}
-
+
@Override
- public void add(PopupMenu popup) {
+ public void add(final PopupMenu popup) {
if (innerPanel != null) {
innerPanel.add(popup);
return;
@@ -255,38 +255,38 @@
super.add(popup);
}
- public void add(Component comp, int x, int y, int w, int h) {
+ public void add(final Component comp, final int x, final int y, final int w, final int h) {
add(comp, "x " + x + ", y " + y + ", w " + w + ", h " + h);
}
@Override
- public void add(Component comp, Object constraints) {
+ public void add(final Component comp, final Object constraints) {
if (innerPanel != null) {
innerPanel.add(comp, constraints);
return;
}
super.add(comp, constraints);
}
-
+
@Override
- public Component add(Component comp, int index) {
+ public Component add(final Component comp, final int index) {
if (innerPanel != null) {
return innerPanel.add(comp, index);
}
return super.add(comp, index);
}
-
+
@Override
- public void add(Component comp, Object constraints, int index) {
+ public void add(final Component comp, final Object constraints, final int index) {
if (innerPanel != null) {
innerPanel.add(comp, constraints, index);
return;
}
super.add(comp, constraints, index);
}
-
+
@Override
- public Component add(String name, Component comp) {
+ public Component add(final String name, final Component comp) {
if (innerPanel != null) {
return innerPanel.add(name, comp);
}
@@ -296,7 +296,7 @@
private void addMoveSupport() {
titleBar.addMouseListener(new MouseAdapter() {
@Override
- public void mousePressed(MouseEvent e) {
+ public void mousePressed(final MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
if (e.getClickCount() == 1) {
locBeforeMove = getLocation();
@@ -305,7 +305,7 @@
}
}
@Override
- public void mouseReleased(MouseEvent e) {
+ public void mouseReleased(final MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
locBeforeMove = null;
mouseDownLoc = null;
@@ -314,7 +314,7 @@
});
titleBar.addMouseMotionListener(new MouseMotionAdapter() {
@Override
- public void mouseDragged(MouseEvent e) {
+ public void mouseDragged(final MouseEvent e) {
if (mouseDownLoc != null) {
final Point loc = e.getLocationOnScreen();
final int dx = loc.x - mouseDownLoc.x;
@@ -325,7 +325,7 @@
});
}
- private void setResizeCursor(int resizeCursor0) {
+ private void setResizeCursor(final int resizeCursor0) {
resizeCursor = resizeCursor0;
getRootPane().setCursor(Cursor.getPredefinedCursor(resizeCursor0));
}
@@ -338,7 +338,7 @@
final JRootPane resizeBorders = getRootPane();
resizeBorders.addMouseListener(new MouseAdapter() {
@Override
- public void mousePressed(MouseEvent e) {
+ public void mousePressed(final MouseEvent e) {
if (resizeCursor != Cursor.DEFAULT_CURSOR && SwingUtilities.isLeftMouseButton(e)) {
locBeforeMove = getLocation();
sizeBeforeResize = getSize();
@@ -346,7 +346,7 @@
}
}
@Override
- public void mouseReleased(MouseEvent e) {
+ public void mouseReleased(final MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
locBeforeMove = null;
sizeBeforeResize = null;
@@ -355,7 +355,7 @@
}
}
@Override
- public void mouseExited(MouseEvent e) {
+ public void mouseExited(final MouseEvent e) {
if (mouseDownLoc == null) {
setResizeCursor(Cursor.DEFAULT_CURSOR);
}
@@ -363,7 +363,7 @@
});
resizeBorders.addMouseMotionListener(new MouseMotionAdapter() {
@Override
- public void mouseMoved(MouseEvent e) {
+ public void mouseMoved(final MouseEvent e) {
if (mouseDownLoc == null) {
final int grabArea = borderThickness * 2;
final Point loc = e.getPoint();
@@ -401,7 +401,7 @@
}
}
@Override
- public void mouseDragged(MouseEvent e) {
+ public void mouseDragged(final MouseEvent e) {
if (mouseDownLoc == null) { return; }
final Point loc = e.getLocationOnScreen();
@@ -412,39 +412,39 @@
int width = sizeBeforeResize.width;
int height = sizeBeforeResize.height;
switch (resizeCursor) {
- case Cursor.E_RESIZE_CURSOR:
- width += dx;
- break;
- case Cursor.W_RESIZE_CURSOR:
- width -= dx;
- break;
- case Cursor.S_RESIZE_CURSOR:
- height += dy;
- break;
- case Cursor.N_RESIZE_CURSOR:
- height -= dy;
- break;
- case Cursor.SE_RESIZE_CURSOR:
- width += dx;
- height += dy;
- break;
- case Cursor.NE_RESIZE_CURSOR:
- width += dx;
- height -= dy;
- break;
- case Cursor.SW_RESIZE_CURSOR:
- width -= dx;
- height += dy;
- break;
- case Cursor.NW_RESIZE_CURSOR:
- width -= dx;
- height -= dy;
- break;
+ case Cursor.E_RESIZE_CURSOR:
+ width += dx;
+ break;
+ case Cursor.W_RESIZE_CURSOR:
+ width -= dx;
+ break;
+ case Cursor.S_RESIZE_CURSOR:
+ height += dy;
+ break;
+ case Cursor.N_RESIZE_CURSOR:
+ height -= dy;
+ break;
+ case Cursor.SE_RESIZE_CURSOR:
+ width += dx;
+ height += dy;
+ break;
+ case Cursor.NE_RESIZE_CURSOR:
+ width += dx;
+ height -= dy;
+ break;
+ case Cursor.SW_RESIZE_CURSOR:
+ width -= dx;
+ height += dy;
+ break;
+ case Cursor.NW_RESIZE_CURSOR:
+ width -= dx;
+ height -= dy;
+ break;
}
//ensure new size in bounds
- Dimension minSize = getMinimumSize();
- Dimension maxSize = getMaximumSize();
+ final Dimension minSize = getMinimumSize();
+ final Dimension maxSize = getMaximumSize();
if (width < minSize.width) {
dx += (width - minSize.width);
width = minSize.width;
@@ -466,18 +466,18 @@
int x = locBeforeMove.x;
int y = locBeforeMove.y;
switch (resizeCursor) {
- case Cursor.W_RESIZE_CURSOR:
- case Cursor.SW_RESIZE_CURSOR:
- x += dx;
- break;
- case Cursor.N_RESIZE_CURSOR:
- case Cursor.NE_RESIZE_CURSOR:
- y += dy;
- break;
- case Cursor.NW_RESIZE_CURSOR:
- x += dx;
- y += dy;
- break;
+ case Cursor.W_RESIZE_CURSOR:
+ case Cursor.SW_RESIZE_CURSOR:
+ x += dx;
+ break;
+ case Cursor.N_RESIZE_CURSOR:
+ case Cursor.NE_RESIZE_CURSOR:
+ y += dy;
+ break;
+ case Cursor.NW_RESIZE_CURSOR:
+ x += dx;
+ y += dy;
+ break;
}
//set bounds based on new size and location
@@ -492,7 +492,7 @@
}
@Override
- public void setMinimized(boolean b) {
+ public void setMinimized(final boolean b) {
}
@Override
@@ -501,7 +501,7 @@
}
@Override
- public void setMaximized(boolean b) {
+ public void setMaximized(final boolean b) {
}
@Override
@@ -510,7 +510,7 @@
}
@Override
- public void setFullScreen(boolean b) {
+ public void setFullScreen(final boolean b) {
}
@Override
@@ -519,7 +519,7 @@
}
@Override
- public void setLockTitleBar(boolean b) {
+ public void setLockTitleBar(final boolean b) {
}
@Override
\ No newline at end of file
Index: forge-gui/src/main/java/forge/player/HumanPlaySpellAbility.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/player/HumanPlaySpellAbility.java (revision 29316)
+++ forge-gui/src/main/java/forge/player/HumanPlaySpellAbility.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -47,7 +47,7 @@
* <p>
* SpellAbility_Requirements class.
* </p>
- *
+ *
* @author Forge
* @version $Id: HumanPlaySpellAbility.java 24317 2014-01-17 08:32:39Z Max mtg $
*/
@@ -62,7 +62,7 @@
payment = payment0;
}
- public final void playAbility(boolean mayChooseTargets, boolean isFree, boolean skipStack) {
+ public final void playAbility(final boolean mayChooseTargets, final boolean isFree, final boolean skipStack) {
final Player human = ability.getActivatingPlayer();
final Game game = ability.getActivatingPlayer().getGame();
@@ -75,9 +75,9 @@
final Card c = ability.getHostCard();
final CardPlayOption option = c.mayPlay(human);
- boolean manaConversion = (ability.isSpell() && (c.hasKeyword("May spend mana as though it were mana of any color to cast CARDNAME")
+ final boolean manaConversion = (ability.isSpell() && (c.hasKeyword("May spend mana as though it were mana of any color to cast CARDNAME")
|| (option != null && option.isIgnoreManaCostColor())));
- boolean playerManaConversion = human.hasManaConversion()
+ final boolean playerManaConversion = human.hasManaConversion()
&& human.getController().confirmAction(ability, null, "Do you want to spend mana as though it were mana of any color to pay the cost?");
if (ability instanceof Spell && !c.isCopiedSpell()) {
fromZone = game.getZoneOf(c);
@@ -106,7 +106,7 @@
}
// This line makes use of short-circuit evaluation of boolean values, that is each subsequent argument
// is only executed or evaluated if the first argument does not suffice to determine the value of the expression
- boolean prerequisitesMet = announceValuesLikeX()
+ final boolean prerequisitesMet = announceValuesLikeX()
&& announceType()
&& (!mayChooseTargets || setupTargets()) // if you can choose targets, then do choose them.
&& (isFree || payment.payCost(new HumanCostDecision(controller, human, ability, ability.getHostCard())));
@@ -160,12 +160,12 @@
SpellAbility currentAbility = ability;
final Card source = ability.getHostCard();
do {
- TargetRestrictions tgt = currentAbility.getTargetRestrictions();
+ final TargetRestrictions tgt = currentAbility.getTargetRestrictions();
if (tgt != null && tgt.doesTarget()) {
clearTargets(currentAbility);
Player targetingPlayer;
if (currentAbility.hasParam("TargetingPlayer")) {
- FCollection<Player> candidates = AbilityUtils.getDefinedPlayers(source, currentAbility.getParam("TargetingPlayer"), currentAbility);
+ final FCollection<Player> candidates = AbilityUtils.getDefinedPlayers(source, currentAbility.getParam("TargetingPlayer"), currentAbility);
// activator chooses targeting player
targetingPlayer = ability.getActivatingPlayer().getController().chooseSingleEntityForEffect(
candidates, currentAbility, "Choose the targeting player");
@@ -173,9 +173,10 @@
targetingPlayer = ability.getActivatingPlayer();
}
currentAbility.setTargetingPlayer(targetingPlayer);
- if (!targetingPlayer.getController().chooseTargetsFor(currentAbility))
+ if (!targetingPlayer.getController().chooseTargetsFor(currentAbility)) {
return false;
- }
+ }
+ }
final SpellAbility subAbility = currentAbility.getSubAbility();
if (subAbility != null) {
// This is necessary for "TargetsWithDefinedController$ ParentTarget"
@@ -186,15 +187,15 @@
return true;
}
- public final void clearTargets(SpellAbility ability) {
- TargetRestrictions tg = ability.getTargetRestrictions();
+ public final void clearTargets(final SpellAbility ability) {
+ final TargetRestrictions tg = ability.getTargetRestrictions();
if (tg != null) {
ability.resetTargets();
tg.calculateStillToDivide(ability.getParam("DividedAsYouChoose"), ability.getHostCard(), ability);
}
}
- private void rollbackAbility(final Zone fromZone, final CardStateName fromState, final int zonePosition) {
+ private void rollbackAbility(final Zone fromZone, final CardStateName fromState, final int zonePosition) {
// cancel ability during target choosing
final Game game = ability.getActivatingPlayer().getGame();
@@ -213,24 +214,24 @@
private boolean announceValuesLikeX() {
if (ability.isCopied()) { return true; } //don't re-announce for spell copies
-
+
boolean needX = true;
- boolean allowZero = !ability.hasParam("XCantBe0");
- CostPartMana manaCost = ability.getPayCosts().getCostMana();
- PlayerController controller = ability.getActivatingPlayer().getController();
- Card card = ability.getHostCard();
+ final boolean allowZero = !ability.hasParam("XCantBe0");
+ final CostPartMana manaCost = ability.getPayCosts().getCostMana();
+ final PlayerController controller = ability.getActivatingPlayer().getController();
+ final Card card = ability.getHostCard();
// Announcing Requirements like Choosing X or Multikicker
// SA Params as comma delimited list
- String announce = ability.getParam("Announce");
+ final String announce = ability.getParam("Announce");
if (announce != null) {
- for (String aVar : announce.split(",")) {
- String varName = aVar.trim();
+ for (final String aVar : announce.split(",")) {
+ final String varName = aVar.trim();
- boolean isX = "X".equalsIgnoreCase(varName);
+ final boolean isX = "X".equalsIgnoreCase(varName);
if (isX) { needX = false; }
- Integer value = controller.announceRequirements(ability, varName, allowZero && (!isX || manaCost == null || manaCost.canXbe0()));
+ final Integer value = controller.announceRequirements(ability, varName, allowZero && (!isX || manaCost == null || manaCost.canXbe0()));
if (value == null) {
return false;
}
@@ -246,9 +247,9 @@
}
if (needX && manaCost != null && manaCost.getAmountOfX() > 0) {
- String sVar = ability.getSVar("X"); //only prompt for new X value if card doesn't determine it another way
+ final String sVar = ability.getSVar("X"); //only prompt for new X value if card doesn't determine it another way
if ("Count$xPaid".equals(sVar) || sVar.isEmpty()) {
- Integer value = controller.announceRequirements(ability, "X", allowZero && manaCost.canXbe0());
+ final Integer value = controller.announceRequirements(ability, "X", allowZero && manaCost.canXbe0());
if (value == null) {
return false;
}
@@ -262,19 +263,19 @@
private boolean announceType() {
if (ability.isCopied()) { return true; } //don't re-announce for spell copies
- String announce = ability.getParam("AnnounceType");
- PlayerController pc = ability.getActivatingPlayer().getController();
+ final String announce = ability.getParam("AnnounceType");
+ final PlayerController pc = ability.getActivatingPlayer().getController();
if (announce != null) {
- for (String aVar : announce.split(",")) {
- String varName = aVar.trim();
+ for (final String aVar : announce.split(",")) {
+ final String varName = aVar.trim();
if ("CreatureType".equals(varName)) {
final String choice = pc.chooseSomeType("Creature", ability, CardType.Constant.CREATURE_TYPES, Collections.<String>emptyList());
ability.getHostCard().setChosenType(choice);
}
if ("ChooseNumber".equals(varName)) {
- int min = Integer.parseInt(ability.getParam("Min"));
- int max = Integer.parseInt(ability.getParam("Max"));
- int i = ability.getActivatingPlayer().getController().chooseNumber(ability,
+ final int min = Integer.parseInt(ability.getParam("Min"));
+ final int max = Integer.parseInt(ability.getParam("Max"));
+ final int i = ability.getActivatingPlayer().getController().chooseNumber(ability,
"Choose a number", min, max);
ability.getHostCard().setChosenNumber(i);
}
@@ -283,7 +284,7 @@
return true;
}
- private void enusureAbilityHasDescription(SpellAbility ability) {
+ private static void enusureAbilityHasDescription(final SpellAbility ability) {
if (!StringUtils.isBlank(ability.getStackDescription())) {
return;
}
Index: forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletQuick.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletQuick.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/CSubmenuGauntletQuick.java (revision 29317)
@@ -1,6 +1,12 @@
package forge.screens.home.gauntlet;
-import forge.UiCommand;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.SwingUtilities;
+
import forge.deck.DeckType;
import forge.game.player.RegisteredPlayer;
import forge.gauntlet.GauntletData;
@@ -9,16 +15,9 @@
import forge.gui.framework.ICDoc;
import forge.player.GamePlayerUtil;
-import javax.swing.*;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
+/**
* Controls the "quick gauntlet" submenu in the home UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -27,8 +26,11 @@
/** */
SINGLETON_INSTANCE;
- private final ActionListener actStartGame = new ActionListener() { @Override
- public void actionPerformed(ActionEvent arg0) { startGame(); } };
+ private final ActionListener actStartGame = new ActionListener() {
+ @Override public void actionPerformed(final ActionEvent arg0) {
+ startGame();
+ }
+ };
private final VSubmenuGauntletQuick view = VSubmenuGauntletQuick.SINGLETON_INSTANCE;
@@ -90,11 +92,4 @@
});
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
}
Index: forge-gui/src/main/java/forge/model/FModel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/model/FModel.java (revision 29316)
+++ forge-gui/src/main/java/forge/model/FModel.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -59,10 +59,10 @@
/**
* The default Model implementation for Forge.
- *
+ *
* This used to be an interface, but it seems unlikely that we will ever use a
* different model.
- *
+ *
* In case we need to convert it into an interface in the future, all fields of
* this class must be either private or public static final.
*/
@@ -98,18 +98,18 @@
ForgeConstants.CACHE_BOOSTERBOX_PICS_DIR, ForgeConstants.CACHE_PRECON_PICS_DIR,
ForgeConstants.CACHE_TOURNAMENTPACK_PICS_DIR);
- // Instantiate preferences: quest and regular
+ // Instantiate preferences: quest and regular
- //Preferences are initialized first so that the splash screen can be translated.
+ // Preferences are initialized first so that the splash screen can be translated.
- try {
- preferences = new ForgePreferences();
- GamePlayerUtil.getGuiPlayer().setName(preferences.getPref(FPref.PLAYER_NAME));
- }
- catch (final Exception exn) {
- throw new RuntimeException(exn);
- }
+ try {
+ preferences = new ForgePreferences();
+ GamePlayerUtil.getGuiPlayer().setName(preferences.getPref(FPref.PLAYER_NAME));
+ }
+ catch (final Exception exn) {
+ throw new RuntimeException(exn);
+ }
- Localizer.getInstance().initialize(FModel.getPreferences().getPref(FPref.UI_LANGUAGE), ForgeConstants.LANG_DIR);
-
+ Localizer.getInstance().initialize(FModel.getPreferences().getPref(FPref.UI_LANGUAGE), ForgeConstants.LANG_DIR);
+
//load card database
final ProgressObserver progressBarBridge = (progressBar == null) ?
ProgressObserver.emptyObserver : new ProgressObserver() {
@@ -140,8 +140,8 @@
magicDb = new StaticData(reader, ForgeConstants.EDITIONS_DIR, ForgeConstants.BLOCK_DATA_DIR);
//create profile dirs if they don't already exist
- for (String dname : ForgeConstants.PROFILE_DIRS) {
- File path = new File(dname);
+ for (final String dname : ForgeConstants.PROFILE_DIRS) {
+ final File path = new File(dname);
if (path.isDirectory()) {
// already exists
continue;
@@ -199,7 +199,7 @@
}
private static boolean keywordsLoaded = false;
-
+
/**
* Load dynamic gamedata.
*/
@@ -210,37 +210,22 @@
List<String> tList = null;
if (typeListFile.size() > 0) {
- for (int i = 0; i < typeListFile.size(); i++) {
- final String s = typeListFile.get(i);
+ for (final String s : typeListFile) {
if (s.equals("[BasicTypes]")) {
tList = CardType.Constant.BASIC_TYPES;
- }
-
- else if (s.equals("[LandTypes]")) {
+ } else if (s.equals("[LandTypes]")) {
tList = CardType.Constant.LAND_TYPES;
- }
-
- else if (s.equals("[CreatureTypes]")) {
+ } else if (s.equals("[CreatureTypes]")) {
tList = CardType.Constant.CREATURE_TYPES;
- }
-
- else if (s.equals("[SpellTypes]")) {
+ } else if (s.equals("[SpellTypes]")) {
tList = CardType.Constant.SPELL_TYPES;
- }
-
- else if (s.equals("[EnchantmentTypes]")) {
+ } else if (s.equals("[EnchantmentTypes]")) {
tList = CardType.Constant.ENCHANTMENT_TYPES;
- }
-
- else if (s.equals("[ArtifactTypes]")) {
+ } else if (s.equals("[ArtifactTypes]")) {
tList = CardType.Constant.ARTIFACT_TYPES;
- }
-
- else if (s.equals("[WalkerTypes]")) {
+ } else if (s.equals("[WalkerTypes]")) {
tList = CardType.Constant.WALKER_TYPES;
- }
-
- else if (s.length() > 1) {
+ } else if (s.length() > 1) {
tList.add(s);
}
}
@@ -252,7 +237,7 @@
final List<String> nskwListFile = FileUtil.readFile(ForgeConstants.KEYWORD_LIST_FILE);
if (nskwListFile.size() > 1) {
- for (String s : nskwListFile) {
+ for (final String s : nskwListFile) {
if (s.length() > 1) {
CardUtil.NON_STACKING_LIST.add(s);
}
@@ -303,7 +288,7 @@
return gauntletData;
}
- public static void setGauntletData(GauntletData data0) {
+ public static void setGauntletData(final GauntletData data0) {
gauntletData = data0;
}
@@ -321,7 +306,7 @@
public static IStorage<QuestWorld> getWorlds() {
return worlds;
}
-
+
public static GameFormat.Collection getFormats() {
return formats;
}
Index: forge-gui-desktop/src/test/java/forge/GuiDownloadSetPicturesLQTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/test/java/forge/GuiDownloadSetPicturesLQTest.java (revision 29316)
+++ forge-gui-desktop/src/test/java/forge/GuiDownloadSetPicturesLQTest.java (revision 29317)
@@ -1,10 +1,10 @@
package forge;
+import org.testng.annotations.Test;
+
import forge.download.GuiDownloadSetPicturesLQ;
import forge.download.GuiDownloader;
-import org.testng.annotations.Test;
-
/**
* Created by IntelliJ IDEA. User: dhudson
*/
@@ -16,6 +16,6 @@
*/
@Test(enabled = false, timeOut = 1000)
public void g() {
- new GuiDownloader(new GuiDownloadSetPicturesLQ());
+ new GuiDownloader(new GuiDownloadSetPicturesLQ()).show();
}
}
Index: forge-gui-desktop/src/main/java/forge/download/GuiDownloader.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/download/GuiDownloader.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/download/GuiDownloader.java (revision 29317)
@@ -6,34 +6,41 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.download;
-import java.net.Proxy;
+import javax.swing.AbstractButton;
+import javax.swing.DefaultBoundedRangeModel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import net.miginfocom.swing.MigLayout;
import forge.UiCommand;
import forge.assets.FSkinProp;
import forge.gui.SOverlayUtils;
-import forge.toolbox.*;
+import forge.toolbox.FButton;
+import forge.toolbox.FLabel;
+import forge.toolbox.FOverlay;
+import forge.toolbox.FPanel;
+import forge.toolbox.FProgressBar;
+import forge.toolbox.FRadioButton;
+import forge.toolbox.FSkin;
+import forge.toolbox.FTextField;
+import forge.toolbox.JXButtonPanel;
import forge.util.Callback;
-import net.miginfocom.swing.MigLayout;
-import javax.swing.*;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
@SuppressWarnings("serial")
public class GuiDownloader extends DefaultBoundedRangeModel {
- public static final Proxy.Type[] TYPES = Proxy.Type.values();
-
// Swing components
private final FPanel pnlDialog = new FPanel(new MigLayout("insets 0, gap 0, wrap, ax center, ay center"));
private final FProgressBar progressBar = new FProgressBar();
@@ -42,8 +49,7 @@
private final FTextField txtPort = new FTextField.Builder().ghostText("Proxy Port").build();
private final UiCommand cmdClose = new UiCommand() {
- @Override
- public void run() {
+ @Override public void run() {
service.setCancel(true);
// Kill overlay
@@ -65,15 +71,15 @@
private final GuiDownloadService service;
private final Callback<Boolean> callback;
- public GuiDownloader(GuiDownloadService service0) {
+ public GuiDownloader(final GuiDownloadService service0) {
this(service0, null);
}
- public GuiDownloader(GuiDownloadService service0, Callback<Boolean> callback0) {
+ public GuiDownloader(final GuiDownloadService service0, final Callback<Boolean> callback0) {
service = service0;
callback = callback0;
- String radConstraints = "w 100%!, h 30px!, gap 2% 0 0 10px";
- JXButtonPanel grpPanel = new JXButtonPanel();
+ final String radConstraints = "w 100%!, h 30px!, gap 2% 0 0 10px";
+ final JXButtonPanel grpPanel = new JXButtonPanel();
grpPanel.add(radProxyNone, radConstraints);
grpPanel.add(radProxyHTTP, radConstraints);
grpPanel.add(radProxySocks, radConstraints);
@@ -98,7 +104,9 @@
pnlDialog.add(progressBar, "w 95%!, h 40px!, gap 2% 0 20px 0");
pnlDialog.add(btnStart, "w 200px!, h 40px!, gap 0 0 20px 0, ax center");
pnlDialog.add(btnClose, "w 20px!, h 20px!, pos 370px 10px");
+ }
+ public void show() {
final JPanel pnl = FOverlay.SINGLETON_INSTANCE.getPanel();
pnl.removeAll();
pnl.setLayout(new MigLayout("insets 0, gap 0, wrap, ax center, ay center"));
@@ -106,8 +114,7 @@
SOverlayUtils.showOverlay();
service.initialize(txtAddress, txtPort, progressBar, btnStart, cmdClose, null, new Runnable() {
- @Override
- public void run() {
+ @Override public void run() {
fireStateChanged();
}
});
Index: forge-gui/src/main/java/forge/itemmanager/ItemManagerModel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/itemmanager/ItemManagerModel.java (revision 29316)
+++ forge-gui/src/main/java/forge/itemmanager/ItemManagerModel.java (revision 29317)
@@ -6,30 +6,34 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.itemmanager;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
import forge.item.InventoryItem;
import forge.itemmanager.ItemColumnConfig.SortState;
import forge.util.ItemPool;
import forge.util.ItemPoolSorter;
-import java.util.*;
-import java.util.Map.Entry;
-
/**
* <p>
* ItemManagerModel class.
* </p>
- *
+ *
* @param <T>
* the generic type
* @author Forge
@@ -44,7 +48,7 @@
/**
* Instantiates a new list view model
- *
+ *
* @param ItemManager0
* @param genericType0
*/
@@ -67,13 +71,7 @@
/** Whether list is in sync. */
protected transient boolean isListInSync = false;
- /**
- *
- * getOrderedList.
- *
- * @return List<Entry<T, Integer>>
- */
- public final List<Entry<T, Integer>> getOrderedList() {
+ public List<Entry<T, Integer>> getOrderedList() {
if (!this.isListInSync) {
this.rebuildOrderedList();
}
@@ -90,19 +88,13 @@
this.isListInSync = true;
}
- /**
- *
- * countDistinct.
- *
- * @return int
- */
- public final int countDistinct() {
+ public int countDistinct() {
return this.data.countDistinct();
}
/**
* Gets all items in the model.
- *
+ *
* @return ItemPoolView<T>
*/
public ItemPool<T> getItems() {
@@ -111,10 +103,10 @@
/**
* Removes a item from the model.
- *
+ *
* @param item0 &emsp; {@link forge.Item} object
*/
- public void removeItem(final T item0, int qty) {
+ public void removeItem(final T item0, final int qty) {
if (isInfinite()) { return; }
final boolean wasThere = this.data.count(item0) > 0;
@@ -125,7 +117,7 @@
}
public void replaceAll(final T item0, final T replacement0) {
- int count = this.data.count(item0);
+ final int count = this.data.count(item0);
if (count > 0) {
this.data.removeAll(item0);
this.data.add(replacement0, count);
@@ -135,17 +127,17 @@
/**
* Adds a item to the model.
- *
+ *
* @param item0 &emsp; {@link forge.Item} object.
*/
- public void addItem(final T item0, int qty) {
+ public void addItem(final T item0, final int qty) {
this.data.add(item0, qty);
isListInSync = false;
}
/**
* Adds multiple copies of multiple items to the model.
- *
+ *
* @param items0 &emsp; {@link java.lang.Iterable}<Entry<T, Integer>>
*/
public void addItems(final Iterable<Entry<T, Integer>> items0) {
@@ -154,17 +146,17 @@
}
/**
- * Sets whether this table's pool of items is in infinite supply. If false, items in the
- * table have a limited number of copies.
+ * Sets whether this table's pool of items is in infinite supply. If false,
+ * items in the table have a limited number of copies.
*/
- public void setInfinite(boolean infinite) {
+ public void setInfinite(final boolean infinite) {
this.infiniteSupply = infinite;
}
public boolean isInfinite() {
return infiniteSupply;
}
-
+
public CascadeManager getCascadeManager() {
return cascadeManager;
}
@@ -188,13 +180,12 @@
// Adds a column to sort cascade list.
// If column is first in the cascade, inverts direction of sort.
// Otherwise, sorts in ascending direction.
- public void add(final ItemColumn col0, boolean forSetup) {
+ public void add(final ItemColumn col0, final boolean forSetup) {
this.sorter = null;
if (forSetup) { //just add column unmodified if setting up sort columns
- this.colsToSort.add(0, (ItemColumn) col0);
- }
- else {
+ this.colsToSort.add(0, col0);
+ } else {
if (colsToSort.size() > 0 && colsToSort.get(0).equals(col0)) { //if column already at top level, just invert
col0.getConfig().setSortPriority(1);
col0.getConfig().setSortState(col0.getConfig().getSortState() == SortState.ASC ? SortState.DESC : SortState.ASC);
@@ -203,7 +194,7 @@
this.colsToSort.remove(col0);
col0.getConfig().setSortPriority(1);
col0.getConfig().setSortState(col0.getConfig().getDefaultSortState());
- this.colsToSort.add(0, (ItemColumn) col0);
+ this.colsToSort.add(0, col0);
}
//decrement sort priority on remaining columns
@@ -236,8 +227,7 @@
}
private Sorter createSorter() {
- final List<ItemPoolSorter<InventoryItem>> oneColSorters
- = new ArrayList<ItemPoolSorter<InventoryItem>>(maxSortDepth);
+ final List<ItemPoolSorter<InventoryItem>> oneColSorters = new ArrayList<ItemPoolSorter<InventoryItem>>(maxSortDepth);
for (final ItemColumn col : this.colsToSort) {
oneColSorters.add(new ItemPoolSorter<InventoryItem>(
@@ -253,9 +243,9 @@
private final int cntFields;
/**
- *
+ *
* Sorter Constructor.
- *
+ *
* @param sorters0
* a List<TableSorter<InventoryItem>>
*/
@@ -266,7 +256,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
@Override
@@ -286,13 +276,13 @@
}
}
- private class MyComparator implements Comparator<Entry<T, Integer>> {
+ private final class MyComparator implements Comparator<Entry<T, Integer>> {
/* (non-Javadoc)
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
@SuppressWarnings("unchecked")
@Override
- public int compare(Entry<T, Integer> o1, Entry<T, Integer> o2) {
+ public int compare(final Entry<T, Integer> o1, final Entry<T, Integer> o2) {
return cascadeManager.getSorter().compare((Entry<InventoryItem, Integer>)o1, (Entry<InventoryItem, Integer>)o2);
}
}
Index: forge-gui-desktop/src/main/java/forge/GuiDesktop.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/GuiDesktop.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/GuiDesktop.java (revision 29317)
@@ -23,7 +23,6 @@
import forge.assets.FSkinProp;
import forge.assets.ISkinImage;
-import forge.control.GuiTimer;
import forge.download.GuiDownloadService;
import forge.download.GuiDownloader;
import forge.error.BugReportDialog;
@@ -33,7 +32,6 @@
import forge.gui.framework.FScreen;
import forge.interfaces.IGuiBase;
import forge.interfaces.IGuiGame;
-import forge.interfaces.IGuiTimer;
import forge.item.PaperCard;
import forge.match.HostedMatch;
import forge.model.FModel;
@@ -70,7 +68,7 @@
}
@Override
- public void invokeInEdtLater(Runnable proc) {
+ public void invokeInEdtLater(final Runnable proc) {
SwingUtilities.invokeLater(proc);
}
@@ -99,28 +97,23 @@
}
@Override
- public IGuiTimer createGuiTimer(Runnable proc, int interval) {
- return new GuiTimer(proc, interval);
- }
-
- @Override
- public ISkinImage getSkinIcon(FSkinProp skinProp) {
+ public ISkinImage getSkinIcon(final FSkinProp skinProp) {
if (skinProp == null) { return null; }
return FSkin.getIcon(skinProp);
}
@Override
- public ISkinImage getUnskinnedIcon(String path) {
+ public ISkinImage getUnskinnedIcon(final String path) {
return new FSkin.UnskinnedIcon(path);
}
@Override
- public ISkinImage getCardArt(PaperCard card) {
+ public ISkinImage getCardArt(final PaperCard card) {
return null; //TODO
}
@Override
- public ISkinImage createLayeredImage(FSkinProp background, String overlayFilename, float opacity) {
+ public ISkinImage createLayeredImage(final FSkinProp background, final String overlayFilename, final float opacity) {
final BufferedImage image = new BufferedImage(background.getWidth(), background.getHeight(), BufferedImage.TYPE_INT_ARGB);
final Graphics2D g = image.createGraphics();
final FSkin.SkinImage backgroundImage = FSkin.getImage(background);
@@ -134,17 +127,17 @@
}
@Override
- public void showImageDialog(ISkinImage image, String message, String title) {
+ public void showImageDialog(final ISkinImage image, final String message, final String title) {
FOptionPane.showMessageDialog(message, title, (SkinImage)image);
}
@Override
- public int showOptionDialog(String message, String title, FSkinProp icon, String[] options, int defaultOption) {
+ public int showOptionDialog(final String message, final String title, final FSkinProp icon, final String[] options, final int defaultOption) {
return FOptionPane.showOptionDialog(message, title, icon == null ? null : FSkin.getImage(icon), options, defaultOption);
}
@Override
- public String showInputDialog(String message, String title, FSkinProp icon, String initialInput, String[] inputOptions) {
+ public String showInputDialog(final String message, final String title, final FSkinProp icon, final String initialInput, final String[] inputOptions) {
return FOptionPane.showInputDialog(message, title, icon == null ? null : FSkin.getImage(icon), initialInput, inputOptions);
}
@@ -192,7 +185,7 @@
}
@Override
- public String showFileDialog(String title, String defaultDir) {
+ public String showFileDialog(final String title, final String defaultDir) {
final JFileChooser fc = new JFileChooser(defaultDir);
final int rc = fc.showDialog(null, title);
if (rc != JFileChooser.APPROVE_OPTION) {
@@ -202,46 +195,46 @@
}
@Override
- public void showBugReportDialog(String title, String text, boolean showExitAppBtn) {
+ public void showBugReportDialog(final String title, final String text, final boolean showExitAppBtn) {
BugReportDialog.show(title, text, showExitAppBtn);
}
@Override
- public File getSaveFile(File defaultFile) {
- JFileChooser fc = new JFileChooser();
+ public File getSaveFile(final File defaultFile) {
+ final JFileChooser fc = new JFileChooser();
fc.setSelectedFile(defaultFile);
fc.showSaveDialog(null);
return fc.getSelectedFile();
}
@Override
- public void download(GuiDownloadService service, Callback<Boolean> callback) {
- new GuiDownloader(service, callback);
+ public void download(final GuiDownloadService service, final Callback<Boolean> callback) {
+ new GuiDownloader(service, callback).show();
}
@Override
- public void copyToClipboard(String text) {
- StringSelection ss = new StringSelection(text);
+ public void copyToClipboard(final String text) {
+ final StringSelection ss = new StringSelection(text);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
}
@Override
- public void browseToUrl(String url) throws IOException, URISyntaxException {
+ public void browseToUrl(final String url) throws IOException, URISyntaxException {
Desktop.getDesktop().browse(new URI(url));
}
@Override
- public IAudioClip createAudioClip(String filename) {
+ public IAudioClip createAudioClip(final String filename) {
return AudioClip.fileExists(filename) ? new AudioClip(filename) : null;
}
@Override
- public IAudioMusic createAudioMusic(String filename) {
+ public IAudioMusic createAudioMusic(final String filename) {
return new AudioMusic(filename);
}
@Override
- public void startAltSoundSystem(String filename, boolean isSynchronized) {
+ public void startAltSoundSystem(final String filename, final boolean isSynchronized) {
new AltSoundSystem(filename, isSynchronized).start();
}
@@ -263,6 +256,7 @@
Singletons.getView().getFrame().validate();
}
+ @Override
public IGuiGame getNewGuiGame() {
return new CMatchUI();
}
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/toolbox/FButton.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FButton.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FButton.java (revision 29317)
@@ -58,7 +58,7 @@
private int w, h = 0;
private boolean allImagesPresent = false;
private boolean toggle = false;
- private boolean hovered = false;
+ private boolean hovered = false;
private final AlphaComposite disabledComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.25f);
private KeyAdapter klEnter;
@@ -99,7 +99,7 @@
// Mouse events
this.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
- public void mouseEntered(MouseEvent evt) {
+ public void mouseEntered(final MouseEvent evt) {
hovered = true;
if (isToggled() || !isEnabled()) { return; }
resetImg();
@@ -107,7 +107,7 @@
}
@Override
- public void mouseExited(MouseEvent evt) {
+ public void mouseExited(final MouseEvent evt) {
hovered = false;
if (isToggled() || !isEnabled()) { return; }
resetImg();
@@ -115,7 +115,7 @@
}
@Override
- public void mousePressed(MouseEvent evt) {
+ public void mousePressed(final MouseEvent evt) {
if (isToggled() || !isEnabled()) { return; }
imgL = FSkin.getIcon(FSkinProp.IMG_BTN_DOWN_LEFT);
imgM = FSkin.getIcon(FSkinProp.IMG_BTN_DOWN_CENTER);
@@ -124,7 +124,7 @@
}
@Override
- public void mouseReleased(MouseEvent evt) {
+ public void mouseReleased(final MouseEvent evt) {
if (isToggled() || !isEnabled()) { return; }
resetImg();
repaintSelf();
@@ -134,7 +134,7 @@
// Focus events
this.addFocusListener(new FocusAdapter() {
@Override
- public void focusGained(FocusEvent e) {
+ public void focusGained(final FocusEvent e) {
if (isToggled()) { return; }
resetImg();
addKeyListener(klEnter);
@@ -142,7 +142,7 @@
}
@Override
- public void focusLost(FocusEvent e) {
+ public void focusLost(final FocusEvent e) {
if (isToggled()) { return; }
resetImg();
removeKeyListener(klEnter);
@@ -167,9 +167,9 @@
imgR = FSkin.getIcon(FSkinProp.IMG_BTN_UP_RIGHT);
}
}
-
+
@Override
- public void setEnabled(boolean b0) {
+ public void setEnabled(final boolean b0) {
if (!b0) {
imgL = FSkin.getIcon(FSkinProp.IMG_BTN_DISABLED_LEFT);
imgM = FSkin.getIcon(FSkinProp.IMG_BTN_DISABLED_CENTER);
@@ -183,9 +183,9 @@
repaintSelf();
}
- /**
+ /**
* Button toggle state, for a "permanently pressed" functionality, e.g. as a tab.
- *
+ *
* @return boolean
*/
public boolean isToggled() {
@@ -193,7 +193,7 @@
}
/** @param b0 &emsp; boolean. */
- public void setToggled(boolean b0) {
+ public void setToggled(final boolean b0) {
if (b0) {
imgL = FSkin.getIcon(FSkinProp.IMG_BTN_TOGGLE_LEFT);
imgM = FSkin.getIcon(FSkinProp.IMG_BTN_TOGGLE_CENTER);
@@ -214,7 +214,7 @@
public int getAutoSizeWidth() {
int width = 0;
if (this.getText() != null && !this.getText().isEmpty()) {
- FontMetrics metrics = this.getFontMetrics(this.getFont());
+ final FontMetrics metrics = this.getFontMetrics(this.getFont());
width = metrics.stringWidth(this.getText());
}
return width;
@@ -257,19 +257,19 @@
public void setCommand(final UiCommand command) {
addActionListener(new ActionListener() {
@Override
- public void actionPerformed(ActionEvent e) {
+ public void actionPerformed(final ActionEvent e) {
command.run();
}
});
}
@Override
- public void setImage(FSkinProp color) {
+ public void setImage(final FSkinProp color) {
setForeground(FSkin.getColor(Colors.fromSkinProp(color)));
}
@Override
- public void setTextColor(int r, int g, int b) {
+ public void setTextColor(final int r, final int g, final int b) {
setForeground(new Color(r, g, b));
}
}
Index: forge-gui/src/main/java/forge/card/CardDetailUtil.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/card/CardDetailUtil.java (revision 29316)
+++ forge-gui/src/main/java/forge/card/CardDetailUtil.java (revision 29317)
@@ -21,6 +21,7 @@
import forge.util.Lang;
public class CardDetailUtil {
+
private CardDetailUtil() {
}
@@ -43,7 +44,7 @@
public final int r, g, b;
- private DetailColors(int r0, int g0, int b0) {
+ private DetailColors(final int r0, final int g0, final int b0) {
r = r0;
g = g0;
b = b0;
@@ -56,9 +57,6 @@
}
return getBorderColors(card.getColors(), card.isLand(), canShow, false).iterator().next();
}
- public static DetailColors getBorderColor(final ColorSet cardColors, final boolean isLand, boolean canShow) {
- return getBorderColors(cardColors, isLand, canShow, false).get(0);
- }
public static List<DetailColors> getBorderColors(final CardStateView card, final boolean canShow) {
if (card == null) {
return getBorderColors(null, false, false, true);
@@ -68,8 +66,8 @@
public static List<DetailColors> getBorderColors(final ColorSet colorSet) {
return getBorderColors(colorSet, false, true, true);
}
- private static List<DetailColors> getBorderColors(final ColorSet cardColors, final boolean isLand, boolean canShow, boolean supportMultiple) {
- List<DetailColors> borderColors = new ArrayList<DetailColors>();
+ private static List<DetailColors> getBorderColors(final ColorSet cardColors, final boolean isLand, final boolean canShow, final boolean supportMultiple) {
+ final List<DetailColors> borderColors = new ArrayList<DetailColors>();
if (cardColors == null || !canShow) {
borderColors.add(DetailColors.FACE_DOWN);
@@ -83,7 +81,7 @@
}
}
else {
- int colorCount = cardColors.countColors();
+ final int colorCount = cardColors.countColors();
if (colorCount > 2 || (colorCount > 1 && !supportMultiple)) {
borderColors.add(DetailColors.MULTICOLOR);
}
@@ -162,7 +160,7 @@
if (item instanceof PreconDeck) {
return ((PreconDeck) item).getDescription();
}
- return item.getName();
+ return item.getName();
}
public static String formatCardName(final CardView card, final boolean canShow, final boolean forAltState) {
@@ -178,7 +176,7 @@
if (!canShow && card.getState() != CardStateName.FaceDown) {
return "";
}
- StringBuilder ptText = new StringBuilder();
+ final StringBuilder ptText = new StringBuilder();
if (card.isCreature()) {
ptText.append(card.getPower()).append(" / ").append(card.getToughness());
}
@@ -250,7 +248,7 @@
}
for (final Entry<String, String> e : Sets.union(changedColorWords.entrySet(), changedTypes.entrySet())) {
// ignore lower case and plural form keys, to avoid duplicity
- if (Character.isUpperCase(e.getKey().charAt(0)) &&
+ if (Character.isUpperCase(e.getKey().charAt(0)) &&
!CardUtil.singularTypes.containsKey(e.getKey())) {
area.append("Text changed: all instances of ");
if (e.getKey().equals("Any")) {
Index: forge-gui-desktop/src/main/java/forge/toolbox/FHyperlink.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FHyperlink.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FHyperlink.java (revision 29317)
@@ -1,27 +1,31 @@
package forge.toolbox;
-import forge.UiCommand;
-
-import javax.swing.*;
-import java.awt.*;
+import java.awt.Cursor;
+import java.awt.Desktop;
+import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.net.URI;
import java.net.URISyntaxException;
+import javax.swing.SwingWorker;
+import forge.UiCommand;
+
+
@SuppressWarnings("serial")
public class FHyperlink extends FLabel {
public static class Builder extends FLabel.Builder {
private String bldUrl;
-
+
public Builder() {
bldHoverable = true;
bldReactOnMouseDown = true;
bldCmd = null;
}
-
+
+ @Override
public FHyperlink build() {
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("<html><a href='").append(bldUrl).append("'>");
sb.append((null == bldText || bldText.isEmpty()) ? bldUrl : bldText);
sb.append("</a></html>");
@@ -33,15 +37,15 @@
else {
tooltip(bldUrl + " (click to copy to clipboard)");
}
-
+
final URI uri;
try {
uri = new URI(bldUrl);
}
- catch (URISyntaxException e) {
+ catch (final URISyntaxException e) {
throw new RuntimeException(e);
}
-
+
// overwrite whatever command is there -- we could chain them if we wanted to, though
cmdClick(new UiCommand() {
@Override
@@ -52,11 +56,11 @@
}
else {
// copy link to clipboard
- StringSelection ss = new StringSelection(bldUrl);
+ final StringSelection ss = new StringSelection(bldUrl);
try {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
}
- catch (IllegalStateException ex) {
+ catch (final IllegalStateException ex) {
FOptionPane.showErrorDialog(
"Sorry, a problem occurred while copying this link to your system clipboard.",
"A problem occurred");
@@ -64,12 +68,12 @@
}
}
});
-
+
return new FHyperlink(this);
}
-
+
- public Builder url(String url) { bldUrl = url; return this; }
+ public Builder url(final String url) { bldUrl = url; return this; }
-
+
private static boolean _isBrowsingSupported() {
if (!Desktop.isDesktopSupported()) {
return false;
@@ -77,18 +81,18 @@
return Desktop.getDesktop().isSupported(Desktop.Action.BROWSE);
}
}
-
+
// Call this using FLabel.Builder()...
private FHyperlink(final Builder b) {
super(b);
-
+
setCursor(new Cursor(Cursor.HAND_CURSOR));
}
private static class _LinkRunner extends SwingWorker<Void, Void> {
private final URI uri;
- private _LinkRunner(URI u) {
+ private _LinkRunner(final URI u) {
if (u == null) {
throw new NullPointerException();
}
Index: forge-gui/src/main/java/forge/match/input/InputSelectEntitiesFromList.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/input/InputSelectEntitiesFromList.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/input/InputSelectEntitiesFromList.java (revision 29317)
@@ -36,7 +36,7 @@
}
@Override
- public String getActivateAction(Card card) {
+ public String getActivateAction(final Card card) {
if (validChoices.contains(card)) {
if (selected.contains(card)) {
return "unselect card";
@@ -54,17 +54,18 @@
refresh();
}
+ @Override
public final Collection<T> getSelected() {
return selected;
}
@SuppressWarnings("unchecked")
- protected boolean selectEntity(GameEntity c) {
+ protected boolean selectEntity(final GameEntity c) {
if (!validChoices.contains(c)) {
return false;
}
- boolean entityWasSelected = selected.contains(c);
+ final boolean entityWasSelected = selected.contains(c);
if (entityWasSelected) {
selected.remove(c);
}
@@ -77,9 +78,12 @@
}
// might re-define later
+ @Override
protected boolean hasEnoughTargets() { return selected.size() >= min; }
+ @Override
protected boolean hasAllTargets() { return selected.size() >= max; }
+ @Override
protected String getMessage() {
return max == Integer.MAX_VALUE
? String.format(message, selected.size())
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CDeckgen.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CDeckgen.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CDeckgen.java (revision 29317)
@@ -4,15 +4,19 @@
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
-import forge.UiCommand;
import forge.Singletons;
+import forge.UiCommand;
import forge.card.CardDb;
import forge.card.CardRulesPredicates;
import forge.card.MagicColor;
import forge.deck.Deck;
import forge.deck.DeckBase;
import forge.deck.DeckFormat;
-import forge.deck.generation.*;
+import forge.deck.generation.DeckGenerator2Color;
+import forge.deck.generation.DeckGenerator3Color;
+import forge.deck.generation.DeckGenerator5Color;
+import forge.deck.generation.DeckGeneratorBase;
+import forge.deck.generation.DeckGeneratorMonoColor;
import forge.gui.framework.ICDoc;
import forge.item.InventoryItem;
import forge.item.PaperCard;
@@ -24,9 +28,9 @@
import forge.util.Aggregates;
-/**
+/**
* Controls the "analysis" panel in the deck editor UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -36,15 +40,7 @@
//========== Overridden methods
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
@Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
-
- @Override
public void register() {
}
@@ -94,11 +90,11 @@
final Deck randomDeck = new Deck();
- Predicate<PaperCard> notBasicLand = Predicates.not(Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, PaperCard.FN_GET_RULES));
- Iterable<PaperCard> source = Iterables.filter(FModel.getMagicDb().getCommonCards().getUniqueCards(), notBasicLand);
+ final Predicate<PaperCard> notBasicLand = Predicates.not(Predicates.compose(CardRulesPredicates.Presets.IS_BASIC_LAND, PaperCard.FN_GET_RULES));
+ final Iterable<PaperCard> source = Iterables.filter(FModel.getMagicDb().getCommonCards().getUniqueCards(), notBasicLand);
randomDeck.getMain().addAllFlat(Aggregates.random(source, 15 * 5));
- for(String landName : MagicColor.Constant.BASIC_LANDS) {
+ for(final String landName : MagicColor.Constant.BASIC_LANDS) {
randomDeck.getMain().add(landName, 1);
}
randomDeck.getMain().add("Terramorphic Expanse", 1);
@@ -114,15 +110,15 @@
if (!SEditorIO.confirmSaveChanges(Singletons.getControl().getCurrentScreen(), true)) { return; }
final Deck genConstructed = new Deck();
- CardDb cardDb = FModel.getMagicDb().getCommonCards();
+ final CardDb cardDb = FModel.getMagicDb().getCommonCards();
DeckGeneratorBase gen = null;
switch (colorCount0) {
- case 1: gen = new DeckGeneratorMonoColor(cardDb, DeckFormat.Constructed, null); break;
- case 2: gen = new DeckGenerator2Color(cardDb, DeckFormat.Constructed, null, null); break;
- case 3: gen = new DeckGenerator3Color(cardDb, DeckFormat.Constructed, null, null, null); break;
- case 5: gen = new DeckGenerator5Color(cardDb, DeckFormat.Constructed); break;
+ case 1: gen = new DeckGeneratorMonoColor(cardDb, DeckFormat.Constructed, null); break;
+ case 2: gen = new DeckGenerator2Color(cardDb, DeckFormat.Constructed, null, null); break;
+ case 3: gen = new DeckGenerator3Color(cardDb, DeckFormat.Constructed, null, null, null); break;
+ case 5: gen = new DeckGenerator5Color(cardDb, DeckFormat.Constructed); break;
}
-
+
if( null != gen ) {
gen.setSingleton(FModel.getPreferences().getPrefBoolean(FPref.DECKGEN_SINGLETONS));
gen.setUseArtifacts(!FModel.getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS));
Index: forge-gui-desktop/src/main/java/forge/gui/WrapLayout.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/WrapLayout.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/WrapLayout.java (revision 29317)
@@ -1,149 +1,155 @@
package forge.gui;
-import javax.swing.*;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Insets;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+
/**
* FlowLayout subclass that fully supports wrapping of components.
*/
@SuppressWarnings("serial")
public class WrapLayout extends FlowLayout {
/**
- * Constructs a new <code>WrapLayout</code> with a left
- * alignment and a default 5-unit horizontal and vertical gap.
- */
+ * Constructs a new <code>WrapLayout</code> with a left
+ * alignment and a default 5-unit horizontal and vertical gap.
+ */
public WrapLayout() {
super();
}
/**
- * Constructs a new <code>FlowLayout</code> with the specified
- * alignment and a default 5-unit horizontal and vertical gap.
- * The value of the alignment argument must be one of
- * <code>FlowLayout.LEFT</code>, <code>FlowLayout.CENTER</code>,
- * or <code>FlowLayout.RIGHT</code>.
- * @param align the alignment value
- */
+ * Constructs a new <code>FlowLayout</code> with the specified
+ * alignment and a default 5-unit horizontal and vertical gap.
+ * The value of the alignment argument must be one of
+ * <code>FlowLayout.LEFT</code>, <code>FlowLayout.CENTER</code>,
+ * or <code>FlowLayout.RIGHT</code>.
+ * @param align the alignment value
+ */
- public WrapLayout(int align) {
+ public WrapLayout(final int align) {
super(align);
}
/**
- * Creates a new flow layout manager with the indicated alignment
- * and the indicated horizontal and vertical gaps.
- * <p>
- * The value of the alignment argument must be one of
- * <code>FlowLayout.LEFT</code>, <code>FlowLayout.CENTER</code>,
- * or <code>FlowLayout.RIGHT</code>.
- * @param align the alignment value
- * @param hgap the horizontal gap between components
- * @param vgap the vertical gap between components
- */
+ * Creates a new flow layout manager with the indicated alignment
+ * and the indicated horizontal and vertical gaps.
+ * <p>
+ * The value of the alignment argument must be one of
+ * <code>FlowLayout.LEFT</code>, <code>FlowLayout.CENTER</code>,
+ * or <code>FlowLayout.RIGHT</code>.
+ * @param align the alignment value
+ * @param hgap the horizontal gap between components
+ * @param vgap the vertical gap between components
+ */
- public WrapLayout(int align, int hgap, int vgap) {
+ public WrapLayout(final int align, final int hgap, final int vgap) {
super(align, hgap, vgap);
}
/**
- * Returns the preferred dimensions for this layout given the
- * <i>visible</i> components in the specified target container.
- * @param target the component which needs to be laid out
+ * Returns the preferred dimensions for this layout given the
+ * <i>visible</i> components in the specified target container.
+ * @param target the component which needs to be laid out
* @return the preferred dimensions to lay out the
- * subcomponents of the specified container
- */
+ * subcomponents of the specified container
+ */
@Override
- public Dimension preferredLayoutSize(Container target) {
+ public Dimension preferredLayoutSize(final Container target) {
return layoutSize(target, true);
}
/**
- * Returns the minimum dimensions needed to layout the <i>visible</i>
- * components contained in the specified target container.
- * @param target the component which needs to be laid out
- * @return the minimum dimensions to lay out the
- * subcomponents of the specified container
- */
+ * Returns the minimum dimensions needed to layout the <i>visible</i>
+ * components contained in the specified target container.
+ * @param target the component which needs to be laid out
+ * @return the minimum dimensions to lay out the
+ * subcomponents of the specified container
+ */
@Override
- public Dimension minimumLayoutSize(Container target) {
- Dimension minimum = layoutSize(target, false);
+ public Dimension minimumLayoutSize(final Container target) {
+ final Dimension minimum = layoutSize(target, false);
minimum.width -= (getHgap() + 1);
return minimum;
}
/**
- * Returns the minimum or preferred dimension needed to layout the target
- * container.
- *
- * @param target target to get layout size for
- * @param preferred should preferred size be calculated
- * @return the dimension to layout the target container
- */
+ * Returns the minimum or preferred dimension needed to layout the target
+ * container.
+ *
+ * @param target target to get layout size for
+ * @param preferred should preferred size be calculated
+ * @return the dimension to layout the target container
+ */
- private Dimension layoutSize(Container target, boolean preferred) {
+ private Dimension layoutSize(final Container target, final boolean preferred) {
- synchronized (target.getTreeLock()) {
- // Each row must fit with the width allocated to the container.
- // When the container width = 0, the preferred width of the container
- // has not yet been calculated so we use a width guaranteed to be less
- // than we need so that it gets recalculated later when the widget is
- // shown.
-
+ synchronized (target.getTreeLock()) {
+ // Each row must fit with the width allocated to the container.
+ // When the container width = 0, the preferred width of the container
+ // has not yet been calculated so we use a width guaranteed to be less
+ // than we need so that it gets recalculated later when the widget is
+ // shown.
+
- int hgap = getHgap();
- Insets insets = target.getInsets();
- int horizontalInsetsAndGap = insets.left + insets.right + (hgap * 2);
- int targetWidth = Math.max(horizontalInsetsAndGap, target.getSize().width);
- int maxWidth = targetWidth - horizontalInsetsAndGap;
+ final int hgap = getHgap();
+ final Insets insets = target.getInsets();
+ final int horizontalInsetsAndGap = insets.left + insets.right + (hgap * 2);
+ final int targetWidth = Math.max(horizontalInsetsAndGap, target.getSize().width);
+ final int maxWidth = targetWidth - horizontalInsetsAndGap;
-
- // Fit components into the allowed width
+
+ // Fit components into the allowed width
- Dimension dim = new Dimension(0, 0);
+ final Dimension dim = new Dimension(0, 0);
- int rowWidth = 0;
- int rowHeight = 0;
-
- final int nmembers = target.getComponentCount();
- for (int i = 0; i < nmembers; i++) {
+ int rowWidth = 0;
+ int rowHeight = 0;
+
+ final int nmembers = target.getComponentCount();
+ for (int i = 0; i < nmembers; i++) {
- Component m = target.getComponent(i);
+ final Component m = target.getComponent(i);
- if (!m.isVisible()) {
- continue;
- }
-
+ if (!m.isVisible()) {
+ continue;
+ }
+
- Dimension d = preferred ? m.getPreferredSize() : m.getMinimumSize();
+ final Dimension d = preferred ? m.getPreferredSize() : m.getMinimumSize();
- // can't add the component to current row. Start a new row if
- // there's at least one component in this row.
- if (0 < rowWidth && rowWidth + d.width > maxWidth) {
- addRow(dim, rowWidth, rowHeight);
- rowWidth = 0;
- rowHeight = 0;
- }
+ // can't add the component to current row. Start a new row if
+ // there's at least one component in this row.
+ if (0 < rowWidth && rowWidth + d.width > maxWidth) {
+ addRow(dim, rowWidth, rowHeight);
+ rowWidth = 0;
+ rowHeight = 0;
+ }
- // Add a horizontal gap for all components after the first
- if (rowWidth != 0) {
- rowWidth += hgap;
- }
+ // Add a horizontal gap for all components after the first
+ if (rowWidth != 0) {
+ rowWidth += hgap;
+ }
- rowWidth += d.width;
- rowHeight = Math.max(rowHeight, d.height);
- }
+ rowWidth += d.width;
+ rowHeight = Math.max(rowHeight, d.height);
+ }
- // add last row
- addRow(dim, rowWidth, rowHeight);
+ // add last row
+ addRow(dim, rowWidth, rowHeight);
- dim.width += horizontalInsetsAndGap;
- dim.height += insets.top + insets.bottom + getVgap() * 2;
+ dim.width += horizontalInsetsAndGap;
+ dim.height += insets.top + insets.bottom + getVgap() * 2;
- // When using a scroll pane or the DecoratedLookAndFeel we need to
- // make sure the preferred size is less than the size of the
- // target container so shrinking the container size works
- // correctly. Removing the horizontal gap is an easy way to do this.
+ // When using a scroll pane or the DecoratedLookAndFeel we need to
+ // make sure the preferred size is less than the size of the
+ // target container so shrinking the container size works
+ // correctly. Removing the horizontal gap is an easy way to do this.
- Container scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane.class, target);
+ final Container scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane.class, target);
- if (scrollPane != null) {
- dim.width -= (hgap + 1);
- }
-
- return dim;
- }
+ if (scrollPane != null) {
+ dim.width -= (hgap + 1);
+ }
+
+ return dim;
+ }
}
-
+
/*
* A new row has been completed. Use the dimensions of this row
* to update the preferred size for the container.
@@ -152,9 +158,9 @@
* @param rowWidth the width of the row to add
* @param rowHeight the height of the row to add
*/
- private void addRow(Dimension dim, int rowWidth, int rowHeight) {
+ private void addRow(final Dimension dim, final int rowWidth, final int rowHeight) {
dim.width = Math.max(dim.width, rowWidth);
-
+
if (dim.height > 0) {
dim.height += getVgap();
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/FTextPane.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FTextPane.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FTextPane.java (revision 29317)
@@ -1,18 +1,18 @@
package forge.toolbox;
-import forge.toolbox.FSkin.SkinnedTextPane;
-
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
+import forge.toolbox.FSkin.SkinnedTextPane;
+
-/**
+/**
* A custom instance of JTextArea using Forge skin properties.
*
*/
@SuppressWarnings("serial")
public class FTextPane extends SkinnedTextPane {
- /** */
+
public FTextPane() {
super();
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
@@ -21,16 +21,16 @@
this.setFocusable(false);
this.setEditable(false);
}
- /** @param str {@java.lang.String} */
+
public FTextPane(final String str) {
this();
this.setText(str);
}
//Use constant in StyleConstants
- public void setTextAlignment(int alignment) {
- StyledDocument doc = getStyledDocument();
- SimpleAttributeSet attrSet = new SimpleAttributeSet();
+ public void setTextAlignment(final int alignment) {
+ final StyledDocument doc = getStyledDocument();
+ final SimpleAttributeSet attrSet = new SimpleAttributeSet();
StyleConstants.setAlignment(attrSet, alignment);
doc.setParagraphAttributes(0, doc.getLength(), attrSet, false);
}
Index: forge-gui-desktop/src/main/java/forge/gui/ImportSourceAnalyzer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/ImportSourceAnalyzer.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/ImportSourceAnalyzer.java (revision 29317)
@@ -6,17 +6,26 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.gui;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
@@ -29,15 +38,6 @@
import forge.util.FileUtil;
import forge.util.ImageUtil;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.tuple.Pair;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TreeMap;
-
public class ImportSourceAnalyzer {
public static enum OpType {
CONSTRUCTED_DECK,
@@ -56,37 +56,37 @@
PREFERENCE_FILE,
DB_FILE
}
-
+
public static interface AnalysisCallback {
boolean checkCancel();
void addOp(OpType type, File src, File dest);
}
-
+
private final File _source;
private final AnalysisCallback _cb;
private final int _numFilesToAnalyze;
-
+
private int _numFilesAnalyzed;
-
+
- public ImportSourceAnalyzer(String source, AnalysisCallback cb) {
+ public ImportSourceAnalyzer(final String source, final AnalysisCallback cb) {
_source = new File(source);
_cb = cb;
_numFilesToAnalyze = _countFiles(_source);
}
-
+
public int getNumFilesToAnalyze() { return _numFilesToAnalyze; }
public int getNumFilesAnalyzed() { return _numFilesAnalyzed; }
-
+
public void doAnalysis() {
_identifyAndAnalyze(_source);
}
-
+
- private void _identifyAndAnalyze(File root) {
+ private void _identifyAndAnalyze(final File root) {
// see if we can figure out the likely identity of the source folder and
// dispatch to the best analysis subroutine to handle it
- String dirname = root.getName();
+ final String dirname = root.getName();
-
+
if ("res".equalsIgnoreCase(dirname)) { _analyzeOldResDir(root); }
else if ("constructed".equalsIgnoreCase(dirname)) { _analyzeConstructedDeckDir(root); }
else if ("draft".equalsIgnoreCase(dirname)) { _analyzeDraftDeckDir(root); }
@@ -104,11 +104,11 @@
else {
// look at files in directory and make a semi-educated guess based on file extensions
int numUnhandledFiles = 0;
- for (File file : root.listFiles()) {
+ for (final File file : root.listFiles()) {
if (_cb.checkCancel()) { return; }
if (file.isFile()) {
- String filename = file.getName();
+ final String filename = file.getName();
if (StringUtils.endsWithIgnoreCase(filename, ".dck")) {
_analyzeDecksDir(root);
numUnhandledFiles = 0;
@@ -118,7 +118,7 @@
numUnhandledFiles = 0;
break;
}
-
+
++numUnhandledFiles;
} else if (file.isDirectory()) {
_identifyAndAnalyze(file);
@@ -127,15 +127,15 @@
_numFilesAnalyzed += numUnhandledFiles;
}
}
-
+
//////////////////////////////////////////////////////////////////////////
// pre-profile res dir
//
-
+
- private void _analyzeOldResDir(File root) {
+ private void _analyzeOldResDir(final File root) {
_analyzeDir(root, new _Analyzer() {
- @Override boolean onDir(File dir) {
- String dirname = dir.getName();
+ @Override boolean onDir(final File dir) {
+ final String dirname = dir.getName();
if ("decks".equalsIgnoreCase(dirname)) {
_analyzeDecksDir(dir);
} else if ("gauntlet".equalsIgnoreCase(dirname)) {
@@ -161,20 +161,20 @@
//////////////////////////////////////////////////////////////////////////
// decks
//
-
+
- private void _analyzeDecksDir(File root) {
+ private void _analyzeDecksDir(final File root) {
_analyzeDir(root, new _Analyzer() {
- @Override void onFile(File file) {
+ @Override void onFile(final File file) {
// we don't really expect any files in here, but if we find a .dck file, add it to the unknown list
- String filename = file.getName();
+ final String filename = file.getName();
if (StringUtils.endsWithIgnoreCase(filename, ".dck")) {
- File targetFile = new File(_lcaseExt(filename));
+ final File targetFile = new File(_lcaseExt(filename));
_cb.addOp(OpType.UNKNOWN_DECK, file, targetFile);
}
}
-
+
- @Override boolean onDir(File dir) {
- String dirname = dir.getName();
+ @Override boolean onDir(final File dir) {
+ final String dirname = dir.getName();
if ("constructed".equalsIgnoreCase(dirname)) {
_analyzeConstructedDeckDir(dir);
} else if ("cube".equalsIgnoreCase(dirname)) {
@@ -194,58 +194,58 @@
}
});
}
-
+
- private void _analyzeConstructedDeckDir(File root) {
+ private void _analyzeConstructedDeckDir(final File root) {
_analyzeKnownDeckDir(root, ForgeConstants.DECK_CONSTRUCTED_DIR, OpType.CONSTRUCTED_DECK);
}
-
+
- private void _analyzeDraftDeckDir(File root) {
+ private void _analyzeDraftDeckDir(final File root) {
_analyzeKnownDeckDir(root, ForgeConstants.DECK_DRAFT_DIR, OpType.DRAFT_DECK);
}
-
+
- private void _analyzePlanarDeckDir(File root) {
+ private void _analyzePlanarDeckDir(final File root) {
_analyzeKnownDeckDir(root, ForgeConstants.DECK_PLANE_DIR, OpType.PLANAR_DECK);
}
-
+
- private void _analyzeSchemeDeckDir(File root) {
+ private void _analyzeSchemeDeckDir(final File root) {
_analyzeKnownDeckDir(root, ForgeConstants.DECK_SCHEME_DIR, OpType.SCHEME_DECK);
}
-
+
- private void _analyzeSealedDeckDir(File root) {
+ private void _analyzeSealedDeckDir(final File root) {
_analyzeKnownDeckDir(root, ForgeConstants.DECK_SEALED_DIR, OpType.SEALED_DECK);
}
-
+
- private void _analyzeKnownDeckDir(File root, final String targetDir, final OpType opType) {
+ private void _analyzeKnownDeckDir(final File root, final String targetDir, final OpType opType) {
_analyzeDir(root, new _Analyzer() {
- @Override void onFile(File file) {
- String filename = file.getName();
+ @Override void onFile(final File file) {
+ final String filename = file.getName();
if (StringUtils.endsWithIgnoreCase(filename, ".dck")) {
- File targetFile = new File(targetDir, _lcaseExt(filename));
+ final File targetFile = new File(targetDir, _lcaseExt(filename));
if (!file.equals(targetFile)) {
_cb.addOp(opType, file, targetFile);
}
}
}
-
+
- @Override boolean onDir(File dir) {
+ @Override boolean onDir(final File dir) {
// if there's a dir beneath a known directory, assume the same kind of decks are in there
_analyzeKnownDeckDir(dir, targetDir, opType);
return true;
}
});
}
-
+
//////////////////////////////////////////////////////////////////////////
// gauntlet
//
-
+
- private void _analyzeGauntletDataDir(File root) {
+ private void _analyzeGauntletDataDir(final File root) {
_analyzeDir(root, new _Analyzer() {
- @Override void onFile(File file) {
+ @Override void onFile(final File file) {
// find *.dat files, but exclude LOCKED_*
- String filename = file.getName();
+ final String filename = file.getName();
if (StringUtils.endsWithIgnoreCase(filename, ".dat") && !filename.startsWith("LOCKED_")) {
- File targetFile = new File(ForgeConstants.GAUNTLET_DIR.userPrefLoc, _lcaseExt(filename));
+ final File targetFile = new File(ForgeConstants.GAUNTLET_DIR.userPrefLoc, _lcaseExt(filename));
if (!file.equals(targetFile)) {
_cb.addOp(OpType.GAUNTLET_DATA, file, targetFile);
}
@@ -253,100 +253,104 @@
}
});
}
-
+
//////////////////////////////////////////////////////////////////////////
// layouts
//
-
+
- private void _analyzeLayoutsDir(File root) {
+ private void _analyzeLayoutsDir(final File root) {
_analyzeDir(root, new _Analyzer() {
- @Override void onFile(File file) {
+ @Override void onFile(final File file) {
// find *_preferred.xml files
- String filename = file.getName();
+ final String filename = file.getName();
if (StringUtils.endsWithIgnoreCase(filename, "_preferred.xml")) {
- File targetFile = new File(ForgeConstants.USER_PREFS_DIR,
+ final File targetFile = new File(ForgeConstants.USER_PREFS_DIR,
file.getName().toLowerCase(Locale.ENGLISH).replace("_preferred", ""));
_cb.addOp(OpType.PREFERENCE_FILE, file, targetFile);
}
}
});
}
-
+
//////////////////////////////////////////////////////////////////////////
// default card pics
//
-
+
- private static String _oldCleanString(String in) {
+ private static String _oldCleanString(final String in) {
final StringBuffer out = new StringBuffer();
for (int i = 0; i < in.length(); i++) {
- char c = in.charAt(i);
+ final char c = in.charAt(i);
if ((c == ' ') || (c == '-')) {
out.append('_');
} else if (Character.isLetterOrDigit(c) || (c == '_')) {
out.append(c);
}
}
-
+
// usually we would want to pass Locale.ENGLISH to the toLowerCase() method to prevent unintentional
// character mangling on some system locales, but we want to replicate the old code here exactly
return out.toString().toLowerCase();
}
-
+
- private void _addDefaultPicNames(PaperCard c, boolean backFace) {
- CardRules card = c.getRules();
- String urls = card.getPictureUrl(backFace);
+ private void _addDefaultPicNames(final PaperCard c, final boolean backFace) {
+ final CardRules card = c.getRules();
+ final String urls = card.getPictureUrl(backFace);
if (StringUtils.isEmpty(urls)) { return; }
- int numPics = 1 + StringUtils.countMatches(urls, "\\");
+ final int numPics = 1 + StringUtils.countMatches(urls, "\\");
if (c.getArtIndex() > numPics) {
return;
}
- String filenameBase = ImageUtil.getImageKey(c, backFace, false);
- String filename = filenameBase + ".jpg";
- boolean alreadyHadIt = null != _defaultPicNames.put(filename, filename);
- if ( alreadyHadIt ) return;
+ final String filenameBase = ImageUtil.getImageKey(c, backFace, false);
+ final String filename = filenameBase + ".jpg";
+ final boolean alreadyHadIt = null != _defaultPicNames.put(filename, filename);
+ if ( alreadyHadIt ) {
+ return;
+ }
-
+
// Do you shift artIndex by one here?
- String newLastSymbol = 0 == c.getArtIndex() ? "" : String.valueOf(c.getArtIndex() /* + 1 */);
- String oldFilename = _oldCleanString(filenameBase.replaceAll("[0-9]?(\\.full)?$", "")) + newLastSymbol + ".jpg";
+ final String newLastSymbol = 0 == c.getArtIndex() ? "" : String.valueOf(c.getArtIndex() /* + 1 */);
+ final String oldFilename = _oldCleanString(filenameBase.replaceAll("[0-9]?(\\.full)?$", "")) + newLastSymbol + ".jpg";
//if ( numPics > 1 )
//System.out.printf("Will move %s -> %s%n", oldFilename, filename);
_defaultPicOldNameToCurrentName.put(oldFilename, filename);
}
-
+
private Map<String, String> _defaultPicNames;
private Map<String, String> _defaultPicOldNameToCurrentName;
- private void _analyzeCardPicsDir(File root) {
+ private void _analyzeCardPicsDir(final File root) {
if (null == _defaultPicNames) {
_defaultPicNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
_defaultPicOldNameToCurrentName = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
- for (PaperCard c : FModel.getMagicDb().getCommonCards().getAllCards()) {
+ for (final PaperCard c : FModel.getMagicDb().getCommonCards().getAllCards()) {
_addDefaultPicNames(c, false);
if (ImageUtil.hasBackFacePicture(c)) {
_addDefaultPicNames(c, true);
}
}
-
+
- for (PaperCard c : FModel.getMagicDb().getVariantCards().getAllCards()) {
+ for (final PaperCard c : FModel.getMagicDb().getVariantCards().getAllCards()) {
_addDefaultPicNames(c, false);
// variants never have backfaces
}
}
-
+
_analyzeListedDir(root, ForgeConstants.CACHE_CARD_PICS_DIR, new _ListedAnalyzer() {
- @Override public String map(String filename) {
+ @Override public String map(final String filename) {
if (_defaultPicOldNameToCurrentName.containsKey(filename)) {
return _defaultPicOldNameToCurrentName.get(filename);
}
return _defaultPicNames.get(filename);
}
-
+
- @Override public OpType getOpType(String filename) { return OpType.DEFAULT_CARD_PIC; }
+ @Override public OpType getOpType(final String filename) {
+ return OpType.DEFAULT_CARD_PIC;
+ }
-
+
- @Override boolean onDir(File dir) {
+ @Override boolean onDir(final File dir) {
if ("icons".equalsIgnoreCase(dir.getName())) {
_analyzeIconsPicsDir(dir);
} else if ("tokens".equalsIgnoreCase(dir.getName())) {
@@ -355,16 +359,16 @@
_analyzeCardPicsSetDir(dir);
}
return true;
- }
+ }
});
}
//////////////////////////////////////////////////////////////////////////
// set card pics
//
-
+
- private static void _addSetCards(Map<String, String> cardFileNames, Iterable<PaperCard> library, Predicate<PaperCard> filter) {
- for (PaperCard c : Iterables.filter(library, filter)) {
+ private static void _addSetCards(final Map<String, String> cardFileNames, final Iterable<PaperCard> library, final Predicate<PaperCard> filter) {
+ for (final PaperCard c : Iterables.filter(library, filter)) {
String filename = ImageUtil.getImageKey(c, false, true) + ".jpg";
cardFileNames.put(filename, filename);
if (ImageUtil.hasBackFacePicture(c)) {
@@ -373,30 +377,30 @@
}
}
}
-
+
Map<String, Map<String, String>> _cardFileNamesBySet;
Map<String, String> _nameUpdates;
- private void _analyzeCardPicsSetDir(File root) {
+ private void _analyzeCardPicsSetDir(final File root) {
if (null == _cardFileNamesBySet) {
_cardFileNamesBySet = new TreeMap<String, Map<String, String>>(String.CASE_INSENSITIVE_ORDER);
- for (CardEdition ce : FModel.getMagicDb().getEditions()) {
- Map<String, String> cardFileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
- Predicate<PaperCard> filter = IPaperCard.Predicates.printedInSet(ce.getCode());
+ for (final CardEdition ce : FModel.getMagicDb().getEditions()) {
+ final Map<String, String> cardFileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
+ final Predicate<PaperCard> filter = IPaperCard.Predicates.printedInSet(ce.getCode());
_addSetCards(cardFileNames, FModel.getMagicDb().getCommonCards().getAllCards(), filter);
_addSetCards(cardFileNames, FModel.getMagicDb().getVariantCards().getAllCards(), filter);
_cardFileNamesBySet.put(ce.getCode2(), cardFileNames);
}
-
+
// planar cards now don't have the ".full" part in their filenames
_nameUpdates = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
- Predicate<PaperCard> predPlanes = new Predicate<PaperCard>() {
+ final Predicate<PaperCard> predPlanes = new Predicate<PaperCard>() {
@Override
- public boolean apply(PaperCard arg0) {
+ public boolean apply(final PaperCard arg0) {
return arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon();
}
};
- for (PaperCard c : Iterables.filter(FModel.getMagicDb().getVariantCards().getAllCards(), predPlanes)) {
+ for (final PaperCard c : Iterables.filter(FModel.getMagicDb().getVariantCards().getAllCards(), predPlanes)) {
String baseName = ImageUtil.getImageKey(c,false, true);
_nameUpdates.put(baseName + ".full.jpg", baseName + ".jpg");
if (ImageUtil.hasBackFacePicture(c)) {
@@ -406,15 +410,15 @@
}
}
- CardEdition.Collection editions = FModel.getMagicDb().getEditions();
- String editionCode = root.getName();
- CardEdition edition = editions.get(editionCode);
+ final CardEdition.Collection editions = FModel.getMagicDb().getEditions();
+ final String editionCode = root.getName();
+ final CardEdition edition = editions.get(editionCode);
if (null == edition) {
// not a valid set name, skip
_numFilesAnalyzed += _countFiles(root);
return;
}
-
+
final String editionCode2 = edition.getCode2();
final Map<String, String> validFilenames = _cardFileNamesBySet.get(editionCode2);
_analyzeListedDir(root, ForgeConstants.CACHE_CARD_PICS_DIR, new _ListedAnalyzer() {
@@ -424,14 +428,14 @@
filename = _nameUpdates.get(filename);
}
if (validFilenames.containsKey(filename)) {
- return validFilenames.get(filename);
+ return validFilenames.get(filename);
} else if (StringUtils.endsWithIgnoreCase(filename, ".jpg")
|| StringUtils.endsWithIgnoreCase(filename, ".png")) {
return filename;
}
return null;
}
- @Override public OpType getOpType(String filename) {
+ @Override public OpType getOpType(final String filename) {
return validFilenames.containsKey(filename) ? OpType.SET_CARD_PIC : OpType.POSSIBLE_SET_CARD_PIC;
}
});
@@ -442,54 +446,54 @@
//
Map<String, String> _iconFileNames;
- private void _analyzeIconsPicsDir(File root) {
+ private void _analyzeIconsPicsDir(final File root) {
if (null == _iconFileNames) {
_iconFileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
- for (Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_QUEST_OPPONENT_ICONS_FILE)) {
+ for (final Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_QUEST_OPPONENT_ICONS_FILE)) {
_iconFileNames.put(nameurl.getLeft(), nameurl.getLeft());
}
- for (Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_QUEST_PET_SHOP_ICONS_FILE)) {
+ for (final Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_QUEST_PET_SHOP_ICONS_FILE)) {
_iconFileNames.put(nameurl.getLeft(), nameurl.getLeft());
}
}
_analyzeListedDir(root, ForgeConstants.CACHE_ICON_PICS_DIR, new _ListedAnalyzer() {
- @Override public String map(String filename) { return _iconFileNames.containsKey(filename) ? _iconFileNames.get(filename) : null; }
- @Override public OpType getOpType(String filename) { return OpType.QUEST_PIC; }
+ @Override public String map(final String filename) { return _iconFileNames.containsKey(filename) ? _iconFileNames.get(filename) : null; }
+ @Override public OpType getOpType(final String filename) { return OpType.QUEST_PIC; }
});
}
-
+
Map<String, String> _tokenFileNames;
Map<String, String> _questTokenFileNames;
- private void _analyzeTokenPicsDir(File root) {
+ private void _analyzeTokenPicsDir(final File root) {
if (null == _tokenFileNames) {
_tokenFileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
_questTokenFileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
- for (Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_TOKENS_FILE)) {
+ for (final Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_TOKENS_FILE)) {
_tokenFileNames.put(nameurl.getLeft(), nameurl.getLeft());
}
- for (Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_QUEST_TOKENS_FILE)) {
+ for (final Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_QUEST_TOKENS_FILE)) {
_questTokenFileNames.put(nameurl.getLeft(), nameurl.getLeft());
}
}
-
+
_analyzeListedDir(root, ForgeConstants.CACHE_TOKEN_PICS_DIR, new _ListedAnalyzer() {
- @Override public String map(String filename) {
+ @Override public String map(final String filename) {
if (_questTokenFileNames.containsKey(filename)) { return _questTokenFileNames.get(filename); }
if (_tokenFileNames.containsKey(filename)) { return _tokenFileNames.get(filename); }
return null;
}
- @Override public OpType getOpType(String filename) {
+ @Override public OpType getOpType(final String filename) {
return _questTokenFileNames.containsKey(filename) ? OpType.QUEST_PIC : OpType.TOKEN_PIC;
}
});
}
-
+
- private void _analyzeProductPicsDir(File root) {
+ private void _analyzeProductPicsDir(final File root) {
// we don't care about the files in the root dir -- the new booster files are .png, not the current .jpg ones
_analyzeDir(root, new _Analyzer() {
- @Override boolean onDir(File dir) {
- String dirName = dir.getName();
+ @Override boolean onDir(final File dir) {
+ final String dirName = dir.getName();
if ("booster".equalsIgnoreCase(dirName)) {
_analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_BOOSTERS_FILE, ForgeConstants.CACHE_BOOSTER_PICS_DIR, OpType.QUEST_PIC);
} else if ("fatpacks".equalsIgnoreCase(dirName)) {
@@ -507,17 +511,17 @@
}
});
}
-
+
//////////////////////////////////////////////////////////////////////////
// preferences
//
-
+
- private void _analyzePreferencesDir(File root) {
+ private void _analyzePreferencesDir(final File root) {
_analyzeDir(root, new _Analyzer() {
- @Override void onFile(File file) {
- String filename = file.getName();
+ @Override void onFile(final File file) {
+ final String filename = file.getName();
if ("editor.preferences".equalsIgnoreCase(filename) || "forge.preferences".equalsIgnoreCase(filename)) {
- File targetFile = new File(ForgeConstants.USER_PREFS_DIR, filename.toLowerCase(Locale.ENGLISH));
+ final File targetFile = new File(ForgeConstants.USER_PREFS_DIR, filename.toLowerCase(Locale.ENGLISH));
if (!file.equals(targetFile)) {
_cb.addOp(OpType.PREFERENCE_FILE, file, targetFile);
}
@@ -525,23 +529,23 @@
}
});
}
-
+
//////////////////////////////////////////////////////////////////////////
// quest data
//
-
+
- private void _analyzeQuestDir(File root) {
+ private void _analyzeQuestDir(final File root) {
_analyzeDir(root, new _Analyzer() {
- @Override void onFile(File file) {
- String filename = file.getName();
+ @Override void onFile(final File file) {
+ final String filename = file.getName();
if ("all-prices.txt".equalsIgnoreCase(filename)) {
- File targetFile = new File(ForgeConstants.DB_DIR, filename.toLowerCase(Locale.ENGLISH));
+ final File targetFile = new File(ForgeConstants.DB_DIR, filename.toLowerCase(Locale.ENGLISH));
if (!file.equals(targetFile)) {
_cb.addOp(OpType.DB_FILE, file, targetFile);
}
}
}
- @Override boolean onDir(File dir) {
+ @Override boolean onDir(final File dir) {
if ("data".equalsIgnoreCase(dir.getName())) {
_analyzeQuestDataDir(dir);
return true;
@@ -550,13 +554,13 @@
}
});
}
-
+
- private void _analyzeQuestDataDir(File root) {
+ private void _analyzeQuestDataDir(final File root) {
_analyzeDir(root, new _Analyzer() {
- @Override void onFile(File file) {
- String filename = file.getName();
+ @Override void onFile(final File file) {
+ final String filename = file.getName();
if (StringUtils.endsWithIgnoreCase(filename, ".dat")) {
- File targetFile = new File(ForgeConstants.QUEST_SAVE_DIR, _lcaseExt(filename));
+ final File targetFile = new File(ForgeConstants.QUEST_SAVE_DIR, _lcaseExt(filename));
if (!file.equals(targetFile)) {
_cb.addOp(OpType.QUEST_DATA, file, targetFile);
}
@@ -564,20 +568,20 @@
}
});
}
-
+
//////////////////////////////////////////////////////////////////////////
// utility functions
//
-
+
private class _Analyzer {
- void onFile(File file) { }
+ void onFile(final File file) { }
// returns whether the directory has been handled
- boolean onDir(File dir) { return false; }
+ boolean onDir(final File dir) { return false; }
}
-
+
- private void _analyzeDir(File root, _Analyzer analyzer) {
- for (File file : root.listFiles()) {
+ private void _analyzeDir(final File root, final _Analyzer analyzer) {
+ for (final File file : root.listFiles()) {
if (_cb.checkCancel()) { return; }
if (file.isFile()) {
@@ -590,54 +594,54 @@
}
}
}
-
+
- private Map<String, Map<String, String>> _fileNameDb = new HashMap<String, Map<String, String>>();
- private void _analyzeSimpleListedDir(File root, String listFile, String targetDir, final OpType opType) {
+ private final Map<String, Map<String, String>> _fileNameDb = new HashMap<String, Map<String, String>>();
+ private void _analyzeSimpleListedDir(final File root, final String listFile, final String targetDir, final OpType opType) {
if (!_fileNameDb.containsKey(listFile)) {
- Map<String, String> fileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
- for (Pair<String, String> nameurl : FileUtil.readNameUrlFile(listFile)) {
+ final Map<String, String> fileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
+ for (final Pair<String, String> nameurl : FileUtil.readNameUrlFile(listFile)) {
- // we use a map instead of a set since we need to match case-insensitively but still map to the correct case
+ // we use a map instead of a set since we need to match case-insensitively but still map to the correct case
fileNames.put(nameurl.getLeft(), nameurl.getLeft());
}
_fileNameDb.put(listFile, fileNames);
}
-
+
final Map<String, String> fileDb = _fileNameDb.get(listFile);
_analyzeListedDir(root, targetDir, new _ListedAnalyzer() {
- @Override public String map(String filename) { return fileDb.containsKey(filename) ? fileDb.get(filename) : null; }
- @Override public OpType getOpType(String filename) { return opType; }
+ @Override public String map(final String filename) { return fileDb.containsKey(filename) ? fileDb.get(filename) : null; }
+ @Override public OpType getOpType(final String filename) { return opType; }
});
}
-
+
private abstract class _ListedAnalyzer {
abstract String map(String filename);
abstract OpType getOpType(String filename);
-
+
// returns whether the directory has been handled
- boolean onDir(File dir) { return false; }
+ boolean onDir(final File dir) { return false; }
}
-
+
- private void _analyzeListedDir(File root, final String targetDir, final _ListedAnalyzer listedAnalyzer) {
+ private void _analyzeListedDir(final File root, final String targetDir, final _ListedAnalyzer listedAnalyzer) {
_analyzeDir(root, new _Analyzer() {
- @Override void onFile(File file) {
- String filename = listedAnalyzer.map(file.getName());
+ @Override void onFile(final File file) {
+ final String filename = listedAnalyzer.map(file.getName());
if (null != filename) {
- File targetFile = new File(targetDir, filename);
+ final File targetFile = new File(targetDir, filename);
if (!file.equals(targetFile)) {
_cb.addOp(listedAnalyzer.getOpType(filename), file, targetFile);
}
}
}
-
+
- @Override boolean onDir(File dir) { return listedAnalyzer.onDir(dir); }
+ @Override boolean onDir(final File dir) { return listedAnalyzer.onDir(dir); }
});
}
-
+
- private int _countFiles(File root) {
+ private int _countFiles(final File root) {
int count = 0;
- for (File file : root.listFiles()) {
+ for (final File file : root.listFiles()) {
if (_cb.checkCancel()) { return 0; }
-
+
if (file.isFile()) {
++count;
} else if (file.isDirectory()) {
@@ -646,14 +650,14 @@
}
return count;
}
-
+
- private String _lcaseExt(String filename) {
- int lastDotIdx = filename.lastIndexOf('.');
+ private static String _lcaseExt(final String filename) {
+ final int lastDotIdx = filename.lastIndexOf('.');
if (0 > lastDotIdx) {
return filename;
}
- String basename = filename.substring(0, lastDotIdx);
- String ext = filename.substring(lastDotIdx).toLowerCase(Locale.ENGLISH);
+ final String basename = filename.substring(0, lastDotIdx);
+ final String ext = filename.substring(lastDotIdx).toLowerCase(Locale.ENGLISH);
if (filename.endsWith(ext)) {
return filename;
}
Index: forge-gui-desktop/src/main/java/forge/gui/GuiChoose.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/GuiChoose.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/GuiChoose.java (revision 29317)
@@ -4,7 +4,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
@@ -17,7 +16,6 @@
import org.apache.commons.lang3.StringUtils;
import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
import forge.FThreads;
import forge.game.card.Card;
@@ -32,7 +30,7 @@
/**
* Convenience for getChoices(message, 0, 1, choices).
- *
+ *
* @param <T>
* is automatically inferred.
* @param message
@@ -60,70 +58,16 @@
return choice.isEmpty() ? null : choice.get(0);
} // getChoiceOptional(String,T...)
- // returned Object will never be null
- /**
- * <p>
- * getChoice.
- * </p>
- *
- * @param <T>
- * a T object.
- * @param message
- * a {@link java.lang.String} object.
- * @param choices
- * a T object.
- * @return a T object.
- */
- public static <T> T one(final String message, final T[] choices) {
- final List<T> choice = GuiChoose.getChoices(message, 1, 1, choices);
- assert choice.size() == 1;
- return choice.get(0);
- }
-
- public static <T> T one(final String message, final Collection<T> choices) {
- if (choices == null || choices.isEmpty())
- return null;
- if( choices.size() == 1)
- return Iterables.getFirst(choices, null);
-
- final List<T> choice = GuiChoose.getChoices(message, 1, 1, choices);
- assert choice.size() == 1;
- return choice.get(0);
- }
-
- public static <T> List<T> noneOrMany(final String message, final Collection<T> choices) {
- return GuiChoose.getChoices(message, 0, choices.size(), choices, null, null);
- }
-
- // Nothing to choose here. Code uses this to just reveal one or more items
- public static <T> void reveal(final String message, final T item) {
- List<T> items = new ArrayList<T>();
- items.add(item);
- reveal(message, items);
- }
- public static <T> void reveal(final String message, final T[] items) {
- GuiChoose.getChoices(message, -1, -1, items);
- }
- public static <T> void reveal(final String message, final Collection<T> items) {
- GuiChoose.getChoices(message, -1, -1, items);
- }
-
// Get Integer in range
- public static Integer getInteger(final String message) {
- return getInteger(message, 0, Integer.MAX_VALUE);
- }
- public static Integer getInteger(final String message, int min) {
- return getInteger(message, min, Integer.MAX_VALUE);
- }
- public static Integer getInteger(final String message, int min, int max) {
+ public static Integer getInteger(final String message, final int min, final int max) {
if (max <= min) { return min; } //just return min if max <= min
//force cutting off after 100 numbers at most
if (max == Integer.MAX_VALUE) {
return getInteger(message, min, max, min + 99);
}
- int count = max - min + 1;
+ final int count = max - min + 1;
- if (count > 100) {
+ if (count > 100) {
return getInteger(message, min, max, min + 99);
}
@@ -133,20 +77,20 @@
}
return GuiChoose.oneOrNone(message, choices);
}
- public static Integer getInteger(final String message, int min, int max, int cutoff) {
+ public static Integer getInteger(final String message, final int min, final int max, final int cutoff) {
if (max <= min || cutoff < min) { return min; } //just return min if max <= min or cutoff < min
if (cutoff >= max) { //fallback to regular integer prompt if cutoff at or after max
return getInteger(message, min, max);
}
- List<Object> choices = new ArrayList<Object>();
+ final List<Object> choices = new ArrayList<Object>();
for (int i = min; i <= cutoff; i++) {
choices.add(Integer.valueOf(i));
}
choices.add("Other...");
- Object choice = GuiChoose.oneOrNone(message, choices);
+ final Object choice = GuiChoose.oneOrNone(message, choices);
if (choice instanceof Integer || choice == null) {
return (Integer)choice;
}
@@ -167,11 +111,11 @@
prompt += ":";
while (true) {
- String str = FOptionPane.showInputDialog(prompt, message);
+ final String str = FOptionPane.showInputDialog(prompt, message);
if (str == null) { return null; } // that is 'cancel'
if (StringUtils.isNumeric(str)) {
- Integer val = Integer.valueOf(str);
+ final Integer val = Integer.valueOf(str);
if (val >= min && val <= max) {
return val;
}
@@ -202,7 +146,7 @@
final Callable<List<T>> showChoice = new Callable<List<T>>() {
@Override
public List<T> call() {
- ListChooser<T> c = new ListChooser<T>(message, min, max, choices, display);
+ final ListChooser<T> c = new ListChooser<T>(message, min, max, choices, display);
final JList<T> list = c.getLstChoices();
if (matchUI != null) {
list.addListSelectionListener(new ListSelectionListener() {
@@ -246,11 +190,11 @@
}
};
- FutureTask<List<T>> future = new FutureTask<List<T>>(showChoice);
+ final FutureTask<List<T>> future = new FutureTask<List<T>>(showChoice);
FThreads.invokeInEdtAndWait(future);
try {
return future.get();
- } catch (Exception e) { // should be no exception here
+ } catch (final Exception e) { // should be no exception here
e.printStackTrace();
}
return null;
@@ -267,17 +211,13 @@
return order(title, top, remainingObjectsMin, remainingObjectsMax, sourceChoices, destChoices, null, false, null);
}
public static <T> List<T> order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax,
- final List<T> sourceChoices, final List<T> destChoices, final CardView referenceCard, final boolean sideboardingMode) {
- return order(title, top, remainingObjectsMin, remainingObjectsMax, sourceChoices, destChoices, referenceCard, sideboardingMode, null);
- }
- public static <T> List<T> order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax,
final List<T> sourceChoices, final List<T> destChoices, final CardView referenceCard, final boolean sideboardingMode, final CMatchUI matchUI) {
// An input box for handling the order of choices.
- Callable<List<T>> callable = new Callable<List<T>>() {
+ final Callable<List<T>> callable = new Callable<List<T>>() {
@Override
public List<T> call() throws Exception {
- DualListBox<T> dual = new DualListBox<T>(remainingObjectsMin, remainingObjectsMax, sourceChoices, destChoices, matchUI);
+ final DualListBox<T> dual = new DualListBox<T>(remainingObjectsMin, remainingObjectsMax, sourceChoices, destChoices, matchUI);
dual.setSecondColumnLabelText(top);
dual.setSideboardMode(sideboardingMode);
@@ -291,7 +231,7 @@
}
dual.setVisible(true);
- List<T> objects = dual.getOrderedList();
+ final List<T> objects = dual.getOrderedList();
dual.dispose();
if (matchUI != null) {
@@ -301,69 +241,14 @@
}
};
- FutureTask<List<T>> ft = new FutureTask<List<T>>(callable);
+ final FutureTask<List<T>> ft = new FutureTask<List<T>>(callable);
FThreads.invokeInEdtAndWait(ft);
try {
return ft.get();
- } catch (Exception e) { // we have waited enough
+ } catch (final Exception e) { // we have waited enough
e.printStackTrace();
}
return null;
- }
-
- // If comparer is NULL, T has to be comparable. Otherwise you'll get an exception from inside the Arrays.sort() routine
- public static <T> T sortedOneOrNone(final String message, final T[] choices, Comparator<T> comparer) {
- if ((choices == null) || (choices.length == 0)) {
- return null;
- }
- final List<T> choice = GuiChoose.sortedGetChoices(message, 0, 1, choices, comparer);
- return choice.isEmpty() ? null : choice.get(0);
- } // getChoiceOptional(String,T...)
-
- // If comparer is NULL, T has to be comparable. Otherwise you'll get an exception from inside the Arrays.sort() routine
- public static <T> T sortedOneOrNone(final String message, final List<T> choices, Comparator<T> comparer) {
- if ((choices == null) || choices.isEmpty()) {
- return null;
- }
- final List<T> choice = GuiChoose.sortedGetChoices(message, 0, 1, choices, comparer);
- return choice.isEmpty() ? null : choice.get(0);
- } // getChoiceOptional(String,T...)
-
-
- // If comparer is NULL, T has to be comparable. Otherwise you'll get an exception from inside the Arrays.sort() routine
- public static <T> T sortedOne(final String message, final T[] choices, Comparator<T> comparer) {
- final List<T> choice = GuiChoose.sortedGetChoices(message, 1, 1, choices, comparer);
- assert choice.size() == 1;
- return choice.get(0);
- } // getChoice()
-
- // If comparer is NULL, T has to be comparable. Otherwise you'll get an exception from inside the Arrays.sort() routine
- public static <T> T sortedOne(final String message, final List<T> choices, Comparator<T> comparer) {
- if ((choices == null) || (choices.size() == 0)) {
- return null;
- }
- final List<T> choice = GuiChoose.sortedGetChoices(message, 1, 1, choices, comparer);
- assert choice.size() == 1;
- return choice.get(0);
- }
-
- // If comparer is NULL, T has to be comparable. Otherwise you'll get an exception from inside the Arrays.sort() routine
- public static <T> List<T> sortedNoneOrMany(final String message, final List<T> choices, Comparator<T> comparer) {
- return GuiChoose.sortedGetChoices(message, 0, choices.size(), choices, comparer);
- }
-
- // If comparer is NULL, T has to be comparable. Otherwise you'll get an exception from inside the Arrays.sort() routine
- public static <T> List<T> sortedGetChoices(final String message, final int min, final int max, final T[] choices, Comparator<T> comparer) {
- // You may create a copy of source array if callers expect the collection to be unchanged
- Arrays.sort(choices, comparer);
- return getChoices(message, min, max, choices);
- }
-
- // If comparer is NULL, T has to be comparable. Otherwise you'll get an exception from inside the Arrays.sort() routine
- public static <T> List<T> sortedGetChoices(final String message, final int min, final int max, final List<T> choices, Comparator<T> comparer) {
- // You may create a copy of source list if callers expect the collection to be unchanged
- Collections.sort(choices, comparer);
- return getChoices(message, min, max, choices);
}
}
Index: forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuAchievements.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuAchievements.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuAchievements.java (revision 29317)
@@ -126,7 +126,7 @@
cbCollections.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- setAchievements((AchievementCollection)cbCollections.getSelectedItem());
+ setAchievements(cbCollections.getSelectedItem());
}
});
cbCollections.setSelectedIndex(0);
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/DeckController.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/DeckController.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/DeckController.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -27,11 +27,6 @@
import forge.screens.home.sanctioned.VSubmenuConstructed;
import forge.util.storage.IStorage;
-/**
- * TODO: Write javadoc for this type.
- *
- * @param <T> the generic type
- */
public class DeckController<T extends DeckBase> {
private T model;
private boolean saved;
@@ -99,8 +94,7 @@
else {
this.notifyModelChanged();
}
- }
- else { //TODO: Make this smarter
+ } else { //TODO: Make this smarter
this.currentFolder = this.rootFolder;
this.modelPath = "";
this.setSaved(true);
@@ -142,7 +136,7 @@
}
}
- private void setSaved(boolean val) {
+ private void setSaved(final boolean val) {
saved = val;
updateCaptions();
}
@@ -151,7 +145,7 @@
* Reload current model
*/
public void reload() {
- String name = this.getModelName();
+ final String name = this.getModelName();
if (name.isEmpty()) {
newModel();
}
@@ -178,7 +172,7 @@
*/
@SuppressWarnings("unchecked")
private void load(final String name) {
- T newModel = this.currentFolder.get(name);
+ final T newModel = this.currentFolder.get(name);
if (newModel != null) {
this.setModel((T) newModel.copyTo(name), true);
}
@@ -237,15 +231,6 @@
}
/**
- * Import deck.
- *
- * @param newDeck the new deck
- */
- public void importDeck(final T newDeck) {
- this.setModel(newDeck);
- }
-
- /**
* Refresh current model or create new one if none
*/
public void refreshModel() {
@@ -272,7 +257,7 @@
public void updateCaptions() {
String tabCaption = "Current Deck";
- String title = this.getModelName();
+ final String title = this.getModelName();
String itemManagerCaption = title.isEmpty() ? "[Untitled]" : title;
if (!saved) {
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/views/VCardCatalog.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/views/VCardCatalog.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/views/VCardCatalog.java (revision 29317)
@@ -1,5 +1,8 @@
package forge.screens.deckeditor.views;
+import javax.swing.JPanel;
+
+import net.miginfocom.swing.MigLayout;
import forge.gui.framework.DragCell;
import forge.gui.framework.DragTab;
import forge.gui.framework.EDocID;
@@ -8,22 +11,16 @@
import forge.itemmanager.ItemManager;
import forge.itemmanager.ItemManagerContainer;
import forge.screens.deckeditor.controllers.CCardCatalog;
-import net.miginfocom.swing.MigLayout;
-import javax.swing.*;
-
-/**
+/**
* Assembles Swing components of card catalog in deck editor.
*
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
- *
+ *
*/
public enum VCardCatalog implements IVDoc<CCardCatalog> {
- /** */
SINGLETON_INSTANCE;
- public static final int SEARCH_MODE_INVERSE_INDEX = 1;
-
// Fields used with interface IVDoc
private DragCell parentCell;
private final DragTab tab = new DragTab("Card Catalog");
@@ -54,7 +51,7 @@
}
@Override
- public void setParentCell(DragCell cell0) {
+ public void setParentCell(final DragCell cell0) {
this.parentCell = cell0;
}
@@ -65,7 +62,7 @@
@Override
public void populate() {
- JPanel parentBody = parentCell.getBody();
+ final JPanel parentBody = parentCell.getBody();
parentBody.setLayout(new MigLayout("insets 5, gap 0, wrap, hidemode 3"));
parentBody.add(itemManagerContainer, "push, grow");
}
Index: forge-gui-desktop/src/main/java/forge/gui/framework/ICDoc.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/framework/ICDoc.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/framework/ICDoc.java (revision 29317)
@@ -1,7 +1,5 @@
package forge.gui.framework;
-import forge.UiCommand;
-
/**
* Dictates methods required for any controller of an
* {@link forge.gui.framework.IVDoc}.
@@ -12,14 +10,6 @@
* <i>(C at beginning of class name denotes a controller class.)</i>
*/
public interface ICDoc {
- /**
- * Fires when this controller's view tab is selected. Since this method is
- * fired when all tabs are first initialized, be wary of NPEs created by
- * referring to non-existent components.
- *
- * @return {@link forge.UiCommand}
- */
- UiCommand getCommandOnSelect();
/**
* Asks this controller to register its docs, so that a layout can be
Index: forge-gui/src/main/java/forge/deck/DeckType.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/deck/DeckType.java (revision 29316)
+++ forge-gui/src/main/java/forge/deck/DeckType.java (revision 29317)
@@ -17,19 +17,12 @@
NET_COMMANDER_DECK ("Net Commander Decks");
private String value;
- private DeckType(String value) {
+ private DeckType(final String value) {
this.value = value;
}
+
@Override
public String toString() {
return value;
- }
- public static DeckType fromString(String value){
- for (final DeckType d : DeckType.values()) {
- if (d.toString().equalsIgnoreCase(value)) {
- return d;
- }
- }
- throw new IllegalArgumentException("No Enum specified for this string");
}
}
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CEditorQuest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CEditorQuest.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CEditorQuest.java (revision 29317)
@@ -6,17 +6,23 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.screens.deckeditor.controllers;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
import com.google.common.base.Function;
import com.google.common.base.Supplier;
@@ -42,21 +48,13 @@
import forge.screens.match.controllers.CDetailPicture;
import forge.util.ItemPool;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-//import forge.quest.data.QuestBoosterPack;
-
/**
* Child controller for quest deck editor UI.
* <br><br>
* Card catalog and decks are drawn from a QuestController object.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
- *
+ *
* @author Forge
* @version $Id: CEditorQuest.java 24868 2014-02-17 05:08:05Z drdev $
*/
@@ -89,7 +87,7 @@
* Child controller for quest deck editor UI.
* <br><br>
* Card catalog and decks are drawn from a QuestController object.
- *
+ *
* @param questData0 &emsp; {@link forge.quest.QuestController}
*/
public CEditorQuest(final QuestController questData0, final CDetailPicture cDetailPicture) {
@@ -121,16 +119,6 @@
this.controller = new DeckController<Deck>(questData0.getMyDecks(), this, newCreator);
}
- /**
- * Adds any card to the catalog and data pool.
- *
- * @param card {@link forge.item.PaperCard}
- */
- public void addCheatCard(final PaperCard card, int qty) {
- this.getCatalogManager().addItem(card, qty);
- this.questData.getCards().getCardpool().add(card, qty);
- }
-
// fills number of decks using each card
private Map<PaperCard, Integer> countDecksForEachCard() {
final Map<PaperCard, Integer> result = new HashMap<PaperCard, Integer>();
@@ -158,7 +146,7 @@
* @see forge.gui.deckeditor.ACEditorBase#onAddItems()
*/
@Override
- protected void onAddItems(Iterable<Entry<PaperCard, Integer>> items, boolean toAlternate) {
+ protected void onAddItems(final Iterable<Entry<PaperCard, Integer>> items, final boolean toAlternate) {
CEditorConstructed.onAddItems(this, items, toAlternate);
}
@@ -166,7 +154,7 @@
* @see forge.gui.deckeditor.ACEditorBase#onRemoveItems()
*/
@Override
- protected void onRemoveItems(Iterable<Entry<PaperCard, Integer>> items, boolean toAlternate) {
+ protected void onRemoveItems(final Iterable<Entry<PaperCard, Integer>> items, final boolean toAlternate) {
CEditorConstructed.onRemoveItems(this, items, toAlternate);
}
@@ -174,7 +162,7 @@
* @see forge.gui.deckeditor.ACEditorBase#buildAddContextMenu()
*/
@Override
- protected void buildAddContextMenu(EditorContextMenuBuilder cmb) {
+ protected void buildAddContextMenu(final EditorContextMenuBuilder cmb) {
CEditorConstructed.buildAddContextMenu(cmb, sectionMode);
}
@@ -182,13 +170,13 @@
* @see forge.gui.deckeditor.ACEditorBase#buildRemoveContextMenu()
*/
@Override
- protected void buildRemoveContextMenu(EditorContextMenuBuilder cmb) {
+ protected void buildRemoveContextMenu(final EditorContextMenuBuilder cmb) {
CEditorConstructed.buildRemoveContextMenu(cmb, sectionMode);
}
/*
* (non-Javadoc)
- *
+ *
* @see forge.gui.deckeditor.ACEditorBase#updateView()
*/
@Override
@@ -212,7 +200,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see forge.gui.deckeditor.ACEditorBase#getController()
*/
@Override
@@ -263,18 +251,17 @@
this.getBtnCycleSection().setVisible(true);
this.getBtnCycleSection().setCommand(new UiCommand() {
- @Override
- public void run() {
+ @Override public void run() {
cycleEditorMode();
- } });
+ }
+ });
deckGenParent = removeTab(VDeckgen.SINGLETON_INSTANCE);
allDecksParent = removeTab(VAllDecks.SINGLETON_INSTANCE);
if (this.controller.getModel() == null) {
this.getDeckController().setModel(new Deck());
- }
- else {
+ } else {
this.controller.refreshModel();
}
}
@@ -283,7 +270,7 @@
* @see forge.gui.deckeditor.controllers.ACEditorBase#canSwitchAway()
*/
@Override
- public boolean canSwitchAway(boolean isClosing) {
+ public boolean canSwitchAway(final boolean isClosing) {
if (SEditorIO.confirmSaveChanges(FScreen.DECK_EDITOR_QUEST, isClosing)) {
FModel.getQuest().save();
return true;
@@ -306,11 +293,4 @@
}
}
- /**
- * TODO: Write javadoc for this method.
- * @param d0
- */
- public void load(Deck deck) {
- controller.setModel(deck);
- }
}
Index: forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuAvatars.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuAvatars.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuAvatars.java (revision 29317)
@@ -1,11 +1,10 @@
package forge.screens.home.settings;
-import forge.UiCommand;
+import javax.swing.SwingUtilities;
+
import forge.gui.framework.ICDoc;
-import javax.swing.*;
-
-/**
+/**
* Controls the avatars submenu in the home UI.
*/
public enum CSubmenuAvatars implements ICDoc {
@@ -24,15 +23,11 @@
@Override
public void update() {
SwingUtilities.invokeLater(new Runnable() {
- @Override public void run() {
+ @Override public final void run() {
- view.refreshAvatarFromPrefs(0);
- view.refreshAvatarFromPrefs(1);
- view.focusHuman(); }
+ view.refreshAvatarFromPrefs(0);
+ view.refreshAvatarFromPrefs(1);
+ view.focusHuman(); }
});
}
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
}
Index: forge-gui-desktop/src/main/java/forge/screens/match/views/VAntes.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/match/views/VAntes.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/views/VAntes.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -38,7 +38,7 @@
import forge.toolbox.FLabel;
import forge.toolbox.FScrollPane;
-/**
+/**
* Assembles Swing components of card ante area.
*
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
@@ -72,10 +72,6 @@
parentCell.getBody().add(scroller, "w 100%!, h 100%!");
}
- public final void setModel() {
- update();
- }
-
/* (non-Javadoc)
* @see forge.gui.framework.IVDoc#setParentCell()
*/
@@ -154,7 +150,7 @@
setLayout(new MigLayout("gap 0, insets 0, wrap"));
add(new FLabel.Builder().fontSize(14).text(card.getOwner().getName())
.fontAlign(SwingConstants.CENTER).build(), "w 160px, h 20px");
- CardPicturePanel picPanel = new CardPicturePanel();
+ final CardPicturePanel picPanel = new CardPicturePanel();
add(picPanel, "w 160px, h 230px");
picPanel.setCard(c.getCurrentState());
}
Index: forge-gui-desktop/src/main/java/forge/sound/AudioMusic.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/sound/AudioMusic.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/sound/AudioMusic.java (revision 29317)
@@ -22,6 +22,7 @@
filename = filename0;
}
+ @Override
public void play(final Runnable onComplete0) {
onComplete = onComplete0;
play(-1);
@@ -46,20 +47,18 @@
}
}
});
- new Thread(
- new Runnable(){
- public void run(){
+ new Thread(new Runnable(){
+ @Override public void run(){
- try {
- musicPlayer.play();
- }
- catch (Exception e){
- e.printStackTrace();
- valid = false;
- }
- }
+ try {
+ musicPlayer.play();
+ }
+ catch (Exception e){
+ e.printStackTrace();
+ valid = false;
+ }
+ }
+ }).start();
- }
+ }
- ).start();
- }
catch (Exception e) {
e.printStackTrace();
valid = false;
@@ -67,6 +66,7 @@
return valid;
}
+ @Override
public void pause() {
if (musicPlayer == null) { return; }
@@ -90,6 +90,7 @@
musicPlayer = null;
}
+ @Override
public void resume() {
if (!canResume) { return; }
@@ -98,6 +99,7 @@
}
}
+ @Override
public void stop() {
if (musicPlayer == null) { return; }
@@ -105,6 +107,7 @@
musicPlayer.stop();
}
+ @Override
public void dispose() {
if (musicPlayer == null) { return; }
Index: forge-gui/src/main/java/forge/interfaces/IGuiBase.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/interfaces/IGuiBase.java (revision 29316)
+++ forge-gui/src/main/java/forge/interfaces/IGuiBase.java (revision 29317)
@@ -24,7 +24,6 @@
void invokeInEdtLater(Runnable runnable);
void invokeInEdtAndWait(Runnable proc);
boolean isGuiThread();
- IGuiTimer createGuiTimer(Runnable proc, int interval);
ISkinImage getSkinIcon(FSkinProp skinProp);
ISkinImage getUnskinnedIcon(String path);
ISkinImage getCardArt(PaperCard card);
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/gui/SOverlayUtils.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/SOverlayUtils.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/SOverlayUtils.java (revision 29317)
@@ -2,14 +2,12 @@
import java.awt.Color;
import java.awt.Component;
-import java.awt.Dimension;
import java.awt.KeyboardFocusManager;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
-import javax.swing.Timer;
import net.miginfocom.swing.MigLayout;
import forge.Singletons;
@@ -19,17 +17,21 @@
import forge.toolbox.FPanel;
import forge.toolbox.FSkin;
import forge.toolbox.FSkin.SkinnedButton;
-import forge.toolbox.FSkin.SkinnedLabel;
-/**
+/**
* All overlay interaction is handled here.
*
* <br><br><i>(S at beginning of class name denotes a static factory.)</i>
*/
public final class SOverlayUtils {
- private static int counter = 0;
- /**
+ /**
+ * Private constructor to prevent instantiation.
+ */
+ private SOverlayUtils() {
+ }
+
+ /**
* A standardized overlay for a game start condition.
*/
public static void startGameOverlay() {
@@ -58,46 +60,6 @@
}
/**
- * A standardized overlay for a loading condition (note: thread issues, as of 1-Mar-12).
- * @param msg0 &emsp; {@link java.lang.String}
- * @return {@link javax.swing.JPanel}
- */
- // NOTE: This animation happens on the EDT; if the EDT is tied up doing something
- // else, the animation is effectively frozen. So, this needs some work.
- public static JPanel loadingOverlay(final String msg0) {
- final JPanel overlay = SOverlayUtils.genericOverlay();
- final FPanel pnlLoading = new FPanel();
- final int w = overlay.getWidth();
- final int h = overlay.getHeight();
-
- final SkinnedLabel lblLoading = new SkinnedLabel("");
- lblLoading.setOpaque(true);
- lblLoading.setBackground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
- lblLoading.setMinimumSize(new Dimension(0, 20));
-
- pnlLoading.setBounds(((w - 170) / 2), ((h - 80) / 2), 170, 80);
- pnlLoading.setLayout(new MigLayout("wrap, align center"));
- pnlLoading.add(new FLabel.Builder().fontSize(18)
- .text(msg0).build(), "h 20px!, w 140px!, gap 0 0 5px 0");
- pnlLoading.add(lblLoading, "gap 0 0 0 10px");
-
- overlay.add(pnlLoading);
-
- SOverlayUtils.counter = 0;
- final Timer timer = new Timer(300, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- lblLoading.setMinimumSize(new Dimension(10 * (SOverlayUtils.counter++), 20));
- lblLoading.revalidate();
- if (SOverlayUtils.counter > 13) { SOverlayUtils.counter = 0; }
- }
- });
- timer.start();
-
- return overlay;
- }
-
- /**
* A template overlay with close button, null layout, ready for anything.
* @return {@link javax.swing.JPanel}
*/
@@ -113,7 +75,7 @@
btnCloseTopRight.setBackground(new Color(0, 0, 0));
btnCloseTopRight.setFocusPainted(false);
btnCloseTopRight.addActionListener(new ActionListener() { @Override
- public void actionPerformed(ActionEvent arg0) { SOverlayUtils.hideOverlay(); } });
+ public void actionPerformed(final ActionEvent arg0) { SOverlayUtils.hideOverlay(); } });
overlay.removeAll();
overlay.setLayout(null);
@@ -126,7 +88,7 @@
public static boolean overlayHasFocus() {
return _overlayHasFocus;
}
-
+
private static Component prevFocusOwner;
public static void showOverlay() {
Singletons.getView().getNavigationBar().setEnabled(false);
Index: forge-gui/src/main/java/forge/util/gui/SOptionPane.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/util/gui/SOptionPane.java (revision 29316)
+++ forge-gui/src/main/java/forge/util/gui/SOptionPane.java (revision 29317)
@@ -9,69 +9,69 @@
public static final FSkinProp WARNING_ICON = FSkinProp.ICO_WARNING;
public static final FSkinProp ERROR_ICON = FSkinProp.ICO_ERROR;
- public static void showMessageDialog(String message) {
+ public static void showMessageDialog(final String message) {
showMessageDialog(message, "Forge", INFORMATION_ICON);
}
- public static void showMessageDialog(String message, String title) {
+ public static void showMessageDialog(final String message, final String title) {
showMessageDialog(message, title, INFORMATION_ICON);
}
- public static void showErrorDialog(String message) {
+ public static void showErrorDialog(final String message) {
showMessageDialog(message, "Forge", ERROR_ICON);
}
- public static void showErrorDialog(String message, String title) {
+ public static void showErrorDialog(final String message, final String title) {
showMessageDialog(message, title, ERROR_ICON);
}
- public static void showMessageDialog(String message, String title, FSkinProp icon) {
+ public static void showMessageDialog(final String message, final String title, final FSkinProp icon) {
showOptionDialog(message, title, icon, new String[] {"OK"}, 0);
}
- public static boolean showConfirmDialog(String message) {
+ public static boolean showConfirmDialog(final String message) {
return showConfirmDialog(message, "Forge");
}
- public static boolean showConfirmDialog(String message, String title) {
+ public static boolean showConfirmDialog(final String message, final String title) {
return showConfirmDialog(message, title, "Yes", "No", true);
}
- public static boolean showConfirmDialog(String message, String title, boolean defaultYes) {
+ public static boolean showConfirmDialog(final String message, final String title, final boolean defaultYes) {
return showConfirmDialog(message, title, "Yes", "No", defaultYes);
}
- public static boolean showConfirmDialog(String message, String title, String yesButtonText, String noButtonText) {
+ public static boolean showConfirmDialog(final String message, final String title, final String yesButtonText, final String noButtonText) {
return showConfirmDialog(message, title, yesButtonText, noButtonText, true);
}
- public static boolean showConfirmDialog(String message, String title, String yesButtonText, String noButtonText, boolean defaultYes) {
- String[] options = {yesButtonText, noButtonText};
- int reply = SOptionPane.showOptionDialog(message, title, QUESTION_ICON, options, defaultYes ? 0 : 1);
+ public static boolean showConfirmDialog(final String message, final String title, final String yesButtonText, final String noButtonText, final boolean defaultYes) {
+ final String[] options = {yesButtonText, noButtonText};
+ final int reply = SOptionPane.showOptionDialog(message, title, QUESTION_ICON, options, defaultYes ? 0 : 1);
return (reply == 0);
}
- public static int showOptionDialog(String message, String title, FSkinProp icon, String[] options) {
+ public static int showOptionDialog(final String message, final String title, final FSkinProp icon, final String[] options) {
return showOptionDialog(message, title, icon, options, 0);
}
- public static int showOptionDialog(String message, String title, FSkinProp icon, String[] options, int defaultOption) {
+ public static int showOptionDialog(final String message, final String title, final FSkinProp icon, final String[] options, final int defaultOption) {
return GuiBase.getInterface().showOptionDialog(message, title, icon, options, defaultOption);
}
- public static String showInputDialog(String message, String title) {
+ public static String showInputDialog(final String message, final String title) {
return showInputDialog(message, title, null, "", null);
}
- public static String showInputDialog(String message, String title, FSkinProp icon) {
+ public static String showInputDialog(final String message, final String title, final FSkinProp icon) {
return showInputDialog(message, title, icon, "", null);
}
- public static String showInputDialog(String message, String title, FSkinProp icon, String initialInput) {
+ public static String showInputDialog(final String message, final String title, final FSkinProp icon, final String initialInput) {
return showInputDialog(message, title, icon, initialInput, null);
}
- public static String showInputDialog(String message, String title, FSkinProp icon, String initialInput, String[] inputOptions) {
+ public static String showInputDialog(final String message, final String title, final FSkinProp icon, final String initialInput, final String[] inputOptions) {
return GuiBase.getInterface().showInputDialog(message, title, icon, initialInput, inputOptions);
}
Index: forge-gui-mobile/src/forge/toolbox/FOptionPane.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-mobile/src/forge/toolbox/FOptionPane.java (revision 29316)
+++ forge-gui-mobile/src/forge/toolbox/FOptionPane.java (revision 29317)
@@ -8,20 +8,20 @@
import forge.Forge;
import forge.Graphics;
+import forge.assets.FImage;
import forge.assets.FSkin;
import forge.assets.FSkinFont;
-import forge.assets.FImage;
import forge.assets.FSkinImage;
import forge.assets.FSkinProp;
import forge.card.CardRenderer;
-import forge.card.CardZoom;
import forge.card.CardRenderer.CardStackPosition;
+import forge.card.CardZoom;
+import forge.game.card.CardView;
import forge.screens.match.views.VPrompt;
-import forge.toolbox.FEvent.*;
+import forge.toolbox.FEvent.FEventHandler;
import forge.util.Callback;
import forge.util.Utils;
import forge.util.WaitCallback;
-import forge.game.card.CardView;
public class FOptionPane extends FDialog {
public static final FSkinImage QUESTION_ICON = FSkinImage.QUESTION;
@@ -35,61 +35,61 @@
return Forge.getCurrentScreen().getHeight() - VPrompt.HEIGHT - 2 * FDialog.MSG_HEIGHT;
}
- public static void showMessageDialog(String message) {
+ public static void showMessageDialog(final String message) {
showMessageDialog(message, "", INFORMATION_ICON);
}
- public static void showMessageDialog(String message, String title) {
+ public static void showMessageDialog(final String message, final String title) {
showMessageDialog(message, title, INFORMATION_ICON);
}
- public static void showErrorDialog(String message) {
+ public static void showErrorDialog(final String message) {
showMessageDialog(message, "", ERROR_ICON);
}
- public static void showErrorDialog(String message, String title) {
+ public static void showErrorDialog(final String message, final String title) {
showMessageDialog(message, title, ERROR_ICON);
}
- public static void showMessageDialog(String message, String title, FImage icon) {
+ public static void showMessageDialog(final String message, final String title, final FImage icon) {
showOptionDialog(message, title, icon, new String[] {"OK"}, 0, null);
}
- public static void showMessageDialog(String message, String title, FImage icon, final Callback<Integer> callback) {
+ public static void showMessageDialog(final String message, final String title, final FImage icon, final Callback<Integer> callback) {
showOptionDialog(message, title, icon, new String[] {"OK"}, 0, callback);
}
- public static void showConfirmDialog(String message, final Callback<Boolean> callback) {
+ public static void showConfirmDialog(final String message, final Callback<Boolean> callback) {
showConfirmDialog(message, "", callback);
}
- public static void showConfirmDialog(String message, String title, final Callback<Boolean> callback) {
+ public static void showConfirmDialog(final String message, final String title, final Callback<Boolean> callback) {
showConfirmDialog(message, title, "Yes", "No", true, callback);
}
- public static void showConfirmDialog(String message, String title, boolean defaultYes, final Callback<Boolean> callback) {
+ public static void showConfirmDialog(final String message, final String title, final boolean defaultYes, final Callback<Boolean> callback) {
showConfirmDialog(message, title, "Yes", "No", defaultYes, callback);
}
- public static void showConfirmDialog(String message, String title, String yesButtonText, String noButtonText, final Callback<Boolean> callback) {
+ public static void showConfirmDialog(final String message, final String title, final String yesButtonText, final String noButtonText, final Callback<Boolean> callback) {
showConfirmDialog(message, title, yesButtonText, noButtonText, true, callback);
}
- public static void showConfirmDialog(String message, String title, String yesButtonText, String noButtonText, boolean defaultYes, final Callback<Boolean> callback) {
- String[] options = {yesButtonText, noButtonText};
+ public static void showConfirmDialog(final String message, final String title, final String yesButtonText, final String noButtonText, final boolean defaultYes, final Callback<Boolean> callback) {
+ final String[] options = {yesButtonText, noButtonText};
showOptionDialog(message, title, QUESTION_ICON, options, defaultYes ? 0 : 1, new Callback<Integer>() {
@Override
- public void run(Integer result) {
+ public void run(final Integer result) {
callback.run(result == 0);
}
});
}
- public static void showOptionDialog(String message, String title, FImage icon, String[] options, final Callback<Integer> callback) {
+ public static void showOptionDialog(final String message, final String title, final FImage icon, final String[] options, final Callback<Integer> callback) {
showOptionDialog(message, title, icon, options, 0, callback);
}
- public static void showOptionDialog(String message, String title, FImage icon, String[] options, int defaultOption, final Callback<Integer> callback) {
+ public static void showOptionDialog(final String message, final String title, final FImage icon, final String[] options, final int defaultOption, final Callback<Integer> callback) {
final FOptionPane optionPane = new FOptionPane(message, title, icon, null, options, defaultOption, callback);
optionPane.show();
}
@@ -103,26 +103,26 @@
}.invokeAndWait();
}
- public static void showCardOptionDialog(final CardView card, String message, String title, FImage icon, String[] options, int defaultOption, final Callback<Integer> callback) {
+ public static void showCardOptionDialog(final CardView card, String message, String title, FImage icon, final String[] options, final int defaultOption, final Callback<Integer> callback) {
final FDisplayObject cardDisplay;
if (card != null) {
cardDisplay = new FDisplayObject() {
@Override
- public boolean tap(float x, float y, int count) {
+ public boolean tap(final float x, final float y, final int count) {
CardZoom.show(card);
return true;
}
@Override
- public boolean longPress(float x, float y) {
+ public boolean longPress(final float x, final float y) {
CardZoom.show(card);
return true;
}
@Override
- public void draw(Graphics g) {
- float h = getHeight();
- float w = h / FCardPanel.ASPECT_RATIO;
- float x = (getWidth() - w) / 2;
- float y = 0;
+ public void draw(final Graphics g) {
+ final float h = getHeight();
+ final float w = h / FCardPanel.ASPECT_RATIO;
+ final float x = (getWidth() - w) / 2;
+ final float y = 0;
CardRenderer.drawCard(g, card, x, y, w, h, CardStackPosition.Top);
}
@@ -144,13 +144,13 @@
optionPane.show();
}
- public static void showInputDialog(String title, final Callback<String> callback) {
+ public static void showInputDialog(final String title, final Callback<String> callback) {
showInputDialog(null, title, "", null, callback);
}
- public static <T> void showInputDialog(String title, T initialInput, final Callback<T> callback) {
+ public static <T> void showInputDialog(final String title, final T initialInput, final Callback<T> callback) {
showInputDialog(null, title, initialInput, null, callback);
}
- public static <T> void showInputDialog(String message, String title, T initialInput, T[] inputOptions, final Callback<T> callback) {
+ public static <T> void showInputDialog(final String message, final String title, final T initialInput, final T[] inputOptions, final Callback<T> callback) {
final FDisplayObject inputField;
final FTextField txtInput;
final FComboBox<T> cbInput;
@@ -171,7 +171,7 @@
//use container to add padding above and below field
final FContainer container = new FContainer() {
@Override
- protected void doLayout(float width, float height) {
+ protected void doLayout(final float width, final float height) {
inputField.setBounds(0, padTop, width, inputField.getHeight());
}
};
@@ -181,16 +181,14 @@
final FOptionPane optionPane = new FOptionPane(message, title, null, container, new String[] {"OK", "Cancel"}, 0, new Callback<Integer>() {
@SuppressWarnings("unchecked")
@Override
- public void run(Integer result) {
+ public void run(final Integer result) {
if (result == 0) {
if (txtInput != null) {
callback.run((T)txtInput.getText());
+ } else {
+ callback.run(cbInput.getSelectedItem());
}
- else {
- callback.run((T)cbInput.getSelectedItem());
- }
- }
- else {
+ } else {
callback.run(null);
}
}
@@ -223,7 +221,7 @@
private final int defaultOption;
private final boolean centerIcon;
- public FOptionPane(String message, String title, FImage icon, FDisplayObject displayObj0, String[] options, int defaultOption0, final Callback<Integer> callback0) {
+ public FOptionPane(final String message, final String title, final FImage icon, final FDisplayObject displayObj0, final String[] options, final int defaultOption0, final Callback<Integer> callback0) {
super(title, options.length);
if (icon != null) {
@@ -260,7 +258,7 @@
final int option = i;
initButton(i, options[i], new FEventHandler() {
@Override
- public void handleEvent(FEvent e) {
+ public void handleEvent(final FEvent e) {
setResult(option);
}
});
@@ -284,7 +282,7 @@
}
@Override
- protected float layoutAndGetHeight(float width, float maxHeight) {
+ protected float layoutAndGetHeight(final float width, final float maxHeight) {
float x = PADDING;
float y = PADDING;
@@ -295,7 +293,7 @@
float promptHeight = 0;
if (lblIcon != null) {
- float labelWidth = Utils.scale(lblIcon.getIcon().getWidth());
+ final float labelWidth = Utils.scale(lblIcon.getIcon().getWidth());
promptHeight = lblIcon.getIcon().getHeight() * labelWidth / lblIcon.getIcon().getWidth();
if (promptHeight > maxPromptHeight) {
promptHeight = maxPromptHeight;
@@ -310,7 +308,7 @@
}
}
if (prompt != null) {
- float promptWidth = width - x - PADDING;
+ final float promptWidth = width - x - PADDING;
prompt.setBounds(x, y, promptWidth, prompt.getPreferredHeight(promptWidth));
if (prompt.getHeight() < promptHeight && !centerIcon) {
//ensure prompt centered next to icon if less tall than icon
@@ -342,7 +340,7 @@
}
@Override
- public boolean keyDown(int keyCode) {
+ public boolean keyDown(final int keyCode) {
switch (keyCode) {
case Keys.ENTER:
case Keys.SPACE:
Index: forge-gui/src/main/java/forge/quest/QuestDraftUtils.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/quest/QuestDraftUtils.java (revision 29316)
+++ forge-gui/src/main/java/forge/quest/QuestDraftUtils.java (revision 29317)
@@ -19,9 +19,8 @@
public class QuestDraftUtils {
private static final List<DraftMatchup> matchups = new ArrayList<DraftMatchup>();
-
+
public static boolean matchInProgress = false;
- public static boolean aiMatchInProgress = false;
private static boolean waitForUserInput = false;
public static void completeDraft(final DeckGroup finishedDraft) {
@@ -56,76 +55,76 @@
if (matchups.size() > 0) {
return;
}
-
+
matchups.clear();
-
+
- QuestEventDraft draft = FModel.getQuest().getAchievements().getCurrentDraft();
- String[] currentStandings = draft.getStandings();
+ final QuestEventDraft draft = FModel.getQuest().getAchievements().getCurrentDraft();
+ final String[] currentStandings = draft.getStandings();
-
+
int currentSet = -1;
-
+
for (int i = currentStandings.length - 1; i >= 0; i--) {
if (!currentStandings[i].equals(QuestEventDraft.UNDETERMINED)) {
currentSet = i;
break;
}
}
-
+
switch (currentSet) {
-
- case 7:
- addMatchup(0, 1, draft);
- addMatchup(2, 3, draft);
- addMatchup(4, 5, draft);
- addMatchup(6, 7, draft);
- break;
-
- case 8:
- addMatchup(2, 3, draft);
- addMatchup(4, 5, draft);
- addMatchup(6, 7, draft);
- break;
-
- case 9:
- addMatchup(4, 5, draft);
- addMatchup(6, 7, draft);
- break;
-
- case 10:
- addMatchup(6, 7, draft);
- break;
-
- case 11:
- addMatchup(8, 9, draft);
- addMatchup(10, 11, draft);
- break;
-
- case 12:
- addMatchup(10, 11, draft);
- break;
-
- case 13:
- addMatchup(12, 13, draft);
- break;
-
- case 14:
- default:
- return;
-
+
+ case 7:
+ addMatchup(0, 1, draft);
+ addMatchup(2, 3, draft);
+ addMatchup(4, 5, draft);
+ addMatchup(6, 7, draft);
+ break;
+
+ case 8:
+ addMatchup(2, 3, draft);
+ addMatchup(4, 5, draft);
+ addMatchup(6, 7, draft);
+ break;
+
+ case 9:
+ addMatchup(4, 5, draft);
+ addMatchup(6, 7, draft);
+ break;
+
+ case 10:
+ addMatchup(6, 7, draft);
+ break;
+
+ case 11:
+ addMatchup(8, 9, draft);
+ addMatchup(10, 11, draft);
+ break;
+
+ case 12:
+ addMatchup(10, 11, draft);
+ break;
+
+ case 13:
+ addMatchup(12, 13, draft);
+ break;
+
+ case 14:
+ default:
+ return;
+
}
-
+
update(gui);
-
+
}
-
+
private static void addMatchup(final int player1, final int player2, final QuestEventDraft draft) {
-
+
- DraftMatchup matchup = new DraftMatchup();
- DeckGroup decks = FModel.getQuest().getAssets().getDraftDeckStorage().get(QuestEventDraft.DECK_NAME);
+ final DraftMatchup matchup = new DraftMatchup();
+ final DeckGroup decks = FModel.getQuest().getAssets().getDraftDeckStorage().get(QuestEventDraft.DECK_NAME);
-
+
int humanIndex = -1;
int aiIndex = -1;
-
+
if (draft.getStandings()[player1].equals(QuestEventDraft.HUMAN)) {
humanIndex = player1;
aiIndex = player2;
@@ -133,36 +132,33 @@
humanIndex = player2;
aiIndex = player1;
}
-
+
if (humanIndex > -1) {
matchup.setHumanPlayer(new RegisteredPlayer(decks.getHumanDeck()).setPlayer(GamePlayerUtil.getGuiPlayer()));
- int aiName = Integer.parseInt(draft.getStandings()[aiIndex]) - 1;
+ final int aiName = Integer.parseInt(draft.getStandings()[aiIndex]) - 1;
-
+
- int aiDeckIndex = Integer.parseInt(draft.getStandings()[aiIndex]) - 1;
+ final int aiDeckIndex = Integer.parseInt(draft.getStandings()[aiIndex]) - 1;
matchup.matchStarter.add(new RegisteredPlayer(decks.getAiDecks().get(aiDeckIndex)).setPlayer(GamePlayerUtil.createAiPlayer(draft.getAINames()[aiName], draft.getAIIcons()[aiName])));
-
+
} else {
- int aiName1 = Integer.parseInt(draft.getStandings()[player1]) - 1;
- int aiName2 = Integer.parseInt(draft.getStandings()[player2]) - 1;
+ final int aiName1 = Integer.parseInt(draft.getStandings()[player1]) - 1;
+ final int aiName2 = Integer.parseInt(draft.getStandings()[player2]) - 1;
-
+
int aiDeckIndex = Integer.parseInt(draft.getStandings()[player1]) - 1;
matchup.matchStarter.add(new RegisteredPlayer(decks.getAiDecks().get(aiDeckIndex)).setPlayer(GamePlayerUtil.createAiPlayer(draft.getAINames()[aiName1], draft.getAIIcons()[aiName1])));
aiDeckIndex = Integer.parseInt(draft.getStandings()[player2]) - 1;
matchup.matchStarter.add(new RegisteredPlayer(decks.getAiDecks().get(aiDeckIndex)).setPlayer(GamePlayerUtil.createAiPlayer(draft.getAINames()[aiName2], draft.getAIIcons()[aiName2])));
-
+
}
-
+
matchups.add(matchup);
}
public static void update(final IGuiGame gui) {
if (matchups.isEmpty()) {
- if (!matchInProgress) {
- aiMatchInProgress = false;
- }
return;
}
@@ -177,11 +173,9 @@
if (nextMatch.hasHumanPlayer()) {
waitForUserInput = true;
- aiMatchInProgress = false;
} else {
gui.disableOverlay();
waitForUserInput = false;
- aiMatchInProgress = true;
}
final GameRules rules = new GameRules(GameType.QuestDraft);
Index: forge-gui-desktop/src/main/java/forge/toolbox/JXButtonPanel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/JXButtonPanel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/JXButtonPanel.java (revision 29317)
@@ -20,22 +20,34 @@
// move from original package (org.jdesktop.swinghelper.buttonpanel) to keep with other gui widgets
package forge.toolbox;
-import net.miginfocom.swing.MigLayout;
-
-import javax.swing.*;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.FocusTraversalPolicy;
+import java.awt.KeyboardFocusManager;
+import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
+import javax.swing.AbstractButton;
+import javax.swing.ButtonGroup;
+import javax.swing.ButtonModel;
+import javax.swing.DefaultButtonModel;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.KeyStroke;
+import javax.swing.LayoutFocusTraversalPolicy;
+
+import net.miginfocom.swing.MigLayout;
+
/**
* This is a JPanel subclass which provides a special functionality
* for its children buttons components.
* It makes it possible to transfer focus from button to button
* with help of arrows keys.
- * <p>The following example shows how to enable cyclic focus transfer
+ * <p>The following example shows how to enable cyclic focus transfer
* <pre>
- * import org.jdesktop.swinghelper.buttonpanel.*;
+ * import org.jdesktop.swinghelper.buttonpanel.*;
* import javax.swing.*;
*
* public class SimpleDemo {
@@ -44,14 +56,14 @@
* public void run() {
* final JFrame frame = new JFrame();
* frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- *
+ *
* JXButtonPanel panel = new JXButtonPanel();
* panel.setCyclic(true);
- *
+ *
* panel.add(new JButton("One"));
* panel.add(new JButton("Two"));
* panel.add(new JButton("Three"));
- *
+ *
* frame.add(panel);
* frame.setSize(200, 200);
* frame.setLocationRelativeTo(null);
@@ -60,11 +72,11 @@
* });
* }
* }
- * </pre>
- *
+ * </pre>
+ *
* If your buttons inside JXButtonPanel are added to one ButtonGroup
* arrow keys will transfer selection between them as well as they do it for focus<p>
- * Note: you can control this behaviour with setGroupSelectionFollowFocus(boolean)
+ * Note: you can control this behaviour with setGroupSelectionFollowFocus(boolean)
* <pre>
* import org.jdesktop.swinghelper.buttonpanel.*;
* import javax.swing.*;
@@ -75,10 +87,10 @@
* public void run() {
* final JFrame frame = new JFrame();
* frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- *
+ *
* JXButtonPanel panel = new JXButtonPanel();
* ButtonGroup group = new ButtonGroup();
- *
+ *
* JRadioButton rb1 = new JRadioButton("One");
* panel.add(rb1);
* group.add(rb1);
@@ -88,10 +100,10 @@
* JRadioButton rb3 = new JRadioButton("Three");
* panel.add(rb3);
* group.add(rb3);
- *
+ *
* rb1.setSelected(true);
* frame.add(panel);
- *
+ *
* frame.setSize(200, 200);
* frame.setLocationRelativeTo(null);
* frame.setVisible(true);
@@ -99,13 +111,13 @@
* });
* }
* }
- * </pre>
- *
+ * </pre>
+ *
* @author Alexander Potochkin
- *
+ *
* https://swinghelper.dev.java.net/
* http://weblogs.java.net/blog/alexfromsun/
- *
+ *
* Modified for use by Forge
*/
@SuppressWarnings("serial")
@@ -118,25 +130,15 @@
this(new MigLayout("wrap, insets 0, gap 0"));
}
- public JXButtonPanel(LayoutManager layout) {
+ public JXButtonPanel(final LayoutManager layout) {
super(layout);
init();
}
- public JXButtonPanel(boolean isDoubleBuffered) {
- super(isDoubleBuffered);
- init();
- }
-
- public JXButtonPanel(LayoutManager layout, boolean isDoubleBuffered) {
- super(layout, isDoubleBuffered);
- init();
- }
-
private void init() {
setFocusTraversalPolicyProvider(true);
setFocusTraversalPolicy(new JXButtonPanelFocusTraversalPolicy());
- ActionListener actionHandler = new ActionHandler();
+ final ActionListener actionHandler = new ActionHandler();
registerKeyboardAction(actionHandler, ActionHandler.FORWARD,
KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0),
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
@@ -149,9 +151,9 @@
registerKeyboardAction(actionHandler, ActionHandler.BACKWARD,
KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0),
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-
+
setGroupSelectionFollowFocus(true);
-
+
// added defaults for Forge
setOpaque(false);
setCyclic(true);
@@ -159,7 +161,7 @@
/**
* Returns whether arrow keys should support
- * cyclic focus traversal ordering for for this JXButtonPanel.
+ * cyclic focus traversal ordering for for this JXButtonPanel.
*/
public boolean isCyclic() {
return isCyclic;
@@ -169,15 +171,15 @@
* Sets whether arrow keys should support
* cyclic focus traversal ordering for this JXButtonPanel.
*/
- public void setCyclic(boolean isCyclic) {
+ public void setCyclic(final boolean isCyclic) {
this.isCyclic = isCyclic;
}
/**
- * Returns whether arrow keys should transfer button's
+ * Returns whether arrow keys should transfer button's
* selection as well as focus for this JXButtonPanel.<p>
- *
- * Note: this property affects buttons which are added to a ButtonGroup
+ *
+ * Note: this property affects buttons which are added to a ButtonGroup
*/
public boolean isGroupSelectionFollowFocus() {
return isGroupSelectionFollowFocus;
@@ -186,62 +188,47 @@
/**
* Sets whether arrow keys should transfer button's
* selection as well as focus for this JXButtonPanel.<p>
- *
- * Note: this property affects buttons which are added to a ButtonGroup
+ *
+ * Note: this property affects buttons which are added to a ButtonGroup
*/
- public void setGroupSelectionFollowFocus(boolean groupSelectionFollowFocus) {
+ public void setGroupSelectionFollowFocus(final boolean groupSelectionFollowFocus) {
isGroupSelectionFollowFocus = groupSelectionFollowFocus;
}
@Override
- public Component add(Component comp) {
- Component ret = super.add(comp);
+ public Component add(final Component comp) {
+ final Component ret = super.add(comp);
if (comp instanceof AbstractButton) {
grp.add((AbstractButton)comp);
}
return ret;
}
-
+
- public Component add(Component comp, AbstractButton groupedComp) {
- Component ret = super.add(comp);
- if (null != groupedComp) {
- grp.add(groupedComp);
- }
- return ret;
- }
-
@Override
- public void add(Component comp, Object constraints) {
+ public void add(final Component comp, final Object constraints) {
super.add(comp, constraints);
if (comp instanceof AbstractButton) {
grp.add((AbstractButton)comp);
}
}
-
+
- public void add(Component comp, AbstractButton groupedComp, Object constraints) {
+ public void add(final Component comp, final AbstractButton groupedComp, final Object constraints) {
super.add(comp, constraints);
if (null != groupedComp) {
grp.add(groupedComp);
}
}
-
+
@Override
- public void add(Component comp, Object constraints, int idx) {
+ public void add(final Component comp, final Object constraints, final int idx) {
super.add(comp, constraints, idx);
if (comp instanceof AbstractButton) {
grp.add((AbstractButton)comp);
}
}
-
+
- public void add(Component comp, AbstractButton groupedComp, Object constraints, int idx) {
- super.add(comp, constraints, idx);
- if (null != groupedComp) {
- grp.add(groupedComp);
- }
- }
-
- private static ButtonGroup getButtonGroup(AbstractButton button) {
- ButtonModel model = button.getModel();
+ private static ButtonGroup getButtonGroup(final AbstractButton button) {
+ final ButtonModel model = button.getModel();
if (model instanceof DefaultButtonModel) {
return ((DefaultButtonModel) model).getGroup();
}
@@ -252,15 +239,16 @@
private static final String FORWARD = "moveSelectionForward";
private static final String BACKWARD = "moveSelectionBackward";
- public void actionPerformed(ActionEvent e) {
- FocusTraversalPolicy ftp = JXButtonPanel.this.getFocusTraversalPolicy();
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ final FocusTraversalPolicy ftp = JXButtonPanel.this.getFocusTraversalPolicy();
if (ftp instanceof JXButtonPanelFocusTraversalPolicy) {
- JXButtonPanelFocusTraversalPolicy xftp =
+ final JXButtonPanelFocusTraversalPolicy xftp =
(JXButtonPanelFocusTraversalPolicy) ftp;
- String actionCommand = e.getActionCommand();
- Component fo =
+ final String actionCommand = e.getActionCommand();
+ final Component fo =
KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
Component next;
@@ -277,17 +265,17 @@
xftp.setAlternativeFocusMode(false);
if (fo instanceof AbstractButton) {
- AbstractButton b = (AbstractButton) fo;
+ final AbstractButton b = (AbstractButton) fo;
b.getModel().setPressed(false);
}
if (next != null) {
if (fo instanceof AbstractButton && next instanceof AbstractButton) {
- ButtonGroup group = getButtonGroup((AbstractButton) fo);
- AbstractButton nextButton = (AbstractButton) next;
+ final ButtonGroup group = getButtonGroup((AbstractButton) fo);
+ final AbstractButton nextButton = (AbstractButton) next;
if (group != getButtonGroup(nextButton)) {
return;
}
- if (isGroupSelectionFollowFocus() && group != null &&
+ if (isGroupSelectionFollowFocus() && group != null &&
group.getSelection() != null && !nextButton.isSelected()) {
nextButton.setSelected(true);
}
@@ -305,14 +293,15 @@
return isAlternativeFocusMode;
}
- public void setAlternativeFocusMode(boolean alternativeFocusMode) {
+ public void setAlternativeFocusMode(final boolean alternativeFocusMode) {
isAlternativeFocusMode = alternativeFocusMode;
}
- protected boolean accept(Component c) {
+ @Override
+ protected boolean accept(final Component c) {
if (!isAlternativeFocusMode() && c instanceof AbstractButton) {
- AbstractButton button = (AbstractButton) c;
- ButtonGroup group = JXButtonPanel.getButtonGroup(button);
+ final AbstractButton button = (AbstractButton) c;
+ final ButtonGroup group = JXButtonPanel.getButtonGroup(button);
if (group != null && group.getSelection() != null
&& !button.isSelected()) {
return false;
@@ -321,8 +310,9 @@
return super.accept(c);
}
- public Component getComponentAfter(Container aContainer, Component aComponent) {
- Component componentAfter = super.getComponentAfter(aContainer, aComponent);
+ @Override
+ public Component getComponentAfter(final Container aContainer, final Component aComponent) {
+ final Component componentAfter = super.getComponentAfter(aContainer, aComponent);
if (!isAlternativeFocusMode()) {
return componentAfter;
}
@@ -336,8 +326,9 @@
return componentAfter;
}
- public Component getComponentBefore(Container aContainer, Component aComponent) {
- Component componentBefore = super.getComponentBefore(aContainer, aComponent);
+ @Override
+ public Component getComponentBefore(final Container aContainer, final Component aComponent) {
+ final Component componentBefore = super.getComponentBefore(aContainer, aComponent);
if (!isAlternativeFocusMode()) {
return componentBefore;
}
Index: forge-gui/src/main/java/forge/deck/RandomDeckGenerator.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/deck/RandomDeckGenerator.java (revision 29316)
+++ forge-gui/src/main/java/forge/deck/RandomDeckGenerator.java (revision 29317)
@@ -18,9 +18,9 @@
User,
Favorite
}
-
+
- public static List<DeckProxy> getRandomDecks(IHasGameType lstDecks0, boolean isAi0) {
- ArrayList<DeckProxy> decks = new ArrayList<DeckProxy>();
+ public static List<DeckProxy> getRandomDecks(final IHasGameType lstDecks0, final boolean isAi0) {
+ final List<DeckProxy> decks = new ArrayList<DeckProxy>();
decks.add(new RandomDeckGenerator("Random Generated Deck", RandomDeckType.Generated, lstDecks0, isAi0));
decks.add(new RandomDeckGenerator("Random User Deck", RandomDeckType.User, lstDecks0, isAi0));
@@ -34,7 +34,7 @@
private final IHasGameType lstDecks;
private final boolean isAi;
- private RandomDeckGenerator(String name0, RandomDeckType type0, IHasGameType lstDecks0, boolean isAi0) {
+ private RandomDeckGenerator(final String name0, final RandomDeckType type0, final IHasGameType lstDecks0, final boolean isAi0) {
super();
name = name0;
type = type0;
@@ -54,7 +54,7 @@
@Override
public int compareTo(final RandomDeckGenerator d) {
- return d instanceof RandomDeckGenerator ? Integer.compare(type.ordinal(), ((RandomDeckGenerator)d).type.ordinal()) : 1;
+ return Integer.compare(type.ordinal(), d.type.ordinal());
}
@Override
@@ -87,8 +87,8 @@
case QUEST_OPPONENT_DECK:
return Aggregates.random(DeckProxy.getAllQuestEventAndChallenges()).getDeck();
case COLOR_DECK:
- List<String> colors = new ArrayList<String>();
- int count = Aggregates.randomInt(1, 3);
+ final List<String> colors = new ArrayList<String>();
+ final int count = Aggregates.randomInt(1, 3);
for (int i = 1; i <= count; i++) {
colors.add("Random " + i);
}
@@ -101,7 +101,7 @@
}
}
}
-
+
private Deck getUserDeck() {
Iterable<Deck> decks;
switch (lstDecks.getGameType()) {
@@ -135,8 +135,7 @@
break;
case TinyLeaders:
decks = Iterables.filter(DeckProxy.getAllCommanderDecks(), new Predicate<DeckProxy>() {
- @Override
- public boolean apply(DeckProxy deck) {
+ @Override public boolean apply(final DeckProxy deck) {
return DeckFormat.TinyLeaders.getDeckConformanceProblem(deck.getDeck()) == null;
}
});
@@ -152,8 +151,7 @@
break;
}
decks = Iterables.filter(decks, new Predicate<DeckProxy>() {
- @Override
- public boolean apply(DeckProxy deck) {
+ @Override public boolean apply(final DeckProxy deck) {
return deck.isFavoriteDeck();
}
});
Index: forge-gui/src/main/java/forge/model/CardCollections.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/model/CardCollections.java (revision 29316)
+++ forge-gui/src/main/java/forge/model/CardCollections.java (revision 29317)
@@ -6,30 +6,29 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.model;
+import java.io.File;
+
+import org.apache.commons.lang3.time.StopWatch;
+
import forge.deck.Deck;
import forge.deck.DeckGroup;
import forge.deck.io.DeckGroupSerializer;
import forge.deck.io.DeckStorage;
-import forge.deck.io.OldDeckParser;
import forge.properties.ForgeConstants;
import forge.util.storage.IStorage;
import forge.util.storage.StorageImmediatelySerialized;
-import org.apache.commons.lang3.time.StopWatch;
-
-import java.io.File;
-
/**
* Holds editable maps of decks saved to disk. Adding or removing items to(from)
* such map turns into immediate file update
@@ -46,24 +45,19 @@
private final IStorage<Deck> tinyLeaders;
public CardCollections() {
- StopWatch sw = new StopWatch();
+ final StopWatch sw = new StopWatch();
sw.start();
- constructed = new StorageImmediatelySerialized<Deck>("Constructed decks", new DeckStorage(new File(ForgeConstants.DECK_CONSTRUCTED_DIR), true), true);
+ constructed = new StorageImmediatelySerialized<Deck> ("Constructed decks", new DeckStorage(new File(ForgeConstants.DECK_CONSTRUCTED_DIR), true), true);
- draft = new StorageImmediatelySerialized<DeckGroup>("Draft deck sets", new DeckGroupSerializer(new File(ForgeConstants.DECK_DRAFT_DIR)));
+ draft = new StorageImmediatelySerialized<DeckGroup>("Draft deck sets", new DeckGroupSerializer(new File(ForgeConstants.DECK_DRAFT_DIR)));
- sealed = new StorageImmediatelySerialized<DeckGroup>("Sealed deck sets", new DeckGroupSerializer(new File(ForgeConstants.DECK_SEALED_DIR)));
+ sealed = new StorageImmediatelySerialized<DeckGroup>("Sealed deck sets", new DeckGroupSerializer(new File(ForgeConstants.DECK_SEALED_DIR)));
- winston = new StorageImmediatelySerialized<DeckGroup>("Winston draft deck sets", new DeckGroupSerializer(new File(ForgeConstants.DECK_WINSTON_DIR)));
+ winston = new StorageImmediatelySerialized<DeckGroup>("Winston draft deck sets", new DeckGroupSerializer(new File(ForgeConstants.DECK_WINSTON_DIR)));
- cube = new StorageImmediatelySerialized<Deck>("Cubes", new DeckStorage(new File(ForgeConstants.DECK_CUBE_DIR)));
+ cube = new StorageImmediatelySerialized<Deck> ("Cubes", new DeckStorage(new File(ForgeConstants.DECK_CUBE_DIR)));
- scheme = new StorageImmediatelySerialized<Deck>("Archenemy decks", new DeckStorage(new File(ForgeConstants.DECK_SCHEME_DIR)));
+ scheme = new StorageImmediatelySerialized<Deck> ("Archenemy decks", new DeckStorage(new File(ForgeConstants.DECK_SCHEME_DIR)));
- plane = new StorageImmediatelySerialized<Deck>("Planechase decks", new DeckStorage(new File(ForgeConstants.DECK_PLANE_DIR)));
+ plane = new StorageImmediatelySerialized<Deck> ("Planechase decks", new DeckStorage(new File(ForgeConstants.DECK_PLANE_DIR)));
- commander = new StorageImmediatelySerialized<Deck>("Commander decks", new DeckStorage(new File(ForgeConstants.DECK_COMMANDER_DIR)));
+ commander = new StorageImmediatelySerialized<Deck> ("Commander decks", new DeckStorage(new File(ForgeConstants.DECK_COMMANDER_DIR)));
- tinyLeaders = new StorageImmediatelySerialized<Deck>("Commander decks", new DeckStorage(new File(ForgeConstants.DECK_TINY_LEADERS_DIR)));
+ tinyLeaders = new StorageImmediatelySerialized<Deck> ("Commander decks", new DeckStorage(new File(ForgeConstants.DECK_TINY_LEADERS_DIR)));
sw.stop();
System.out.printf("Read decks (%d ms): %d constructed, %d sealed, %d draft, %d cubes, %d scheme, %d planar, %d commander, %d tiny leaders.%n", sw.getTime(), constructed.size(), sealed.size(), draft.size(), cube.size(), scheme.size(), plane.size(), commander.size(), tinyLeaders.size());
-// int sum = constructed.size() + sealed.size() + draft.size() + cube.size() + scheme.size() + plane.size();
-// FSkin.setProgessBarMessage(String.format("Loaded %d decks in %f sec", sum, sw.getTime() / 1000f ));
- // remove this after most people have been switched to new layout
- final OldDeckParser oldParser = new OldDeckParser(constructed, draft, sealed, cube);
- oldParser.tryParse();
}
public final IStorage<Deck> getConstructed() {
Index: forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java (revision 29317)
@@ -1,7 +1,20 @@
package forge.screens.home.settings;
-import forge.UiCommand;
+import java.awt.Desktop;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JCheckBox;
+import javax.swing.SwingUtilities;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+
import forge.Singletons;
+import forge.UiCommand;
import forge.ai.AiProfileUtil;
import forge.control.FControl.CloseAction;
import forge.control.RestartUtil;
@@ -10,30 +23,18 @@
import forge.gui.framework.ICDoc;
import forge.model.FModel;
import forge.player.GamePlayerUtil;
+import forge.properties.ForgeConstants;
import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.FPref;
-import forge.properties.ForgeConstants;
import forge.sound.SoundSystem;
import forge.toolbox.FComboBox;
import forge.toolbox.FComboBoxPanel;
import forge.toolbox.FLabel;
import forge.toolbox.FOptionPane;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.tuple.Pair;
-
-import javax.swing.*;
-
-import java.awt.Desktop;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Controls the preferences submenu in the home UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -142,7 +143,7 @@
CSubmenuPreferences.this.resetDeckEditorLayout();
}
});
-
+
view.getBtnDeleteWorkshopUI().setCommand(new UiCommand() {
@Override
public void run() {
@@ -191,7 +192,7 @@
view.getCbDevMode().setSelected(ForgePreferences.DEV_MODE);
view.getCbEnableMusic().setSelected(prefs.getPrefBoolean(FPref.UI_ENABLE_MUSIC));
- for(Pair<JCheckBox, FPref> kv: lstControls) {
+ for(final Pair<JCheckBox, FPref> kv: lstControls) {
kv.getKey().setSelected(prefs.getPrefBoolean(kv.getValue()));
}
view.reloadShortcuts();
@@ -203,20 +204,12 @@
updating = false;
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
-
private void resetForgeSettingsToDefault() {
- String userPrompt =
+ final String userPrompt =
"This will reset all preferences to their defaults and restart Forge.\n\n" +
"Reset and restart Forge?";
if (FOptionPane.showConfirmDialog(userPrompt, "Reset Settings")) {
- ForgePreferences prefs = FModel.getPreferences();
+ final ForgePreferences prefs = FModel.getPreferences();
prefs.reset();
prefs.save();
update();
@@ -225,7 +218,7 @@
}
private void resetDeckEditorLayout() {
- String userPrompt =
+ final String userPrompt =
"This will reset the Deck Editor screen layout.\n" +
"All tabbed views will be restored to their default positions.\n\n" +
"Reset layout?";
@@ -237,7 +230,7 @@
}
private void resetWorkshopLayout() {
- String userPrompt =
+ final String userPrompt =
"This will reset the Workshop screen layout.\n" +
"All tabbed views will be restored to their default positions.\n\n" +
"Reset layout?";
@@ -249,7 +242,7 @@
}
private void resetMatchScreenLayout() {
- String userPrompt =
+ final String userPrompt =
"This will reset the layout of the Match screen.\n" +
"If you want to save the current layout first, please use " +
"the Dock tab -> Save Layout option in the Match screen.\n\n" +
@@ -262,56 +255,53 @@
}
private void openUserProfileDirectory() {
- try{
+ try {
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().open(new File(ForgeConstants.USER_DIR));
}
- }
- catch(Exception e) {
+ } catch(final Exception e) {
System.out.println("Unable to open Directory: " + e.toString());
}
}
private void openContentDirectory() {
- try{
+ try {
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().open(new File(ForgeConstants.CACHE_DIR));
}
- }
- catch(Exception e) {
+ } catch(final Exception e) {
System.out.println("Unable to open Directory: " + e.toString());
}
}
private void initializeGameLogVerbosityComboBox() {
- FPref userSetting = FPref.DEV_LOG_ENTRY_TYPE;
- FComboBoxPanel<GameLogEntryType> panel = this.view.getGameLogVerbosityComboBoxPanel();
- FComboBox<GameLogEntryType> comboBox = createComboBox(GameLogEntryType.values(), userSetting);
- GameLogEntryType selectedItem = GameLogEntryType.valueOf(this.prefs.getPref(userSetting));
+ final FPref userSetting = FPref.DEV_LOG_ENTRY_TYPE;
+ final FComboBoxPanel<GameLogEntryType> panel = this.view.getGameLogVerbosityComboBoxPanel();
+ final FComboBox<GameLogEntryType> comboBox = createComboBox(GameLogEntryType.values(), userSetting);
+ final GameLogEntryType selectedItem = GameLogEntryType.valueOf(this.prefs.getPref(userSetting));
panel.setComboBox(comboBox, selectedItem);
}
-
+
private void initializeCloseActionComboBox() {
final FComboBoxPanel<CloseAction> panel = this.view.getCloseActionComboBoxPanel();
final FComboBox<CloseAction> comboBox = new FComboBox<CloseAction>(CloseAction.values());
comboBox.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(final ItemEvent e) {
- Singletons.getControl().setCloseAction((CloseAction) comboBox.getSelectedItem());
+ @Override public void itemStateChanged(final ItemEvent e) {
+ Singletons.getControl().setCloseAction(comboBox.getSelectedItem());
}
});
panel.setComboBox(comboBox, Singletons.getControl().getCloseAction());
}
private void initializeAiProfilesComboBox() {
- FPref userSetting = FPref.UI_CURRENT_AI_PROFILE;
- FComboBoxPanel<String> panel = this.view.getAiProfilesComboBoxPanel();
- FComboBox<String> comboBox = createComboBox(AiProfileUtil.getProfilesArray(), userSetting);
- String selectedItem = this.prefs.getPref(userSetting);
+ final FPref userSetting = FPref.UI_CURRENT_AI_PROFILE;
+ final FComboBoxPanel<String> panel = this.view.getAiProfilesComboBoxPanel();
+ final FComboBox<String> comboBox = createComboBox(AiProfileUtil.getProfilesArray(), userSetting);
+ final String selectedItem = this.prefs.getPref(userSetting);
panel.setComboBox(comboBox, selectedItem);
}
- private <E> FComboBox<E> createComboBox(E[] items, final ForgePreferences.FPref setting) {
+ private <E> FComboBox<E> createComboBox(final E[] items, final ForgePreferences.FPref setting) {
final FComboBox<E> comboBox = new FComboBox<E>(items);
addComboBoxListener(comboBox, setting);
return comboBox;
@@ -319,9 +309,8 @@
private <E> void addComboBoxListener(final FComboBox<E> comboBox, final ForgePreferences.FPref setting) {
comboBox.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(final ItemEvent e) {
- E selectedType = (E) comboBox.getSelectedItem();
+ @Override public void itemStateChanged(final ItemEvent e) {
+ final E selectedType = comboBox.getSelectedItem();
CSubmenuPreferences.this.prefs.setPref(setting, selectedType.toString());
CSubmenuPreferences.this.prefs.save();
}
@@ -329,22 +318,21 @@
}
private void initializePlayerNameButton() {
- FLabel btn = view.getBtnPlayerName();
+ final FLabel btn = view.getBtnPlayerName();
setPlayerNameButtonText();
btn.setCommand(getPlayerNameButtonCommand());
}
private void setPlayerNameButtonText() {
- FLabel btn = view.getBtnPlayerName();
- String name = prefs.getPref(FPref.PLAYER_NAME);
+ final FLabel btn = view.getBtnPlayerName();
+ final String name = prefs.getPref(FPref.PLAYER_NAME);
btn.setText(StringUtils.isBlank(name) ? "Human" : name);
}
@SuppressWarnings("serial")
private UiCommand getPlayerNameButtonCommand() {
return new UiCommand() {
- @Override
- public void run() {
+ @Override public void run() {
GamePlayerUtil.setPlayerName();
setPlayerNameButtonText();
}
Index: forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemTableColumn.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemTableColumn.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemTableColumn.java (revision 29317)
@@ -6,17 +6,22 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.itemmanager.views;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.swing.table.TableColumn;
+
import com.google.common.base.Function;
import forge.item.InventoryItem;
@@ -26,11 +31,6 @@
import forge.itemmanager.ItemColumnConfig.SortState;
import forge.itemmanager.ItemManagerConfig;
-import javax.swing.table.TableColumn;
-
-import java.util.Map;
-import java.util.Map.Entry;
-
/**
* A column object in a EditorTableModel in the card editor.
* Requires a sorting function and a display function
@@ -41,15 +41,15 @@
private final ItemColumn itemColumn;
- public ItemTableColumn(ItemColumn itemColumn0) {
+ public ItemTableColumn(final ItemColumn itemColumn0) {
super();
itemColumn = itemColumn0;
- ColumnDef def = itemColumn.getConfig().getDef();
+ final ColumnDef def = itemColumn.getConfig().getDef();
this.setIdentifier(def);
this.setHeaderValue(def.shortName);
- int width = itemColumn.getConfig().getPreferredWidth();
+ final int width = itemColumn.getConfig().getPreferredWidth();
this.setPreferredWidth(width);
if (def.isWidthFixed) {
this.setMinWidth(width);
@@ -102,7 +102,7 @@
return itemColumn.getConfig().isVisible();
}
- public void setVisible(boolean visible0) {
+ public void setVisible(final boolean visible0) {
itemColumn.getConfig().setVisible(visible0);
}
@@ -125,7 +125,7 @@
public void endResize() {
//restore min/max width after resize to prevent table auto-scaling fixed width columns
if (itemColumn.getConfig().getDef().isWidthFixed) {
- int width = this.getWidth();
+ final int width = this.getWidth();
this.setMinWidth(width);
this.setMaxWidth(width);
}
@@ -140,13 +140,13 @@
return itemColumn.toString();
}
- public static void addColOverride(ItemManagerConfig config, Map<ColumnDef, ItemTableColumn> colOverrides, ColumnDef colDef) {
- ItemColumnConfig colConfig = config.getCols().get(colDef);
+ public static void addColOverride(final ItemManagerConfig config, final Map<ColumnDef, ItemTableColumn> colOverrides, final ColumnDef colDef) {
+ final ItemColumnConfig colConfig = config.getCols().get(colDef);
addColOverride(config, colOverrides, colDef, colConfig.getFnSort(), colConfig.getFnDisplay());
}
- public static void addColOverride(ItemManagerConfig config, Map<ColumnDef, ItemTableColumn> colOverrides, ColumnDef colDef,
- Function<Entry<InventoryItem, Integer>, Comparable<?>> fnSort0,
- Function<Entry<? extends InventoryItem, Integer>, Object> fnDisplay0) {
+ public static void addColOverride(final ItemManagerConfig config, final Map<ColumnDef, ItemTableColumn> colOverrides, final ColumnDef colDef,
+ final Function<Entry<InventoryItem, Integer>, Comparable<?>> fnSort0,
+ final Function<Entry<? extends InventoryItem, Integer>, Object> fnDisplay0) {
colOverrides.put(colDef, new ItemTableColumn(new ItemColumn(config.getCols().get(colDef), fnSort0, fnDisplay0)));
}
}
Index: forge-gui-desktop/src/main/java/forge/screens/match/controllers/CStack.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/match/controllers/CStack.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/controllers/CStack.java (revision 29317)
@@ -1,15 +1,14 @@
package forge.screens.match.controllers;
-import forge.UiCommand;
import forge.gui.framework.EDocID;
import forge.gui.framework.ICDoc;
import forge.gui.framework.SDisplayUtil;
import forge.screens.match.CMatchUI;
import forge.screens.match.views.VStack;
-/**
+/**
* Controls the combat panel in the match UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -27,14 +26,6 @@
}
public final VStack getView() {
return view;
- }
-
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
}
@Override
Index: forge-gui/src/main/java/forge/properties/PreferencesStore.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/properties/PreferencesStore.java (revision 29316)
+++ forge-gui/src/main/java/forge/properties/PreferencesStore.java (revision 29317)
@@ -6,19 +6,17 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.properties;
-import forge.util.FileUtil;
-
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
@@ -26,6 +24,8 @@
import java.util.List;
import java.util.Map;
+import forge.util.FileUtil;
+
/**
* Holds default preference values in an enum.
* Loads preferred values when instantiated.
@@ -35,25 +35,25 @@
private final Map<T, String> preferenceValues;
private final String filename;
- public PreferencesStore(String filename0, Class<T> clasz) {
+ public PreferencesStore(final String filename0, final Class<T> clasz) {
preferenceValues = new EnumMap<T, String>(clasz);
filename = filename0;
-
+
- List<String> lines = FileUtil.readFile(filename);
+ final List<String> lines = FileUtil.readFile(filename);
for (String line : lines) {
line = line.trim();
if (line.startsWith("#") || (line.isEmpty())) {
continue;
}
- String[] split = line.split("=");
- T pref = valueOf(split[0]);
+ final String[] split = line.split("=");
+ final T pref = valueOf(split[0]);
-
+
if (null == pref) {
System.out.println("unknown preference: " + line);
continue;
}
-
+
if (split.length == 2) {
this.setPref(pref, split[1]);
} else if (split.length == 1 && line.endsWith("=")) {
@@ -61,42 +61,45 @@
}
}
}
-
+
protected abstract T[] getEnumValues();
protected abstract T valueOf(String name);
protected abstract String getPrefDefault(T key);
-
+
public final void save() {
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(filename));
- for (T key : getEnumValues()) {
+ for (final T key : getEnumValues()) {
writer.write(key + "=" + getPref(key));
writer.newLine();
}
- } catch (IOException ex) {
+ } catch (final IOException ex) {
ex.printStackTrace();
} finally {
if (null != writer) {
- try { writer.close(); }
- catch (IOException e) { System.out.println("error while closing " + filename); }
+ try {
+ writer.close();
+ } catch (final IOException e) {
+ System.out.println("error while closing " + filename);
- }
- }
- }
+ }
+ }
+ }
+ }
public final void reset() {
this.preferenceValues.clear();
}
- public final void setPref(T q0, String s0) {
+ public final void setPref(final T q0, final String s0) {
preferenceValues.put(q0, s0);
}
- public final void setPref(T q0, boolean val) {
+ public final void setPref(final T q0, final boolean val) {
setPref(q0, String.valueOf(val));
}
- public final String getPref(T fp0) {
+ public final String getPref(final T fp0) {
String val;
val = preferenceValues.get(fp0);
@@ -105,11 +108,11 @@
return val;
}
- public final int getPrefInt(T fp0) {
+ public final int getPrefInt(final T fp0) {
return Integer.parseInt(getPref(fp0));
}
- public final boolean getPrefBoolean(T fp0) {
+ public final boolean getPrefBoolean(final T fp0) {
return Boolean.parseBoolean(getPref(fp0));
}
}
Index: forge-gui-desktop/src/main/java/forge/screens/match/controllers/CDetail.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/match/controllers/CDetail.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/controllers/CDetail.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -19,7 +19,6 @@
import java.awt.event.MouseEvent;
-import forge.UiCommand;
import forge.game.card.CardView;
import forge.gui.framework.ICDoc;
import forge.item.InventoryItem;
@@ -30,7 +29,7 @@
/**
* Controller for {@link VDetail}. May be used as part of a
* {@link CDetailPicture}.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*/
public class CDetail implements ICDoc {
@@ -52,7 +51,7 @@
/**
* Shows card details and/or picture in sidebar cardview tabber.
- *
+ *
* @param c &emsp; {@link CardView} object
* @param isInAltState whether to draw the flip side of the card.
*/
@@ -71,11 +70,6 @@
view.getPnlDetail().setItem((InventoryItemFromSet)item);
view.getParentCell().repaintSelf();
}
- }
-
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
}
@Override
Index: forge-gui-desktop/src/main/java/forge/toolbox/FMouseAdapter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FMouseAdapter.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FMouseAdapter.java (revision 29317)
@@ -1,40 +1,41 @@
package forge.toolbox;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
-/**
+/**
* Special mouse adapter to make it handling specific mouse buttons easier
* and improve responsiveness of click and double click actions
*
*/
public abstract class FMouseAdapter extends MouseAdapter {
//Event functions to override
- public void onLeftMouseDown(MouseEvent e) {}
- public void onLeftMouseUp(MouseEvent e) {}
- public void onLeftClick(MouseEvent e) {}
- public void onLeftDoubleClick(MouseEvent e) {}
- public void onLeftMouseDragging(MouseEvent e) {}
- public void onLeftMouseDragDrop(MouseEvent e) {}
+ public void onLeftMouseDown(final MouseEvent e) {}
+ public void onLeftMouseUp(final MouseEvent e) {}
+ public void onLeftClick(final MouseEvent e) {}
+ public void onLeftDoubleClick(final MouseEvent e) {}
+ public void onLeftMouseDragging(final MouseEvent e) {}
+ public void onLeftMouseDragDrop(final MouseEvent e) {}
- public void onMiddleMouseDown(MouseEvent e) {}
- public void onMiddleMouseUp(MouseEvent e) {}
- public void onMiddleClick(MouseEvent e) {}
- public void onMiddleDoubleClick(MouseEvent e) {}
- public void onMiddleMouseDragging(MouseEvent e) {}
- public void onMiddleMouseDragDrop(MouseEvent e) {}
+ public void onMiddleMouseDown(final MouseEvent e) {}
+ public void onMiddleMouseUp(final MouseEvent e) {}
+ public void onMiddleClick(final MouseEvent e) {}
+ public void onMiddleDoubleClick(final MouseEvent e) {}
+ public void onMiddleMouseDragging(final MouseEvent e) {}
+ public void onMiddleMouseDragDrop(final MouseEvent e) {}
- public void onRightMouseDown(MouseEvent e) {}
- public void onRightMouseUp(MouseEvent e) {}
- public void onRightClick(MouseEvent e) {}
- public void onRightDoubleClick(MouseEvent e) {}
- public void onRightMouseDragging(MouseEvent e) {}
- public void onRightMouseDragDrop(MouseEvent e) {}
+ public void onRightMouseDown(final MouseEvent e) {}
+ public void onRightMouseUp(final MouseEvent e) {}
+ public void onRightClick(final MouseEvent e) {}
+ public void onRightDoubleClick(final MouseEvent e) {}
+ public void onRightMouseDragging(final MouseEvent e) {}
+ public void onRightMouseDragDrop(final MouseEvent e) {}
- public void onMouseEnter(MouseEvent e) {}
- public void onMouseExit(MouseEvent e) {}
+ public void onMouseEnter(final MouseEvent e) {}
+ public void onMouseExit(final MouseEvent e) {}
/**
* Forge Mouse Adapter with infinite click tolerance (so long as mouse doesn't leave component)
@@ -43,7 +44,7 @@
this(false);
}
- public FMouseAdapter(boolean isCompDraggable0) {
+ public FMouseAdapter(final boolean isCompDraggable0) {
isCompDraggable = isCompDraggable0;
}
@@ -54,7 +55,7 @@
setMouseDownAdapter(null);
}
- private static void setMouseDownAdapter(FMouseAdapter mouseDownAdapter0) {
+ private static void setMouseDownAdapter(final FMouseAdapter mouseDownAdapter0) {
if (mouseDownAdapter == mouseDownAdapter0) { return; }
if (mouseDownAdapter != null) {
//ensure mouse up handled for mouse down adapter if needed
@@ -124,7 +125,7 @@
if (isCompDraggable) {
tempMotionListenerComp = e.getComponent();
if (tempMotionListenerComp != null) {
- for (MouseMotionListener motionListener : tempMotionListenerComp.getMouseMotionListeners()) {
+ for (final MouseMotionListener motionListener : tempMotionListenerComp.getMouseMotionListeners()) {
if (motionListener == this) {
tempMotionListenerComp = null;
break;
@@ -159,7 +160,7 @@
}
@Override
- public final void mouseDragged(MouseEvent e) {
+ public final void mouseDragged(final MouseEvent e) {
//clear mouse down location if component begins being dragged
if (mouseDownLoc != null && isCompDraggable &&
e.getLocationOnScreen().distance(mouseDownLoc) > 3) {
@@ -181,13 +182,13 @@
}
@Override
- public final void mouseEntered(MouseEvent e) {
+ public final void mouseEntered(final MouseEvent e) {
hovered = true;
onMouseEnter(e);
}
@Override
- public final void mouseExited(MouseEvent e) {
+ public final void mouseExited(final MouseEvent e) {
hovered = false;
onMouseExit(e);
}
@@ -201,7 +202,7 @@
}
@Override
- public final void mouseReleased(MouseEvent e) {
+ public final void mouseReleased(final MouseEvent e) {
int button = e.getButton();
if (button < 1 || button > 3 || downButton == 0 || mouseDownAdapter != this) {
return;
@@ -268,7 +269,7 @@
}
@Override
- public final void mouseClicked(MouseEvent e) {
+ public final void mouseClicked(final MouseEvent e) {
//override mouseClicked as final to prevent it being used since it doesn't fire
//if the user moves the mouse at all between mouse down and mouse up
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/FSpinner.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FSpinner.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FSpinner.java (revision 29317)
@@ -1,13 +1,15 @@
package forge.toolbox;
-import forge.toolbox.FSkin.SkinnedSpinner;
+import java.awt.Insets;
-import javax.swing.*;
+import javax.swing.JFormattedTextField;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
import javax.swing.text.NumberFormatter;
-import java.awt.*;
+import forge.toolbox.FSkin.SkinnedSpinner;
-/**
+/**
* A custom instance of JSpinner using Forge skin properties. Only numeric
* integer spinners are implemented, since that's all we've needed so far.
*
@@ -23,26 +25,24 @@
public FSpinner build() { return new FSpinner(this); }
- public Builder initialValue(int i0) { initialValue = i0; return this; }
- public Builder minValue(int i0) { minValue = i0; return this; }
- public Builder maxValue(int i0) { maxValue = i0; return this; }
-
- public Builder tooltip(String s0) { toolTip = s0; return this; }
+ public Builder initialValue(final int i0) { initialValue = i0; return this; }
+ public Builder minValue(final int i0) { minValue = i0; return this; }
+ public Builder maxValue(final int i0) { maxValue = i0; return this; }
}
- private FSpinner(Builder builder) {
+ private FSpinner(final Builder builder) {
this.setOpaque(false);
-
+
this.setModel(new SpinnerNumberModel(builder.initialValue, builder.minValue, builder.maxValue, 1));
this.setEditor(new JSpinner.NumberEditor(this, "##"));
- JFormattedTextField txt = this.getTextField();
+ final JFormattedTextField txt = this.getTextField();
((NumberFormatter)txt.getFormatter()).setAllowsInvalid(false);
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
this.setCaretColor(FSkin.getColor(FSkin.Colors.CLR_TEXT));
txt.setMargin(new Insets(5, 5, 5, 5));
txt.setOpaque(true);
-
+
this.setToolTipText(builder.toolTip);
this.setFocusable(true);
}
Index: forge-gui/src/main/java/forge/player/GamePlayerUtil.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/player/GamePlayerUtil.java (revision 29316)
+++ forge-gui/src/main/java/forge/player/GamePlayerUtil.java (revision 29317)
@@ -9,7 +9,6 @@
import forge.LobbyPlayer;
import forge.ai.AiProfileUtil;
import forge.ai.LobbyPlayerAi;
-import forge.game.player.Player;
import forge.model.FModel;
import forge.properties.ForgePreferences.FPref;
import forge.util.GuiDisplayUtil;
@@ -43,15 +42,15 @@
public final static LobbyPlayer createAiPlayer() {
return createAiPlayer(GuiDisplayUtil.getRandomAiName());
}
- public final static LobbyPlayer createAiPlayer(String name) {
- int avatarCount = GuiBase.getInterface().getAvatarCount();
+ public final static LobbyPlayer createAiPlayer(final String name) {
+ final int avatarCount = GuiBase.getInterface().getAvatarCount();
return createAiPlayer(name, avatarCount == 0 ? 0 : MyRandom.getRandom().nextInt(avatarCount));
}
- public final static LobbyPlayer createAiPlayer(String name, int avatarIndex) {
+ public final static LobbyPlayer createAiPlayer(final String name, final int avatarIndex) {
return createAiPlayer(name, avatarIndex, null);
}
- public final static LobbyPlayer createAiPlayer(String name, int avatarIndex, Set<AIOption> options) {
- LobbyPlayerAi player = new LobbyPlayerAi(name, options);
+ public final static LobbyPlayer createAiPlayer(final String name, final int avatarIndex, final Set<AIOption> options) {
+ final LobbyPlayerAi player = new LobbyPlayerAi(name, options);
// TODO: implement specific AI profiles for quest mode.
String lastProfileChosen = FModel.getPreferences().getPref(FPref.UI_CURRENT_AI_PROFILE);
@@ -65,32 +64,20 @@
return player;
}
- public Player getSingleOpponent(Player player) {
- if (player.getGame().getRegisteredPlayers().size() == 2) {
- for (Player p : player.getGame().getRegisteredPlayers()) {
- if (p.isOpponentOf(player)) {
- return p;
- }
- }
- }
- return null;
- }
-
public static void setPlayerName() {
- String oldPlayerName = FModel.getPreferences().getPref(FPref.PLAYER_NAME);
+ final String oldPlayerName = FModel.getPreferences().getPref(FPref.PLAYER_NAME);
String newPlayerName;
- try{
- if (StringUtils.isBlank(oldPlayerName)) {
- newPlayerName = getVerifiedPlayerName(getPlayerNameUsingFirstTimePrompt(), oldPlayerName);
+ try{
+ if (StringUtils.isBlank(oldPlayerName)) {
+ newPlayerName = getVerifiedPlayerName(getPlayerNameUsingFirstTimePrompt(), oldPlayerName);
- }
- else {
+ } else {
- newPlayerName = getVerifiedPlayerName(getPlayerNameUsingStandardPrompt(oldPlayerName), oldPlayerName);
- }
+ newPlayerName = getVerifiedPlayerName(getPlayerNameUsingStandardPrompt(oldPlayerName), oldPlayerName);
+ }
- } catch (IllegalStateException ise){
+ } catch (final IllegalStateException ise){
- //now is not a good time for this...
- newPlayerName = StringUtils.isBlank(oldPlayerName) ? "Human" : oldPlayerName;
- }
+ //now is not a good time for this...
+ newPlayerName = StringUtils.isBlank(oldPlayerName) ? "Human" : oldPlayerName;
+ }
FModel.getPreferences().setPref(FPref.PLAYER_NAME, newPlayerName);
FModel.getPreferences().save();
@@ -123,7 +110,7 @@
playerName);
}
- private static String getVerifiedPlayerName(String newName, String oldName) {
+ private static String getVerifiedPlayerName(String newName, final String oldName) {
if (newName == null || !StringUtils.isAlphanumericSpace(newName)) {
newName = (StringUtils.isBlank(oldName) ? "Human" : oldName);
} else if (StringUtils.isWhitespace(newName)) {
Index: forge-gui/src/main/java/forge/match/input/InputPayManaSimple.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/input/InputPayManaSimple.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/input/InputPayManaSimple.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -51,6 +51,7 @@
}
}
+ @Override
protected void onManaAbilityPaid() {
if (this.manaCost.isPaid()) {
this.originalCard.setSunburstValue(this.manaCost.getSunburst());
@@ -59,7 +60,7 @@
/** {@inheritDoc} */
@Override
- protected final void onPlayerSelected(Player selected, final ITriggerEvent triggerEvent) {
+ protected final void onPlayerSelected(final Player selected, final ITriggerEvent triggerEvent) {
if (player == selected) {
if (player.canPayLife(this.phyLifeToLose + 2) && manaCost.payPhyrexian()) {
this.phyLifeToLose += 2;
Index: forge-gui/src/main/java/forge/UiCommand.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/UiCommand.java (revision 29316)
+++ forge-gui/src/main/java/forge/UiCommand.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -21,19 +21,9 @@
* <p>
* Command interface.
* </p>
- *
+ *
* @author Forge
- * @version $Id: UiCommand.java 24794 2014-02-10 08:11:32Z Max mtg $
+ * @version $Id: UiCommand.java 29317 2015-05-01 19:27:48Z elcnesh $
*/
public interface UiCommand extends java.io.Serializable, Runnable {
- /** Constant <code>Blank</code>. */
- public final UiCommand BLANK = new UiCommand() {
-
- private static final long serialVersionUID = 2689172297036001710L;
-
- @Override
- public void run() {
- }
-
- };
}
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/views/VStatistics.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/views/VStatistics.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/views/VStatistics.java (revision 29317)
@@ -1,5 +1,10 @@
package forge.screens.deckeditor.views;
+import java.awt.Font;
+
+import javax.swing.JPanel;
+
+import net.miginfocom.swing.MigLayout;
import forge.gui.framework.DragCell;
import forge.gui.framework.DragTab;
import forge.gui.framework.EDocID;
@@ -10,13 +15,8 @@
import forge.toolbox.FScrollPane;
import forge.toolbox.FSkin;
import forge.toolbox.FSkin.SkinImage;
-import net.miginfocom.swing.MigLayout;
-import javax.swing.*;
-
-import java.awt.*;
-
-/**
+/**
* Assembles Swing components of deck editor analysis tab.
*
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
@@ -279,7 +279,7 @@
//========== Other methods
- private FLabel buildLabel(SkinImage icon, boolean zebra) {
+ private static FLabel buildLabel(final SkinImage icon, final boolean zebra) {
final FLabel lbl = new FLabel.Builder().text("0 (0%)")
.icon(icon).iconScaleAuto(false)
.fontSize(11).build();
@@ -291,8 +291,8 @@
return lbl;
}
-
+
- private FLabel buildLabel(StatTypes statType, boolean zebra) {
+ private static FLabel buildLabel(final StatTypes statType, final boolean zebra) {
return buildLabel(FSkin.getImage(statType.skinProp, 18, 18), zebra);
}
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/special/PlayerDetailsPanel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/special/PlayerDetailsPanel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/special/PlayerDetailsPanel.java (revision 29317)
@@ -20,7 +20,6 @@
import forge.assets.FSkinProp;
import forge.card.MagicColor;
import forge.game.player.PlayerView;
-import forge.gui.ForgeAction;
import forge.toolbox.FLabel;
import forge.toolbox.FMouseAdapter;
import forge.toolbox.FSkin;
@@ -111,7 +110,7 @@
/**
* Handles observer update of player Zones - hand, graveyard, etc.
- *
+ *
* @param p0 &emsp; {@link forge.game.player.Player}
*/
public void updateZones() {
@@ -146,44 +145,38 @@
}
}
- public void setupMouseActions(final ForgeAction handAction, final ForgeAction libraryAction, final ForgeAction exileAction,
- final ForgeAction graveAction, final ForgeAction flashBackAction, final ForgeAction commandAction,
+ public void setupMouseActions(final Runnable handAction, final Runnable libraryAction, final Runnable exileAction,
+ final Runnable graveAction, final Runnable flashBackAction, final Runnable commandAction,
final Function<Byte, Boolean> manaAction) {
// Detail label listeners
lblGraveyard.addMouseListener(new FMouseAdapter() {
- @Override
- public void onLeftClick(final MouseEvent e) {
- graveAction.actionPerformed(null);
+ @Override public void onLeftClick(final MouseEvent e) {
+ graveAction.run();
}
});
lblExile.addMouseListener(new FMouseAdapter() {
- @Override
- public void onLeftClick(final MouseEvent e) {
- exileAction.actionPerformed(null);
+ @Override public void onLeftClick(final MouseEvent e) {
+ exileAction.run();
}
});
lblLibrary.addMouseListener(new FMouseAdapter() {
- @Override
- public void onLeftClick(final MouseEvent e) {
- libraryAction.actionPerformed(null);
+ @Override public void onLeftClick(final MouseEvent e) {
+ libraryAction.run();
}
});
lblHand.addMouseListener(new FMouseAdapter() {
- @Override
- public void onLeftClick(final MouseEvent e) {
- handAction.actionPerformed(null);
+ @Override public void onLeftClick(final MouseEvent e) {
+ handAction.run();
}
});
lblFlashback.addMouseListener(new FMouseAdapter() {
- @Override
- public void onLeftClick(final MouseEvent e) {
- flashBackAction.actionPerformed(null);
+ @Override public void onLeftClick(final MouseEvent e) {
+ flashBackAction.run();
}
});
lblCommand.addMouseListener(new FMouseAdapter() {
- @Override
- public void onLeftClick(final MouseEvent e) {
- commandAction.actionPerformed(null);
+ @Override public void onLeftClick(final MouseEvent e) {
+ commandAction.run();
}
});
@@ -204,14 +197,15 @@
private final String tooltip;
private DetailLabel(final FSkinProp icon, final String tooltip) {
super(new FLabel.Builder().icon(FSkin.getImage(icon))
- .opaque(false).fontSize(14).hoverable()
- .fontStyle(Font.BOLD).iconInBackground()
- .fontAlign(SwingConstants.RIGHT));
+ .opaque(false).fontSize(14).hoverable()
+ .fontStyle(Font.BOLD).iconInBackground()
+ .fontAlign(SwingConstants.RIGHT));
this.tooltip = tooltip;
setFocusable(false);
}
+ @Override
public void setText(final String text0) {
super.setText(text0);
autoSizeFont();
@@ -221,6 +215,7 @@
super.setToolTipText(String.format(tooltip, (Object[]) args));
}
+ @Override
protected void resetIcon() {
super.resetIcon();
autoSizeFont();
Index: forge-gui/src/main/java/forge/match/HostedMatch.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/HostedMatch.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/HostedMatch.java (revision 29317)
@@ -17,7 +17,6 @@
import forge.FThreads;
import forge.GuiBase;
-import forge.LobbyPlayer;
import forge.control.FControlGameEventHandler;
import forge.control.FControlGamePlayback;
import forge.control.WatchLocalGame;
@@ -110,7 +109,7 @@
if (sortedPlayers.size() == 2) {
title = String.format("%s vs %s", sortedPlayers.get(0).getPlayer().getName(), sortedPlayers.get(1).getPlayer().getName());
} else {
- title = String.format("Multiplayer Game (%d players)", sortedPlayers.size());
+ title = String.format("Multiplayer Game (%d players)", sortedPlayers.size());
}
this.match = new Match(gameRules, sortedPlayers, title);
startGame();
@@ -134,7 +133,7 @@
game = match.createGame();
if (game.getRules().getGameType() == GameType.Quest) {
- QuestController qc = FModel.getQuest();
+ final QuestController qc = FModel.getQuest();
// Reset new list when the Match round starts, not when each game starts
if (game.getMatch().getPlayedGames().isEmpty()) {
qc.getCards().resetNewList();
@@ -150,7 +149,7 @@
final GameView gameView = getGameView();
humanCount = 0;
- final MapOfLists<IGuiGame, PlayerView> playersPerGui = new HashMapOfLists<IGuiGame, PlayerView>(CollectionSuppliers.<PlayerView>arrayLists());
+ final MapOfLists<IGuiGame, PlayerView> playersPerGui = new HashMapOfLists<IGuiGame, PlayerView>(CollectionSuppliers.<PlayerView>arrayLists());
for (int iPlayer = 0; iPlayer < players.size(); iPlayer++) {
final RegisteredPlayer rp = match.getPlayers().get(iPlayer);
final Player p = players.get(iPlayer);
@@ -234,7 +233,7 @@
}
- public void registerSpectator(final LobbyPlayer lobbyPlayer, final IGuiGame gui) {
+ public void registerSpectator(final IGuiGame gui) {
final PlayerControllerHuman humanController = new WatchLocalGame(game, null, gui);
gui.setGameController(null, humanController);
gui.openView(null);
Index: forge-gui/src/main/java/forge/deck/ColorDeckGenerator.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/deck/ColorDeckGenerator.java (revision 29316)
+++ forge-gui/src/main/java/forge/deck/ColorDeckGenerator.java (revision 29317)
@@ -5,24 +5,23 @@
import forge.itemmanager.IItemManager;
-
public class ColorDeckGenerator extends DeckProxy implements Comparable<ColorDeckGenerator> {
- public static List<DeckProxy> getColorDecks(IItemManager<DeckProxy> lstDecks0, boolean isAi0) {
- String[] colors = new String[] { "Random 1", "Random 2", "Random 3",
+ public static List<DeckProxy> getColorDecks(final IItemManager<DeckProxy> lstDecks0, final boolean isAi0) {
+ final String[] colors = new String[] { "Random 1", "Random 2", "Random 3",
"White", "Blue", "Black", "Red", "Green" };
- ArrayList<DeckProxy> decks = new ArrayList<DeckProxy>();
+ final ArrayList<DeckProxy> decks = new ArrayList<DeckProxy>();
for (int i = 0; i < colors.length; i++) {
decks.add(new ColorDeckGenerator(colors[i], i, lstDecks0, isAi0));
}
return decks;
}
- private String name;
- private int index;
+ private final String name;
+ private final int index;
private final IItemManager<DeckProxy> lstDecks;
private final boolean isAi;
- private ColorDeckGenerator(String name0, int index0, IItemManager<DeckProxy> lstDecks0, boolean isAi0) {
+ private ColorDeckGenerator(final String name0, final int index0, final IItemManager<DeckProxy> lstDecks0, final boolean isAi0) {
super();
name = name0;
index = index0;
@@ -40,16 +39,15 @@
return name;
}
-
@Override
public int compareTo(final ColorDeckGenerator d) {
- return d instanceof ColorDeckGenerator ? Integer.compare(index, ((ColorDeckGenerator)d).index) : 1;
+ return Integer.compare(index, d.index);
}
@Override
public Deck getDeck() {
- List<String> selection = new ArrayList<String>();
- for (DeckProxy deck : lstDecks.getSelectedItems()) {
+ final List<String> selection = new ArrayList<String>();
+ for (final DeckProxy deck : lstDecks.getSelectedItems()) {
selection.add(deck.getName());
}
if (DeckgenUtil.colorCheck(selection)) {
@@ -57,7 +55,7 @@
}
return null;
}
-
+
@Override
public boolean isGeneratedDeck() {
return true;
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/toolbox/FDigitalClock.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FDigitalClock.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FDigitalClock.java (revision 29317)
@@ -1,15 +1,15 @@
package forge.toolbox;
-import forge.toolbox.FSkin.SkinnedLabel;
-
-import javax.swing.*;
-
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
+import javax.swing.Timer;
+
+import forge.toolbox.FSkin.SkinnedLabel;
+
/**
* Digital clock label that displays current time
*
@@ -26,7 +26,8 @@
clocks.add(this);
if (timer == null) {
timer = new Timer(60000, new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(final ActionEvent e) {
now.add(Calendar.MINUTE, 1);
updateTimeDisplay();
}
@@ -43,7 +44,7 @@
private static void updateTimeDisplay() {
currentTimeDisplay = timeFormatter.format(now.getTime());
- for (FDigitalClock clock : clocks) {
+ for (final FDigitalClock clock : clocks) {
clock.setText(currentTimeDisplay);
}
}
Index: forge-gui-desktop/src/main/java/forge/gui/UnsortedListModel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/UnsortedListModel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/UnsortedListModel.java (revision 29317)
@@ -1,18 +1,21 @@
package forge.gui;
-import javax.swing.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import javax.swing.AbstractListModel;
+import javax.swing.ListModel;
+import com.google.common.collect.Lists;
+
@SuppressWarnings("serial")
public class UnsortedListModel<T> extends AbstractListModel<T> {
- List<T> model;
+ final List<T> model;
public UnsortedListModel() {
- model = new ArrayList<T>();
+ model = Lists.newArrayList();
}
@Override
@@ -21,25 +24,17 @@
}
@Override
- public T getElementAt(int index) {
+ public T getElementAt(final int index) {
return model.get(index);
}
- public void add(T element) {
+ public void add(final T element) {
model.add(element);
fireIntervalAdded(this, getSize() - 1, getSize() - 1);
fireContentsChanged(this, 0, getSize() - 1);
}
- public void addAll(T[] elements) {
- for (T e : elements) {
- model.add(e);
- }
- fireIntervalAdded(this, getSize() - elements.length, getSize() - 1);
- fireContentsChanged(this, 0, getSize() - 1);
- }
-
- public void addAll(Collection<T> elements) {
+ public void addAll(final Collection<T> elements) {
if (elements.isEmpty()) {
return;
}
@@ -48,23 +43,23 @@
fireContentsChanged(this, 0, getSize() - 1);
}
- public void addAll(ListModel<T> otherModel) {
- Collection<T> elements = new ArrayList<T>();
- int size = otherModel.getSize();
+ public void addAll(final ListModel<T> otherModel) {
+ final Collection<T> elements = new ArrayList<T>();
+ final int size = otherModel.getSize();
for (int i = 0; size > i; ++i) {
- elements.add((T)otherModel.getElementAt(i));
+ elements.add(otherModel.getElementAt(i));
}
addAll(elements);
}
public void clear() {
- int prevSize = getSize();
+ final int prevSize = getSize();
model.clear();
fireIntervalRemoved(this, 0, prevSize - 1);
fireContentsChanged(this, 0, prevSize - 1);
}
- public boolean contains(Object element) {
+ public boolean contains(final Object element) {
return model.contains(element);
}
@@ -72,7 +67,7 @@
return model.iterator();
}
- public void removeElement(int idx) {
+ public void removeElement(final int idx) {
model.remove(idx);
fireIntervalRemoved(this, idx, idx);
fireContentsChanged(this, 0, getSize());
Index: forge-gui/src/main/java/forge/sound/EventVisualizer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/sound/EventVisualizer.java (revision 29316)
+++ forge-gui/src/main/java/forge/sound/EventVisualizer.java (revision 29317)
@@ -33,7 +33,7 @@
import forge.game.zone.ZoneType;
import forge.util.maps.MapOfLists;
-/**
+/**
* This class is in charge of converting any forge.game.event.Event to a SoundEffectType.
*
*/
@@ -44,49 +44,67 @@
this.player = lobbyPlayer;
}
- public SoundEffectType visit(GameEventCardDamaged event) { return SoundEffectType.Damage; }
- public SoundEffectType visit(GameEventCardDestroyed event) { return SoundEffectType.Destroy; }
- public SoundEffectType visit(GameEventCardAttachment event) { return SoundEffectType.Equip; }
- public SoundEffectType visit(GameEventCardChangeZone event) {
- ZoneType from = event.from == null ? null : event.from.getZoneType();
- ZoneType to = event.to.getZoneType();
- if( from == ZoneType.Library && to == ZoneType.Hand)
+ @Override
+ public SoundEffectType visit(final GameEventCardDamaged event) { return SoundEffectType.Damage; }
+ @Override
+ public SoundEffectType visit(final GameEventCardDestroyed event) { return SoundEffectType.Destroy; }
+ @Override
+ public SoundEffectType visit(final GameEventCardAttachment event) { return SoundEffectType.Equip; }
+ @Override
+ public SoundEffectType visit(final GameEventCardChangeZone event) {
+ final ZoneType from = event.from == null ? null : event.from.getZoneType();
+ final ZoneType to = event.to.getZoneType();
+ if( from == ZoneType.Library && to == ZoneType.Hand) {
- return SoundEffectType.Draw;
+ return SoundEffectType.Draw;
- if( from == ZoneType.Hand && (to == ZoneType.Graveyard || to == ZoneType.Library) )
+ }
+ if( from == ZoneType.Hand && (to == ZoneType.Graveyard || to == ZoneType.Library) ) {
return SoundEffectType.Discard;
+ }
-
- return to == ZoneType.Exile ? SoundEffectType.Exile : null;
+
+ return to == ZoneType.Exile ? SoundEffectType.Exile : null;
}
- public SoundEffectType visit(GameEventCardRegenerated event) { return SoundEffectType.Regen; }
- public SoundEffectType visit(GameEventCardSacrificed event) { return SoundEffectType.Sacrifice; }
- public SoundEffectType visit(GameEventCardCounters event) { return event.newValue > event.oldValue ? SoundEffectType.AddCounter : event.newValue < event.oldValue ? SoundEffectType.RemoveCounter : null; }
- public SoundEffectType visit(GameEventTurnEnded event) { return SoundEffectType.EndOfTurn; }
- public SoundEffectType visit(GameEventFlipCoin event) { return SoundEffectType.FlipCoin; }
- public SoundEffectType visit(GameEventPlayerLivesChanged event) { return event.newLives < event.oldLives ? SoundEffectType.LifeLoss : SoundEffectType.LifeGain; }
- public SoundEffectType visit(GameEventPlayerPoisoned event) { return SoundEffectType.Poison; }
- public SoundEffectType visit(GameEventShuffle event) { return SoundEffectType.Shuffle; }
- public SoundEffectType visit(GameEventTokenCreated event) { return SoundEffectType.Token; }
- public SoundEffectType visit(GameEventBlockersDeclared event) {
+ @Override
+ public SoundEffectType visit(final GameEventCardRegenerated event) { return SoundEffectType.Regen; }
+ @Override
+ public SoundEffectType visit(final GameEventCardSacrificed event) { return SoundEffectType.Sacrifice; }
+ @Override
+ public SoundEffectType visit(final GameEventCardCounters event) { return event.newValue > event.oldValue ? SoundEffectType.AddCounter : event.newValue < event.oldValue ? SoundEffectType.RemoveCounter : null; }
+ @Override
+ public SoundEffectType visit(final GameEventTurnEnded event) { return SoundEffectType.EndOfTurn; }
+ @Override
+ public SoundEffectType visit(final GameEventFlipCoin event) { return SoundEffectType.FlipCoin; }
+ @Override
+ public SoundEffectType visit(final GameEventPlayerLivesChanged event) { return event.newLives < event.oldLives ? SoundEffectType.LifeLoss : SoundEffectType.LifeGain; }
+ @Override
+ public SoundEffectType visit(final GameEventPlayerPoisoned event) { return SoundEffectType.Poison; }
+ @Override
+ public SoundEffectType visit(final GameEventShuffle event) { return SoundEffectType.Shuffle; }
+ @Override
+ public SoundEffectType visit(final GameEventTokenCreated event) { return SoundEffectType.Token; }
+ @Override
+ public SoundEffectType visit(final GameEventBlockersDeclared event) {
final boolean isLocalHuman = event.defendingPlayer.getLobbyPlayer() == player;
- if (isLocalHuman)
+ if (isLocalHuman) {
return null; // already played sounds in interactive mode
+ }
-
+
- for(MapOfLists<Card, Card> ab : event.blockers.values()) {
- for(Collection<Card> bb : ab.values()) {
+ for (final MapOfLists<Card, Card> ab : event.blockers.values()) {
+ for(final Collection<Card> bb : ab.values()) {
if ( !bb.isEmpty() ) {
// hasAnyBlocker = true;
return SoundEffectType.Block;
}
}
}
- return null;
+ return null;
}
-
+
/**
* Plays the sound corresponding to the outcome of the duel.
*/
- public SoundEffectType visit(GameEventGameOutcome event) {
- boolean humanWonTheDuel = event.result.getWinningLobbyPlayer() == player;
+ @Override
+ public SoundEffectType visit(final GameEventGameOutcome event) {
+ final boolean humanWonTheDuel = event.result.getWinningLobbyPlayer() == player;
return humanWonTheDuel ? SoundEffectType.WinDuel : SoundEffectType.LoseDuel;
}
@@ -94,12 +112,13 @@
* Plays the sound corresponding to the card type/color when the card
* ability resolves on the stack.
*/
- public SoundEffectType visit(GameEventSpellResolved evt) {
+ @Override
+ public SoundEffectType visit(final GameEventSpellResolved evt) {
if (evt.spell == null ) {
return null;
}
- Card source = evt.spell.getHostCard();
+ final Card source = evt.spell.getHostCard();
if (evt.spell.isSpell()) {
// if there's a specific effect for this particular card, play it and
// we're done.
@@ -129,12 +148,13 @@
/**
* Plays the sound corresponding to the change of the card's tapped state
* (when a card is tapped or untapped).
- *
+ *
* @param tapped_state if true, the "tap" sound is played; otherwise, the
* "untap" sound is played
* @return the sound effect type
*/
- public SoundEffectType visit(GameEventCardTapped event) {
+ @Override
+ public SoundEffectType visit(final GameEventCardTapped event) {
return event.tapped ? SoundEffectType.Tap : SoundEffectType.Untap;
}
@@ -144,7 +164,8 @@
* @param land the land card that was played
* @return the sound effect type
*/
- public SoundEffectType visit(GameEventLandPlayed event) {
+ @Override
+ public SoundEffectType visit(final GameEventLandPlayed event) {
if (event.land == null) {
return null;
}
@@ -155,15 +176,25 @@
return SoundEffectType.ScriptedEffect;
}
- for (SpellAbility sa : event.land.getManaAbilities()) {
- String manaColors = sa.getManaPartRecursive().getOrigProduced();
+ for (final SpellAbility sa : event.land.getManaAbilities()) {
+ final String manaColors = sa.getManaPartRecursive().getOrigProduced();
- if (manaColors.contains("B")) return SoundEffectType.BlackLand;
- if (manaColors.contains("U")) return SoundEffectType.BlueLand;
- if (manaColors.contains("G")) return SoundEffectType.GreenLand;
- if (manaColors.contains("R")) return SoundEffectType.RedLand;
- if (manaColors.contains("W")) return SoundEffectType.WhiteLand;
+ if (manaColors.contains("B")) {
+ return SoundEffectType.BlackLand;
- }
+ }
+ if (manaColors.contains("U")) {
+ return SoundEffectType.BlueLand;
+ }
+ if (manaColors.contains("G")) {
+ return SoundEffectType.GreenLand;
+ }
+ if (manaColors.contains("R")) {
+ return SoundEffectType.RedLand;
+ }
+ if (manaColors.contains("W")) {
+ return SoundEffectType.WhiteLand;
+ }
+ }
// play a generic land sound if no other sound corresponded to it.
return SoundEffectType.OtherLand;
@@ -188,12 +219,12 @@
/**
* Returns the value of the SoundEffect SVar of the card that triggered
* the event, otherwise returns an empty string.
- *
+ *
* @param evt the event which is the source of the sound effect
* @return a string containing the SoundEffect SVar, or empty string if
* SVar:SoundEffect does not exist.
*/
- public String getScriptedSoundEffectName(GameEvent evt) {
+ public String getScriptedSoundEffectName(final GameEvent evt) {
Card c = null;
if (evt instanceof GameEventSpellResolved) {
@@ -207,19 +238,19 @@
@Override
- public SoundEffectType visit(UiEventBlockerAssigned event) {
+ public SoundEffectType visit(final UiEventBlockerAssigned event) {
return event.attackerBeingBlocked == null ? null : SoundEffectType.Block;
}
@Override
- public SoundEffectType visit(UiEventAttackerDeclared event) {
+ public SoundEffectType visit(final UiEventAttackerDeclared event) {
return null;
}
@Override
- public SoundEffectType visit(UiEventNextGameDecision event) {
+ public SoundEffectType visit(final UiEventNextGameDecision event) {
return null;
}
@Override
- public SoundEffectType visit(GameEventCardPhased event) {
+ public SoundEffectType visit(final GameEventCardPhased event) {
return SoundEffectType.Phasing;
}
}
Index: forge-gui-desktop/src/main/java/forge/view/FFrame.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/view/FFrame.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/view/FFrame.java (revision 29317)
@@ -49,11 +49,7 @@
setUndecorated(true);
}
- public void initialize() {
- initialize(new FTitleBar(this));
- }
-
- public void initialize(FTitleBarBase titleBar0) {
+ public void initialize(final FTitleBarBase titleBar0) {
this.isMainFrame = (FView.SINGLETON_INSTANCE.getFrame() == this);
// Frame border
@@ -63,12 +59,12 @@
addResizeSupport();
this.addWindowListener(new WindowAdapter() {
@Override
- public void windowActivated(WindowEvent e) {
+ public void windowActivated(final WindowEvent e) {
resume(); //resume music when main frame regains focus
}
@Override
- public void windowDeactivated(WindowEvent e) {
+ public void windowDeactivated(final WindowEvent e) {
if (e.getOppositeWindow() == null) {
pause(); //pause music when main frame loses focus to outside application
@@ -80,7 +76,7 @@
});
this.addWindowStateListener(new WindowStateListener() {
@Override
- public void windowStateChanged(WindowEvent e) {
+ public void windowStateChanged(final WindowEvent e) {
setState(e.getNewState());
}
});
@@ -120,11 +116,13 @@
return this.titleBar;
}
+ @Override
public boolean getLockTitleBar() {
return this.lockTitleBar;
}
- public void setLockTitleBar(boolean lockTitleBar0) {
+ @Override
+ public void setLockTitleBar(final boolean lockTitleBar0) {
if (this.lockTitleBar == lockTitleBar0) { return; }
this.lockTitleBar = lockTitleBar0;
if (this.isMainFrame) {
@@ -152,7 +150,7 @@
}
@Override
- public void setTitle(String title) {
+ public void setTitle(final String title) {
super.setTitle(title);
if (this.titleBar != null) {
this.titleBar.setTitle(title);
@@ -160,7 +158,7 @@
}
@Override
- public void setIconImage(Image image) {
+ public void setIconImage(final Image image) {
super.setIconImage(image);
if (this.titleBar != null) {
this.titleBar.setIconImage(image);
@@ -169,22 +167,22 @@
//ensure un-maximized if location or size changed
@Override
- public void setLocation(Point point) {
+ public void setLocation(final Point point) {
resetState();
super.setLocation(point);
}
@Override
- public void setLocation(int x, int y) {
+ public void setLocation(final int x, final int y) {
resetState();
super.setLocation(x, y);
}
@Override
- public void setSize(Dimension size) {
+ public void setSize(final Dimension size) {
resetState();
super.setSize(size);
}
@Override
- public void setSize(int width, int height) {
+ public void setSize(final int width, final int height) {
resetState();
super.setSize(width, height);
}
@@ -201,7 +199,7 @@
}
}
- public void setWindowLayout(int x, int y, int width, int height, boolean maximized0, boolean fullScreen0) {
+ public void setWindowLayout(final int x, final int y, final int width, final int height, final boolean maximized0, final boolean fullScreen0) {
this.normalBounds = new Rectangle(x, y, width, height);
this.maximized = maximized0;
this.fullScreen = fullScreen0;
@@ -219,11 +217,13 @@
this.normalBounds = this.getBounds();
}
+ @Override
public boolean isMinimized() {
return this.minimized;
}
- public void setMinimized(boolean minimized0) {
+ @Override
+ public void setMinimized(final boolean minimized0) {
if (this.minimized == minimized0) { return; }
this.minimized = minimized0;
updateState();
@@ -237,21 +237,25 @@
}
}
+ @Override
public boolean isMaximized() {
return this.maximized;
}
- public void setMaximized(boolean maximized0) {
+ @Override
+ public void setMaximized(final boolean maximized0) {
if (this.maximized == maximized0) { return; }
this.maximized = maximized0;
updateState();
}
+ @Override
public boolean isFullScreen() {
return this.fullScreen;
}
- public void setFullScreen(boolean fullScreen0) {
+ @Override
+ public void setFullScreen(final boolean fullScreen0) {
if (this.fullScreen == fullScreen0) { return; }
this.fullScreen = fullScreen0;
if (!fullScreen0) { //cancel full screen here instead of updateState
@@ -313,7 +317,7 @@
//override normal extended state behavior
@Override
- public void setExtendedState(int state) {
+ public void setExtendedState(final int state) {
if (this.isActive()) { //only update state set this way when active, otherwise window will be minimized when deactivated
this.minimized = (state & Frame.ICONIFIED) == Frame.ICONIFIED;
this.maximized = (state & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH;
@@ -324,7 +328,7 @@
private void addMoveSupport() {
this.titleBar.addMouseListener(new MouseAdapter() {
@Override
- public void mousePressed(MouseEvent e) {
+ public void mousePressed(final MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e) && !fullScreen) { //don't allow moving or restore down when Full Screen
if (e.getClickCount() == 1) {
locBeforeMove = getLocation();
@@ -336,7 +340,7 @@
}
}
@Override
- public void mouseReleased(MouseEvent e) {
+ public void mouseReleased(final MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
locBeforeMove = null;
mouseDownLoc = null;
@@ -346,7 +350,7 @@
});
this.titleBar.addMouseMotionListener(new MouseMotionAdapter() {
@Override
- public void mouseDragged(MouseEvent e) {
+ public void mouseDragged(final MouseEvent e) {
if (mouseDownLoc != null) {
final Point loc = e.getLocationOnScreen();
final int dx = loc.x - mouseDownLoc.x;
@@ -364,7 +368,7 @@
});
}
- private void setResizeCursor(int resizeCursor0) {
+ private void setResizeCursor(final int resizeCursor0) {
this.resizeCursor = resizeCursor0;
this.getRootPane().setCursor(Cursor.getPredefinedCursor(resizeCursor0));
}
@@ -373,7 +377,7 @@
final JRootPane resizeBorders = getRootPane();
resizeBorders.addMouseListener(new MouseAdapter() {
@Override
- public void mousePressed(MouseEvent e) {
+ public void mousePressed(final MouseEvent e) {
if (resizeCursor != Cursor.DEFAULT_CURSOR && SwingUtilities.isLeftMouseButton(e)) {
locBeforeMove = getLocation();
sizeBeforeResize = getSize();
@@ -381,7 +385,7 @@
}
}
@Override
- public void mouseReleased(MouseEvent e) {
+ public void mouseReleased(final MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
locBeforeMove = null;
sizeBeforeResize = null;
@@ -390,7 +394,7 @@
}
}
@Override
- public void mouseExited(MouseEvent e) {
+ public void mouseExited(final MouseEvent e) {
if (mouseDownLoc == null) {
setResizeCursor(Cursor.DEFAULT_CURSOR);
}
@@ -398,7 +402,7 @@
});
resizeBorders.addMouseMotionListener(new MouseMotionAdapter() {
@Override
- public void mouseMoved(MouseEvent e) {
+ public void mouseMoved(final MouseEvent e) {
if (mouseDownLoc == null && !maximized) {
final int grabArea = borderThickness * 2;
final Point loc = e.getPoint();
@@ -436,7 +440,7 @@
}
}
@Override
- public void mouseDragged(MouseEvent e) {
+ public void mouseDragged(final MouseEvent e) {
if (mouseDownLoc == null) { return; }
final Point loc = e.getLocationOnScreen();
@@ -447,39 +451,39 @@
int width = sizeBeforeResize.width;
int height = sizeBeforeResize.height;
switch (resizeCursor) {
- case Cursor.E_RESIZE_CURSOR:
- width += dx;
- break;
- case Cursor.W_RESIZE_CURSOR:
- width -= dx;
- break;
- case Cursor.S_RESIZE_CURSOR:
- height += dy;
- break;
- case Cursor.N_RESIZE_CURSOR:
- height -= dy;
- break;
- case Cursor.SE_RESIZE_CURSOR:
- width += dx;
- height += dy;
- break;
- case Cursor.NE_RESIZE_CURSOR:
- width += dx;
- height -= dy;
- break;
- case Cursor.SW_RESIZE_CURSOR:
- width -= dx;
- height += dy;
- break;
- case Cursor.NW_RESIZE_CURSOR:
- width -= dx;
- height -= dy;
- break;
+ case Cursor.E_RESIZE_CURSOR:
+ width += dx;
+ break;
+ case Cursor.W_RESIZE_CURSOR:
+ width -= dx;
+ break;
+ case Cursor.S_RESIZE_CURSOR:
+ height += dy;
+ break;
+ case Cursor.N_RESIZE_CURSOR:
+ height -= dy;
+ break;
+ case Cursor.SE_RESIZE_CURSOR:
+ width += dx;
+ height += dy;
+ break;
+ case Cursor.NE_RESIZE_CURSOR:
+ width += dx;
+ height -= dy;
+ break;
+ case Cursor.SW_RESIZE_CURSOR:
+ width -= dx;
+ height += dy;
+ break;
+ case Cursor.NW_RESIZE_CURSOR:
+ width -= dx;
+ height -= dy;
+ break;
}
//ensure new size in bounds
- Dimension minSize = getMinimumSize();
- Dimension maxSize = getMaximumSize();
+ final Dimension minSize = getMinimumSize();
+ final Dimension maxSize = getMaximumSize();
if (width < minSize.width) {
dx += (width - minSize.width);
width = minSize.width;
@@ -501,18 +505,18 @@
int x = locBeforeMove.x;
int y = locBeforeMove.y;
switch (resizeCursor) {
- case Cursor.W_RESIZE_CURSOR:
- case Cursor.SW_RESIZE_CURSOR:
- x += dx;
- break;
- case Cursor.N_RESIZE_CURSOR:
- case Cursor.NE_RESIZE_CURSOR:
- y += dy;
- break;
- case Cursor.NW_RESIZE_CURSOR:
- x += dx;
- y += dy;
- break;
+ case Cursor.W_RESIZE_CURSOR:
+ case Cursor.SW_RESIZE_CURSOR:
+ x += dx;
+ break;
+ case Cursor.N_RESIZE_CURSOR:
+ case Cursor.NE_RESIZE_CURSOR:
+ y += dy;
+ break;
+ case Cursor.NW_RESIZE_CURSOR:
+ x += dx;
+ y += dy;
+ break;
}
//set bounds based on new size and location
Index: forge-gui-desktop/src/main/java/forge/view/arcane/CardPanelContainer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/view/arcane/CardPanelContainer.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/view/arcane/CardPanelContainer.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -40,7 +40,7 @@
/**
* Manages mouse events and common functionality for CardPanel containing
* components.
- *
+ *
* @author Forge
* @version $Id: CardPanelContainer.java 24793 2014-02-10 08:04:02Z Max mtg $
*/
@@ -98,7 +98,7 @@
private void setupMouseWheelListener() {
this.addMouseWheelListener(new MouseWheelListener() {
@Override
- public void mouseWheelMoved(MouseWheelEvent e) {
+ public void mouseWheelMoved(final MouseWheelEvent e) {
final CardPanel hitPanel = getCardPanel(e.getX(), e.getY());
if (hitPanel != null && e.getWheelRotation() < 0) {
mouseWheelZoom(hitPanel.getCard());
@@ -134,7 +134,7 @@
return;
}
- boolean zoomed = CardZoomer.SINGLETON_INSTANCE.isZoomerOpen();
+ final boolean zoomed = CardZoomer.SINGLETON_INSTANCE.isZoomerOpen();
if (!zoomed && dragEnabled) {
intialMouseDragX = -1;
if (getMouseDragPanel() != null) {
@@ -295,13 +295,13 @@
repaint();
}
- public final void setCardPanels(List<CardPanel> cardPanels) {
+ public final void setCardPanels(final List<CardPanel> cardPanels) {
if (cardPanels.size() == 0) {
clear();
return;
}
- for (CardPanel p : this.getCardPanels()) {
+ for (final CardPanel p : this.getCardPanels()) {
if (!cardPanels.contains(p)) { //dispose of any card panels that have been removed
p.dispose();
}
@@ -309,7 +309,7 @@
this.getCardPanels().clear();
this.removeAll();
this.getCardPanels().addAll(cardPanels);
- for (CardPanel cardPanel : cardPanels) {
+ for (final CardPanel cardPanel : cardPanels) {
this.add(cardPanel);
}
this.doLayout();
@@ -320,7 +320,7 @@
public final void clear() {
FThreads.assertExecutedByEdt(true);
- for (CardPanel p : getCardPanels()) {
+ for (final CardPanel p : getCardPanels()) {
p.dispose();
}
getCardPanels().clear();
@@ -403,22 +403,6 @@
for (final CardPanelMouseListener listener : this.listeners) {
listener.mouseOver(panel, evt);
}
- }
-
- public final CardView getHoveredCard(final MouseEvent e) {
- // re-evaluate cursor position so if we hovered over a card, alt-tabbed out of the application, then
- // clicked back on the application somewhere else, the last hovered card won't register the click
- // this cannot protect against alt tabbing off then re-focusing on the application by clicking on
- // the already-hovered card, though, since we cannot tell the difference between that and clicking
- // on the hovered card when the app already has focus.
- CardPanel p = getCardPanel(e.getX(), e.getY());
-
- // if cursor has jumped, for example via the above alt-tabbing example, fix the card hover highlight
- if (null != hoveredPanel && p != hoveredPanel) {
- mouseOut(hoveredPanel, e);
- }
-
- return (null == p || p != hoveredPanel) ? null : p.getCard();
}
public final List<CardPanel> getCardPanels() {
Index: forge-gui/src/main/java/forge/match/AbstractGuiGame.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/AbstractGuiGame.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/AbstractGuiGame.java (revision 29317)
@@ -65,6 +65,7 @@
public final GameView getGameView() {
return gameView;
}
+ @Override
public void setGameView(final GameView gameView) {
this.gameView = gameView;
}
@@ -73,7 +74,7 @@
public final IGameController getGameController() {
return gameControllers.get(getCurrentPlayer());
}
- public final IGameController getGameController(PlayerView p0) {
+ public final IGameController getGameController(final PlayerView p0) {
return gameControllers.get(p0);
}
public final Collection<IGameController> getGameControllers() {
@@ -94,10 +95,6 @@
//not needed for base game implementation
}
- public String getCardImageKey(final CardStateView csv) {
- return csv.getImageKey(getLocalPlayers());
- }
-
@Override
public boolean mayView(final CardView c) {
if (!hasLocalPlayers()) {
@@ -113,12 +110,12 @@
public boolean mayFlip(final CardView cv) {
if (cv == null) { return false; }
- CardStateView altState = cv.getAlternateState();
+ final CardStateView altState = cv.getAlternateState();
if (altState == null) { return false; }
switch (altState.getState()) {
case Original:
- CardStateView currentState = cv.getCurrentState();
+ final CardStateView currentState = cv.getCurrentState();
if (currentState.getState() == CardStateName.FaceDown) {
return getCurrentPlayer() == null || cv.canFaceDownBeShownToAny(getLocalPlayers());
}
@@ -131,7 +128,7 @@
}
}
- private Set<PlayerView> highlightedPlayers = Sets.newHashSet();
+ private final Set<PlayerView> highlightedPlayers = Sets.newHashSet();
@Override
public void setHighlighted(final PlayerView pv, final boolean b) {
if (b) {
@@ -141,21 +138,21 @@
}
}
- public boolean isHighlighted(PlayerView player) {
+ public boolean isHighlighted(final PlayerView player) {
return highlightedPlayers.contains(player);
}
- private Set<CardView> highlightedCards = Sets.newHashSet();
+ private final Set<CardView> highlightedCards = Sets.newHashSet();
// used to highlight cards in UI
@Override
- public void setUsedToPay(CardView card, boolean value) {
- boolean hasChanged = value ? highlightedCards.add(card) : highlightedCards.remove(card);
+ public void setUsedToPay(final CardView card, final boolean value) {
+ final boolean hasChanged = value ? highlightedCards.add(card) : highlightedCards.remove(card);
if (hasChanged) { // since we are in UI thread, may redraw the card right now
updateSingleCard(card);
}
}
- public boolean isUsedToPay(CardView card) {
+ public boolean isUsedToPay(final CardView card) {
return highlightedCards.contains(card);
}
@@ -210,6 +207,7 @@
updateAutoPassPrompt();
}
+ @Override
public final void autoPassCancel(final PlayerView player) {
if (!autoPassUntilEndOfTurn.remove(player)) {
return;
@@ -222,6 +220,7 @@
awaitNextInput();
}
+ @Override
public final boolean mayAutoPass(final PlayerView player) {
return autoPassUntilEndOfTurn.contains(player);
}
@@ -313,8 +312,6 @@
public final boolean shouldAlwaysAcceptTrigger(final int trigger) { return Boolean.TRUE.equals(triggersAlwaysAccept.get(Integer.valueOf(trigger))); }
@Override
public final boolean shouldAlwaysDeclineTrigger(final int trigger) { return Boolean.FALSE.equals(triggersAlwaysAccept.get(Integer.valueOf(trigger))); }
- @Override
- public final boolean shouldAlwaysAskTrigger(final int trigger) { return !triggersAlwaysAccept.containsKey(Integer.valueOf(trigger)); }
@Override
public final void setShouldAlwaysAcceptTrigger(final int trigger) { triggersAlwaysAccept.put(Integer.valueOf(trigger), Boolean.TRUE); }
@@ -329,7 +326,7 @@
/**
* Convenience for getChoices(message, 0, 1, choices).
- *
+ *
* @param <T>
* is automatically inferred.
* @param message
@@ -364,7 +361,7 @@
* <p>
* getChoice.
* </p>
- *
+ *
* @param <T>
* a T object.
* @param message
@@ -394,38 +391,19 @@
return choice.get(0);
}
- @Override
- public <T> List<T> noneOrMany(final String message, final Collection<T> choices) {
- return getChoices(message, 0, choices.size(), choices, null, null);
- }
-
- @Override
// Nothing to choose here. Code uses this to just reveal one or more items
- public <T> void reveal(final String message, final T item) {
- List<T> items = new ArrayList<T>();
- items.add(item);
- reveal(message, items);
- }
@Override
- public <T> void reveal(final String message, final T[] items) {
- getChoices(message, -1, -1, items);
- }
- @Override
public <T> void reveal(final String message, final Collection<T> items) {
getChoices(message, -1, -1, items);
}
// Get Integer in range
@Override
- public Integer getInteger(final String message) {
- return getInteger(message, 0, Integer.MAX_VALUE, false);
- }
- @Override
- public Integer getInteger(final String message, int min) {
+ public Integer getInteger(final String message, final int min) {
return getInteger(message, min, Integer.MAX_VALUE, false);
}
@Override
- public Integer getInteger(final String message, int min, int max) {
+ public Integer getInteger(final String message, final int min, final int max) {
return getInteger(message, min, max, false);
}
@Override
@@ -436,8 +414,8 @@
if (max == Integer.MAX_VALUE) {
return getInteger(message, min, max, min + 99);
}
- int count = max - min + 1;
+ final int count = max - min + 1;
- if (count > 100) {
+ if (count > 100) {
return getInteger(message, min, max, min + 99);
}
@@ -513,33 +491,18 @@
}
@Override
- public <T> List<T> many(final String title, final String topCaption, int cnt, final List<T> sourceChoices) {
- return many(title, topCaption, cnt, sourceChoices, null);
- }
-
- @Override
public <T> List<T> many(final String title, final String topCaption, final int cnt, final List<T> sourceChoices, final CardView c) {
return many(title, topCaption, cnt, cnt, sourceChoices, c);
}
@Override
- public <T> List<T> many(final String title, final String topCaption, final int min, final int max, final List<T> sourceChoices) {
- return many(title, topCaption, min, max, sourceChoices, null);
- }
-
- @Override
- public <T> List<T> many(final String title, final String topCaption, int min, int max, final List<T> sourceChoices, final CardView c) {
+ public <T> List<T> many(final String title, final String topCaption, final int min, final int max, final List<T> sourceChoices, final CardView c) {
final int m2 = min >= 0 ? sourceChoices.size() - min : -1;
final int m1 = max >= 0 ? sourceChoices.size() - max : -1;
return order(title, topCaption, m1, m2, sourceChoices, null, c, false);
}
@Override
- public <T> List<T> order(final String title, final String top, final List<T> sourceChoices) {
- return order(title, top, sourceChoices, null);
- }
-
- @Override
public <T> List<T> order(final String title, final String top, final List<T> sourceChoices, final CardView c) {
return order(title, top, 0, 0, sourceChoices, null, c, false);
}
@@ -548,7 +511,7 @@
* Ask the user to insert an object into a list of other objects. The
* current implementation requires the user to cancel in order to get the
* new item to be the first item in the resulting list.
- *
+ *
* @param title the dialog title.
* @param newItem the object to insert.
* @param oldItems the list of objects.
@@ -584,11 +547,7 @@
return confirm(c, question, true, null);
}
@Override
- public boolean confirm(final CardView c, final String question, final boolean defaultChoice) {
- return confirm(c, question, defaultChoice, null);
- }
- @Override
- public boolean confirm(final CardView c, final String question, String[] options) {
+ public boolean confirm(final CardView c, final String question, final String[] options) {
return confirm(c, question, true, options);
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/FPanel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FPanel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FPanel.java (revision 29317)
@@ -6,31 +6,38 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.toolbox;
-import forge.UiCommand;
-import forge.gui.framework.ILocalRepaint;
-import forge.toolbox.FSkin.FPanelBase;
-import forge.toolbox.FSkin.SkinColor;
-
-import javax.swing.*;
-
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.LayoutManager;
+import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
+import javax.swing.SwingConstants;
+
+import forge.UiCommand;
+import forge.gui.framework.ILocalRepaint;
+import forge.toolbox.FSkin.FPanelBase;
+import forge.toolbox.FSkin.SkinColor;
+
-/**
+/**
* Core panel used in UI.
* <br><br>
* Adjustable features of FPanel:<br>
@@ -141,6 +148,7 @@
}
/** @param img0 &emsp; {@link java.awt.Image} */
+ @Override
protected void onSetForegroundImage(final Image img0) {
if (img0 == null) {
this.foregroundImage = null;
@@ -177,6 +185,7 @@
}
/** @param img0 &emsp; {@link java.awt.Image} */
+ @Override
protected void onSetBackgroundTexture(final Image img0) {
if (img0 == null) { return; }
@@ -186,6 +195,7 @@
}
/** @param clr0 &emsp; {@link java.awt.Color} */
+ @Override
public void onSetBackgroundTextureOverlay(final Color color) {
this.backgroundTextureOverlay = color;
}
@@ -213,7 +223,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
*/
@Override
@@ -308,13 +318,13 @@
// Scaling step 3: Center image in panel
switch(this.foregroundAlign) {
- case SwingConstants.BOTTOM:
- tempX = ((pnlW - scaledW) / 2);
- tempY = pnlH - scaledH;
- break;
- default:
- tempX = ((pnlW - scaledW) / 2);
- tempY = ((pnlH - scaledH) / 2);
+ case SwingConstants.BOTTOM:
+ tempX = ((pnlW - scaledW) / 2);
+ tempY = pnlH - scaledH;
+ break;
+ default:
+ tempX = ((pnlW - scaledW) / 2);
+ tempY = ((pnlH - scaledH) / 2);
}
g2d0.drawImage(foregroundImage, tempX, tempY, scaledW + tempX, scaledH + tempY, 0, 0, imgW, imgH, null);
Index: forge-gui-desktop/src/main/java/forge/menus/LayoutMenu.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/menus/LayoutMenu.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/menus/LayoutMenu.java (revision 29317)
@@ -38,12 +38,12 @@
private FScreen currentScreen;
private static final ForgePreferences prefs = FModel.getPreferences();
- private boolean showIcons = false;
+ private final boolean showIcons = false;
public JMenu getMenu() {
currentScreen = Singletons.getControl().getCurrentScreen();
- JMenu menu = new JMenu("Layout");
+ final JMenu menu = new JMenu("Layout");
menu.setMnemonic(KeyEvent.VK_L);
if (currentScreen != FScreen.HOME_SCREEN) {
menu.add(getMenu_ViewOptions());
@@ -60,7 +60,7 @@
}
private JMenu getMenu_ViewOptions() {
- JMenu menu = new JMenu("View");
+ final JMenu menu = new JMenu("View");
menu.add(getMenuItem_ShowTabs());
if (currentScreen != null && currentScreen.isMatchScreen()) {
menu.add(getMenuItem_ShowBackgroundImage());
@@ -69,18 +69,18 @@
}
private JMenu getMenu_FileOptions() {
- JMenu menu = new JMenu("File");
+ final JMenu menu = new JMenu("File");
menu.add(getMenuItem_OpenLayout());
menu.add(getMenuItem_SaveLayout());
return menu;
}
private static JMenu getMenu_ThemeOptions() {
- JMenu menu = new JMenu("Theme");
+ final JMenu menu = new JMenu("Theme");
JRadioButtonMenuItem menuItem;
- ButtonGroup group = new ButtonGroup();
- String currentSkin = prefs.getPref(FPref.UI_SKIN);
- for (String skin : FSkin.getAllSkins()) {
+ final ButtonGroup group = new ButtonGroup();
+ final String currentSkin = prefs.getPref(FPref.UI_SKIN);
+ for (final String skin : FSkin.getAllSkins()) {
menuItem = new JRadioButtonMenuItem(skin);
group.add(menuItem);
if (skin.equals(currentSkin)) {
@@ -94,8 +94,7 @@
}
private static final ActionListener changeSkin = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(final ActionEvent e) {
MouseUtil.setCursor(Cursor.WAIT_CURSOR);
FSkin.changeSkin(e.getActionCommand());
MouseUtil.resetCursor();
@@ -111,9 +110,8 @@
private static ActionListener getShowBackgroundImageAction(final JCheckBoxMenuItem menuItem) {
return new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- boolean isVisible = menuItem.getState();
+ @Override public void actionPerformed(final ActionEvent e) {
+ final boolean isVisible = menuItem.getState();
prefs.setPref(FPref.UI_MATCH_IMAGE_VISIBLE, isVisible);
if (isVisible) {
FView.SINGLETON_INSTANCE.getPnlInsets().setForegroundImage(FSkin.getIcon(FSkinProp.BG_MATCH));
@@ -134,9 +132,8 @@
}
private static ActionListener getShowTabsAction(final JCheckBoxMenuItem menuItem) {
return new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- boolean showTabs = menuItem.getState();
+ @Override public void actionPerformed(final ActionEvent e) {
+ final boolean showTabs = menuItem.getState();
FView.SINGLETON_INSTANCE.refreshAllCellLayouts(showTabs);
prefs.setPref(FPref.UI_HIDE_GAME_TABS, !showTabs);
prefs.save();
@@ -145,67 +142,63 @@
}
private JMenuItem getMenuItem_SaveLayout() {
- SkinnedMenuItem menuItem = new SkinnedMenuItem("Save Current Layout");
+ final SkinnedMenuItem menuItem = new SkinnedMenuItem("Save Current Layout");
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkinProp.ICO_SAVELAYOUT) : null));
menuItem.addActionListener(getSaveLayoutAction());
return menuItem;
}
- private ActionListener getSaveLayoutAction() {
+ private static ActionListener getSaveLayoutAction() {
return new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(final ActionEvent e) {
SLayoutIO.saveLayout();
}
};
}
private JMenuItem getMenuItem_OpenLayout() {
- SkinnedMenuItem menuItem = new SkinnedMenuItem("Open...");
+ final SkinnedMenuItem menuItem = new SkinnedMenuItem("Open...");
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkinProp.ICO_OPENLAYOUT) : null));
menuItem.addActionListener(getOpenLayoutAction());
return menuItem;
}
- private ActionListener getOpenLayoutAction() {
+ private static ActionListener getOpenLayoutAction() {
return new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(final ActionEvent e) {
SLayoutIO.openLayout();
}
};
}
private JMenuItem getMenuItem_RevertLayout() {
- SkinnedMenuItem menuItem = new SkinnedMenuItem("Refresh");
+ final SkinnedMenuItem menuItem = new SkinnedMenuItem("Refresh");
menuItem.setIcon((showIcons ? MenuUtil.getMenuIcon(FSkinProp.ICO_REVERTLAYOUT) : null));
menuItem.addActionListener(getRevertLayoutAction());
return menuItem;
}
- private ActionListener getRevertLayoutAction() {
+ private static ActionListener getRevertLayoutAction() {
return new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(final ActionEvent e) {
SLayoutIO.revertLayout();
}
};
}
private static JMenuItem getMenuItem_SetWindowSize() {
- JMenuItem menuItem = new JMenuItem("Set Window Size");
+ final JMenuItem menuItem = new JMenuItem("Set Window Size");
menuItem.addActionListener(getSetWindowSizeAction());
return menuItem;
}
private static ActionListener getSetWindowSizeAction() {
return new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- String[] options = {"800x600", "1024x768", "1280x720"};
+ @Override public void actionPerformed(final ActionEvent e) {
+ final String[] options = {"800x600", "1024x768", "1280x720"};
final String choice = GuiChoose.oneOrNone("Choose new window size", options);
if (choice != null) {
- String[] dims = choice.split("x");
+ final String[] dims = choice.split("x");
Singletons.getView().getFrame().setSize(Integer.parseInt(dims[0]), Integer.parseInt(dims[1]));
}
}
@@ -225,8 +218,7 @@
}
private static ActionListener getFullScreenAction() {
return new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(final ActionEvent e) {
final FFrame frame = Singletons.getView().getFrame();
frame.setFullScreen(!frame.isFullScreen());
}
Index: forge-gui-desktop/src/main/java/forge/screens/match/controllers/CCombat.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/match/controllers/CCombat.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/controllers/CCombat.java (revision 29317)
@@ -4,7 +4,6 @@
import com.google.common.collect.Iterables;
-import forge.UiCommand;
import forge.game.GameEntityView;
import forge.game.card.CardView;
import forge.game.card.CardView.CardStateView;
@@ -15,9 +14,9 @@
import forge.util.FCollection;
import forge.util.Lang;
-/**
+/**
* Controls the combat panel in the match UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -33,15 +32,7 @@
return view;
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
@Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
-
- @Override
public void register() {
}
@@ -57,7 +48,7 @@
*/
@Override
public void update() {
- final CombatView localCombat = this.combat; // noone will re-assign this from other thread.
+ final CombatView localCombat = this.combat; // noone will re-assign this from other thread.
if (localCombat != null) {
view.updateCombat(localCombat.getNumAttackers(), getCombatDescription(localCombat));
} else {
@@ -81,7 +72,7 @@
private static String getCombatDescription(final CombatView localCombat, final GameEntityView defender) {
final StringBuilder display = new StringBuilder();
- Iterable<FCollection<CardView>> bands = localCombat.getAttackingBandsOf(defender);
+ final Iterable<FCollection<CardView>> bands = localCombat.getAttackingBandsOf(defender);
if (bands == null || Iterables.isEmpty(bands)) {
return StringUtils.EMPTY;
}
@@ -108,7 +99,7 @@
display.append("\n");
}
- final FCollection<CardView> blockers = localCombat.getBlockers(band);
+ final FCollection<CardView> blockers = localCombat.getBlockers(band);
final boolean blocked = blockers != null && !blockers.isEmpty();
final boolean isBand = bandSize > 1;
if (isBand) {
@@ -151,7 +142,7 @@
* <p>
* combatantToString.
* </p>
- *
+ *
* @param c
* a {@link forge.game.card.Card} object.
* @return a {@link java.lang.String} object.
Index: forge-gui/src/main/java/forge/match/input/InputProliferate.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/input/InputProliferate.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/input/InputProliferate.java (revision 29317)
@@ -16,20 +16,21 @@
public final class InputProliferate extends InputSelectManyBase<GameEntity> {
private static final long serialVersionUID = -1779224307654698954L;
- private Map<GameEntity, CounterType> chosenCounters = new HashMap<GameEntity, CounterType>();
+ private final Map<GameEntity, CounterType> chosenCounters = new HashMap<GameEntity, CounterType>();
public InputProliferate(final PlayerControllerHuman controller) {
super(controller, 1, Integer.MAX_VALUE);
}
+ @Override
protected String getMessage() {
- StringBuilder sb = new StringBuilder("Choose permanents and/or players with counters on them to add one more counter of that type.");
+ final StringBuilder sb = new StringBuilder("Choose permanents and/or players with counters on them to add one more counter of that type.");
sb.append("\n\nYou've selected so far:\n");
if (chosenCounters.isEmpty()) {
sb.append("(none)");
}
else {
- for (Entry<GameEntity, CounterType> ge : chosenCounters.entrySet()) {
+ for (final Entry<GameEntity, CounterType> ge : chosenCounters.entrySet()) {
if (ge.getKey() instanceof Player) {
sb.append("* A poison counter to player ").append(ge.getKey()).append("\n");
}
@@ -47,8 +48,8 @@
if (!card.hasCounters()) {
return false;
}
-
+
- boolean entityWasSelected = chosenCounters.containsKey(card);
+ final boolean entityWasSelected = chosenCounters.containsKey(card);
if (entityWasSelected) {
this.chosenCounters.remove(card);
}
@@ -60,7 +61,7 @@
}
}
- CounterType toAdd = choices.size() == 1 ? choices.get(0) : getController().getGui().one("Select counter type", choices);
+ final CounterType toAdd = choices.size() == 1 ? choices.get(0) : getController().getGui().one("Select counter type", choices);
chosenCounters.put(card, toAdd);
}
@@ -69,7 +70,7 @@
}
@Override
- public String getActivateAction(Card card) {
+ public String getActivateAction(final Card card) {
if (card.hasCounters() && !chosenCounters.containsKey(card)) {
return "add counter to card";
}
@@ -77,17 +78,18 @@
}
@Override
- protected final void onPlayerSelected(Player player, final ITriggerEvent triggerEvent) {
+ protected final void onPlayerSelected(final Player player, final ITriggerEvent triggerEvent) {
if (player.getPoisonCounters() == 0 || player.hasKeyword("You can't get poison counters")) {
return;
}
-
+
- boolean entityWasSelected = chosenCounters.containsKey(player);
+ final boolean entityWasSelected = chosenCounters.containsKey(player);
if (entityWasSelected) {
this.chosenCounters.remove(player);
- } else
+ } else {
this.chosenCounters.put(player, null /* POISON counter is meant */);
+ }
-
+
refresh();
}
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/toolbox/FTabbedPane.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FTabbedPane.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FTabbedPane.java (revision 29317)
@@ -2,10 +2,6 @@
import forge.toolbox.FSkin.SkinnedTabbedPane;
-/**
- * TODO: Write javadoc for this type.
- *
- */
public class FTabbedPane extends SkinnedTabbedPane {
private static final long serialVersionUID = 2207172560817790885L;
Index: forge-gui/src/main/java/forge/download/GuiDownloadZipService.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/download/GuiDownloadZipService.java (revision 29316)
+++ forge-gui/src/main/java/forge/download/GuiDownloadZipService.java (revision 29317)
@@ -26,7 +26,7 @@
private final String name, desc, sourceUrl, destFolder, deleteFolder;
private int filesExtracted;
- public GuiDownloadZipService(String name0, String desc0, String sourceUrl0, String destFolder0, String deleteFolder0, IProgressBar progressBar0) {
+ public GuiDownloadZipService(final String name0, final String desc0, final String sourceUrl0, final String destFolder0, final String deleteFolder0, final IProgressBar progressBar0) {
name = name0;
desc = desc0;
sourceUrl = sourceUrl0;
@@ -47,7 +47,7 @@
@Override
protected final Map<String, String> getNeededFiles() {
- HashMap<String, String> files = new HashMap<String, String>();
+ final Map<String, String> files = new HashMap<String, String>();
files.put("_", "_");
return files; //not needed by zip service, so just return map of size 1
}
@@ -74,13 +74,13 @@
//if assets.zip downloaded successfully, unzip into destination folder
try {
if (deleteFolder != null) {
- File deleteDir = new File(deleteFolder);
+ final File deleteDir = new File(deleteFolder);
if (deleteDir.exists()) {
//attempt to delete previous res directory if to be rebuilt
progressBar.reset();
progressBar.setDescription("Deleting old " + desc + "...");
if (deleteFolder.equals(destFolder)) { //move zip file to prevent deleting it
- String oldZipFilename = zipFilename;
+ final String oldZipFilename = zipFilename;
zipFilename = deleteDir.getParentFile().getAbsolutePath() + File.separator + "temp.zip";
Files.move(new File(oldZipFilename), new File(zipFilename));
}
@@ -88,8 +88,8 @@
}
}
- ZipFile zipFile = new ZipFile(zipFilename);
- Enumeration<? extends ZipEntry> entries = zipFile.entries();
+ final ZipFile zipFile = new ZipFile(zipFilename);
+ final Enumeration<? extends ZipEntry> entries = zipFile.entries();
progressBar.reset();
progressBar.setPercentMode(true);
@@ -104,9 +104,9 @@
if (cancel) { break; }
try {
- ZipEntry entry = (ZipEntry)entries.nextElement();
+ final ZipEntry entry = entries.nextElement();
- String path = destFolder + entry.getName();
+ final String path = destFolder + entry.getName();
if (entry.isDirectory()) {
new File(path).mkdir();
progressBar.setValue(++count);
@@ -116,7 +116,7 @@
progressBar.setValue(++count);
filesExtracted++;
}
- catch (Exception e) { //don't quit out completely if an entry is not UTF-8
+ catch (final Exception e) { //don't quit out completely if an entry is not UTF-8
progressBar.setValue(++count);
failedCount++;
}
@@ -129,19 +129,19 @@
zipFile.close();
new File(zipFilename).delete();
}
- catch (Exception e) {
+ catch (final Exception e) {
e.printStackTrace();
}
}
- public String download(String filename) {
+ public String download(final String filename) {
progressBar.reset();
progressBar.setPercentMode(true);
progressBar.setDescription("Downloading " + desc);
try {
- URL url = new URL(sourceUrl);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection(getProxy());
+ final URL url = new URL(sourceUrl);
+ final HttpURLConnection conn = (HttpURLConnection) url.openConnection(getProxy());
if (url.getPath().endsWith(".php")) {
//ensure file can be downloaded if returned from PHP script
@@ -154,7 +154,7 @@
return null;
}
- long contentLength = conn.getContentLength();
+ final long contentLength = conn.getContentLength();
if (contentLength == 0) {
return null;
}
@@ -162,18 +162,18 @@
progressBar.setMaximum(100);
// input stream to read file - with 8k buffer
- InputStream input = new BufferedInputStream(conn.getInputStream(), 8192);
+ final InputStream input = new BufferedInputStream(conn.getInputStream(), 8192);
FileUtil.ensureDirectoryExists(destFolder);
-
+
// output stream to write file
- String destFile = destFolder + filename;
- OutputStream output = new FileOutputStream(destFile);
+ final String destFile = destFolder + filename;
+ final OutputStream output = new FileOutputStream(destFile);
-
+
int count;
long total = 0;
- byte data[] = new byte[1024];
+ final byte data[] = new byte[1024];
-
+
while ((count = input.read(data)) != -1) {
if (cancel) { break; }
@@ -181,7 +181,7 @@
progressBar.setValue((int)(100 * total / contentLength));
output.write(data, 0, count);
}
-
+
output.flush();
output.close();
input.close();
@@ -198,10 +198,10 @@
return null;
}
- protected void copyInputStream(InputStream in, String outPath) throws IOException{
- byte[] buffer = new byte[1024];
+ protected void copyInputStream(final InputStream in, final String outPath) throws IOException{
+ final byte[] buffer = new byte[1024];
int len;
- BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(outPath));
+ final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(outPath));
while((len = in.read(buffer)) >= 0) {
out.write(buffer, 0, len);
Index: forge-gui/src/main/java/forge/quest/QuestRewardCard.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/quest/QuestRewardCard.java (revision 29316)
+++ forge-gui/src/main/java/forge/quest/QuestRewardCard.java (revision 29317)
@@ -11,10 +11,6 @@
import forge.item.PaperCard;
import forge.model.FModel;
-/**
- * TODO: Write javadoc for this type.
- *
- */
public abstract class QuestRewardCard implements IQuestRewardCard {
protected String buildDescription(final String [] input) {
@@ -22,12 +18,12 @@
if (input == null || input.length < 1) {
return defaultDescription;
}
-
+
String buildDesc = null;
-
+
- for (String s : input) {
+ for (final String s : input) {
if (s.startsWith("desc:") || s.startsWith("Desc:")) {
- String[] tmp = s.split(":");
+ final String[] tmp = s.split(":");
if (tmp.length > 1) {
buildDesc = new String(tmp[1]);
} else {
@@ -41,7 +37,7 @@
}
}
}
-
+
if (buildDesc != null) {
return buildDesc;
}
@@ -52,19 +48,19 @@
if (input == null || input.length < 1) {
return null;
}
-
+
Predicate<PaperCard> filters = FModel.getQuest().getFormat().getFilterPrinted();
Predicate<CardRules> filterRules = null;
Predicate<PaperCard> filterRarity = null;
-
+
- for (String s : input) {
+ for (final String s : input) {
if (s.startsWith("sets:") || s.startsWith("Sets:")) {
final String[] tmp = s.split(":");
if (tmp.length > 1) {
- String [] setcodes = tmp[1].split(",");
+ final String [] setcodes = tmp[1].split(",");
if (setcodes.length > 0) {
- List<String> sets = new ArrayList<String>();
- for (String code : setcodes) {
+ final List<String> sets = new ArrayList<String>();
+ for (final String code : setcodes) {
if (FModel.getMagicDb().getEditions().contains(code)) {
// System.out.println("Set " + code + " was found!");
sets.add(code);
@@ -79,9 +75,9 @@
} else if (s.startsWith("rules:") || s.startsWith("Rules:")) {
final String[] tmp = s.split(":");
if (tmp.length > 1) {
- String [] ruleCodes = tmp[1].split(",");
+ final String [] ruleCodes = tmp[1].split(",");
if (ruleCodes.length > 0) {
- for (String rule : ruleCodes) {
+ for (final String rule : ruleCodes) {
final Predicate<CardRules> newRule = BoosterUtils.parseRulesLimitation(rule);
if (newRule != null) {
filterRules = (filterRules == null ? newRule : Predicates.and(filterRules, newRule));
@@ -92,9 +88,9 @@
} else if (s.startsWith("rarity:") || s.startsWith("Rarity:")) {
final String[] tmp = s.split(":");
if (tmp.length > 1) {
- String [] rarityCodes = tmp[1].split(",");
+ final String [] rarityCodes = tmp[1].split(",");
if (rarityCodes.length > 0) {
- for (String rarity : rarityCodes) {
+ for (final String rarity : rarityCodes) {
if (rarity.startsWith("C") || rarity.startsWith("c")) {
filterRarity = (filterRarity == null ? IPaperCard.Predicates.Presets.IS_COMMON : Predicates.or(filterRarity, IPaperCard.Predicates.Presets.IS_COMMON));
} else if (rarity.startsWith("U") || rarity.startsWith("u")) {
@@ -109,7 +105,7 @@
}
}
}
-
+
if (filterRules != null) {
final Predicate<PaperCard> rulesPrinted = Predicates.compose(filterRules, PaperCard.FN_GET_RULES);
filters = Predicates.and(filters, rulesPrinted);
@@ -119,7 +115,5 @@
}
return filters;
}
-
- public abstract List<PaperCard> getChoices();
}
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/views/VProbabilities.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/views/VProbabilities.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/views/VProbabilities.java (revision 29317)
@@ -1,5 +1,15 @@
package forge.screens.deckeditor.views;
+import java.awt.Font;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.List;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+
+import net.miginfocom.swing.MigLayout;
import forge.deck.DeckBase;
import forge.gui.framework.DragCell;
import forge.gui.framework.DragTab;
@@ -13,16 +23,8 @@
import forge.toolbox.FLabel;
import forge.toolbox.FScrollPane;
import forge.toolbox.FSkin;
-import net.miginfocom.swing.MigLayout;
-import javax.swing.*;
-
-import java.awt.*;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.List;
-
-/**
+/**
* Assembles Swing components of deck editor analysis tab.
*
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
@@ -43,8 +45,8 @@
.fontSize(12).text("SAMPLE HAND").opaque(true).build();
private final FLabel lblRemainingDraws = new FLabel.Builder().fontStyle(Font.BOLD)
.fontSize(12).text("REMAINING DRAWS").opaque(true).build();
- // private final JLabel lblExplanation = new FLabel.Builder()
- // .fontSize(11).text("XX % = frequency that card will appear at that position").build();
+ // private final JLabel lblExplanation = new FLabel.Builder()
+ // .fontSize(11).text("XX % = frequency that card will appear at that position").build();
// Layout containers
private final JPanel pnlContent = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
@@ -61,14 +63,14 @@
lblSampleHand.setBorder(new FSkin.MatteSkinBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
lblSampleHand.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
-
+
lblRemainingDraws.setBorder(new FSkin.MatteSkinBorder(1, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
lblRemainingDraws.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
// Core layout
pnlContent.add(lblReshuffle, "w 96%!, h 29px!, gap 2% 0 5px 5px");
pnlContent.add(lblSampleHand, "w 96%!, h 25px!, gap 2% 0 0 0");
- // pnlContent.add(lblExplanation, "w 96%!, h 25px!, gap 2% 0 0 0");
+ // pnlContent.add(lblExplanation, "w 96%!, h 25px!, gap 2% 0 0 0");
pnlContent.add(pnlHand, "w 96%!, gap 2% 0 0 5px");
pnlContent.add(lblRemainingDraws, "w 96%!, h 25px!, gap 2% 0 0 0");
pnlContent.add(pnlLibrary, "w 96%!, gap 2% 0 5px 0");
@@ -152,7 +154,7 @@
pnlLibrary.validate();
}
- private <T extends InventoryItem, TModel extends DeckBase> JLabel buildLabel(final boolean zebra) {
+ private static <T extends InventoryItem, TModel extends DeckBase> JLabel buildLabel(final boolean zebra) {
final FLabel lbl = new FLabel.Builder().text("--")
.fontAlign(SwingConstants.CENTER).fontSize(13)
.build();
@@ -168,7 +170,7 @@
final String name1 = lbl.getText();
String name2;
- for (PaperCard c : cards) {
+ for (final PaperCard c : cards) {
name2 = c.getName();
if (name2.length() > name1.length()) { continue; }
Index: forge-gui-desktop/src/main/java/forge/toolbox/FUndoManager.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FUndoManager.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FUndoManager.java (revision 29317)
@@ -19,235 +19,235 @@
import javax.swing.undo.UndoableEdit;
/*
-** This class will merge individual edits into a single larger edit.
-** That is, characters entered sequentially will be grouped together and
-** undone as a group. Any attribute changes will be considered as part
-** of the group and will therefore be undone when the group is undone.
-*/
+ ** This class will merge individual edits into a single larger edit.
+ ** That is, characters entered sequentially will be grouped together and
+ ** undone as a group. Any attribute changes will be considered as part
+ ** of the group and will therefore be undone when the group is undone.
+ */
@SuppressWarnings("serial")
public class FUndoManager extends UndoManager implements DocumentListener {
- private UndoManager undoManager;
+ private final UndoManager undoManager;
- private CompoundEdit compoundEdit;
+ private CompoundEdit compoundEdit;
- private JTextComponent textComponent;
- private UndoAction undoAction;
- private RedoAction redoAction;
+ private final JTextComponent textComponent;
+ private final UndoAction undoAction;
+ private final RedoAction redoAction;
- // These fields are used to help determine whether the edit is an
- // incremental edit. The offset and length should increase by 1 for
- // each character added or decrease by 1 for each character removed.
+ // These fields are used to help determine whether the edit is an
+ // incremental edit. The offset and length should increase by 1 for
+ // each character added or decrease by 1 for each character removed.
- private int lastOffset;
- private int lastLength;
+ private int lastOffset;
+ private int lastLength;
- public FUndoManager(JTextComponent textComponent) {
+ public FUndoManager(final JTextComponent textComponent) {
- this.textComponent = textComponent;
- undoManager = this;
- undoAction = new UndoAction();
- redoAction = new RedoAction();
- textComponent.getDocument().addUndoableEditListener(this);
- }
+ this.textComponent = textComponent;
+ undoManager = this;
+ undoAction = new UndoAction();
+ redoAction = new RedoAction();
+ textComponent.getDocument().addUndoableEditListener(this);
+ }
- /*
- ** Add a DocumentLister before the undo is done so we can position
- ** the Caret correctly as each edit is undone.
- */
- @Override
- public synchronized void undo() {
- if (canUndo()) {
- textComponent.getDocument().addDocumentListener(this);
- super.undo();
- textComponent.getDocument().removeDocumentListener(this);
- }
- }
+ /*
+ ** Add a DocumentLister before the undo is done so we can position
+ ** the Caret correctly as each edit is undone.
+ */
+ @Override
+ public synchronized void undo() {
+ if (canUndo()) {
+ textComponent.getDocument().addDocumentListener(this);
+ super.undo();
+ textComponent.getDocument().removeDocumentListener(this);
+ }
+ }
- /*
- ** Add a DocumentLister before the redo is done so we can position
- ** the Caret correctly as each edit is redone.
- */
- @Override
- public synchronized void redo() {
- if (canRedo()) {
- textComponent.getDocument().addDocumentListener(this);
- super.redo();
- textComponent.getDocument().removeDocumentListener(this);
- }
- }
+ /*
+ ** Add a DocumentLister before the redo is done so we can position
+ ** the Caret correctly as each edit is redone.
+ */
+ @Override
+ public synchronized void redo() {
+ if (canRedo()) {
+ textComponent.getDocument().addDocumentListener(this);
+ super.redo();
+ textComponent.getDocument().removeDocumentListener(this);
+ }
+ }
- /*
- ** Whenever an UndoableEdit happens the edit will either be absorbed
- ** by the current compound edit or a new compound edit will be started
- */
- @Override
+ /*
+ ** Whenever an UndoableEdit happens the edit will either be absorbed
+ ** by the current compound edit or a new compound edit will be started
+ */
+ @Override
- public void undoableEditHappened(UndoableEditEvent e) {
+ public void undoableEditHappened(final UndoableEditEvent e) {
- // Start a new compound edit
- if (compoundEdit == null) {
- compoundEdit = startCompoundEdit(e.getEdit());
- return;
- }
+ // Start a new compound edit
+ if (compoundEdit == null) {
+ compoundEdit = startCompoundEdit(e.getEdit());
+ return;
+ }
- int offsetChange = textComponent.getCaretPosition() - lastOffset;
- int lengthChange = textComponent.getDocument().getLength() - lastLength;
+ final int offsetChange = textComponent.getCaretPosition() - lastOffset;
+ final int lengthChange = textComponent.getDocument().getLength() - lastLength;
- // Check for an attribute change
+ // Check for an attribute change
- AbstractDocument.DefaultDocumentEvent event = (AbstractDocument.DefaultDocumentEvent)e.getEdit();
+ final AbstractDocument.DefaultDocumentEvent event = (AbstractDocument.DefaultDocumentEvent)e.getEdit();
- if (event.getType().equals(DocumentEvent.EventType.CHANGE)) {
- if (offsetChange == 0) {
- compoundEdit.addEdit(e.getEdit());
- return;
- }
- }
+ if (event.getType().equals(DocumentEvent.EventType.CHANGE)) {
+ if (offsetChange == 0) {
+ compoundEdit.addEdit(e.getEdit());
+ return;
+ }
+ }
- // Check for an incremental edit or backspace.
- // The Change in Caret position and Document length should both be
- // either 1 or -1.
- if (offsetChange == lengthChange && Math.abs(offsetChange) == 1) {
- compoundEdit.addEdit(e.getEdit());
- lastOffset = textComponent.getCaretPosition();
- lastLength = textComponent.getDocument().getLength();
- return;
- }
+ // Check for an incremental edit or backspace.
+ // The Change in Caret position and Document length should both be
+ // either 1 or -1.
+ if (offsetChange == lengthChange && Math.abs(offsetChange) == 1) {
+ compoundEdit.addEdit(e.getEdit());
+ lastOffset = textComponent.getCaretPosition();
+ lastLength = textComponent.getDocument().getLength();
+ return;
+ }
- // Not incremental edit, end previous edit and start a new one
- compoundEdit.end();
- compoundEdit = startCompoundEdit(e.getEdit());
- }
+ // Not incremental edit, end previous edit and start a new one
+ compoundEdit.end();
+ compoundEdit = startCompoundEdit(e.getEdit());
+ }
- /*
- ** Each CompoundEdit will store a group of related incremental edits
- ** (ie. each character typed or backspaced is an incremental edit)
- */
+ /*
+ ** Each CompoundEdit will store a group of related incremental edits
+ ** (ie. each character typed or backspaced is an incremental edit)
+ */
- private CompoundEdit startCompoundEdit(UndoableEdit anEdit) {
+ private CompoundEdit startCompoundEdit(final UndoableEdit anEdit) {
- // Track Caret and Document information of this compound edit
- lastOffset = textComponent.getCaretPosition();
- lastLength = textComponent.getDocument().getLength();
+ // Track Caret and Document information of this compound edit
+ lastOffset = textComponent.getCaretPosition();
+ lastLength = textComponent.getDocument().getLength();
- // The compound edit is used to store incremental edits
- compoundEdit = new MyCompoundEdit();
- compoundEdit.addEdit(anEdit);
+ // The compound edit is used to store incremental edits
+ compoundEdit = new MyCompoundEdit();
+ compoundEdit.addEdit(anEdit);
- // The compound edit is added to the UndoManager. All incremental
- // edits stored in the compound edit will be undone/redone at once
- addEdit(compoundEdit);
+ // The compound edit is added to the UndoManager. All incremental
+ // edits stored in the compound edit will be undone/redone at once
+ addEdit(compoundEdit);
- undoAction.updateUndoState();
- redoAction.updateRedoState();
+ undoAction.updateUndoState();
+ redoAction.updateRedoState();
- return compoundEdit;
- }
+ return compoundEdit;
+ }
- /*
- * The Action to Undo changes to the Document.
- * The state of the Action is managed by the CompoundUndoManager
- */
- public Action getUndoAction() {
- return undoAction;
- }
+ /*
+ * The Action to Undo changes to the Document.
+ * The state of the Action is managed by the CompoundUndoManager
+ */
+ public Action getUndoAction() {
+ return undoAction;
+ }
- /*
- * The Action to Redo changes to the Document.
- * The state of the Action is managed by the CompoundUndoManager
- */
- public Action getRedoAction() {
- return redoAction;
- }
+ /*
+ * The Action to Redo changes to the Document.
+ * The state of the Action is managed by the CompoundUndoManager
+ */
+ public Action getRedoAction() {
+ return redoAction;
+ }
- /*
- * Updates to the Document as a result of Undo/Redo will cause the
- * Caret to be repositioned
- */
- @Override
- public void insertUpdate(final DocumentEvent e) {
- int offset = e.getOffset() + e.getLength();
- offset = Math.min(offset, textComponent.getDocument().getLength());
- textComponent.setCaretPosition(offset);
- }
+ /*
+ * Updates to the Document as a result of Undo/Redo will cause the
+ * Caret to be repositioned
+ */
+ @Override
+ public void insertUpdate(final DocumentEvent e) {
+ int offset = e.getOffset() + e.getLength();
+ offset = Math.min(offset, textComponent.getDocument().getLength());
+ textComponent.setCaretPosition(offset);
+ }
- @Override
+ @Override
- public void removeUpdate(DocumentEvent e) {
+ public void removeUpdate(final DocumentEvent e) {
- textComponent.setCaretPosition(e.getOffset());
- }
+ textComponent.setCaretPosition(e.getOffset());
+ }
- @Override
+ @Override
- public void changedUpdate(DocumentEvent e) {}
+ public void changedUpdate(final DocumentEvent e) {}
- private class MyCompoundEdit extends CompoundEdit {
- @Override
- public boolean isInProgress() {
- // in order for the canUndo() and canRedo() methods to work
- // assume that the compound edit is never in progress
- return false;
- }
+ private class MyCompoundEdit extends CompoundEdit {
+ @Override
+ public boolean isInProgress() {
+ // in order for the canUndo() and canRedo() methods to work
+ // assume that the compound edit is never in progress
+ return false;
+ }
- @Override
- public void undo() throws CannotUndoException {
- // End the edit so future edits don't get absorbed by this edit
- if (compoundEdit != null) {
- compoundEdit.end();
- }
+ @Override
+ public void undo() throws CannotUndoException {
+ // End the edit so future edits don't get absorbed by this edit
+ if (compoundEdit != null) {
+ compoundEdit.end();
+ }
- super.undo();
+ super.undo();
- // Always start a new compound edit after an undo
- compoundEdit = null;
- }
- }
+ // Always start a new compound edit after an undo
+ compoundEdit = null;
+ }
+ }
- /*
- * Perform the Undo and update the state of the undo/redo Actions
- */
- private class UndoAction extends AbstractAction {
- public UndoAction() {
- putValue(Action.NAME, "Undo");
- putValue(Action.SHORT_DESCRIPTION, getValue(Action.NAME));
- putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_U));
- putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK));
- setEnabled(false);
- }
+ /*
+ * Perform the Undo and update the state of the undo/redo Actions
+ */
+ private class UndoAction extends AbstractAction {
+ public UndoAction() {
+ putValue(Action.NAME, "Undo");
+ putValue(Action.SHORT_DESCRIPTION, getValue(Action.NAME));
+ putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_U));
+ putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK));
+ setEnabled(false);
+ }
- @Override
+ @Override
- public void actionPerformed(ActionEvent e) {
+ public void actionPerformed(final ActionEvent e) {
- try {
- undoManager.undo();
- textComponent.requestFocusInWindow();
- }
+ try {
+ undoManager.undo();
+ textComponent.requestFocusInWindow();
+ }
- catch (CannotUndoException ex) {}
+ catch (final CannotUndoException ex) {}
- updateUndoState();
- redoAction.updateRedoState();
- }
+ updateUndoState();
+ redoAction.updateRedoState();
+ }
- private void updateUndoState() {
- setEnabled(undoManager.canUndo());
- }
- }
+ private void updateUndoState() {
+ setEnabled(undoManager.canUndo());
+ }
+ }
- /*
- * Perform the Redo and update the state of the undo/redo Actions
- */
- private class RedoAction extends AbstractAction {
- public RedoAction() {
- putValue(Action.NAME, "Redo");
- putValue(Action.SHORT_DESCRIPTION, getValue(Action.NAME));
- putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_R));
- putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK));
- setEnabled(false);
- }
+ /*
+ * Perform the Redo and update the state of the undo/redo Actions
+ */
+ private class RedoAction extends AbstractAction {
+ public RedoAction() {
+ putValue(Action.NAME, "Redo");
+ putValue(Action.SHORT_DESCRIPTION, getValue(Action.NAME));
+ putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_R));
+ putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK));
+ setEnabled(false);
+ }
- @Override
+ @Override
- public void actionPerformed(ActionEvent e) {
+ public void actionPerformed(final ActionEvent e) {
- try {
- undoManager.redo();
- textComponent.requestFocusInWindow();
- }
+ try {
+ undoManager.redo();
+ textComponent.requestFocusInWindow();
+ }
- catch (CannotRedoException ex) {}
+ catch (final CannotRedoException ex) {}
- updateRedoState();
- undoAction.updateUndoState();
- }
+ updateRedoState();
+ undoAction.updateUndoState();
+ }
- protected void updateRedoState() {
- setEnabled(undoManager.canRedo());
- }
- }
+ protected void updateRedoState() {
+ setEnabled(undoManager.canRedo());
+ }
+ }
}
Index: forge-gui-desktop/src/main/java/forge/view/arcane/CardPanel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/view/arcane/CardPanel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/view/arcane/CardPanel.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -52,7 +52,7 @@
* <p>
* CardPanel class.
* </p>
- *
+ *
* @author Forge
* @version $Id: CardPanel.java 25264 2014-03-27 01:59:18Z drdev $
*/
@@ -155,24 +155,10 @@
add(cardIdText);
}
- public void updateImage() {
- updateImage(false);
- }
- private void updateImage(boolean fromSetCard) {
+ private void updateImage() {
final BufferedImage image = card == null ? null : ImageCache.getImage(card, matchUI.getLocalPlayers(), imagePanel.getWidth(), imagePanel.getHeight());
- if (fromSetCard) {
- setImage(image);
- }
+ setImage(image);
+ }
- else {
- synchronized (imagePanel) {
- if (imagePanel.getSrcImage() == image) {
- return;
- }
- imagePanel.setImage(image);
- repaint();
- }
- }
- }
private void setImage(final BufferedImage srcImage) {
synchronized (imagePanel) {
@@ -285,9 +271,9 @@
}
}
- private void drawManaCost(final Graphics g, ManaCost cost, int deltaY) {
- int width = CardFaceSymbols.getWidth(cost);
- int height = CardFaceSymbols.getHeight();
+ private void drawManaCost(final Graphics g, final ManaCost cost, final int deltaY) {
+ final int width = CardFaceSymbols.getWidth(cost);
+ final int height = CardFaceSymbols.getHeight();
CardFaceSymbols.draw(g, cost, (cardXOffset + (cardWidth / 2)) - (width / 2), deltaY + cardYOffset + (cardHeight / 2) - height/2);
}
@@ -299,7 +285,7 @@
return;
}
- boolean canShow = matchUI.mayView(card);
+ final boolean canShow = matchUI.mayView(card);
displayIconOverlay(g, canShow);
if (canShow) {
drawFoilEffect(g, card, cardXOffset, cardYOffset,
@@ -309,7 +295,7 @@
public static void drawFoilEffect(final Graphics g, final CardView card2, final int x, final int y, final int width, final int height, final int borderSize) {
if (isPreferenceEnabled(FPref.UI_OVERLAY_FOIL_EFFECT)) {
- int foil = card2.getCurrentState().getFoilIndex();
+ final int foil = card2.getCurrentState().getFoilIndex();
if (foil > 0) {
CardFaceSymbols.drawOther(g, String.format("foil%02d", foil),
x + borderSize, y + borderSize, width - 2 * borderSize, height - 2 * borderSize);
@@ -327,15 +313,15 @@
imagePanel.setLocation(imgPos);
imagePanel.setSize(imgSize);
- boolean canShow = matchUI.mayView(card);
- boolean showText = !imagePanel.hasImage() || !isAnimationPanel;
+ final boolean canShow = matchUI.mayView(card);
+ final boolean showText = !imagePanel.hasImage() || !isAnimationPanel;
displayCardNameOverlay(showText && canShow && showCardNameOverlay(), imgSize, imgPos);
displayPTOverlay(showText && (canShow || card.isFaceDown()) && showCardPowerOverlay(), imgSize, imgPos);
displayCardIdOverlay(showText && canShow && showCardIdOverlay(), imgSize, imgPos);
}
- private void displayCardIdOverlay(boolean isVisible, Dimension imgSize, Point imgPos) {
+ private void displayCardIdOverlay(final boolean isVisible, final Dimension imgSize, final Point imgPos) {
if (isVisible) {
final Dimension idSize = cardIdText.getPreferredSize();
cardIdText.setSize(idSize.width, idSize.height);
@@ -346,7 +332,7 @@
cardIdText.setVisible(isVisible);
}
- private void displayPTOverlay(boolean isVisible, Dimension imgSize, Point imgPos) {
+ private void displayPTOverlay(final boolean isVisible, final Dimension imgSize, final Point imgPos) {
if (isVisible) {
final int rightLine = Math.round(imgSize.width * (412f / 480)) + 3;
// Power
@@ -366,7 +352,7 @@
damageText.setVisible(isVisible);
}
- private void displayCardNameOverlay(boolean isVisible, Dimension imgSize, Point imgPos) {
+ private void displayCardNameOverlay(final boolean isVisible, final Dimension imgSize, final Point imgPos) {
if (isVisible) {
final int titleX = Math.round(imgSize.width * (24f / 480));
final int titleY = Math.round(imgSize.height * (54f / 640)) - 15;
@@ -507,7 +493,7 @@
// Card Id overlay
cardIdText.setText(card.getCurrentState().getDisplayId());
- }
+ }
public final void updatePTOverlay() {
// P/T overlay
@@ -533,7 +519,7 @@
/** {@inheritDoc} */
@Override
public final void setCard(final CardView cardView) {
- CardView oldCard = card;
+ final CardView oldCard = card;
card = cardView; //always update card in case new card view instance for same card
if (imagePanel == null) {
@@ -545,9 +531,10 @@
updateText();
updatePTOverlay();
- updateImage(true);
+ updateImage();
}
+ @Override
public void dispose() {
attachedToPanel = null;
attachedPanels = null;
@@ -596,11 +583,7 @@
tappedAngle = tappedAngle0;
}
- public static final float getBorderSize() {
- return BLACK_BORDER_SIZE;
- }
-
- private static boolean isPreferenceEnabled(FPref preferenceName) {
+ private static boolean isPreferenceEnabled(final FPref preferenceName) {
return FModel.getPreferences().getPrefBoolean(preferenceName);
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/FOptionPane.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FOptionPane.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FOptionPane.java (revision 29317)
@@ -1,18 +1,23 @@
package forge.toolbox;
-import forge.assets.FSkinProp;
-import forge.toolbox.FSkin.SkinImage;
-import forge.view.FDialog;
-
-import javax.swing.*;
-import javax.swing.text.StyleConstants;
-
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FontMetrics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.text.StyleConstants;
+
+import forge.assets.FSkinProp;
+import forge.toolbox.FSkin.SkinImage;
+import forge.view.FDialog;
+
/**
* Class to replace JOptionPane using skinned dialogs
*
@@ -24,74 +29,74 @@
public static final SkinImage WARNING_ICON = FSkin.getIcon(FSkinProp.ICO_WARNING);
public static final SkinImage ERROR_ICON = FSkin.getIcon(FSkinProp.ICO_ERROR);
- public static void showMessageDialog(String message) {
+ public static void showMessageDialog(final String message) {
showMessageDialog(message, "Forge", INFORMATION_ICON);
}
- public static void showMessageDialog(String message, String title) {
+ public static void showMessageDialog(final String message, final String title) {
showMessageDialog(message, title, INFORMATION_ICON);
}
- public static void showErrorDialog(String message) {
+ public static void showErrorDialog(final String message) {
showMessageDialog(message, "Forge", ERROR_ICON);
}
- public static void showErrorDialog(String message, String title) {
+ public static void showErrorDialog(final String message, final String title) {
showMessageDialog(message, title, ERROR_ICON);
}
- public static void showMessageDialog(String message, String title, SkinImage icon) {
+ public static void showMessageDialog(final String message, final String title, final SkinImage icon) {
showOptionDialog(message, title, icon, new String[] {"OK"}, 0);
}
- public static boolean showConfirmDialog(String message) {
+ public static boolean showConfirmDialog(final String message) {
return showConfirmDialog(message, "Forge");
}
- public static boolean showConfirmDialog(String message, String title) {
+ public static boolean showConfirmDialog(final String message, final String title) {
return showConfirmDialog(message, title, "Yes", "No", true);
}
- public static boolean showConfirmDialog(String message, String title, boolean defaultYes) {
+ public static boolean showConfirmDialog(final String message, final String title, final boolean defaultYes) {
return showConfirmDialog(message, title, "Yes", "No", defaultYes);
}
- public static boolean showConfirmDialog(String message, String title, String yesButtonText, String noButtonText) {
+ public static boolean showConfirmDialog(final String message, final String title, final String yesButtonText, final String noButtonText) {
return showConfirmDialog(message, title, yesButtonText, noButtonText, true);
}
- public static boolean showConfirmDialog(String message, String title, String yesButtonText, String noButtonText, boolean defaultYes) {
- String[] options = {yesButtonText, noButtonText};
- int reply = FOptionPane.showOptionDialog(message, title, QUESTION_ICON, options, defaultYes ? 0 : 1);
+ public static boolean showConfirmDialog(final String message, final String title, final String yesButtonText, final String noButtonText, final boolean defaultYes) {
+ final String[] options = {yesButtonText, noButtonText};
+ final int reply = FOptionPane.showOptionDialog(message, title, QUESTION_ICON, options, defaultYes ? 0 : 1);
return (reply == 0);
}
- public static int showOptionDialog(String message, String title, SkinImage icon, String[] options) {
+ public static int showOptionDialog(final String message, final String title, final SkinImage icon, final String[] options) {
return showOptionDialog(message, title, icon, options, 0);
}
- public static int showOptionDialog(String message, String title, SkinImage icon, String[] options, int defaultOption) {
+ public static int showOptionDialog(final String message, final String title, final SkinImage icon, final String[] options, final int defaultOption) {
final FOptionPane optionPane = new FOptionPane(message, title, icon, null, options, defaultOption);
optionPane.setVisible(true);
- int dialogResult = optionPane.result;
+ final int dialogResult = optionPane.result;
optionPane.dispose();
return dialogResult;
}
- public static String showInputDialog(String message, String title) {
+ public static String showInputDialog(final String message, final String title) {
return showInputDialog(message, title, null, "", null);
}
- public static String showInputDialog(String message, String title, SkinImage icon) {
+ public static String showInputDialog(final String message, final String title, final SkinImage icon) {
return showInputDialog(message, title, icon, "", null);
}
- public static String showInputDialog(String message, String title, SkinImage icon, String initialInput) {
+ public static String showInputDialog(final String message, final String title, final SkinImage icon, final String initialInput) {
return showInputDialog(message, title, icon, initialInput, null);
}
@SuppressWarnings("unchecked")
- public static <T> T showInputDialog(String message, String title, SkinImage icon, T initialInput, T[] inputOptions) {
+ public static <T> T showInputDialog(final String message, final String title, final SkinImage icon, final T initialInput, final T[] inputOptions) {
final JComponent inputField;
FTextField txtInput = null;
FComboBox<T> cbInput = null;
@@ -109,47 +114,46 @@
optionPane.setDefaultFocus(inputField);
inputField.addKeyListener(new KeyAdapter() { //hook so pressing Enter on field accepts dialog
@Override
- public void keyPressed(KeyEvent e) {
+ public void keyPressed(final KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
optionPane.setResult(0);
}
}
});
optionPane.setVisible(true);
- int dialogResult = optionPane.result;
+ final int dialogResult = optionPane.result;
optionPane.dispose();
if (dialogResult == 0) {
if (inputOptions == null) {
return (T)txtInput.getText();
+ } else {
+ return cbInput.getSelectedItem();
}
- else {
- return (T)cbInput.getSelectedItem();
- }
+ }
- }
return null;
}
private int result = -1; //default result to -1, indicating dialog closed without choosing option
private final FButton[] buttons;
- public FOptionPane(String message, String title, SkinImage icon, Component comp, String[] options, int defaultOption) {
+ public FOptionPane(final String message, final String title, final SkinImage icon, final Component comp, final String[] options, final int defaultOption) {
this.setTitle(title);
- int padding = 10;
+ final int padding = 10;
int x = padding;
- int gapAboveButtons = padding * 3 / 2;
- int gapBottom = comp == null ? gapAboveButtons : padding;
+ final int gapAboveButtons = padding * 3 / 2;
+ final int gapBottom = comp == null ? gapAboveButtons : padding;
FLabel centeredLabel = null;
FTextPane centeredPrompt = null;
if (icon != null) {
if (icon.getWidth() < 100) {
- FLabel lblIcon = new FLabel.Builder().icon(icon).build();
+ final FLabel lblIcon = new FLabel.Builder().icon(icon).build();
this.add(lblIcon, "x " + (x - 3) + ", ay top, w " + icon.getWidth() + ", h " + icon.getHeight() + ", gapbottom " + gapBottom);
x += icon.getWidth();
}
else {
- FLabel lblIcon = new FLabel.Builder().icon(icon).iconInBackground(true).iconScaleFactor(1).iconAlignX(SwingConstants.CENTER).build();
+ final FLabel lblIcon = new FLabel.Builder().icon(icon).iconInBackground(true).iconScaleFactor(1).iconAlignX(SwingConstants.CENTER).build();
lblIcon.setMinimumSize(new Dimension(icon.getWidth() * 2, icon.getHeight()));
this.add(lblIcon, "x " + x + ", ay top, wrap, gapbottom " + gapBottom);
centeredLabel = lblIcon;
@@ -157,18 +161,18 @@
}
if (message != null) {
if (centeredLabel == null) {
- FTextArea prompt = new FTextArea(message);
+ final FTextArea prompt = new FTextArea(message);
prompt.setFont(FSkin.getFont(14));
prompt.setAutoSize(true);
- Dimension parentSize = JOptionPane.getRootFrame().getSize();
+ final Dimension parentSize = JOptionPane.getRootFrame().getSize();
prompt.setMaximumSize(new Dimension(parentSize.width / 2, parentSize.height - 100));
this.add(prompt, "x " + x + ", ay top, wrap, gaptop " + (icon == null ? 0 : 7) + ", gapbottom " + gapBottom);
}
else {
- FTextPane prompt = new FTextPane(message);
+ final FTextPane prompt = new FTextPane(message);
prompt.setFont(FSkin.getFont(14));
prompt.setTextAlignment(StyleConstants.ALIGN_CENTER);
- Dimension parentSize = JOptionPane.getRootFrame().getSize();
+ final Dimension parentSize = JOptionPane.getRootFrame().getSize();
prompt.setMaximumSize(new Dimension(parentSize.width / 2, parentSize.height - 100));
this.add(prompt, "x " + x + ", ay top, wrap, gapbottom " + gapBottom);
centeredPrompt = prompt;
@@ -180,14 +184,14 @@
}
//determine size of buttons
- int optionCount = options.length;
- FButton btnMeasure = new FButton(); //use blank button to aid in measurement
- FontMetrics metrics = JOptionPane.getRootFrame().getGraphics().getFontMetrics(btnMeasure.getFont());
+ final int optionCount = options.length;
+ final FButton btnMeasure = new FButton(); //use blank button to aid in measurement
+ final FontMetrics metrics = JOptionPane.getRootFrame().getGraphics().getFontMetrics(btnMeasure.getFont());
int maxTextWidth = 0;
buttons = new FButton[optionCount];
for (int i = 0; i < optionCount; i++) {
- int textWidth = metrics.stringWidth(options[i]);
+ final int textWidth = metrics.stringWidth(options[i]);
if (textWidth > maxTextWidth) {
maxTextWidth = textWidth;
}
@@ -197,11 +201,11 @@
this.pack(); //resize dialog to fit component and title to help determine button layout
int width = this.getWidth();
- int gapBetween = 3;
- int buttonHeight = 26;
- int buttonWidth = Math.max(maxTextWidth + btnMeasure.getMargin().left + btnMeasure.getMargin().right, 120); //account for margins and enforce minimum width
- int dx = buttonWidth + gapBetween;
- int totalButtonWidth = dx * optionCount - gapBetween;
+ final int gapBetween = 3;
+ final int buttonHeight = 26;
+ final int buttonWidth = Math.max(maxTextWidth + btnMeasure.getMargin().left + btnMeasure.getMargin().right, 120); //account for margins and enforce minimum width
+ final int dx = buttonWidth + gapBetween;
+ final int totalButtonWidth = dx * optionCount - gapBetween;
final int lastOption = optionCount - 1;
//add buttons
@@ -215,14 +219,14 @@
final FButton btn = buttons[i];
btn.addActionListener(new ActionListener() {
@Override
- public void actionPerformed(ActionEvent arg0) {
+ public void actionPerformed(final ActionEvent arg0) {
FOptionPane.this.result = option;
FOptionPane.this.setVisible(false);
}
});
btn.addKeyListener(new KeyAdapter() { //hook certain keys to move focus between buttons
@Override
- public void keyPressed(KeyEvent e) {
+ public void keyPressed(final KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_LEFT:
if (option > 0) {
@@ -263,7 +267,7 @@
}
@Override
- public void setVisible(boolean visible) {
+ public void setVisible(final boolean visible) {
if (this.isVisible() == visible) { return; }
if (visible) {
@@ -276,7 +280,7 @@
return result;
}
- public void setResult(int result0) {
+ public void setResult(final int result0) {
this.result = result0;
SwingUtilities.invokeLater(new Runnable() { //delay hiding so action can finish first
@Override
@@ -286,11 +290,11 @@
});
}
- public boolean isButtonEnabled(int index) {
+ public boolean isButtonEnabled(final int index) {
return buttons[index].isEnabled();
}
- public void setButtonEnabled(int index, boolean enabled) {
+ public void setButtonEnabled(final int index, final boolean enabled) {
buttons[index].setEnabled(enabled);
}
}
Index: forge-gui-desktop/src/main/java/forge/gui/framework/SDisplayUtil.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/framework/SDisplayUtil.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/framework/SDisplayUtil.java (revision 29317)
@@ -1,18 +1,29 @@
package forge.gui.framework;
-import forge.FThreads;
-import forge.view.FFrame;
-
-import javax.swing.*;
-
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Insets;
+import java.awt.KeyboardFocusManager;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.Window;
import java.util.Timer;
import java.util.TimerTask;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import forge.FThreads;
+import forge.view.FFrame;
+
-/**
+/**
* Experimental static factory for generic operations carried out
* onto specific members of the framework. Doublestrike 11-04-12
- *
+ *
* <br><br><i>(S at beginning of class name denotes a static factory.)</i>
*/
public class SDisplayUtil {
@@ -22,7 +33,7 @@
private static Timer timer1 = null;
/** Flashes animation on input panel if play is currently waiting on input.
- *
+ *
* @param tab0 &emsp; {@link java.GuiBase.getInterface().framework.IVDoc}
*/
public static void remind(final IVDoc<? extends ICDoc> tab0) {
@@ -55,21 +66,22 @@
}
final TimerTask tt = new TimerTask() {
- @Override
- public void run() {
+ @Override public final void run() {
counter++;
if (counter != (steps - 1)) {
- SwingUtilities.invokeLater(new Runnable() { @Override
- public void run() {
- int r = newR == null ? oldR : newR[counter];
- int a = newA == null ? oldA : newR[counter];
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override public void run() {
+ final int r = newR == null ? oldR : newR[counter];
+ final int a = newA == null ? oldA : newR[counter];
- pnl.setBackground(new Color(r, oldG, oldB, a));
- }
+ pnl.setBackground(new Color(r, oldG, oldB, a));
+ }
});
+ } else {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override public void run() {
+ pnl.setBackground(new Color(oldR, oldG, oldB, oldA));
- }
+ }
- else {
- SwingUtilities.invokeLater(new Runnable() { @Override
- public void run() { pnl.setBackground(new Color(oldR, oldG, oldB, oldA)); } });
+ });
remindIsRunning = false;
timer1.cancel();
newR = null;
@@ -86,15 +98,15 @@
/** @param tab0 &emsp; {@link java.GuiBase.getInterface().framework.IVDoc} */
public static void showTab(final IVDoc<? extends ICDoc> tab0) {
-
+
- Runnable showTabRoutine = new Runnable() {
- @Override
- public void run() {
+ final Runnable showTabRoutine = new Runnable() {
+ @Override public void run() {
// FThreads.assertExecutedByEdt(true); - always true
- Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner();
- DragCell dc = tab0.getParentCell();
- if (dc != null)
+ final Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner();
+ final DragCell dc = tab0.getParentCell();
+ if (dc != null) {
dc.setSelected(tab0);
+ }
// set focus back to previous owner, if any
if (null != c) {
c.requestFocusInWindow();
@@ -103,56 +115,52 @@
};
FThreads.invokeInEdtLater(showTabRoutine);
}
-
+
- public static GraphicsDevice getGraphicsDevice(Point point) {
- GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
- for (GraphicsDevice gd : env.getScreenDevices()) {
+ public static GraphicsDevice getGraphicsDevice(final Point point) {
+ final GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ for (final GraphicsDevice gd : env.getScreenDevices()) {
if (gd.getDefaultConfiguration().getBounds().contains(point)) {
return gd;
}
}
return null;
}
-
+
- public static GraphicsDevice getGraphicsDevice(Rectangle rect) {
+ public static GraphicsDevice getGraphicsDevice(final Rectangle rect) {
return getGraphicsDevice(new Point(rect.x + (rect.width / 2), rect.y + (rect.height / 2)));
}
-
+
- public static Rectangle getScreenBoundsForPoint(Point point) {
- GraphicsDevice gd = getGraphicsDevice(point);
+ public static Rectangle getScreenBoundsForPoint(final Point point) {
+ final GraphicsDevice gd = getGraphicsDevice(point);
if (gd == null) {
//return bounds of default monitor if point not on any screen
return GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
}
return gd.getDefaultConfiguration().getBounds();
}
-
+
- public static Rectangle getScreenMaximizedBounds(Rectangle rect) {
- GraphicsDevice gd = getGraphicsDevice(rect);
+ public static Rectangle getScreenMaximizedBounds(final Rectangle rect) {
+ final GraphicsDevice gd = getGraphicsDevice(rect);
if (gd == null) {
//return bounds of default monitor if center of rect not on any screen
return GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
}
- GraphicsConfiguration config = gd.getDefaultConfiguration();
- Rectangle bounds = config.getBounds();
- Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(config);
+ final GraphicsConfiguration config = gd.getDefaultConfiguration();
+ final Rectangle bounds = config.getBounds();
+ final Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(config);
bounds.x += screenInsets.left;
bounds.y += screenInsets.top;
bounds.width -= screenInsets.left + screenInsets.right;
bounds.height -= screenInsets.top + screenInsets.bottom;
return bounds;
}
-
+
- public static boolean setFullScreenWindow(FFrame frame, boolean fullScreen) {
+ public static boolean setFullScreenWindow(final FFrame frame, final boolean fullScreen) {
return setFullScreenWindow(getGraphicsDevice(frame.getNormalBounds()), frame, fullScreen);
}
-
+
- public static boolean setFullScreenWindow(Window window, boolean fullScreen) {
- return setFullScreenWindow(getGraphicsDevice(window.getBounds()), window, fullScreen);
- }
-
- private static boolean setFullScreenWindow(GraphicsDevice gd, Window window, boolean fullScreen) {
+ private static boolean setFullScreenWindow(final GraphicsDevice gd, final Window window, final boolean fullScreen) {
if (gd != null && gd.isFullScreenSupported()) {
if (fullScreen) {
gd.setFullScreenWindow(window);
Index: forge-gui/src/main/java/forge/quest/QuestUtilCards.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/quest/QuestUtilCards.java (revision 29316)
+++ forge-gui/src/main/java/forge/quest/QuestUtilCards.java (revision 29317)
@@ -20,8 +20,10 @@
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
+
import forge.card.*;
import forge.deck.Deck;
import forge.deck.DeckSection;
@@ -38,6 +40,7 @@
import forge.util.Aggregates;
import forge.util.ItemPool;
import forge.util.MyRandom;
+
import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList;
@@ -626,9 +629,8 @@
));
}
- @SuppressWarnings("unchecked")
private SealedProduct.Template getBoosterTemplate() {
- return new SealedProduct.Template(Lists.newArrayList(
+ return new SealedProduct.Template(ImmutableList.of(
Pair.of(BoosterSlots.COMMON, this.qpref.getPrefInt(QPref.BOOSTER_COMMONS)),
Pair.of(BoosterSlots.UNCOMMON, this.qpref.getPrefInt(QPref.BOOSTER_UNCOMMONS)),
Pair.of(BoosterSlots.RARE_MYTHIC, this.qpref.getPrefInt(QPref.BOOSTER_RARES))
@@ -649,7 +651,6 @@
final int levelPacks = level > 0 ? startPacks / level : startPacks;
final int winPacks = this.qc.getAchievements().getWin() / winsForPack;
final int totalPacks = Math.min(Math.max(levelPacks + winPacks, minPacks), maxPacks);
-
SealedProduct.Template tpl = getShopBoosterTemplate();
UnOpenedProduct unopened = qc.getFormat() == null ? new UnOpenedProduct(tpl) : new UnOpenedProduct(tpl, qc.getFormat().getFilterPrinted());
Index: forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemListView.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemListView.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemListView.java (revision 29317)
@@ -6,44 +6,24 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.itemmanager.views;
-import forge.assets.FSkinProp;
-import forge.gui.MouseUtil;
-import forge.item.InventoryItem;
-import forge.itemmanager.ColumnDef;
-import forge.itemmanager.ItemColumn;
-import forge.itemmanager.ItemColumnConfig;
-import forge.itemmanager.ItemManager;
-import forge.itemmanager.ItemManagerConfig;
-import forge.itemmanager.ItemManagerModel;
-import forge.toolbox.FCheckBox;
-import forge.toolbox.FMouseAdapter;
-import forge.toolbox.FSkin;
-import forge.toolbox.FSkin.*;
-
-import javax.swing.*;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.table.*;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.KeyboardFocusManager;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
@@ -54,14 +34,62 @@
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.JViewport;
+import javax.swing.KeyStroke;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingConstants;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.TableModelEvent;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.JTableHeader;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import org.apache.commons.lang3.StringUtils;
+
+import forge.assets.FSkinProp;
+import forge.gui.MouseUtil;
+import forge.item.InventoryItem;
+import forge.itemmanager.ColumnDef;
+import forge.itemmanager.ItemColumn;
+import forge.itemmanager.ItemColumnConfig;
+import forge.itemmanager.ItemManager;
+import forge.itemmanager.ItemManagerConfig;
+import forge.itemmanager.ItemManagerModel;
+import forge.toolbox.FCheckBox;
+import forge.toolbox.FMouseAdapter;
+import forge.toolbox.FSkin;
+import forge.toolbox.FSkin.SkinBorder;
+import forge.toolbox.FSkin.SkinColor;
+import forge.toolbox.FSkin.SkinFont;
+import forge.toolbox.FSkin.SkinImage;
+import forge.toolbox.FSkin.SkinnedTable;
+import forge.toolbox.FSkin.SkinnedTableHeader;
+
+
/**
* ItemTable.
- *
+ *
* @param <T>
* the generic type
*/
@@ -87,11 +115,11 @@
/**
* ItemTable Constructor.
- *
+ *
* @param itemManager0
* @param model0
*/
- public ItemListView(ItemManager<T> itemManager0, ItemManagerModel<T> model0) {
+ public ItemListView(final ItemManager<T> itemManager0, final ItemManagerModel<T> model0) {
super(itemManager0, model0);
this.tableModel = new ItemTableModel(model0);
this.setAllowMultipleSelections(false);
@@ -99,21 +127,19 @@
// use different selection highlight colors for focused vs. unfocused tables
this.table.addMouseListener(new FMouseAdapter() {
- @Override
- public void onLeftDoubleClick(MouseEvent e) {
+ @Override public void onLeftDoubleClick(final MouseEvent e) {
if (e.isConsumed()) { return; } //don't activate if inline button double clicked
- int clickedIndex = table.rowAtPoint(e.getPoint());
+ final int clickedIndex = table.rowAtPoint(e.getPoint());
itemManager.activateSelectedItems();
if (clickedIndex >= table.getRowCount()) {
- FMouseAdapter.forceMouseUp(); //prevent mouse getting stuck if final row removed from double click handling
+ FMouseAdapter.forceMouseUp(); //prevent mouse getting stuck if final row removed from double click handling
}
}
- @Override
- public void onRightClick(MouseEvent e) {
+ @Override public void onRightClick(final MouseEvent e) {
itemManager.showContextMenu(e);
}
});
@@ -124,13 +150,13 @@
}
@Override
- public void setup(ItemManagerConfig config, Map<ColumnDef, ItemTableColumn> colOverrides) {
+ public void setup(final ItemManagerConfig config, final Map<ColumnDef, ItemTableColumn> colOverrides) {
final Iterable<T> selectedItemsBefore = getSelectedItems();
final DefaultTableColumnModel colmodel = new DefaultTableColumnModel();
//ensure columns ordered properly
final List<ItemTableColumn> columns = new LinkedList<ItemTableColumn>();
- for (ItemColumnConfig colConfig : config.getCols().values()) {
+ for (final ItemColumnConfig colConfig : config.getCols().values()) {
if (colOverrides == null || !colOverrides.containsKey(colConfig.getDef())) {
columns.add(new ItemTableColumn(new ItemColumn(colConfig)));
}
@@ -139,14 +165,13 @@
}
}
Collections.sort(columns, new Comparator<ItemTableColumn>() {
- @Override
- public int compare(ItemTableColumn arg0, ItemTableColumn arg1) {
+ @Override public int compare(final ItemTableColumn arg0, final ItemTableColumn arg1) {
return Integer.compare(arg0.getIndex(), arg1.getIndex());
}
});
//hide table header if only showing single string column
- boolean hideHeader = (config.getCols().size() == 1 && config.getCols().containsKey(ColumnDef.STRING));
+ final boolean hideHeader = (config.getCols().size() == 1 && config.getCols().containsKey(ColumnDef.STRING));
getPnlOptions().removeAll();
@@ -155,9 +180,8 @@
chkBox.setFont(ROW_FONT);
chkBox.setToolTipText("Toggle whether to show unique cards only");
chkBox.addChangeListener(new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent arg0) {
- boolean wantUnique = chkBox.isSelected();
+ @Override public void stateChanged(final ChangeEvent arg0) {
+ final boolean wantUnique = chkBox.isSelected();
if (itemManager.getWantUnique() == wantUnique) { return; }
itemManager.setWantUnique(wantUnique);
itemManager.refresh();
@@ -181,9 +205,8 @@
chkBox.setFont(ROW_FONT);
chkBox.setToolTipText(col.getLongName());
chkBox.addChangeListener(new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent arg0) {
- boolean visible = chkBox.isSelected();
+ @Override public void stateChanged(final ChangeEvent arg0) {
+ final boolean visible = chkBox.isSelected();
if (col.isVisible() == visible) { return; }
col.setVisible(visible);
@@ -191,7 +214,7 @@
colmodel.addColumn(col);
//move column into proper position
- int oldIndex = colmodel.getColumnCount() - 1;
+ final int oldIndex = colmodel.getColumnCount() - 1;
int newIndex = col.getIndex();
for (int i = 0; i < col.getIndex(); i++) {
if (!columns.get(i).isVisible()) {
@@ -252,7 +275,7 @@
}
@Override
- public void setAllowMultipleSelections(boolean allowMultipleSelections) {
+ public void setAllowMultipleSelections(final boolean allowMultipleSelections) {
this.table.setSelectionMode(allowMultipleSelections ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION);
}
@@ -263,8 +286,8 @@
@Override
public Iterable<Integer> getSelectedIndices() {
- List<Integer> indices = new ArrayList<Integer>();
- int[] selectedRows = this.table.getSelectedRows();
+ final List<Integer> indices = new ArrayList<Integer>();
+ final int[] selectedRows = this.table.getSelectedRows();
for (int i = 0; i < selectedRows.length; i++) {
indices.add(selectedRows[i]);
}
@@ -272,23 +295,23 @@
}
@Override
- protected void onSetSelectedIndex(int index) {
+ protected void onSetSelectedIndex(final int index) {
this.table.setRowSelectionInterval(index, index);
}
@Override
- protected void onSetSelectedIndices(Iterable<Integer> indices) {
+ protected void onSetSelectedIndices(final Iterable<Integer> indices) {
this.table.clearSelection();
- for (Integer index : indices) {
+ for (final Integer index : indices) {
this.table.addRowSelectionInterval(index, index);
}
}
@Override
- protected void onScrollSelectionIntoView(JViewport viewport) {
+ protected void onScrollSelectionIntoView(final JViewport viewport) {
// compute where we're going and where we are
- Rectangle targetRect = this.table.getCellRect(this.getSelectedIndex(), 0, true);
- Rectangle curViewRect = viewport.getViewRect();
+ final Rectangle targetRect = this.table.getCellRect(this.getSelectedIndex(), 0, true);
+ final Rectangle curViewRect = viewport.getViewRect();
// if the target cell is not visible, attempt to jump to a location where it is
// visible but not on the edge of the viewport
@@ -310,13 +333,13 @@
}
@Override
- public int getIndexOfItem(T item) {
+ public int getIndexOfItem(final T item) {
return this.tableModel.itemToRow(item);
}
@Override
- public T getItemAtIndex(int index) {
- Entry<T, Integer> itemEntry = this.tableModel.rowToItem(index);
+ public T getItemAtIndex(final int index) {
+ final Entry<T, Integer> itemEntry = this.tableModel.rowToItem(index);
return itemEntry != null ? itemEntry.getKey() : null;
}
@@ -331,7 +354,7 @@
}
@Override
- public int getIndexAtPoint(Point p) {
+ public int getIndexAtPoint(final Point p) {
return this.table.rowAtPoint(p);
}
@@ -355,7 +378,7 @@
this.addFocusListener(new FocusListener() {
@Override
- public void focusGained(FocusEvent e) {
+ public void focusGained(final FocusEvent e) {
setSelectionBackground(SEL_ACTIVE_COLOR);
// if nothing selected when we gain focus, select the first row (if exists)
if (getSelectedIndex() == -1 && getCount() > 0) {
@@ -364,7 +387,7 @@
}
@Override
- public void focusLost(FocusEvent e) {
+ public void focusLost(final FocusEvent e) {
if (!e.isTemporary()) {
setSelectionBackground(SEL_INACTIVE_COLOR);
}
@@ -382,13 +405,13 @@
public void actionPerformed(final ActionEvent e) {
final StringBuilder sb = new StringBuilder();
for (final int row : getSelectedRows()) {
- Entry<T, Integer> item = tableModel.rowToItem(row);
+ final Entry<T, Integer> item = tableModel.rowToItem(row);
sb.append(item.getValue().toString());
sb.append(' ');
sb.append(item.getKey().toString());
sb.append('\n');
}
- final StringSelection selection = new StringSelection(sb.toString());
+ final StringSelection selection = new StringSelection(sb.toString());
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(selection, selection);
}
@@ -399,12 +422,12 @@
}
@Override
protected JTableHeader createDefaultTableHeader() {
- SkinnedTableHeader header = new SkinnedTableHeader(columnModel) {
+ final SkinnedTableHeader header = new SkinnedTableHeader(columnModel) {
@Override
- public String getToolTipText(MouseEvent e) {
- int col = columnModel.getColumnIndexAtX(e.getPoint().x);
+ public String getToolTipText(final MouseEvent e) {
+ final int col = columnModel.getColumnIndexAtX(e.getPoint().x);
if (col < 0) { return null; }
- ItemTableColumn tableColumn = (ItemTableColumn) columnModel.getColumn(col);
+ final ItemTableColumn tableColumn = (ItemTableColumn) columnModel.getColumn(col);
if (tableColumn.getLongName().isEmpty()) {
return null;
}
@@ -418,9 +441,9 @@
final DefaultTableCellRenderer renderer = ((DefaultTableCellRenderer)header.getDefaultRenderer());
header.setDefaultRenderer(new DefaultTableCellRenderer() {
@Override
- public Component getTableCellRendererComponent(JTable table,
- Object value, boolean isSelected, boolean hasFocus, int row, int column) {
- JLabel lbl = (JLabel) renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ public Component getTableCellRendererComponent(final JTable table,
+ final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
+ final JLabel lbl = (JLabel) renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
lbl.setHorizontalAlignment(SwingConstants.LEFT);
FSkin.setTempBorder(lbl, HEADER_BORDER);
return lbl;
@@ -429,39 +452,40 @@
return header;
}
- public void processMouseEvent(MouseEvent e) {
- Point p = e.getPoint();
- int row = rowAtPoint(p);
- int col = columnAtPoint(p);
+ @Override
+ public void processMouseEvent(final MouseEvent e) {
+ final Point p = e.getPoint();
+ final int row = rowAtPoint(p);
+ final int col = columnAtPoint(p);
if (col < 0 || col >= getColumnCount() || row < 0 || row >= getRowCount()) {
return;
}
- Object val = getValueAt(row, col);
+ final Object val = getValueAt(row, col);
if (val == null) {
return;
}
- ItemCellRenderer renderer = (ItemCellRenderer)getCellRenderer(row, col);
+ final ItemCellRenderer renderer = (ItemCellRenderer)getCellRenderer(row, col);
if (renderer != null) {
renderer.processMouseEvent(e, ItemListView.this, val, row, col); //give renderer a chance to process the mouse event
}
try {
super.processMouseEvent(e);
}
- catch (Exception ex) { //trap error thrown by weird tooltip issue
+ catch (final Exception ex) { //trap error thrown by weird tooltip issue
ex.printStackTrace();
}
}
- private String getCellTooltip(TableCellRenderer renderer, int row, int col, Object val) {
- Component cell = renderer.getTableCellRendererComponent(this, val, false, false, row, col);
+ private String getCellTooltip(final TableCellRenderer renderer, final int row, final int col, final Object val) {
+ final Component cell = renderer.getTableCellRendererComponent(this, val, false, false, row, col);
// use a pre-set tooltip if it exists
if (cell instanceof JComponent) {
- JComponent jcell = (JComponent)cell;
- String tip = jcell.getToolTipText();
+ final JComponent jcell = (JComponent)cell;
+ final String tip = jcell.getToolTipText();
if (tip != null && !tip.isEmpty()) {
return tip;
}
@@ -470,7 +494,7 @@
// if we're conditionally showing the tooltip, check to see
// if we shouldn't show it
if (val == null) { return null; }
- String text = val.toString();
+ final String text = val.toString();
if (text.isEmpty()) { return null; }
if (!(renderer instanceof ItemCellRenderer) || !((ItemCellRenderer)renderer).alwaysShowTooltip()) {
@@ -478,8 +502,8 @@
// we use '>' here instead of '>=' since that seems to be the
// threshold for where the ellipses appear for the default
// JTable renderer
- int requiredWidth = cell.getPreferredSize().width;
- TableColumn tableColumn = this.getColumnModel().getColumn(col);
+ final int requiredWidth = cell.getPreferredSize().width;
+ final TableColumn tableColumn = this.getColumnModel().getColumn(col);
if (tableColumn.getWidth() > requiredWidth) {
return null;
}
@@ -490,16 +514,16 @@
}
@Override
- public String getToolTipText(MouseEvent e) {
- Point p = e.getPoint();
- int row = rowAtPoint(p);
- int col = columnAtPoint(p);
+ public String getToolTipText(final MouseEvent e) {
+ final Point p = e.getPoint();
+ final int row = rowAtPoint(p);
+ final int col = columnAtPoint(p);
if (col >= getColumnCount() || row >= getRowCount()) {
return null;
}
- Object val = getValueAt(row, col);
+ final Object val = getValueAt(row, col);
if (val == null) {
return null;
}
@@ -512,7 +536,7 @@
private Point lastTooltipPt;
@Override
- public Point getToolTipLocation(MouseEvent e) {
+ public Point getToolTipLocation(final MouseEvent e) {
Point p = e.getPoint();
final int row = rowAtPoint(p);
final int col = columnAtPoint(p);
@@ -533,7 +557,7 @@
/**
* Instantiates a new table model.
- *
+ *
* @param table0 &emsp; {@link forge.gui.ItemManager.ItemTable<T>}
* @param model0 &emsp; {@link forge.gui.ItemManager.ItemManagerModel<T>}
*/
@@ -556,7 +580,7 @@
model.getCascadeManager().reset();
for (int i = sortcols.length - 1; i >= 0; i--) {
- ItemTableColumn col = sortcols[i];
+ final ItemTableColumn col = sortcols[i];
if (col != null) {
model.getCascadeManager().add(col.getItemColumn(), true);
}
@@ -565,7 +589,7 @@
/**
* Row to item.
- *
+ *
* @param row - the row
* @return the item
*/
@@ -576,7 +600,7 @@
/**
* Item to row.
- *
+ *
* @param item - the item
* @return the row
*/
@@ -608,11 +632,11 @@
private ItemTableColumn resizeColumn;
@Override
- public void onLeftMouseDown(MouseEvent e) {
+ public void onLeftMouseDown(final MouseEvent e) {
focus();
if (Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR) == table.getTableHeader().getCursor()) {
final TableColumnModel colModel = table.getColumnModel();
- int index = colModel.getColumnIndexAtX(e.getX() - 3); //-3 to ensure we get column left of resizer
+ final int index = colModel.getColumnIndexAtX(e.getX() - 3); //-3 to ensure we get column left of resizer
if (index >= 0) {
resizeColumn = (ItemTableColumn) colModel.getColumn(index);
resizeColumn.startResize();
@@ -622,7 +646,7 @@
}
@Override
- public void onLeftMouseUp(MouseEvent e) {
+ public void onLeftMouseUp(final MouseEvent e) {
if (resizeColumn != null) {
MouseUtil.unlockCursor();
resizeColumn.endResize();
@@ -631,7 +655,7 @@
}
@Override
- public void onLeftClick(MouseEvent e) {
+ public void onLeftClick(final MouseEvent e) {
if (Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR) == table.getTableHeader().getCursor()) {
return;
}
@@ -655,9 +679,9 @@
}
@Override
- public void onLeftMouseDragDrop(MouseEvent e) { //save preferences after column moved/resized
+ public void onLeftMouseDragDrop(final MouseEvent e) { //save preferences after column moved/resized
for (int i = 0; i < table.getColumnCount(); i++) {
- ItemTableColumn column = (ItemTableColumn) table.getColumnModel().getColumn(i);
+ final ItemTableColumn column = (ItemTableColumn) table.getColumnModel().getColumn(i);
column.updatePreferredWidth();
column.setIndex(i);
}
@@ -665,14 +689,14 @@
}
@Override
- public void onMouseExit(MouseEvent e) {
+ public void onMouseExit(final MouseEvent e) {
MouseUtil.resetCursor();
}
};
private final MouseMotionAdapter headerMouseMotionAdapter = new MouseMotionAdapter() {
@Override
- public void mouseMoved(MouseEvent arg0) {
+ public void mouseMoved(final MouseEvent arg0) {
MouseUtil.setCursor(table.getTableHeader().getCursor());
}
};
@@ -724,8 +748,8 @@
* @see javax.swing.table.TableModel#getValueAt(int, int)
*/
@Override
- public Object getValueAt(int iRow, int iCol) {
- Entry<T, Integer> card = this.rowToItem(iRow);
+ public Object getValueAt(final int iRow, final int iCol) {
+ final Entry<T, Integer> card = this.rowToItem(iRow);
if (null == card) {
return null;
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/FTextField.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FTextField.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FTextField.java (revision 29317)
@@ -1,33 +1,38 @@
package forge.toolbox;
-import forge.gui.MouseUtil;
-import forge.interfaces.ITextField;
-import forge.toolbox.FSkin.SkinnedTextField;
+import java.awt.Cursor;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Insets;
+import java.awt.RenderingHints;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
-import javax.swing.*;
+import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
-import java.awt.*;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
+import forge.gui.MouseUtil;
+import forge.interfaces.ITextField;
+import forge.toolbox.FSkin.SkinnedTextField;
-/**
+/**
* A custom instance of JTextField using Forge skin properties.
- *
*/
@SuppressWarnings("serial")
public class FTextField extends SkinnedTextField implements ITextField {
+
- /**
+ /**
* Uses the Builder pattern to facilitate/encourage inline styling.
* Credit to Effective Java 2 (Joshua Bloch).
* Methods in builder can be chained. To declare:
* <code>new FTextField.Builder().method1(foo).method2(bar).method3(baz)...</code>
* <br>and then call build() to make the widget (don't forget that part).
- */
+ */
public static class Builder {
//========== Default values for FTextField are set here.
private int maxLength = 0; // <=0 indicates no maximum
@@ -39,14 +44,14 @@
public FTextField build() { return new FTextField(this); }
- public Builder maxLength(int i0) { maxLength = i0; return this; }
- public Builder readonly(boolean b0) { readonly = b0; return this; }
+ public Builder maxLength(final int i0) { maxLength = i0; return this; }
+ public Builder readonly(final boolean b0) { readonly = b0; return this; }
public Builder readonly() { return readonly(true); }
- public Builder text(String s0) { text = s0; return this; }
- public Builder tooltip(String s0) { toolTip = s0; return this; }
- public Builder ghostText(String s0) { ghostText = s0; return this; }
- public Builder showGhostTextWithFocus(boolean b0) { showGhostTextWithFocus = b0; return this; }
+ public Builder text(final String s0) { text = s0; return this; }
+ public Builder tooltip(final String s0) { toolTip = s0; return this; }
+ public Builder ghostText(final String s0) { ghostText = s0; return this; }
+ public Builder showGhostTextWithFocus(final boolean b0) { showGhostTextWithFocus = b0; return this; }
public Builder showGhostTextWithFocus() { return showGhostTextWithFocus(true); }
}
@@ -58,7 +63,7 @@
private String ghostText;
private boolean showGhostTextWithFocus;
- private FTextField(Builder builder) {
+ private FTextField(final Builder builder) {
this.setForeground(textColor);
this.setBackground(backColor);
this.setCaretColor(textColor);
@@ -98,7 +103,7 @@
@Override
public void focusLost(final FocusEvent e) {
- FTextField field = (FTextField)e.getSource();
+ final FTextField field = (FTextField)e.getSource();
if (field.ghostText != null && field.isEmpty() && !field.showGhostTextWithFocus) {
field.repaint();
}
@@ -110,17 +115,17 @@
}
public boolean isEmpty() {
- String text = this.getText();
+ final String text = this.getText();
return (text == null || text.isEmpty());
}
-
+
public int getAutoSizeWidth() {
- FontMetrics metrics = this.getFontMetrics(this.getFont());
+ final FontMetrics metrics = this.getFontMetrics(this.getFont());
return metrics.stringWidth(this.getText()) + 12;
}
@Override
- public void paint(Graphics g) {
+ public void paint(final Graphics g) {
super.paint(g);
if (this.ghostText != null && this.isEmpty() && (this.showGhostTextWithFocus || !this.hasFocus())) {
//TODO: Make ghost text look more like regular text
@@ -151,7 +156,7 @@
return this.showGhostTextWithFocus;
}
- public void setShowGhostTextWithFocus(boolean showGhostTextWithFocus0) {
+ public void setShowGhostTextWithFocus(final boolean showGhostTextWithFocus0) {
if (this.showGhostTextWithFocus == showGhostTextWithFocus0) { return; }
this.showGhostTextWithFocus = showGhostTextWithFocus0;
if (this.isEmpty() && this.hasFocus()) {
@@ -162,16 +167,16 @@
private static class _LengthLimitedDocument extends PlainDocument {
private final int _limit;
- _LengthLimitedDocument(int limit) { _limit = limit; }
+ _LengthLimitedDocument(final int limit) { _limit = limit; }
// called each time a character is typed or a string is pasted
@Override
- public void insertString(int offset, String s, AttributeSet attributeSet)
+ public void insertString(final int offset, String s, final AttributeSet attributeSet)
throws BadLocationException {
if (_limit <= this.getLength()) {
return;
}
- int newLen = this.getLength() + s.length();
+ final int newLen = this.getLength() + s.length();
if (_limit < newLen) {
s = s.substring(0, _limit - this.getLength());
}
@@ -179,23 +184,23 @@
}
}
- public void addChangeListener(ChangeListener listener) {
+ public void addChangeListener(final ChangeListener listener) {
this.getDocument().addDocumentListener(listener);
}
public static abstract class ChangeListener implements DocumentListener {
@Override
- public void changedUpdate(DocumentEvent e) {
+ public void changedUpdate(final DocumentEvent e) {
textChanged();
}
@Override
- public void removeUpdate(DocumentEvent e) {
+ public void removeUpdate(final DocumentEvent e) {
textChanged();
}
@Override
- public void insertUpdate(DocumentEvent e) {
+ public void insertUpdate(final DocumentEvent e) {
textChanged();
}
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CCurrentDeck.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CCurrentDeck.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CCurrentDeck.java (revision 29317)
@@ -1,7 +1,16 @@
package forge.screens.deckeditor.controllers;
-import forge.UiCommand;
+import java.awt.Dialog.ModalityType;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.io.File;
+
+import javax.swing.JFileChooser;
+import javax.swing.SwingUtilities;
+import javax.swing.filechooser.FileFilter;
+
import forge.Singletons;
+import forge.UiCommand;
import forge.deck.Deck;
import forge.deck.DeckBase;
import forge.deck.io.DeckSerializer;
@@ -14,45 +23,33 @@
import forge.screens.deckeditor.SEditorIO;
import forge.screens.deckeditor.views.VCurrentDeck;
-import javax.swing.*;
-import javax.swing.filechooser.FileFilter;
-
-import java.awt.Dialog.ModalityType;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.io.File;
-
-/**
+/**
* Controls the "current deck" panel in the deck editor UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
public enum CCurrentDeck implements ICDoc {
- /** */
SINGLETON_INSTANCE;
private static File previousDirectory;
- private JFileChooser fileChooser = new JFileChooser(ForgeConstants.DECK_BASE_DIR);
+ private final JFileChooser fileChooser = new JFileChooser(ForgeConstants.DECK_BASE_DIR);
//========== Overridden methods
private CCurrentDeck() {
- FileFilter[] defaultFilters = fileChooser.getChoosableFileFilters();
- for(FileFilter defFilter : defaultFilters)
- {
+ final FileFilter[] defaultFilters = fileChooser.getChoosableFileFilters();
+ for (final FileFilter defFilter : defaultFilters) {
fileChooser.removeChoosableFileFilter(defFilter);
}
- FileFilter DCK_FILTER = new FileFilter() {
- @Override
- public boolean accept(final File f) {
+ final FileFilter DCK_FILTER = new FileFilter() {
+ @Override public final boolean accept(final File f) {
return f.getName().endsWith(DeckStorage.FILE_EXTENSION) || f.isDirectory();
}
- @Override
- public String getDescription() {
+ @Override public final String getDescription() {
return "Simple Deck File .dck";
}
};
@@ -60,15 +57,7 @@
fileChooser.addChoosableFileFilter(DCK_FILTER);
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
@Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
-
- @Override
public void register() {
}
@@ -117,7 +106,7 @@
});
VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().addKeyListener(new KeyAdapter() {
@Override
- public void keyPressed(KeyEvent e) {
+ public void keyPressed(final KeyEvent e) {
if (Character.isLetterOrDigit(e.getKeyChar())) {
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController().notifyModelChanged();
}
@@ -204,7 +193,7 @@
/** */
@SuppressWarnings("unchecked")
private void exportDeck() {
- DeckController<Deck> controller = (DeckController<Deck>)
+ final DeckController<Deck> controller = (DeckController<Deck>)
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController();
final File filename = this.getExportFilename();
@@ -215,7 +204,7 @@
//create copy of deck to save under new name
String name = filename.getName();
name = name.substring(0, name.lastIndexOf(".")); //remove extension
- Deck deck = (Deck)controller.getModel().copyTo(name);
+ final Deck deck = (Deck)controller.getModel().copyTo(name);
try {
DeckSerializer.writeDeck(deck, filename);
Index: forge-gui/src/main/java/forge/control/FControlGamePlayback.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/control/FControlGamePlayback.java (revision 29316)
+++ forge-gui/src/main/java/forge/control/FControlGamePlayback.java (revision 29317)
@@ -53,7 +53,9 @@
}
@Subscribe
- public void receiveGameEvent(final GameEvent ev) { ev.visit(this); }
+ public void receiveGameEvent(final GameEvent ev) {
+ ev.visit(this);
+ }
public static final int phasesDelay = 200;
public static final int combatDelay = 400;
@@ -83,9 +85,9 @@
@Override
public Void visit(final GameEventTurnPhase ev) {
try {
- final boolean isUiToStop = !humanController.getGui().isUiSetToSkipPhase(ev.playerTurn.getView(), ev.phase);
+ final boolean isUiToStop = !humanController.getGui().isUiSetToSkipPhase(ev.playerTurn.getView(), ev.phase);
- switch(ev.phase) {
+ switch(ev.phase) {
case COMBAT_END:
case COMBAT_DECLARE_ATTACKERS:
case COMBAT_DECLARE_BLOCKERS:
@@ -98,8 +100,8 @@
pauseForEvent(phasesDelay);
}
break;
- }
+ }
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/screens/workshop/views/VWorkshopCatalog.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/workshop/views/VWorkshopCatalog.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/workshop/views/VWorkshopCatalog.java (revision 29317)
@@ -21,18 +21,15 @@
import forge.screens.workshop.controllers.CWorkshopCatalog;
import forge.util.ItemPool;
-/**
+/**
* Assembles Swing components of card catalog in workshop.
*
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
- *
+ *
*/
public enum VWorkshopCatalog implements IVDoc<CWorkshopCatalog> {
- /** */
SINGLETON_INSTANCE;
- public static final int SEARCH_MODE_INVERSE_INDEX = 1;
-
// Fields used with interface IVDoc
private DragCell parentCell;
private final DragTab tab = new DragTab("Card Catalog");
@@ -41,7 +38,6 @@
private final CDetailPicture cDetailPicture = new CDetailPicture();
//========== Constructor
- /** */
private VWorkshopCatalog() {
this.cardManager = new CardManager(cDetailPicture, true);
this.cardManager.setCaption("Catalog");
@@ -77,7 +73,7 @@
}
@Override
- public void setParentCell(DragCell cell0) {
+ public void setParentCell(final DragCell cell0) {
this.parentCell = cell0;
}
Index: forge-gui/src/main/java/forge/itemmanager/SItemManagerUtil.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/itemmanager/SItemManagerUtil.java (revision 29316)
+++ forge-gui/src/main/java/forge/itemmanager/SItemManagerUtil.java (revision 29317)
@@ -1,5 +1,13 @@
package forge.itemmanager;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map.Entry;
+
+import com.google.common.base.Predicate;
+
import forge.assets.FSkinProp;
import forge.card.CardRules;
import forge.card.CardRulesPredicates;
@@ -8,15 +16,7 @@
import forge.item.InventoryItem;
import forge.util.ComparableOp;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Map.Entry;
-
-import com.google.common.base.Predicate;
-
-
-/**
+/**
* Static methods for working with top-level editor methods,
* included but not limited to preferences IO, icon generation,
* and stats analysis.
@@ -65,25 +65,25 @@
public final Predicate<CardRules> predicate;
public final String label;
- private StatTypes(FSkinProp skinProp0, Predicate<CardRules> predicate0, String label0) {
+ private StatTypes(final FSkinProp skinProp0, final Predicate<CardRules> predicate0, final String label0) {
skinProp = skinProp0;
predicate = predicate0;
label = label0;
}
}
- public static String getItemDisplayString(InventoryItem item, int qty, boolean forTitle) {
- ArrayList<InventoryItem> items = new ArrayList<InventoryItem>();
+ public static String getItemDisplayString(final InventoryItem item, final int qty, final boolean forTitle) {
+ final List<InventoryItem> items = new ArrayList<InventoryItem>();
items.add(item);
return getItemDisplayString(items, qty, forTitle);
}
- public static String getItemDisplayString(Iterable<? extends InventoryItem> items, int qty, boolean forTitle) {
+ public static String getItemDisplayString(final Iterable<? extends InventoryItem> items, final int qty, final boolean forTitle) {
//determine shared type among items
int itemCount = 0;
String sharedType = null;
boolean checkForSharedType = true;
- for (InventoryItem item : items) {
+ for (final InventoryItem item : items) {
if (checkForSharedType) {
if (sharedType == null) {
sharedType = item.getItemType();
@@ -122,9 +122,9 @@
return result;
}
- public static String buildDisplayList(Iterable<Entry<InventoryItem, Integer>> items) {
- ArrayList<Entry<InventoryItem, Integer>> sorted = new ArrayList<Entry<InventoryItem, Integer>>();
- for (Entry<InventoryItem, Integer> itemEntry : items) {
+ public static String buildDisplayList(final Iterable<Entry<InventoryItem, Integer>> items) {
+ final List<Entry<InventoryItem, Integer>> sorted = new ArrayList<Entry<InventoryItem, Integer>>();
+ for (final Entry<InventoryItem, Integer> itemEntry : items) {
sorted.add(itemEntry);
}
Collections.sort(sorted, new Comparator<Entry<InventoryItem, Integer>>() {
@@ -133,8 +133,8 @@
return x.getKey().toString().compareTo(y.getKey().toString());
}
});
- StringBuilder builder = new StringBuilder();
- for (Entry<InventoryItem, Integer> itemEntry : sorted) {
+ final StringBuilder builder = new StringBuilder();
+ for (final Entry<InventoryItem, Integer> itemEntry : sorted) {
builder.append("\n" + itemEntry.getValue() + " * " + itemEntry.getKey().toString());
}
return builder.toString();
@@ -145,16 +145,16 @@
private static final ColumnDef[] CARD_PILEBY_OPTIONS = { ColumnDef.CMC, ColumnDef.COLOR, ColumnDef.NAME, ColumnDef.COST, ColumnDef.TYPE, ColumnDef.RARITY, ColumnDef.SET };
private static final ColumnDef[] DECK_PILEBY_OPTIONS = { ColumnDef.DECK_COLOR, ColumnDef.DECK_FOLDER, ColumnDef.NAME, ColumnDef.DECK_FORMAT, ColumnDef.DECK_EDITION };
- public static void populateImageViewOptions(IItemManager<?> itemManager, IComboBox<Object> cbGroupByOptions, IComboBox<Object> cbPileByOptions) {
- boolean isDeckManager = itemManager.getGenericType().equals(DeckProxy.class);
- GroupDef[] groupByOptions = isDeckManager ? DECK_GROUPBY_OPTIONS : CARD_GROUPBY_OPTIONS;
- ColumnDef[] pileByOptions = isDeckManager ? DECK_PILEBY_OPTIONS : CARD_PILEBY_OPTIONS;
+ public static void populateImageViewOptions(final IItemManager<?> itemManager, final IComboBox<Object> cbGroupByOptions, final IComboBox<Object> cbPileByOptions) {
+ final boolean isDeckManager = itemManager.getGenericType().equals(DeckProxy.class);
+ final GroupDef[] groupByOptions = isDeckManager ? DECK_GROUPBY_OPTIONS : CARD_GROUPBY_OPTIONS;
+ final ColumnDef[] pileByOptions = isDeckManager ? DECK_PILEBY_OPTIONS : CARD_PILEBY_OPTIONS;
cbGroupByOptions.addItem("(none)");
cbPileByOptions.addItem("(none)");
- for (GroupDef option : groupByOptions) {
+ for (final GroupDef option : groupByOptions) {
cbGroupByOptions.addItem(option);
}
- for (ColumnDef option : pileByOptions) {
+ for (final ColumnDef option : pileByOptions) {
cbPileByOptions.addItem(option);
}
cbGroupByOptions.setSelectedIndex(0);
Index: forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/ContestGauntletLister.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/ContestGauntletLister.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/ContestGauntletLister.java (revision 29317)
@@ -1,25 +1,25 @@
package forge.screens.home.gauntlet;
+import java.awt.Color;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+
+import net.miginfocom.swing.MigLayout;
import forge.UiCommand;
import forge.gauntlet.GauntletData;
import forge.gauntlet.GauntletIO;
import forge.toolbox.FLabel;
import forge.toolbox.FSkin;
import forge.toolbox.FSkin.SkinnedPanel;
-import net.miginfocom.swing.MigLayout;
-import javax.swing.*;
-
-import java.awt.*;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-/**
+/**
* Creates file list/table for quick deleting, editing, and basic info.
*
*/
@@ -31,7 +31,6 @@
private final Color clrDefault;
private final FSkin.SkinColor clrHover, clrActive, clrBorders;
- /** */
public ContestGauntletLister() {
super();
this.clrDefault = new Color(0, 0, 0, 0);
@@ -43,12 +42,11 @@
this.setLayout(new MigLayout("insets 0, gap 0, wrap"));
}
- /** @param gd0 &emsp; {@link forge.gauntlet.GauntletData}[] */
- public void setGauntlets(List<GauntletData> gd0) {
+ public void setGauntlets(final List<GauntletData> gd0) {
this.removeAll();
- List<RowPanel> tempRows = new ArrayList<RowPanel>();
- List<GauntletData> sorted = new ArrayList<GauntletData>();
- for (GauntletData gd : gd0) { sorted.add(gd); }
+ final List<RowPanel> tempRows = new ArrayList<RowPanel>();
+ final List<GauntletData> sorted = new ArrayList<GauntletData>();
+ for (final GauntletData gd : gd0) { sorted.add(gd); }
Collections.sort(sorted, new Comparator<GauntletData>() {
@Override
public int compare(final GauntletData x, final GauntletData y) {
@@ -77,7 +75,7 @@
RowPanel row;
String name;
String progress;
- for (GauntletData gd : sorted) {
+ for (final GauntletData gd : sorted) {
name = gd.getName();
name = name.substring(GauntletIO.PREFIX_LOCKED.length());
@@ -109,7 +107,6 @@
revalidate();
}
- /** @return {@link forge.deck.Deck} */
public GauntletData getSelectedGauntlet() {
if (previousSelect == null) {
return null;
@@ -121,9 +118,9 @@
private class RowPanel extends SkinnedPanel {
private boolean selected = false;
- private GauntletData gauntletData;
+ private final GauntletData gauntletData;
- public RowPanel(GauntletData gd0) {
+ public RowPanel(final GauntletData gd0) {
super();
setOpaque(false);
setBackground(new Color(0, 0, 0, 0));
@@ -133,27 +130,27 @@
this.addMouseListener(new MouseAdapter() {
@Override
- public void mouseEntered(MouseEvent e) {
+ public void mouseEntered(final MouseEvent e) {
if (!selected) {
RowPanel.this.setBackground(clrHover);
RowPanel.this.setOpaque(true);
}
}
@Override
- public void mouseExited(MouseEvent e) {
+ public void mouseExited(final MouseEvent e) {
if (!selected) {
RowPanel.this.setBackground(clrDefault);
RowPanel.this.setOpaque(false);
}
}
@Override
- public void mousePressed(MouseEvent e) {
+ public void mousePressed(final MouseEvent e) {
selectHandler(RowPanel.this);
}
});
}
- public void setSelected(boolean b0) {
+ public void setSelected(final boolean b0) {
selected = b0;
setOpaque(b0);
this.setBackground(b0 ? clrActive : clrHover);
@@ -168,7 +165,6 @@
}
}
- /** @return {@link java.lang.Integer} */
public int getSelectedIndex() {
for (int i = 0; i < rows.length; i++) {
if (rows[i].isSelected()) { return i; }
@@ -180,32 +176,18 @@
* @param i0 &emsp; int
* @return boolean success
*/
- public boolean setSelectedIndex(int i0) {
+ public boolean setSelectedIndex(final int i0) {
if (i0 >= rows.length) { return false; }
selectHandler(rows[i0]);
return true;
}
- /**
- * @param qd0 &emsp; Gauntlet data object to select (if exists in list)
- * @return boolean success
- */
- public boolean setSelectedGauntletData(GauntletData qd0) {
- /*for (RowPanel r : rows) {
- if (r.getQuestData().getName().equals(qd0.getName())) {
- selectHandler(r);
- return true;
- }
- }*/
- return false;
- }
-
/** @param c0 &emsp; {@link forge.UiCommand} command executed on row select. */
- public void setSelectCommand(UiCommand c0) {
+ public void setSelectCommand(final UiCommand c0) {
this.cmdRowSelect = c0;
}
- private void selectHandler(RowPanel r0) {
+ private void selectHandler(final RowPanel r0) {
if (previousSelect != null) {
previousSelect.setSelected(false);
}
Index: forge-gui/src/main/java/forge/match/input/InputSelectCardsForConvoke.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/input/InputSelectCardsForConvoke.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/input/InputSelectCardsForConvoke.java (revision 29317)
@@ -26,14 +26,15 @@
private final ManaCostBeingPaid remainingCost;
private final Player player;
private final CardCollectionView availableCreatures;
-
- public InputSelectCardsForConvoke(final PlayerControllerHuman controller, final Player p, final ManaCost cost, final CardCollectionView untapped) {
+
+ public InputSelectCardsForConvoke(final PlayerControllerHuman controller, final Player p, final ManaCost cost, final CardCollectionView untapped) {
super(controller, 0, Math.min(cost.getCMC(), untapped.size()));
remainingCost = new ManaCostBeingPaid(cost);
player = p;
availableCreatures = untapped;
}
+ @Override
protected String getMessage() {
return "Choose creatures to tap for convoke.\nRemaining mana cost is " + remainingCost.toString();
}
@@ -45,15 +46,15 @@
return false;
}
- boolean entityWasSelected = chosenCards.containsKey(card);
+ final boolean entityWasSelected = chosenCards.containsKey(card);
if (entityWasSelected) {
- ImmutablePair<Byte, ManaCostShard> color = this.chosenCards.remove(card);
+ final ImmutablePair<Byte, ManaCostShard> color = this.chosenCards.remove(card);
remainingCost.increaseShard(color.right, 1);
onSelectStateChanged(card, false);
}
else {
byte chosenColor;
- ColorSet colors = CardUtil.getColors(card);
+ final ColorSet colors = CardUtil.getColors(card);
if (colors.isMonoColor()) {
// Since the convoke mana logic can use colored mana as colorless if needed,
// there is no need to prompt the user when convoking with a mono-color creature.
@@ -61,7 +62,7 @@
} else {
chosenColor = player.getController().chooseColorAllowColorless("Convoke " + card.toString() + " for which color?", card, colors);
}
- ManaCostShard shard = remainingCost.payManaViaConvoke(chosenColor);
+ final ManaCostShard shard = remainingCost.payManaViaConvoke(chosenColor);
if (shard != null) {
chosenCards.put(card, ImmutablePair.of(chosenColor, shard));
onSelectStateChanged(card, true);
@@ -77,7 +78,7 @@
}
@Override
- public String getActivateAction(Card card) {
+ public String getActivateAction(final Card card) {
if (availableCreatures.contains(card)) {
return "tap creature for Convoke";
}
@@ -85,14 +86,16 @@
}
@Override
- protected final void onPlayerSelected(Player player, final ITriggerEvent triggerEvent) {
+ protected final void onPlayerSelected(final Player player, final ITriggerEvent triggerEvent) {
}
public Map<Card, ManaCostShard> getConvokeMap() {
- Map<Card, ManaCostShard> result = new HashMap<Card, ManaCostShard>();
- if( !hasCancelled() )
- for(Entry<Card, ImmutablePair<Byte, ManaCostShard>> c : chosenCards.entrySet())
+ final Map<Card, ManaCostShard> result = new HashMap<Card, ManaCostShard>();
+ if(!hasCancelled()) {
+ for(final Entry<Card, ImmutablePair<Byte, ManaCostShard>> c : chosenCards.entrySet()) {
result.put(c.getKey(), c.getValue().right);
+ }
+ }
return result;
}
\ No newline at end of file
Index: forge-gui/src/main/java/forge/match/input/InputBase.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/input/InputBase.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/input/InputBase.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -32,7 +32,7 @@
* <p>
* Abstract Input class.
* </p>
- *
+ *
* @author Forge
* @version $Id: InputBase.java 24769 2014-02-09 13:56:04Z Hellfish $
*/
@@ -47,6 +47,7 @@
public final PlayerControllerHuman getController() {
return controller;
}
+ @Override
public PlayerView getOwner() {
final Player owner = getController().getPlayer();
return owner == null ? null : owner.getView();
Index: forge-gui/src/main/java/forge/quest/QuestUtil.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/quest/QuestUtil.java (revision 29316)
+++ forge-gui/src/main/java/forge/quest/QuestUtil.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -34,7 +34,6 @@
import forge.deck.Deck;
import forge.game.GameRules;
import forge.game.GameType;
-import forge.game.card.Card;
import forge.game.player.RegisteredPlayer;
import forge.interfaces.IButton;
import forge.interfaces.IGuiGame;
@@ -58,28 +57,18 @@
* QuestUtil class.
* </p>
* MODEL - Static utility methods to help with minor tasks around Quest.
- *
+ *
* @author Forge
- * @version $Id: QuestUtil.java 29270 2015-04-22 17:55:58Z elcnesh $
+ * @version $Id: QuestUtil.java 29317 2015-05-01 19:27:48Z elcnesh $
*/
public class QuestUtil {
- /**
- * <p>
- * getComputerStartingCards.
- * </p>
- *
- * @return a {@link java.util.List} object.
- */
- public static List<Card> getComputerStartingCards() {
- return new ArrayList<>();
- }
/**
* <p>
* getComputerStartingCards.
* </p>
* Returns new card instances of extra AI cards in play at start of event.
- *
+ *
* @param qe
* a {@link forge.quest.QuestEvent} object.
* @return a {@link java.util.List} object.
@@ -107,10 +96,10 @@
final List<IPaperCard> list = new ArrayList<>();
for (int iSlot = 0; iSlot < QuestController.MAX_PET_SLOTS; iSlot++) {
- String petName = qc.getSelectedPet(iSlot);
- QuestPetController pet = qc.getPetsStorage().getPet(petName);
+ final String petName = qc.getSelectedPet(iSlot);
+ final QuestPetController pet = qc.getPetsStorage().getPet(petName);
if (pet != null) {
- IPaperCard c = pet.getPetCard(qc.getAssets());
+ final IPaperCard c = pet.getPetCard(qc.getAssets());
if (c != null) {
list.add(c);
}
@@ -126,7 +115,7 @@
* </p>
* Returns new card instances of extra human cards, including current
* plant/pet configuration, and cards in play at start of quest.
- *
+ *
* @param qc
* a {@link forge.quest.QuestController} object.
* @param qe
@@ -146,7 +135,7 @@
* createToken.
* </p>
* Creates a card instance for token defined by property string.
- *
+ *
* @param s
* Properties string of token
* (TOKEN;W;1;1;sheep;type;type;type...)
@@ -155,13 +144,13 @@
public static PaperToken createToken(final String s) {
final String[] properties = s.split(";", 6);
- List<String> script = new ArrayList<>();
+ final List<String> script = new ArrayList<>();
script.add("Name:" + properties[4]);
script.add("Colors:" + properties[1]);
script.add("PT:"+ properties[2] + "/" + properties[3]);
script.add("Types:" + properties[5].replace(';', ' '));
script.add("Oracle:"); // tokens don't have texts yet
- String fileName = PaperToken.makeTokenFileName(properties[1], properties[2], properties[3], properties[4]);
+ final String fileName = PaperToken.makeTokenFileName(properties[1], properties[2], properties[3], properties[4]);
return new PaperToken(CardRules.fromScript(script), CardEdition.UNKNOWN, fileName);
}
@@ -170,7 +159,7 @@
* readExtraCard.
* </p>
* Creates single card for a string read from unique event properties.
- *
+ *
* @param name
* the name
* @return the card
@@ -185,15 +174,15 @@
// Standard card creation
return FModel.getMagicDb().getCommonCards().getCardFromEdition(name, SetPreference.Latest);
}
-
+
public static void travelWorld() {
if (!checkActiveQuest("Travel between worlds.")) {
return;
}
- List<QuestWorld> worlds = new ArrayList<>();
+ final List<QuestWorld> worlds = new ArrayList<>();
final QuestController qCtrl = FModel.getQuest();
- for (QuestWorld qw : FModel.getWorlds()) {
+ for (final QuestWorld qw : FModel.getWorlds()) {
if (qCtrl.getWorld() != qw) {
worlds.add(qw);
}
@@ -246,15 +235,15 @@
qCtrl.save();
}
}
-
+
private static QuestEvent event;
- private static QuestEventDraft draftEvent;
+ private static QuestEventDraft draftEvent;
/**
* <p>
* nextChallengeInWins.
* </p>
- *
+ *
* @return a int.
*/
public static int nextChallengeInWins() {
@@ -312,7 +301,7 @@
view.getCbxPet().addItem("Don't summon a pet");
for (final QuestPetController pet : petList) {
- String name = "Summon " + pet.getName();
+ final String name = "Summon " + pet.getName();
view.getCbxPet().addItem(name);
if (pet.getName().equals(currentPetName)) {
view.getCbxPet().setSelectedItem(name);
@@ -323,7 +312,7 @@
}
}
}
-
+
if (qCtrl.getAssets().hasItem(QuestItemType.CHARM)) {
view.getCbCharm().setVisible(true);
}
@@ -354,7 +343,7 @@
* - Pets<br>
* - Current deck info<br>
* - "Challenge In" info<br>
- *
+ *
* @param view0 {@link forge.quest.IVQuestStats}
*/
public static void updateQuestView(final IVQuestStats view0) {
@@ -462,16 +451,16 @@
}
public static boolean checkActiveQuest(final String location) {
- QuestController qc = FModel.getQuest();
+ final QuestController qc = FModel.getQuest();
if (qc == null || qc.getAssets() == null) {
- String msg = "Please create a Quest before attempting to " + location;
+ final String msg = "Please create a Quest before attempting to " + location;
SOptionPane.showErrorDialog(msg, "No Quest");
System.out.println(msg);
return false;
}
return true;
}
-
+
/** */
public static void showSpellShop() {
if (!checkActiveQuest("Visit the Spell Shop.")) {
@@ -494,12 +483,12 @@
return;
}
final QuestController qData = FModel.getQuest();
- ImmutablePair<CardEdition, Integer> toUnlock = QuestUtilUnlockSets.chooseSetToUnlock(qData, false, null);
+ final ImmutablePair<CardEdition, Integer> toUnlock = QuestUtilUnlockSets.chooseSetToUnlock(qData, false, null);
if (toUnlock == null) {
return;
}
- CardEdition unlocked = toUnlock.left;
+ final CardEdition unlocked = toUnlock.left;
qData.getAssets().subtractCredits(toUnlock.right);
SOptionPane.showMessageDialog("You have successfully unlocked " + unlocked.getName() + "!",
unlocked.getName() + " unlocked!", null);
@@ -531,7 +520,7 @@
Boolean forceAnte = null;
int lifeAI = 20;
if (event instanceof QuestEventChallenge) {
- QuestEventChallenge qc = ((QuestEventChallenge) event);
+ final QuestEventChallenge qc = ((QuestEventChallenge) event);
lifeAI = qc.getAILife();
lifeHuman = qc.getHumanLife();
@@ -545,7 +534,7 @@
final RegisteredPlayer humanStart = new RegisteredPlayer(getDeckForNewGame());
final RegisteredPlayer aiStart = new RegisteredPlayer(event.getEventDeck());
-
+
if (lifeHuman != null) {
humanStart.setStartingLife(lifeHuman);
} else {
@@ -554,7 +543,7 @@
if (useBazaar) {
humanStart.setCardsOnBattlefield(QuestUtil.getHumanStartingCards(qData, event));
- aiStart.setStartingLife(lifeAI);
+ aiStart.setStartingLife(lifeAI);
aiStart.setCardsOnBattlefield(QuestUtil.getComputerStartingCards(event));
}
@@ -612,16 +601,16 @@
return false;
}
- Deck deck = getDeckForNewGame();
+ final Deck deck = getDeckForNewGame();
if (deck == null) {
- String msg = "Please select a Quest Deck.";
+ final String msg = "Please select a Quest Deck.";
SOptionPane.showErrorDialog(msg, "No Deck");
System.out.println(msg);
return false;
}
if (FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
- String errorMessage = GameType.Quest.getDeckFormat().getDeckConformanceProblem(deck);
+ final String errorMessage = GameType.Quest.getDeckFormat().getDeckConformanceProblem(deck);
if (null != errorMessage) {
SOptionPane.showErrorDialog("Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid Deck");
return false;
@@ -642,7 +631,7 @@
final StringBuilder out = new StringBuilder();
final char[] c = in.toCharArray();
- for (char aC : c) {
+ for (final char aC : c) {
if (Character.isLetterOrDigit(aC) || (aC == '-') || (aC == '_') || (aC == ' ')) {
out.append(aC);
}
@@ -651,7 +640,7 @@
return out.toString();
}
- public static void buyQuestItem(IQuestBazaarItem item) {
+ public static void buyQuestItem(final IQuestBazaarItem item) {
final QuestAssets qA = FModel.getQuest().getAssets();
final int cost = item.getBuyingPrice(qA);
if (cost >= 0 && (qA.getCredits() - cost) >= 0) {
Index: forge-gui-desktop/src/main/java/forge/screens/home/quest/VSubmenuDuels.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/quest/VSubmenuDuels.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/quest/VSubmenuDuels.java (revision 29317)
@@ -1,26 +1,37 @@
package forge.screens.home.quest;
+import java.awt.Font;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.ScrollPaneConstants;
+import javax.swing.SwingConstants;
+
+import net.miginfocom.swing.MigLayout;
import forge.assets.FSkinProp;
import forge.gui.framework.DragCell;
import forge.gui.framework.DragTab;
import forge.gui.framework.EDocID;
import forge.interfaces.IButton;
import forge.quest.IVQuestStats;
-import forge.screens.home.*;
-import forge.toolbox.*;
-import net.miginfocom.swing.MigLayout;
+import forge.screens.home.EMenuGroup;
+import forge.screens.home.IVSubmenu;
+import forge.screens.home.LblHeader;
+import forge.screens.home.StartButton;
+import forge.screens.home.VHomeUI;
+import forge.toolbox.FCheckBox;
+import forge.toolbox.FComboBoxWrapper;
+import forge.toolbox.FLabel;
+import forge.toolbox.FScrollPanel;
+import forge.toolbox.FSkin;
-import javax.swing.*;
-
-import java.awt.*;
-
/**
* Assembles Swing components of quest duels submenu singleton.
*
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
*/
public enum VSubmenuDuels implements IVSubmenu<CSubmenuDuels>, IVQuestStats {
- /** */
SINGLETON_INSTANCE;
// Fields used with interface IVDoc
@@ -60,8 +71,8 @@
private final LblHeader lblTitle = new LblHeader("Quest Mode: Duels");
private final FLabel lblInfo = new FLabel.Builder().text("Select your next duel.")
- .fontStyle(Font.BOLD).fontSize(16)
- .fontAlign(SwingConstants.LEFT).build();
+ .fontStyle(Font.BOLD).fontSize(16)
+ .fontAlign(SwingConstants.LEFT).build();
private final FLabel lblCurrentDeck = new FLabel.Builder()
.text("Current deck hasn't been set yet.")
@@ -81,7 +92,7 @@
* Constructor.
*/
private VSubmenuDuels() {
-
+
final String constraints = "h 30px!, gap 0 0 0 5px";
pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 0"));
pnlStats.add(btnUnlock, "w 150px!, h 30px!, gap 0 0 0 10px");
@@ -99,9 +110,9 @@
pnlStats.add(cbCharm, constraints);
cbxPet.addTo(pnlStats, constraints);
pnlStats.setOpaque(false);
-
+
btnRandomOpponent.setToolTipText("Starts a duel against a randomly selected opponent.");
-
+
}
/* (non-Javadoc)
@@ -274,7 +285,7 @@
* @see forge.gui.framework.IVDoc#setParentCell(forge.gui.framework.DragCell)
*/
@Override
- public void setParentCell(DragCell cell0) {
+ public void setParentCell(final DragCell cell0) {
this.parentCell = cell0;
}
@@ -286,12 +297,13 @@
return parentCell;
}
- /**
- * @return the cbCharm
- */
+ /**
+ * @return the cbCharm
+ */
+ @Override
- public FCheckBox getCbCharm() {
- return cbCharm;
- }
+ public FCheckBox getCbCharm() {
+ return cbCharm;
+ }
@Override
public boolean isChallengesView() {
Index: forge-gui/src/main/java/forge/quest/QuestWinLoseController.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/quest/QuestWinLoseController.java (revision 29316)
+++ forge-gui/src/main/java/forge/quest/QuestWinLoseController.java (revision 29317)
@@ -1,5 +1,12 @@
package forge.quest;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.apache.commons.lang3.StringUtils;
+
import forge.LobbyPlayer;
import forge.assets.FSkinProp;
import forge.card.CardEdition;
@@ -15,7 +22,11 @@
import forge.game.player.PlayerView;
import forge.interfaces.IButton;
import forge.interfaces.IWinLoseView;
-import forge.item.*;
+import forge.item.BoosterPack;
+import forge.item.InventoryItem;
+import forge.item.PaperCard;
+import forge.item.SealedProduct;
+import forge.item.TournamentPack;
import forge.model.FModel;
import forge.player.GamePlayerUtil;
import forge.properties.ForgePreferences.FPref;
@@ -26,13 +37,6 @@
import forge.util.MyRandom;
import forge.util.gui.SGuiChoose;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map.Entry;
-
public class QuestWinLoseController {
private final GameView lastGame;
private final IWinLoseView<? extends IButton> view;
@@ -89,7 +93,7 @@
public void run() {
if (isAnte) {
// Won/lost cards should already be calculated (even in a draw)
- GameOutcome.AnteResult anteResult = lastGame.getAnteResult(questPlayer);
+ final GameOutcome.AnteResult anteResult = lastGame.getAnteResult(questPlayer);
if (anteResult != null) {
if (anteResult.wonCards != null) {
qc.getCards().addAllCards(anteResult.wonCards);
@@ -104,7 +108,7 @@
if (matchIsNotOver) { return; } //skip remaining logic if match isn't over yet
// TODO: We don't have a enum for difficulty?
- int difficulty = qData.getAchievements().getDifficulty();
+ final int difficulty = qData.getAchievements().getDifficulty();
final int wins = qData.getAchievements().getWin();
// Win case
@@ -124,7 +128,7 @@
awardRandomRare("You've won a random rare for winning against a very hard deck.");
}
}
-
+
awardWinStreakBonus();
// Random rare given at 50% chance (65% with luck upgrade)
@@ -147,7 +151,7 @@
// Grant booster on a win, or on a loss in easy mode
if (wonMatch || difficulty == 0) {
final int outcome = wonMatch ? wins : qData.getAchievements().getLost();
- int winsPerBooster = FModel.getQuestPreferences().getPrefInt(DifficultyPrefs.WINS_BOOSTER, qData.getAchievements().getDifficulty());
+ final int winsPerBooster = FModel.getQuestPreferences().getPrefInt(DifficultyPrefs.WINS_BOOSTER, qData.getAchievements().getDifficulty());
if (winsPerBooster > 0 && (outcome + 1) % winsPerBooster == 0) {
awardBooster();
}
@@ -156,7 +160,7 @@
});
}
- private void anteReport(final List<PaperCard> cardsWon, List<PaperCard> cardsLost) {
+ private void anteReport(final List<PaperCard> cardsWon, final List<PaperCard> cardsLost) {
// Generate Swing components and attach.
if (cardsWon != null && !cardsWon.isEmpty()) {
view.showCards("Spoils! Cards won from ante", cardsWon);
@@ -196,14 +200,13 @@
qData.save();
FModel.getQuestPreferences().save();
}
-
+
-
/**
* <p>
* awardEventCredits.
* </p>
* Generates and displays standard rewards for gameplay and skill level.
- *
+ *
*/
private void awardEventCredits() {
// TODO use q.qdPrefs to write bonus credits in prefs file
@@ -220,17 +223,17 @@
final double multiplier = qEvent.getDifficulty().getMultiplier();
credBase = (int) (base * multiplier);
-
+
sb.append(StringUtils.capitalize(qEvent.getDifficulty().getTitle()));
sb.append(" opponent: ").append(credBase).append(" credits.\n");
final int creditsForPreviousWins = (int) ((Double.parseDouble(FModel.getQuestPreferences()
.getPref(QPref.REWARDS_WINS_MULTIPLIER)) * qData.getAchievements().getWin()));
credBase += creditsForPreviousWins;
-
+
sb.append("Bonus for previous wins: ").append(creditsForPreviousWins).append(
- creditsForPreviousWins != 1 ? " credits.\n" : " credit.\n");
-
+ creditsForPreviousWins != 1 ? " credits.\n" : " credit.\n");
+
// Gameplay bonuses (for each game win)
boolean hasNeverLost = true;
int lifeDifferenceCredits = 0;
@@ -245,7 +248,7 @@
// final PlayerStatistics aiRating = game.getStatistics(computer.getName());
PlayerStatistics humanRating = null;
- for (Entry<LobbyPlayer, PlayerStatistics> kvRating : game) {
+ for (final Entry<LobbyPlayer, PlayerStatistics> kvRating : game) {
if (kvRating.getKey().equals(localHuman)) {
humanRating = kvRating.getValue();
continue;
@@ -290,11 +293,11 @@
credGameplay += mulliganReward;
sb.append(String.format("Mulliganed to zero and still won! Bonus: %d credits.\n", mulliganReward));
}
-
+
// Early turn bonus
final int winTurn = game.getLastTurnNumber();
final int turnCredits = getCreditsRewardForWinByTurn(winTurn);
-
+
if (winTurn == 0) {
sb.append("Won on turn zero!");
}
@@ -310,18 +313,18 @@
else if (winTurn <= 15) {
sb.append("Won by turn 15!");
}
-
+
if (turnCredits > 0) {
credGameplay += turnCredits;
sb.append(String.format(" Bonus: %d credits.\n", turnCredits));
}
-
+
if (game.getLifeDelta() >= 50) {
lifeDifferenceCredits += Math.max(Math.min((game.getLifeDelta() - 46) / 4, 750), 0);
}
-
+
} // End for(game)
-
+
if (lifeDifferenceCredits > 0) {
sb.append(String.format("Life total difference: %d credits.\n", lifeDifferenceCredits));
}
@@ -384,7 +387,7 @@
* awardRandomRare.
* </p>
* Generates and displays a random rare win case.
- *
+ *
*/
private void awardRandomRare(final String message) {
final PaperCard c = qData.getCards().addRandomRare();
@@ -393,69 +396,69 @@
view.showCards(message, cardsWon);
}
-
+
/**
* <p>
* awardWinStreakBonus.
* </p>
* Generates and displays a reward for maintaining a win streak.
- *
+ *
*/
private void awardWinStreakBonus() {
- int currentStreak = (qData.getAchievements().getWinStreakCurrent() + 1) % 50;
+ final int currentStreak = (qData.getAchievements().getWinStreakCurrent() + 1) % 50;
final List<PaperCard> cardsWon = new ArrayList<>();
List<PaperCard> cardsToAdd;
String typeWon = "";
boolean addDraftToken = false;
-
+
switch (currentStreak) {
- case 3:
- cardsWon.addAll(qData.getCards().addRandomCommon(1));
- typeWon = "common";
- break;
- case 5:
- cardsWon.addAll(qData.getCards().addRandomUncommon(1));
- typeWon = "uncommon";
- break;
- case 7:
- cardsWon.addAll(qData.getCards().addRandomRareNotMythic(1));
- typeWon = "rare";
- break;
- case 10:
- cardsToAdd = qData.getCards().addRandomMythicRare(1);
- if (cardsToAdd != null) {
- cardsWon.addAll(cardsToAdd);
- typeWon = "mythic rare";
- } else {
- cardsWon.addAll(qData.getCards().addRandomRareNotMythic(3));
- typeWon = "rare";
- }
- break;
- case 25:
- cardsToAdd = qData.getCards().addRandomMythicRare(5);
- if (cardsToAdd != null) {
- cardsWon.addAll(cardsToAdd);
- typeWon = "mythic rare";
- } else {
- cardsWon.addAll(qData.getCards().addRandomRareNotMythic(15));
- typeWon = "rare";
- }
- addDraftToken = true;
- break;
- case 0: //The 50th win in the streak is 0, since (50 % 50 == 0)
- cardsToAdd = qData.getCards().addRandomMythicRare(10);
- if (cardsToAdd != null) {
- cardsWon.addAll(cardsToAdd);
- typeWon = "mythic rare";
- } else {
- cardsWon.addAll(qData.getCards().addRandomRareNotMythic(30));
- typeWon = "rare";
- }
- addDraftToken = true;
- break;
- default:
- return;
+ case 3:
+ cardsWon.addAll(qData.getCards().addRandomCommon(1));
+ typeWon = "common";
+ break;
+ case 5:
+ cardsWon.addAll(qData.getCards().addRandomUncommon(1));
+ typeWon = "uncommon";
+ break;
+ case 7:
+ cardsWon.addAll(qData.getCards().addRandomRareNotMythic(1));
+ typeWon = "rare";
+ break;
+ case 10:
+ cardsToAdd = qData.getCards().addRandomMythicRare(1);
+ if (cardsToAdd != null) {
+ cardsWon.addAll(cardsToAdd);
+ typeWon = "mythic rare";
+ } else {
+ cardsWon.addAll(qData.getCards().addRandomRareNotMythic(3));
+ typeWon = "rare";
+ }
+ break;
+ case 25:
+ cardsToAdd = qData.getCards().addRandomMythicRare(5);
+ if (cardsToAdd != null) {
+ cardsWon.addAll(cardsToAdd);
+ typeWon = "mythic rare";
+ } else {
+ cardsWon.addAll(qData.getCards().addRandomRareNotMythic(15));
+ typeWon = "rare";
+ }
+ addDraftToken = true;
+ break;
+ case 0: //The 50th win in the streak is 0, since (50 % 50 == 0)
+ cardsToAdd = qData.getCards().addRandomMythicRare(10);
+ if (cardsToAdd != null) {
+ cardsWon.addAll(cardsToAdd);
+ typeWon = "mythic rare";
+ } else {
+ cardsWon.addAll(qData.getCards().addRandomRareNotMythic(30));
+ typeWon = "rare";
+ }
+ addDraftToken = true;
+ break;
+ default:
+ return;
}
if (addDraftToken) {
@@ -473,7 +476,7 @@
* awardJackpot.
* </p>
* Generates and displays jackpot win case.
- *
+ *
*/
private void awardJackpot() {
final List<PaperCard> cardsWon = qData.getCards().addRandomRare(10);
@@ -485,7 +488,7 @@
* awardBooster.
* </p>
* Generates and displays booster pack win case.
- *
+ *
*/
private void awardBooster() {
List<PaperCard> cardsWon = null;
@@ -493,10 +496,10 @@
String title;
if (qData.getFormat() == null) {
final List<GameFormat> formats = new ArrayList<GameFormat>();
- String preferredFormat = FModel.getQuestPreferences().getPref(QPref.BOOSTER_FORMAT);
+ final String preferredFormat = FModel.getQuestPreferences().getPref(QPref.BOOSTER_FORMAT);
GameFormat pref = null;
- for (GameFormat f : FModel.getFormats().getOrderedList()) {
+ for (final GameFormat f : FModel.getFormats().getOrderedList()) {
formats.add(f);
if (f.toString().equals(preferredFormat)) {
pref = f;
@@ -516,7 +519,7 @@
else {
final List<String> sets = new ArrayList<String>();
- for (SealedProduct.Template bd : FModel.getMagicDb().getBoosters()) {
+ for (final SealedProduct.Template bd : FModel.getMagicDb().getBoosters()) {
if (bd != null && qData.getFormat().isSetLegal(bd.getEdition())) {
sets.add(bd.getEdition());
}
@@ -532,11 +535,11 @@
maxChoices += qData.getAssets().getItemLevel(QuestItemType.MEMBERSHIP_TOKEN);
}
- List<CardEdition> options = new ArrayList<CardEdition>();
+ final List<CardEdition> options = new ArrayList<CardEdition>();
-
+
- while(!sets.isEmpty() && maxChoices > 0) {
+ while (!sets.isEmpty() && maxChoices > 0) {
- int ix = MyRandom.getRandom().nextInt(sets.size());
- String set = sets.get(ix);
+ final int ix = MyRandom.getRandom().nextInt(sets.size());
+ final String set = sets.get(ix);
sets.remove(ix);
options.add(FModel.getMagicDb().getEditions().get(set));
maxChoices--;
@@ -544,7 +547,7 @@
final CardEdition chooseEd = SGuiChoose.one("Choose bonus booster set", options);
- IUnOpenedProduct product = new UnOpenedProduct(FModel.getMagicDb().getBoosters().get(chooseEd.getCode()));
+ final IUnOpenedProduct product = new UnOpenedProduct(FModel.getMagicDb().getBoosters().get(chooseEd.getCode()));
cardsWon = product.get();
qData.getCards().addAllCards(cardsWon);
title = "Bonus " + chooseEd.getName() + " booster pack!";
@@ -561,7 +564,7 @@
* awardChallengeWin.
* </p>
* Generates and displays win case for challenge event.
- *
+ *
*/
private void awardChallengeWin() {
final long questRewardCredits = ((QuestEventChallenge) qEvent).getCreditsReward();
@@ -585,7 +588,7 @@
* @param message String, reward text to be displayed, if any
*/
private void awardSpecialReward(String message) {
- final List<InventoryItem> itemsWon = ((QuestEvent) qEvent).getCardRewardList();
+ final List<InventoryItem> itemsWon = qEvent.getCardRewardList();
if (itemsWon == null || itemsWon.isEmpty()) {
return;
@@ -593,12 +596,12 @@
final List<PaperCard> cardsWon = new ArrayList<PaperCard>();
- for (InventoryItem ii : itemsWon) {
+ for (final InventoryItem ii : itemsWon) {
if (ii instanceof PaperCard) {
cardsWon.add((PaperCard) ii);
}
else if (ii instanceof TournamentPack || ii instanceof BoosterPack) {
- List<PaperCard> boosterCards = new ArrayList<PaperCard>();
+ final List<PaperCard> boosterCards = new ArrayList<PaperCard>();
SealedProduct booster = null;
if (ii instanceof BoosterPack) {
booster = (BoosterPack) ((BoosterPack) ii).clone();
@@ -640,7 +643,7 @@
* getLuckyCoinResult.
* </p>
* A chance check, for rewards like random rares.
- *
+ *
* @return boolean
*/
private boolean getLuckyCoinResult() {
@@ -654,12 +657,12 @@
* getCreditsRewardForAltWin.
* </p>
* Retrieves credits for win under special conditions.
- *
+ *
* @param whyAiLost GameLossReason
* @return int
*/
- private int getCreditsRewardForAltWin(final GameLossReason whyAiLost) {
- QuestPreferences qp = FModel.getQuestPreferences();
+ private static int getCreditsRewardForAltWin(final GameLossReason whyAiLost) {
+ final QuestPreferences qp = FModel.getQuestPreferences();
if (null == whyAiLost) {
// Felidar, Helix Pinnacle, etc.
return qp.getPrefInt(QPref.REWARDS_ALTERNATIVE);
@@ -683,11 +686,11 @@
* getCreditsRewardForWinByTurn.
* </p>
* Retrieves credits for win on or under turn count.
- *
- * @param iTurn int - turn count
+ *
+ * @param iTurn int - turn count
* @return int credits won
*/
- private int getCreditsRewardForWinByTurn(final int iTurn) {
+ private static int getCreditsRewardForWinByTurn(final int iTurn) {
int credits;
if (iTurn <= 1) {
Index: forge-gui/src/main/java/forge/control/FControlGameEventHandler.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/control/FControlGameEventHandler.java (revision 29316)
+++ forge-gui/src/main/java/forge/control/FControlGameEventHandler.java (revision 29317)
@@ -159,23 +159,23 @@
return null;
}
- private Void processCard(Card card, Set<CardView> list) {
+ private Void processCard(final Card card, final Set<CardView> list) {
synchronized (list) {
list.add(card.getView());
}
return processEvent();
}
- private Void processCards(Collection<Card> cards, Set<CardView> list) {
+ private Void processCards(final Collection<Card> cards, final Set<CardView> list) {
if (cards.isEmpty()) { return null; }
synchronized (list) {
- for (Card c : cards) {
+ for (final Card c : cards) {
list.add(c.getView());
}
}
return processEvent();
}
- private Void processPlayer(Player player, Set<PlayerView> list) {
+ private Void processPlayer(final Player player, final Set<PlayerView> list) {
synchronized (list) {
list.add(player.getView());
}
@@ -186,7 +186,7 @@
return updateZone(z.getPlayer(), z.getZoneType());
}
- private Void updateZone(Player p, ZoneType z) {
+ private Void updateZone(final Player p, final ZoneType z) {
if (p == null || z == null) { return null; }
synchronized (zonesUpdate) {
@@ -202,7 +202,7 @@
}
@Override
- public Void visit(GameEventPlayerPriority event) {
+ public Void visit(final GameEventPlayerPriority event) {
needCombatUpdate = true;
return processEvent();
}
@@ -218,7 +218,7 @@
}
@Override
- public Void visit(GameEventAnteCardsSelected ev) {
+ public Void visit(final GameEventAnteCardsSelected ev) {
final List<CardView> options = Lists.newArrayList();
for (final Entry<Player, Card> kv : ev.cards.entries()) {
//use fake card so real cards appear with proper formatting
@@ -231,7 +231,7 @@
}
@Override
- public Void visit(GameEventPlayerControl ev) {
+ public Void visit(final GameEventPlayerControl ev) {
if (ev.player.getGame().isGameOver()) {
return null;
}
@@ -243,37 +243,37 @@
}
@Override
- public Void visit(GameEventGameOutcome ev) {
+ public Void visit(final GameEventGameOutcome ev) {
gameOver = true;
return processEvent();
}
@Override
- public Void visit(GameEventGameFinished ev) {
+ public Void visit(final GameEventGameFinished ev) {
gameFinished = true;
return processEvent();
}
@Override
- public Void visit(GameEventSpellAbilityCast event) {
+ public Void visit(final GameEventSpellAbilityCast event) {
needStackUpdate = true;
return processEvent();
}
@Override
- public Void visit(GameEventSpellResolved event) {
+ public Void visit(final GameEventSpellResolved event) {
needStackUpdate = true;
return processEvent();
}
@Override
- public Void visit(GameEventSpellRemovedFromStack event) {
+ public Void visit(final GameEventSpellRemovedFromStack event) {
needStackUpdate = true;
return processEvent();
}
@Override
- public Void visit(GameEventZone event) {
+ public Void visit(final GameEventZone event) {
if (event.player != null) {
// anything except stack will get here
updateZone(event.player, event.zoneType);
@@ -283,7 +283,7 @@
}
@Override
- public Void visit(GameEventCardAttachment event) {
+ public Void visit(final GameEventCardAttachment event) {
final Game game = event.equipment.getGame();
final PlayerZone zEq = (PlayerZone)game.getZoneOf(event.equipment);
if (event.oldEntiy instanceof Card) {
@@ -301,7 +301,7 @@
processCard(event.card, cardsUpdate);
return processEvent();
}
-
+
@Override
public Void visit(final GameEventCardPhased event) {
processCard(event.card, cardsUpdate);
@@ -322,9 +322,9 @@
@Override
public Void visit(final GameEventBlockersDeclared event) {
- HashSet<Card> cards = new HashSet<Card>();
- for (MapOfLists<Card, Card> kv : event.blockers.values()) {
- for (Collection<Card> blockers : kv.values()) {
+ final HashSet<Card> cards = new HashSet<Card>();
+ for (final MapOfLists<Card, Card> kv : event.blockers.values()) {
+ for (final Collection<Card> blockers : kv.values()) {
cards.addAll(blockers);
}
}
@@ -332,18 +332,18 @@
}
@Override
- public Void visit(GameEventAttackersDeclared event) {
+ public Void visit(final GameEventAttackersDeclared event) {
return processCards(event.attackersMap.values(), cardsUpdate);
}
@Override
- public Void visit(GameEventCombatChanged event) {
+ public Void visit(final GameEventCombatChanged event) {
needCombatUpdate = true;
return processEvent();
}
@Override
- public Void visit(GameEventCombatEnded event) {
+ public Void visit(final GameEventCombatEnded event) {
needCombatUpdate = true;
// This should remove sword/shield icons from combatants by the time game moves to M2
@@ -352,20 +352,20 @@
}
@Override
- public Void visit(GameEventCardChangeZone event) {
+ public Void visit(final GameEventCardChangeZone event) {
updateZone(event.from);
return updateZone(event.to);
}
@Override
- public Void visit(GameEventCardStatsChanged event) {
+ public Void visit(final GameEventCardStatsChanged event) {
processCards(event.cards, cardsRefreshDetails);
return processCards(event.cards, cardsUpdate);
}
@Override
- public Void visit(GameEventPlayerStatsChanged event) {
- CardCollection cards = new CardCollection();
+ public Void visit(final GameEventPlayerStatsChanged event) {
+ final CardCollection cards = new CardCollection();
for (final Player p : event.players) {
cards.addAll(p.getAllCards());
}
@@ -373,22 +373,22 @@
}
@Override
- public Void visit(GameEventShuffle event) {
+ public Void visit(final GameEventShuffle event) {
return updateZone(event.player.getZone(ZoneType.Library));
}
@Override
- public Void visit(GameEventManaPool event) {
+ public Void visit(final GameEventManaPool event) {
return processPlayer(event.player, manaPoolUpdate);
}
@Override
- public Void visit(GameEventPlayerLivesChanged event) {
+ public Void visit(final GameEventPlayerLivesChanged event) {
return processPlayer(event.player, livesUpdate);
}
@Override
- public Void visit(GameEventPlayerPoisoned event) {
+ public Void visit(final GameEventPlayerPoisoned event) {
return processPlayer(event.receiver, livesUpdate);
}
}
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/screens/match/controllers/CDev.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/match/controllers/CDev.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/controllers/CDev.java (revision 29317)
@@ -7,7 +7,6 @@
import com.google.common.collect.Lists;
-import forge.UiCommand;
import forge.gui.framework.ICDoc;
import forge.interfaces.IGameController;
import forge.screens.match.CMatchUI;
@@ -16,7 +15,7 @@
/**
* Controls the combat panel in the match UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -100,7 +99,7 @@
public void setupGameState() {
getController().cheat().setupGameState();
}
-
+
private final MouseListener madDump = new MouseAdapter() {
@Override
public void mousePressed(final MouseEvent e) {
@@ -212,14 +211,6 @@
}
//========== End mouse listener inits
-
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
@Override
public void register() {
Index: forge-gui-desktop/src/main/java/forge/toolbox/FScrollPane.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FScrollPane.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FScrollPane.java (revision 29317)
@@ -1,16 +1,22 @@
package forge.toolbox;
-import forge.toolbox.FSkin.SkinColor;
-import forge.toolbox.FSkin.SkinnedScrollPane;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
-import javax.swing.*;
+import javax.swing.JScrollBar;
+import javax.swing.ScrollPaneConstants;
+import javax.swing.Timer;
import javax.swing.border.Border;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
+import forge.toolbox.FSkin.SkinColor;
+import forge.toolbox.FSkin.SkinnedScrollPane;
-/**
+/**
* An extension of JScrollPane to centralize common styling changes
* and supports using arrow buttons to scroll instead of scrollbars
*
@@ -20,22 +26,22 @@
private static final SkinColor arrowColor = FSkin.getColor(FSkin.Colors.CLR_TEXT);
private final ArrowButton[] arrowButtons;
- public FScrollPane(boolean showBorder0) {
+ public FScrollPane(final boolean showBorder0) {
this(null, showBorder0);
}
- public FScrollPane(boolean showBorder0, final int vertical0, final int horizontal0) {
+ public FScrollPane(final boolean showBorder0, final int vertical0, final int horizontal0) {
this(null, showBorder0, false, vertical0, horizontal0);
}
- public FScrollPane(final Component c0, boolean showBorder0) {
+ public FScrollPane(final Component c0, final boolean showBorder0) {
this(c0, showBorder0, false, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
}
- public FScrollPane(final Component c0, boolean showBorder0, boolean useArrowButtons0) {
+ public FScrollPane(final Component c0, final boolean showBorder0, final boolean useArrowButtons0) {
this(c0, showBorder0, useArrowButtons0, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
}
- public FScrollPane(final Component c0, boolean showBorder0, final int vertical0, final int horizontal0) {
+ public FScrollPane(final Component c0, final boolean showBorder0, final int vertical0, final int horizontal0) {
this(c0, showBorder0, false, vertical0, horizontal0);
}
- public FScrollPane(final Component c0, boolean showBorder0, boolean useArrowButtons0, final int vertical0, final int horizontal0) {
+ public FScrollPane(final Component c0, final boolean showBorder0, final boolean useArrowButtons0, final int vertical0, final int horizontal0) {
super(c0, vertical0, horizontal0);
getVerticalScrollBar().setUnitIncrement(16);
@@ -60,7 +66,7 @@
}
@Override
- public void setVisible(boolean visible0) {
+ public void setVisible(final boolean visible0) {
super.setVisible(visible0);
if (!visible0) { //ensure arrow buttons hidden if scroll pane hidden
hideArrowButtons();
@@ -70,7 +76,7 @@
public void hideArrowButtons() {
if (arrowButtons == null) { return; }
- for (ArrowButton arrowButton : arrowButtons) {
+ for (final ArrowButton arrowButton : arrowButtons) {
if (arrowButton != null) {
FAbsolutePositioner.SINGLETON_INSTANCE.hide(arrowButton);
}
@@ -82,12 +88,12 @@
}
@Override
- public void paint(Graphics g) {
+ public void paint(final Graphics g) {
super.paint(g);
if (arrowButtons == null) { return; }
//determine which buttons should be visible
- boolean[] visible = new boolean[] { false, false, false, false };
+ final boolean[] visible = new boolean[] { false, false, false, false };
final JScrollBar horzScrollBar = this.getHorizontalScrollBar();
if (horzScrollBar.isVisible()) { //NOTE: scrollbar wouldn't actually be visible since size set to 0 to hide it
visible[0] = horzScrollBar.getValue() > 0;
@@ -103,7 +109,7 @@
}
}
- private void updateArrowButton(int dir, boolean[] visible) {
+ private void updateArrowButton(final int dir, final boolean[] visible) {
ArrowButton arrowButton = arrowButtons[dir];
if (!visible[dir]) {
if (arrowButton != null) {
@@ -149,18 +155,18 @@
if (arrowButton == null) {
switch (dir) {
- case 0:
- arrowButton = new LeftArrowButton(getHorizontalScrollBar());
- break;
- case 1:
- arrowButton = new RightArrowButton(getHorizontalScrollBar());
- break;
- case 2:
- arrowButton = new TopArrowButton(getVerticalScrollBar());
- break;
- default:
- arrowButton = new BottomArrowButton(getVerticalScrollBar());
- break;
+ case 0:
+ arrowButton = new LeftArrowButton(getHorizontalScrollBar());
+ break;
+ case 1:
+ arrowButton = new RightArrowButton(getHorizontalScrollBar());
+ break;
+ case 2:
+ arrowButton = new TopArrowButton(getVerticalScrollBar());
+ break;
+ default:
+ arrowButton = new BottomArrowButton(getVerticalScrollBar());
+ break;
}
arrowButtons[dir] = arrowButton;
}
@@ -183,7 +189,7 @@
}
@Override
- protected void setPressed(boolean pressed0) {
+ protected void setPressed(final boolean pressed0) {
super.setPressed(pressed0);
if (pressed0) {
scrollBar.setValue(scrollBar.getValue() + scrollBar.getUnitIncrement() * incrementDirection);
@@ -195,7 +201,7 @@
}
@Override
- protected void paintContent(final Graphics2D g, int w, int h, final boolean paintPressedState) {
+ protected void paintContent(final Graphics2D g, final int w, final int h, final boolean paintPressedState) {
FSkin.setGraphicsColor(g, arrowColor);
drawArrow(g);
}
@@ -204,7 +210,8 @@
//timer to continue scrollling while mouse remains down
final Timer timer = new Timer(50, new ActionListener() {
- public void actionPerformed(ActionEvent e) {
+ @Override
+ public void actionPerformed(final ActionEvent e) {
if (!isVisible()) {
//ensure timer stops if button hidden from scrolling to beginning/end (based on incrementDirection)
((Timer)e.getSource()).stop();
Index: forge-gui-desktop/src/main/java/forge/toolbox/FSkin.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FSkin.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FSkin.java (revision 29317)
@@ -17,22 +17,78 @@
*/
package forge.toolbox;
-import forge.FThreads;
-import forge.Singletons;
-import forge.assets.FSkinProp;
-import forge.assets.ISkinImage;
-import forge.gui.GuiUtils;
-import forge.gui.framework.ILocalRepaint;
-import forge.model.FModel;
-import forge.properties.ForgePreferences;
-import forge.properties.ForgePreferences.FPref;
-import forge.properties.ForgeConstants;
-import forge.view.FView;
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Composite;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.GradientPaint;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.LayoutManager;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.Toolkit;
+import java.awt.Window;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Vector;
-import org.apache.commons.lang3.text.WordUtils;
-
import javax.imageio.ImageIO;
-import javax.swing.*;
+import javax.swing.AbstractButton;
+import javax.swing.Action;
+import javax.swing.BorderFactory;
+import javax.swing.ComboBoxModel;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JEditorPane;
+import javax.swing.JFormattedTextField;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JLayeredPane;
+import javax.swing.JList;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JRadioButton;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.JSlider;
+import javax.swing.JSpinner;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.JTextPane;
+import javax.swing.ListModel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;
@@ -41,25 +97,35 @@
import javax.swing.table.TableColumnModel;
import javax.swing.text.JTextComponent;
-import java.awt.*;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.*;
-import java.util.Map.Entry;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.text.WordUtils;
+import forge.FThreads;
+import forge.Singletons;
+import forge.assets.FSkinProp;
+import forge.assets.ISkinImage;
+import forge.gui.GuiUtils;
+import forge.gui.framework.ILocalRepaint;
+import forge.model.FModel;
+import forge.properties.ForgeConstants;
+import forge.properties.ForgePreferences;
+import forge.properties.ForgePreferences.FPref;
+import forge.view.FView;
+
/**
* Assembles settings from selected or default theme as appropriate. Saves in a
* hashtable, access using .get(settingName) method.
- *
*/
public class FSkin {
+
/**
+ * Utf-8 chars representing a bullet symbol.
+ */
+ public static final String BULLET = String.valueOf(new char[] {(char) 226, (char) 128, (char) 162 } );
+
+ /**
* Retrieves a color from this skin's color map.
- *
+ *
* @param c0 &emsp; Colors property (from enum)
* @return {@link forge.toolbox.SkinColor}
*/
@@ -75,7 +141,7 @@
* @param step int
* @return {@link java.awt.Color}
*/
- public static Color stepColor(Color clr0, int step) {
+ public static Color stepColor(final Color clr0, final int step) {
int r = clr0.getRed();
int g = clr0.getGreen();
int b = clr0.getBlue();
@@ -102,42 +168,42 @@
* @param alpha int
* @return {@link java.awt.Color}
*/
- public static Color alphaColor(Color clr0, int alpha) {
+ public static Color alphaColor(final Color clr0, final int alpha) {
return new Color(clr0.getRed(), clr0.getGreen(), clr0.getBlue(), alpha);
}
/**
* @see http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx
*/
- public static boolean isColorBright(Color c) {
- int v = (int)Math.sqrt(
+ public static boolean isColorBright(final Color c) {
+ final int v = (int)Math.sqrt(
c.getRed() * c.getRed() * 0.241 +
c.getGreen() * c.getGreen() * 0.691 +
c.getBlue() * c.getBlue() * 0.068);
return v >= 130;
}
- public static Color getHighContrastColor(Color c) {
+ public static Color getHighContrastColor(final Color c) {
return isColorBright(c) ? Color.BLACK : Color.WHITE;
}
- public static void setGraphicsColor(Graphics g, SkinColor skinColor) {
+ public static void setGraphicsColor(final Graphics g, final SkinColor skinColor) {
g.setColor(skinColor.color);
}
- public static void setGraphicsGradientPaint(Graphics2D g2d, float x1, float y1, SkinColor skinColor1, float x2, float y2, SkinColor skinColor2) {
+ public static void setGraphicsGradientPaint(final Graphics2D g2d, final float x1, final float y1, final SkinColor skinColor1, final float x2, final float y2, final SkinColor skinColor2) {
g2d.setPaint(new GradientPaint(x1, y1, skinColor1.color, x2, y2, skinColor2.color));
}
- public static void setGraphicsGradientPaint(Graphics2D g2d, float x1, float y1, Color color1, float x2, float y2, SkinColor skinColor2) {
+ public static void setGraphicsGradientPaint(final Graphics2D g2d, final float x1, final float y1, final Color color1, final float x2, final float y2, final SkinColor skinColor2) {
g2d.setPaint(new GradientPaint(x1, y1, color1, x2, y2, skinColor2.color));
}
- public static void setGraphicsGradientPaint(Graphics2D g2d, float x1, float y1, SkinColor skinColor1, float x2, float y2, Color color2) {
+ public static void setGraphicsGradientPaint(final Graphics2D g2d, final float x1, final float y1, final SkinColor skinColor1, final float x2, final float y2, final Color color2) {
g2d.setPaint(new GradientPaint(x1, y1, skinColor1.color, x2, y2, color2));
}
//set background color for component that's temporary
//only use if can't use ISkinnedComponent class
- public static void setTempBackground(Component comp, SkinColor skinColor) {
+ public static void setTempBackground(final Component comp, final SkinColor skinColor) {
comp.setBackground(skinColor.color);
}
@@ -158,10 +224,10 @@
public Color getColor() { return color; }
//private constructors for color that changes with skin (use getColor())
- private SkinColor(Colors baseColor0) {
+ private SkinColor(final Colors baseColor0) {
this(baseColor0, NO_BRIGHTNESS_DELTA, NO_STEP, NO_STEP, NO_ALPHA);
}
- private SkinColor(Colors baseColor0, int brightnessDelta0, int step0, int contrastStep0, int alpha0) {
+ private SkinColor(final Colors baseColor0, final int brightnessDelta0, final int step0, final int contrastStep0, final int alpha0) {
this.baseColor = baseColor0;
this.brightnessDelta = brightnessDelta0;
this.step = step0;
@@ -170,8 +236,8 @@
this.updateColor();
}
- private SkinColor getDerivedColor(int brightnessDelta0, int step0, int contrastStep0, int alpha0) {
- String key = this.baseColor.name() + "|" + brightnessDelta0 + "|" + step0 + "|" + contrastStep0 + "|" + alpha0;
+ private SkinColor getDerivedColor(final int brightnessDelta0, final int step0, final int contrastStep0, final int alpha0) {
+ final String key = this.baseColor.name() + "|" + brightnessDelta0 + "|" + step0 + "|" + contrastStep0 + "|" + alpha0;
SkinColor derivedColor = derivedColors.get(key);
if (derivedColor == null) {
derivedColor = new SkinColor(this.baseColor, brightnessDelta0, step0, contrastStep0, alpha0);
@@ -206,7 +272,7 @@
return getContrastColor(255);
}
- public SkinColor alphaColor(int alpha0) {
+ public SkinColor alphaColor(final int alpha0) {
return getDerivedColor(this.brightnessDelta, this.step, this.contrastStep, alpha0);
}
@@ -238,7 +304,7 @@
//set border for component that's temporary
//only use if can't use ISkinnedComponent class
- public static void setTempBorder(JComponent comp, SkinBorder skinBorder) {
+ public static void setTempBorder(final JComponent comp, final SkinBorder skinBorder) {
comp.setBorder(skinBorder.createBorder());
}
@@ -249,10 +315,10 @@
private final SkinColor skinColor;
private final int thickness;
- public LineSkinBorder(SkinColor skinColor0) {
+ public LineSkinBorder(final SkinColor skinColor0) {
this(skinColor0, 1);
}
- public LineSkinBorder(SkinColor skinColor0, int thickness0) {
+ public LineSkinBorder(final SkinColor skinColor0, final int thickness0) {
this.skinColor = skinColor0;
this.thickness = thickness0;
}
@@ -266,7 +332,7 @@
private final int top, left, bottom, right;
private final SkinColor skinColor;
- public MatteSkinBorder(int top0, int left0, int bottom0, int right0, SkinColor skinColor0) {
+ public MatteSkinBorder(final int top0, final int left0, final int bottom0, final int right0, final SkinColor skinColor0) {
this.top = top0;
this.left = left0;
this.bottom = bottom0;
@@ -283,15 +349,15 @@
private Border outsideBorder, insideBorder;
private SkinBorder outsideSkinBorder, insideSkinBorder;
- public CompoundSkinBorder(SkinBorder outsideSkinBorder0, SkinBorder insideSkinBorder0) {
+ public CompoundSkinBorder(final SkinBorder outsideSkinBorder0, final SkinBorder insideSkinBorder0) {
this.outsideSkinBorder = outsideSkinBorder0;
this.insideSkinBorder = insideSkinBorder0;
}
- public CompoundSkinBorder(SkinBorder outsideSkinBorder0, Border insideBorder0) {
+ public CompoundSkinBorder(final SkinBorder outsideSkinBorder0, final Border insideBorder0) {
this.outsideSkinBorder = outsideSkinBorder0;
this.insideBorder = insideBorder0;
}
- public CompoundSkinBorder(Border outsideBorder0, SkinBorder insideSkinBorder0) {
+ public CompoundSkinBorder(final Border outsideBorder0, final SkinBorder insideSkinBorder0) {
this.outsideBorder = outsideBorder0;
this.insideSkinBorder = insideSkinBorder0;
}
@@ -315,13 +381,13 @@
private Border insideBorder;
private SkinBorder insideSkinBorder;
- public TitledSkinBorder(Border insideBorder0, String title0, SkinColor foreColor0) {
+ public TitledSkinBorder(final Border insideBorder0, final String title0, final SkinColor foreColor0) {
this.insideBorder = insideBorder0;
this.title = title0;
this.foreColor = foreColor0;
}
- public TitledSkinBorder(SkinBorder insideSkinBorder0, String title0, SkinColor foreColor0) {
+ public TitledSkinBorder(final SkinBorder insideSkinBorder0, final String title0, final SkinColor foreColor0) {
this.insideSkinBorder = insideSkinBorder0;
this.title = title0;
this.foreColor = foreColor0;
@@ -333,7 +399,7 @@
if (this.insideSkinBorder != null) {
inBorder = this.insideSkinBorder.createBorder();
}
- TitledBorder border = new TitledBorder(inBorder, this.title);
+ final TitledBorder border = new TitledBorder(inBorder, this.title);
border.setTitleColor(foreColor.color);
return border;
}
@@ -357,13 +423,13 @@
CLR_NORMAL_TARGETING_ARROW(FSkinProp.CLR_NORMAL_TARGETING_ARROW);
private Color color;
- private FSkinProp skinProp;
+ private final FSkinProp skinProp;
- private Colors(FSkinProp skinProp0) {
+ private Colors(final FSkinProp skinProp0) {
skinProp = skinProp0;
}
- public static Colors fromSkinProp(FSkinProp skinProp) {
+ public static Colors fromSkinProp(final FSkinProp skinProp) {
for (final Colors c : Colors.values()) {
if (c.skinProp == skinProp) {
return c;
@@ -400,13 +466,13 @@
}
}
- public static void drawImage(Graphics g, SkinImage skinImage, int x, int y) {
+ public static void drawImage(final Graphics g, final SkinImage skinImage, final int x, final int y) {
skinImage.draw(g, x, y);
}
- public static void drawImage(Graphics g, SkinImage skinImage, int x, int y, int w, int h) {
+ public static void drawImage(final Graphics g, final SkinImage skinImage, final int x, final int y, final int w, final int h) {
skinImage.draw(g, x, y, w, h);
}
- public static void drawImage(Graphics g, SkinImage skinImage, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) {
+ public static void drawImage(final Graphics g, final SkinImage skinImage, final int dx1, final int dy1, final int dx2, final int dy2, final int sx1, final int sy1, final int sx2, final int sy2) {
skinImage.draw(g, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2);
}
@@ -429,7 +495,7 @@
/**
* Gets a scaled version of an image from this skin's image map.
- *
+ *
* @param s0
* String image enum
* @param w0
@@ -447,7 +513,7 @@
public static class SkinImage implements ISkinImage {
private static final Map<FSkinProp, SkinImage> images = new HashMap<FSkinProp, SkinImage>();
- private static void setImage(final FSkinProp s0, Image image0) {
+ private static void setImage(final FSkinProp s0, final Image image0) {
SkinImage skinImage = images.get(s0);
if (skinImage == null) {
skinImage = new SkinImage(image0);
@@ -460,7 +526,7 @@
/**
* setImage, with auto-scaling assumed true.
- *
+ *
* @param s0
*/
private static void setImage(final FSkinProp s0) {
@@ -470,12 +536,12 @@
/**
* Checks the preferred sprite for existence of a sub-image
* defined by X, Y, W, H.
- *
+ *
* If an image is not present at those coordinates, default
* icon is substituted.
- *
+ *
* The result is saved in a HashMap.
- *
+ *
* @param s0 &emsp; An address in the hashmap, derived from FSkinProp enum
*/
private static void setImage(final FSkinProp s0, final boolean scale) {
@@ -502,26 +568,27 @@
protected HashMap<String, SkinImage> scaledImages;
private HashMap<String, SkinCursor> cursors;
- private SkinImage(Image image0) {
+ private SkinImage(final Image image0) {
this.image = image0;
}
- protected void changeImage(Image image0, ImageIcon imageIcon0) {
+ protected void changeImage(final Image image0, final ImageIcon imageIcon0) {
this.image = image0;
this.imageIcon = imageIcon0;
this.updateScaledImages();
this.updateCursors();
}
+ @Override
protected SkinImage clone() {
return new SkinImage(this.image);
}
- public SkinImage resize(int w, int h) {
+ public SkinImage resize(final int w, final int h) {
if (this.scaledImages == null) {
this.scaledImages = new HashMap<String, SkinImage>();
}
- String key = w + "x" + h;
+ final String key = w + "x" + h;
SkinImage scaledImage = this.scaledImages.get(key);
if (scaledImage == null) {
scaledImage = this.clone();
@@ -531,32 +598,32 @@
return scaledImage;
}
- public boolean save(String path, int w, int h) {
+ public boolean save(final String path, final int w, final int h) {
- final BufferedImage resizedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
+ final BufferedImage resizedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
final Graphics2D g2d = resizedImage.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.drawImage(this.image, 0, 0, w, h, 0, 0, this.getWidth(), this.getHeight(), null);
g2d.dispose();
- File outputfile = new File(path);
+ final File outputfile = new File(path);
try {
- ImageIO.write(resizedImage, "png", outputfile);
- return true;
+ ImageIO.write(resizedImage, "png", outputfile);
+ return true;
- } catch (IOException e) {
+ } catch (final IOException e) {
- e.printStackTrace();
- }
+ e.printStackTrace();
+ }
return false;
}
- public SkinImage scale(double scale) {
+ public SkinImage scale(final double scale) {
return scale(scale, scale);
}
- public SkinImage scale(double scaleX, double scaleY) {
+ public SkinImage scale(final double scaleX, final double scaleY) {
if (this.scaledImages == null) {
this.scaledImages = new HashMap<String, SkinImage>();
}
- String key = scaleX + "|" + scaleY;
+ final String key = scaleX + "|" + scaleY;
SkinImage scaledImage = this.scaledImages.get(key);
if (scaledImage == null) {
scaledImage = this.clone();
@@ -569,7 +636,7 @@
protected void updateScaledImages() {
if (this.scaledImages == null) { return; }
- for (Entry<String, SkinImage> i : this.scaledImages.entrySet()) {
+ for (final Entry<String, SkinImage> i : this.scaledImages.entrySet()) {
String[] dims = i.getKey().split("x");
if (dims.length == 2) { //static scale
i.getValue().createResizedImage(this, Integer.parseInt(dims[0]), Integer.parseInt(dims[1]));
@@ -581,7 +648,7 @@
}
}
- protected void createResizedImage(SkinImage baseImage, int w, int h) {
+ protected void createResizedImage(final SkinImage baseImage, final int w, final int h) {
final BufferedImage resizedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
final Graphics2D g2d = resizedImage.createGraphics();
@@ -592,15 +659,15 @@
this.changeImage(resizedImage, null);
}
- private void createScaledImage(SkinImage baseImage, double scaleX, double scaleY) {
+ private void createScaledImage(final SkinImage baseImage, final double scaleX, final double scaleY) {
createResizedImage(baseImage, (int)(baseImage.getWidth() * scaleX), (int)(baseImage.getHeight() * scaleY));
}
- private SkinCursor toCursor(int hotSpotX, int hotSpotY, String name) {
+ private SkinCursor toCursor(final int hotSpotX, final int hotSpotY, final String name) {
if (this.cursors == null) {
this.cursors = new HashMap<String, SkinCursor>();
}
- String key = hotSpotX + "|" + hotSpotY + "|" + name;
+ final String key = hotSpotX + "|" + hotSpotY + "|" + name;
SkinCursor cursor = this.cursors.get(key);
if (cursor == null) {
cursor = new SkinCursor(new Point(hotSpotX, hotSpotY), name);
@@ -613,12 +680,12 @@
private void updateCursors() {
if (this.cursors == null) { return; }
- for (SkinCursor cursor : this.cursors.values()) {
+ for (final SkinCursor cursor : this.cursors.values()) {
cursor.updateCursor(this.image);
}
}
- public Dimension getSizeForPaint(Graphics g) {
+ public Dimension getSizeForPaint(final Graphics g) {
if (g == null) {
throw new NullPointerException("Must pass Graphics to get size for paint");
}
@@ -640,13 +707,13 @@
return this.imageIcon;
}
- protected void draw(Graphics g, int x, int y) {
+ protected void draw(final Graphics g, final int x, final int y) {
g.drawImage(image, x, y, null);
}
- protected void draw(Graphics g, int x, int y, int w, int h) {
+ protected void draw(final Graphics g, final int x, final int y, final int w, final int h) {
g.drawImage(image, x, y, w, h, null);
}
- protected void draw(Graphics g, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) {
+ protected void draw(final Graphics g, final int dx1, final int dy1, final int dx2, final int dy2, final int sx1, final int sy1, final int sx2, final int sy2) {
g.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null);
}
}
@@ -657,7 +724,7 @@
* @param s0 &emsp; FSkinProp enum
* @return {@link forge.toolbox.SkinCursor}
*/
- public static SkinCursor getCursor(final FSkinProp s0, int hotSpotX, int hotSpotY, String name) {
+ public static SkinCursor getCursor(final FSkinProp s0, final int hotSpotX, final int hotSpotY, final String name) {
return getImage(s0).toCursor(hotSpotX, hotSpotY, name);
}
@@ -668,12 +735,12 @@
private final String name;
private Cursor cursor;
- private SkinCursor(Point hotSpot0, String name0) {
+ private SkinCursor(final Point hotSpot0, final String name0) {
this.hotSpot = hotSpot0;
this.name = name0;
}
- private void updateCursor(Image image) {
+ private void updateCursor(final Image image) {
this.cursor = TOOLS.createCustomCursor(image, this.hotSpot, this.name);
}
}
@@ -685,7 +752,7 @@
* @return {@link forge.toolbox.SkinImage}
*/
public static SkinIcon getIcon(final FSkinProp s0) {
- SkinIcon icon = SkinIcon.icons.get(s0);
+ final SkinIcon icon = SkinIcon.icons.get(s0);
if (icon == null) {
throw new NullPointerException("Can't find an icon for FSkinProp " + s0);
}
@@ -695,7 +762,7 @@
public static class SkinIcon extends SkinImage {
private static final Map<FSkinProp, SkinIcon> icons = new HashMap<FSkinProp, SkinIcon>();
- private static void setIcon(final FSkinProp s0, ImageIcon imageIcon0) {
+ private static void setIcon(final FSkinProp s0, final ImageIcon imageIcon0) {
SkinIcon skinIcon = icons.get(s0);
if (skinIcon == null) {
skinIcon = new SkinIcon(imageIcon0);
@@ -721,7 +788,7 @@
/**
* Sets an icon in this skin's icon map from a file address.
* Throws IO exception for debugging if needed.
- *
+ *
* @param s0
* &emsp; Skin property (from enum)
* @param s1
@@ -739,7 +806,7 @@
/**
* Sets an icon in this skin's icon map from a buffered image.
- *
+ *
* @param s0 &emsp; Skin property (from enum)
* @param bi0 &emsp; BufferedImage
*/
@@ -747,7 +814,7 @@
setIcon(s0, new ImageIcon(bi0));
}
- private SkinIcon(ImageIcon imageIcon0) {
+ private SkinIcon(final ImageIcon imageIcon0) {
super(imageIcon0.getImage());
this.imageIcon = imageIcon0;
}
@@ -758,22 +825,22 @@
}
@Override
- public SkinIcon resize(int w, int h) {
+ public SkinIcon resize(final int w, final int h) {
return (SkinIcon)super.resize(w, h);
}
@Override
- public SkinIcon scale(double scale) {
+ public SkinIcon scale(final double scale) {
return scale(scale, scale);
}
@Override
- public SkinIcon scale(double scaleX, double scaleY) {
+ public SkinIcon scale(final double scaleX, final double scaleY) {
return (SkinIcon)super.scale(scaleX, scaleY);
}
@Override
- protected void createResizedImage(SkinImage baseImage, int w, int h) {
- Image image0 = baseImage.image.getScaledInstance(w, h, java.awt.Image.SCALE_SMOOTH);
+ protected void createResizedImage(final SkinImage baseImage, final int w, final int h) {
+ final Image image0 = baseImage.image.getScaledInstance(w, h, java.awt.Image.SCALE_SMOOTH);
this.changeImage(image0, new ImageIcon(image0));
}
@@ -797,14 +864,14 @@
public static class UnskinnedIcon extends SkinIcon {
private final float opacity;
- public UnskinnedIcon(String path0) {
+ public UnskinnedIcon(final String path0) {
super(new ImageIcon(path0));
opacity = 1;
}
- public UnskinnedIcon(BufferedImage i0) {
+ public UnskinnedIcon(final BufferedImage i0) {
this(i0, 1);
}
- public UnskinnedIcon(BufferedImage i0, float opacity0) {
+ public UnskinnedIcon(final BufferedImage i0, final float opacity0) {
super(new ImageIcon(i0));
opacity = opacity0;
}
@@ -815,37 +882,37 @@
}
@Override
- protected void draw(Graphics g, int x, int y) {
+ protected void draw(final Graphics g, final int x, final int y) {
if (opacity == 1) {
super.draw(g, x, y);
return;
}
- Graphics2D g2d = (Graphics2D)g;
- Composite oldComp = g2d.getComposite();
+ final Graphics2D g2d = (Graphics2D)g;
+ final Composite oldComp = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));
super.draw(g2d, x, y);
g2d.setComposite(oldComp);
}
@Override
- protected void draw(Graphics g, int x, int y, int w, int h) {
+ protected void draw(final Graphics g, final int x, final int y, final int w, final int h) {
if (opacity == 1) {
super.draw(g, x, y, w, h);
return;
}
- Graphics2D g2d = (Graphics2D)g;
- Composite oldComp = g2d.getComposite();
+ final Graphics2D g2d = (Graphics2D)g;
+ final Composite oldComp = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));
super.draw(g, x, y, w, h);
g2d.setComposite(oldComp);
}
@Override
- protected void draw(Graphics g, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) {
+ protected void draw(final Graphics g, final int dx1, final int dy1, final int dx2, final int dy2, final int sx1, final int sy1, final int sx2, final int sy2) {
if (opacity == 1) {
super.draw(g, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2);
return;
}
- Graphics2D g2d = (Graphics2D)g;
- Composite oldComp = g2d.getComposite();
+ final Graphics2D g2d = (Graphics2D)g;
+ final Composite oldComp = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));
super.draw(g, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2);
g2d.setComposite(oldComp);
@@ -910,7 +977,7 @@
return SkinFont.get(Font.ITALIC, size);
}
- public static void setGraphicsFont(Graphics g, SkinFont skinFont) {
+ public static void setGraphicsFont(final Graphics g, final SkinFont skinFont) {
g.setFont(skinFont.font);
}
@@ -919,7 +986,7 @@
private static Map<String, SkinFont> fonts = new HashMap<String, SkinFont>();
private static SkinFont get(final int style0, final int size0) {
- String key = style0 + "|" + size0;
+ final String key = style0 + "|" + size0;
SkinFont skinFont = fonts.get(key);
if (skinFont == null) {
skinFont = new SkinFont(style0, size0);
@@ -928,11 +995,11 @@
return skinFont;
}
- private static void setBaseFont(Font baseFont0) {
+ private static void setBaseFont(final Font baseFont0) {
baseFont = baseFont0;
//update all cached skin fonts
- for (SkinFont skinFont : fonts.values()) {
+ for (final SkinFont skinFont : fonts.values()) {
skinFont.updateFont();
}
}
@@ -950,7 +1017,7 @@
return this.font.getSize();
}
- public int measureTextWidth(Graphics g, String text) {
+ public int measureTextWidth(final Graphics g, final String text) {
return g.getFontMetrics(this.font).stringWidth(text);
}
@@ -963,40 +1030,43 @@
}
}
- private static void addEncodingSymbol(String key, FSkinProp skinProp) {
- String path = ForgeConstants.CACHE_SYMBOLS_DIR + "/" + key.replace("/", "") + ".png";
+ private static void addEncodingSymbol(final String key, final FSkinProp skinProp) {
+ final String path = ForgeConstants.CACHE_SYMBOLS_DIR + "/" + key.replace("/", "") + ".png";
- getImage(skinProp).save(path, 13, 13);
+ getImage(skinProp).save(path, 13, 13);
}
- public static String encodeSymbols(String str, boolean formatReminderText) {
+ public static String encodeSymbols(String str, final boolean formatReminderText) {
- String pattern, replacement;
+ String pattern, replacement;
+ // Bullet char
+ str = StringUtils.replace(str, BULLET, "\u2022");
+
- if (formatReminderText) {
- //format reminder text in italics (or hide if preference set)
- pattern = "\\((.+)\\)";
- replacement = FModel.getPreferences().getPrefBoolean(FPref.UI_HIDE_REMINDER_TEXT) ?
- "" : "<i>\\($1\\)</i>";
- str = str.replaceAll(pattern, replacement);
- }
+ if (formatReminderText) {
+ //format reminder text in italics (or hide if preference set)
+ pattern = "\\((.+)\\)";
+ replacement = FModel.getPreferences().getPrefBoolean(FPref.UI_HIDE_REMINDER_TEXT) ?
+ "" : "<i>\\($1\\)</i>";
+ str = str.replaceAll(pattern, replacement);
+ }
//format mana symbols to display as icons
- pattern = "\\{([A-Z0-9]+)\\}|\\{([A-Z0-9]+)/([A-Z0-9]+)\\}"; //fancy pattern needed so "/" can be omitted from replacement
- try {
- replacement = "<img src='" + new File(ForgeConstants.CACHE_SYMBOLS_DIR + "/$1$2$3.png").toURI().toURL().toString() + "'>";
- str = str.replaceAll(pattern, replacement);
+ pattern = "\\{([A-Z0-9]+)\\}|\\{([A-Z0-9]+)/([A-Z0-9]+)\\}"; //fancy pattern needed so "/" can be omitted from replacement
+ try {
+ replacement = "<img src='" + new File(ForgeConstants.CACHE_SYMBOLS_DIR + "/$1$2$3.png").toURI().toURL().toString() + "'>";
+ str = str.replaceAll(pattern, replacement);
- } catch (MalformedURLException e) {
+ } catch (final MalformedURLException e) {
- e.printStackTrace();
- }
+ e.printStackTrace();
+ }
- return "<html>" + str + "</html>"; //must wrap in <html> tag for images to appear
+ return "<html>" + str + "</html>"; //must wrap in <html> tag for images to appear
}
- private static ArrayList<String> allSkins;
+ private static List<String> allSkins;
private static int currentSkinIndex;
private static String preferredDir;
private static String preferredName;
private static BufferedImage bimDefaultSprite, bimPreferredSprite, bimFoils, bimQuestDraftDeck,
- bimOldFoils, bimDefaultAvatars, bimPreferredAvatars, bimTrophies;
+ bimOldFoils, bimDefaultAvatars, bimPreferredAvatars, bimTrophies;
private static int x0, y0, w0, h0, newW, newH, preferredW, preferredH;
private static int[] tempCoords;
private static int defaultFontSize = 12;
@@ -1027,8 +1097,8 @@
/**
* Loads a "light" version of FSkin, just enough for the splash screen:
* skin name. Generates custom skin settings, fonts, and backgrounds.
- *
- *
+ *
+ *
* @param skinName
* the skin name
*/
@@ -1039,7 +1109,7 @@
if (allSkins == null) { //initialize
allSkins = new ArrayList<String>();
- ArrayList<String> skinDirectoryNames = getSkinDirectoryNames();
+ final ArrayList<String> skinDirectoryNames = getSkinDirectoryNames();
for (int i = 0; i < skinDirectoryNames.size(); i++) {
allSkins.add(WordUtils.capitalize(skinDirectoryNames.get(i).replace('_', ' ')));
}
@@ -1089,17 +1159,17 @@
* Loads two sprites: the default (which should be a complete
* collection of all symbols) and the preferred (which may be
* incomplete).
- *
+ *
* Font must be present in the skin folder, and will not
* be replaced by default. The fonts are pre-derived
* in this method and saved in a HashMap for future access.
- *
+ *
* Color swatches must be present in the preferred
* sprite, and will not be replaced by default.
- *
+ *
* Background images must be present in skin folder,
* and will not be replaced by default.
- *
+ *
* Icons, however, will be pulled from the two sprites. Obviously,
* preferred takes precedence over default, but if something is
* missing, the default picture is retrieved.
@@ -1158,7 +1228,7 @@
// Initialize fonts
if (onInit) { //set default font size only once onInit
- Font f = UIManager.getDefaults().getFont("Label.font");
+ final Font f = UIManager.getDefaults().getFont("Label.font");
if (f != null) {
defaultFontSize = f.getSize();
}
@@ -1172,7 +1242,7 @@
// Run through enums and load their coords.
Colors.updateAll();
- for (FSkinProp prop : FSkinProp.values()) {
+ for (final FSkinProp prop : FSkinProp.values()) {
switch (prop.getType()) {
case IMAGE:
SkinImage.setImage(prop);
@@ -1222,11 +1292,11 @@
bimTrophies = null;
//establish encoding symbols
- File dir = new File(ForgeConstants.CACHE_SYMBOLS_DIR);
+ final File dir = new File(ForgeConstants.CACHE_SYMBOLS_DIR);
if (!dir.mkdir()) { //ensure symbols directory exists and is empty
- for (File file : dir.listFiles()) {
+ for (final File file : dir.listFiles()) {
- file.delete();
- }
+ file.delete();
+ }
}
addEncodingSymbol("W", FSkinProp.IMG_MANA_W);
@@ -1267,20 +1337,11 @@
// Set look and feel after skin loaded
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage("Setting look and feel...");
- ForgeLookAndFeel laf = new ForgeLookAndFeel();
+ final ForgeLookAndFeel laf = new ForgeLookAndFeel();
laf.setForgeLookAndFeel(Singletons.getView().getFrame());
}
/**
- * Gets the name.
- *
- * @return Name of the current skin.
- */
- public static String getName() {
- return preferredName;
- }
-
- /**
* Gets the skins.
*
* @return the skins
@@ -1318,7 +1379,7 @@
* <p>
* getColorFromPixel.
* </p>
- *
+ *
* @param {@link java.lang.Integer} pixel information
*/
private static Color getColorFromPixel(final int pixel) {
@@ -1338,7 +1399,7 @@
h0 = tempCoords[3];
if (s0.equals(FSkinProp.IMG_QUEST_DRAFT_DECK)) {
- Color c = getColorFromPixel(bimQuestDraftDeck.getRGB((x0 + w0 / 2), (y0 + h0 / 2)));
+ final Color c = getColorFromPixel(bimQuestDraftDeck.getRGB((x0 + w0 / 2), (y0 + h0 / 2)));
if (c.getAlpha() != 0) { return bimQuestDraftDeck; }
}
@@ -1353,7 +1414,7 @@
// If any return true, image exists.
int x = 0, y = 0;
Color c;
-
+
// Center
x = (x0 + w0 / 2);
y = (y0 + h0 / 2);
@@ -1412,7 +1473,7 @@
}
}
- private static void setImage(final FSkinProp s0, BufferedImage bim) {
+ private static void setImage(final FSkinProp s0, final BufferedImage bim) {
tempCoords = s0.getCoords();
x0 = tempCoords[0];
y0 = tempCoords[1];
@@ -1422,10 +1483,6 @@
SkinImage.setImage(s0, bim.getSubimage(x0, y0, w0, h0));
}
- public static boolean isLookAndFeelSet() {
- return ForgeLookAndFeel.isMetalLafSet;
- }
-
/**
* Sets the look and feel of the GUI based on the selected Forge theme.
*
@@ -1461,7 +1518,7 @@
* If not explicitly set then the Mac uses its native L&F which does
* not support various settings (eg. combobox background color).
*/
- private boolean setMetalLookAndFeel(JFrame appFrame) {
+ private boolean setMetalLookAndFeel(final JFrame appFrame) {
if (onInit) { //only attempt to set Metal Look and Feel the first time
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
@@ -1480,9 +1537,9 @@
*/
private void setMenusLookAndFeel() {
// JMenuBar
- Color clrTheme = getColor(Colors.CLR_THEME).color;
- Color backgroundColor = stepColor(clrTheme, 0);
- Color menuBarEdgeColor = stepColor(clrTheme, -80);
+ final Color clrTheme = getColor(Colors.CLR_THEME).color;
+ final Color backgroundColor = stepColor(clrTheme, 0);
+ final Color menuBarEdgeColor = stepColor(clrTheme, -80);
UIManager.put("MenuBar.foreground", FORE_COLOR);
UIManager.put("MenuBar.gradient", getColorGradients(backgroundColor.darker(), backgroundColor));
UIManager.put("MenuBar.border", BorderFactory.createMatteBorder(0, 0, 1, 0, menuBarEdgeColor));
@@ -1542,7 +1599,7 @@
UIManager.put("ComboBox.disabledBackground", BACK_COLOR);
UIManager.put("ComboBox.disabledForeground", BACK_COLOR.darker());
UIManager.put("ComboBox.font", getDefaultFont("ComboBox.font"));
- boolean isBright = isColorBright(FORE_COLOR);
+ final boolean isBright = isColorBright(FORE_COLOR);
UIManager.put("ComboBox.border", BorderFactory.createLineBorder(isBright ? FORE_COLOR.darker() : FORE_COLOR.brighter(), 1));
}
@@ -1560,12 +1617,12 @@
UIManager.put("ToolTip.border", LINE_BORDER);
}
- private Font getDefaultFont(String component) {
+ private static Font getDefaultFont(final String component) {
return getFont(UIManager.getFont(component).getSize()).font;
}
- private ArrayList<Object> getColorGradients(Color bottom, Color top) {
- ArrayList<Object> gradients = new ArrayList<>();
+ private static List<Object> getColorGradients(final Color bottom, final Color top) {
+ final List<Object> gradients = new ArrayList<>();
gradients.add(0.0);
gradients.add(0.0);
gradients.add(top);
@@ -1584,7 +1641,7 @@
protected ComponentSkin() {
}
- protected boolean update(T comp) {
+ protected boolean update(final T comp) {
if (appliedSkinIndex == currentSkinIndex) { return false; }
appliedSkinIndex = currentSkinIndex;
reapply(comp);
@@ -1592,21 +1649,21 @@
}
public SkinColor getForeground() { return this.foreground; }
- protected void setForeground(T comp, SkinColor skinColor) { comp.setForeground(skinColor != null ? skinColor.color : null); this.foreground = skinColor; }
+ protected void setForeground(final T comp, final SkinColor skinColor) { comp.setForeground(skinColor != null ? skinColor.color : null); this.foreground = skinColor; }
protected void resetForeground() { this.foreground = null; }
public SkinColor getBackground() { return this.background; }
- protected void setBackground(T comp, SkinColor skinColor) { comp.setBackground(skinColor != null ? skinColor.color : null); this.background = skinColor; }
+ protected void setBackground(final T comp, final SkinColor skinColor) { comp.setBackground(skinColor != null ? skinColor.color : null); this.background = skinColor; }
protected void resetBackground() { this.background = null; }
public SkinFont getFont() { return this.font; }
- protected void setFont(T comp, SkinFont skinFont) { comp.setFont(skinFont != null ? skinFont.font : null); this.font = skinFont; }
+ protected void setFont(final T comp, final SkinFont skinFont) { comp.setFont(skinFont != null ? skinFont.font : null); this.font = skinFont; }
protected void resetFont() { this.font = null; }
- protected void setCursor(T comp, SkinCursor skinCursor) { comp.setCursor(skinCursor != null ? skinCursor.cursor : null); this.cursor = skinCursor; }
+ protected void setCursor(final T comp, final SkinCursor skinCursor) { comp.setCursor(skinCursor != null ? skinCursor.cursor : null); this.cursor = skinCursor; }
protected void resetCursor() { this.cursor = null; }
- protected void reapply(T comp) {
+ protected void reapply(final T comp) {
if (this.foreground != null) { setForeground(comp, this.foreground); }
if (this.background != null) { setBackground(comp, this.background); }
if (this.font != null) { setFont(comp, this.font); }
@@ -1619,11 +1676,11 @@
protected WindowSkin() {
}
- protected void setIconImage(T comp, SkinImage skinImage) { comp.setIconImage(skinImage != null ? skinImage.image : null); this.iconImage = skinImage; }
+ protected void setIconImage(final T comp, final SkinImage skinImage) { comp.setIconImage(skinImage != null ? skinImage.image : null); this.iconImage = skinImage; }
protected void resetIconImage() { this.iconImage = null; }
@Override
- protected void reapply(T comp) {
+ protected void reapply(final T comp) {
if (this.iconImage != null) { setIconImage(comp, this.iconImage); }
super.reapply(comp);
}
@@ -1634,11 +1691,11 @@
protected JComponentSkin() {
}
- protected void setBorder(T comp, SkinBorder skinBorder) { comp.setBorder(skinBorder != null ? skinBorder.createBorder() : null); this.border = skinBorder; }
+ protected void setBorder(final T comp, final SkinBorder skinBorder) { comp.setBorder(skinBorder != null ? skinBorder.createBorder() : null); this.border = skinBorder; }
protected void resetBorder() { this.border = null; }
@Override
- protected void reapply(T comp) {
+ protected void reapply(final T comp) {
if (this.border != null) { setBorder(comp, this.border); }
super.reapply(comp);
}
@@ -1649,11 +1706,11 @@
protected JLabelSkin() {
}
- protected void setIcon(T comp, SkinImage skinImage) { comp.setIcon(skinImage != null ? skinImage.getIcon() : null); this.icon = skinImage; }
+ protected void setIcon(final T comp, final SkinImage skinImage) { comp.setIcon(skinImage != null ? skinImage.getIcon() : null); this.icon = skinImage; }
protected void resetIcon() { this.icon = null; }
@Override
- protected void reapply(T comp) {
+ protected void reapply(final T comp) {
if (this.icon != null) { setIcon(comp, this.icon); }
super.reapply(comp);
}
@@ -1664,17 +1721,17 @@
protected AbstractButtonSkin() {
}
- protected void setIcon(T comp, SkinImage skinImage) { comp.setIcon(skinImage != null ? skinImage.getIcon() : null); this.icon = skinImage; }
+ protected void setIcon(final T comp, final SkinImage skinImage) { comp.setIcon(skinImage != null ? skinImage.getIcon() : null); this.icon = skinImage; }
protected void resetIcon() { this.icon = null; }
- protected void setPressedIcon(T comp, SkinImage skinImage) { comp.setPressedIcon(skinImage != null ? skinImage.getIcon() : null); this.pressedIcon = skinImage; }
+ protected void setPressedIcon(final T comp, final SkinImage skinImage) { comp.setPressedIcon(skinImage != null ? skinImage.getIcon() : null); this.pressedIcon = skinImage; }
protected void resetPressedIcon() { this.pressedIcon = null; }
- protected void setRolloverIcon(T comp, SkinImage skinImage) { comp.setRolloverIcon(skinImage != null ? skinImage.getIcon() : null); this.rolloverIcon = skinImage; }
+ protected void setRolloverIcon(final T comp, final SkinImage skinImage) { comp.setRolloverIcon(skinImage != null ? skinImage.getIcon() : null); this.rolloverIcon = skinImage; }
protected void resetRolloverIcon() { this.rolloverIcon = null; }
@Override
- protected void reapply(T comp) {
+ protected void reapply(final T comp) {
if (this.icon != null) { setIcon(comp, this.icon); }
if (this.pressedIcon != null) { setPressedIcon(comp, this.pressedIcon); }
if (this.rolloverIcon != null) { setRolloverIcon(comp, this.rolloverIcon); }
@@ -1687,11 +1744,11 @@
protected JTextComponentSkin() {
}
- protected void setCaretColor(T comp, SkinColor skinColor) { comp.setCaretColor(skinColor != null ? skinColor.color : null); this.caretColor = skinColor; }
+ protected void setCaretColor(final T comp, final SkinColor skinColor) { comp.setCaretColor(skinColor != null ? skinColor.color : null); this.caretColor = skinColor; }
protected void resetCaretColor() { this.caretColor = null; }
@Override
- protected void reapply(T comp) {
+ protected void reapply(final T comp) {
if (this.caretColor != null) { setCaretColor(comp, this.caretColor); }
super.reapply(comp);
}
@@ -1702,17 +1759,17 @@
protected JTableSkin() {
}
- protected void setSelectionForeground(T comp, SkinColor skinColor) { comp.setSelectionForeground(skinColor != null ? skinColor.color : null); this.selectionForeground = skinColor; }
+ protected void setSelectionForeground(final T comp, final SkinColor skinColor) { comp.setSelectionForeground(skinColor != null ? skinColor.color : null); this.selectionForeground = skinColor; }
protected void resetSelectionForeground() { this.selectionForeground = null; }
- protected void setSelectionBackground(T comp, SkinColor skinColor) { comp.setSelectionBackground(skinColor != null ? skinColor.color : null); this.selectionBackground = skinColor; }
+ protected void setSelectionBackground(final T comp, final SkinColor skinColor) { comp.setSelectionBackground(skinColor != null ? skinColor.color : null); this.selectionBackground = skinColor; }
protected void resetSelectionBackground() { this.selectionBackground = null; }
- protected void setGridColor(T comp, SkinColor skinColor) { comp.setGridColor(skinColor != null ? skinColor.color : null); this.gridColor = skinColor; }
+ protected void setGridColor(final T comp, final SkinColor skinColor) { comp.setGridColor(skinColor != null ? skinColor.color : null); this.gridColor = skinColor; }
protected void resetGridColor() { this.gridColor = null; }
@Override
- protected void reapply(T comp) {
+ protected void reapply(final T comp) {
if (this.selectionForeground != null) { setSelectionForeground(comp, this.selectionForeground); }
if (this.selectionBackground != null) { setSelectionBackground(comp, this.selectionBackground); }
if (this.gridColor != null) { setGridColor(comp, this.gridColor); }
@@ -1725,14 +1782,14 @@
protected JSkinSkin() {
}
- protected void setSelectionForeground(T comp, SkinColor skinColor) { comp.setSelectionForeground(skinColor != null ? skinColor.color : null); this.selectionForeground = skinColor; }
+ protected void setSelectionForeground(final T comp, final SkinColor skinColor) { comp.setSelectionForeground(skinColor != null ? skinColor.color : null); this.selectionForeground = skinColor; }
protected void resetSelectionForeground() { this.selectionForeground = null; }
- protected void setSelectionBackground(T comp, SkinColor skinColor) { comp.setSelectionBackground(skinColor != null ? skinColor.color : null); this.selectionBackground = skinColor; }
+ protected void setSelectionBackground(final T comp, final SkinColor skinColor) { comp.setSelectionBackground(skinColor != null ? skinColor.color : null); this.selectionBackground = skinColor; }
protected void resetSelectionBackground() { this.selectionBackground = null; }
@Override
- protected void reapply(T comp) {
+ protected void reapply(final T comp) {
if (this.selectionForeground != null) { setSelectionForeground(comp, this.selectionForeground); }
if (this.selectionBackground != null) { setSelectionBackground(comp, this.selectionBackground); }
super.reapply(comp);
@@ -1749,6 +1806,7 @@
private SkinBorder border;
private WindowSkin<JFrame> skin;
+ @Override
public WindowSkin<JFrame> getSkin() {
if (skin == null) { skin = new WindowSkin<JFrame>(); }
return skin;
@@ -1756,27 +1814,27 @@
public SkinnedFrame() { super(); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setIconImage(SkinImage skinImage) { getSkin().setIconImage(this, skinImage); }
- @Override public void setIconImage(Image image) { getSkin().resetIconImage(); super.setIconImage(image); }
+ public void setIconImage(final SkinImage skinImage) { getSkin().setIconImage(this, skinImage); }
+ @Override public void setIconImage(final Image image) { getSkin().resetIconImage(); super.setIconImage(image); }
//relay border to root pane
- public void setBorder(SkinBorder skinBorder) { getRootPane().setBorder(skinBorder != null ? skinBorder.createBorder() : null); this.border = skinBorder; }
- public void setBorder(Border border) { getRootPane().setBorder(border); this.border = null; }
+ public void setBorder(final SkinBorder skinBorder) { getRootPane().setBorder(skinBorder != null ? skinBorder.createBorder() : null); this.border = skinBorder; }
+ public void setBorder(final Border border) { getRootPane().setBorder(border); this.border = null; }
@Override
- public void paint(Graphics g) {
+ public void paint(final Graphics g) {
if (getSkin().update(this)) {
if (this.border != null) { setBorder(this.border); }
}
@@ -1789,35 +1847,36 @@
private SkinBorder border;
private WindowSkin<JDialog> skin;
+ @Override
public WindowSkin<JDialog> getSkin() {
if (skin == null) { skin = new WindowSkin<JDialog>(); }
return skin;
}
public SkinnedDialog() { super(); }
- public SkinnedDialog(Frame owner, boolean modal) { super(owner, modal); }
+ public SkinnedDialog(final Frame owner, final boolean modal) { super(owner, modal); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setIconImage(SkinImage skinImage) { getSkin().setIconImage(this, skinImage); }
- @Override public void setIconImage(Image image) { getSkin().resetIconImage(); super.setIconImage(image); }
+ public void setIconImage(final SkinImage skinImage) { getSkin().setIconImage(this, skinImage); }
+ @Override public void setIconImage(final Image image) { getSkin().resetIconImage(); super.setIconImage(image); }
//relay border to root pane
- public void setBorder(SkinBorder skinBorder) { getRootPane().setBorder(skinBorder != null ? skinBorder.createBorder() : null); this.border = skinBorder; }
- public void setBorder(Border border) { getRootPane().setBorder(border); this.border = null; }
+ public void setBorder(final SkinBorder skinBorder) { getRootPane().setBorder(skinBorder != null ? skinBorder.createBorder() : null); this.border = skinBorder; }
+ public void setBorder(final Border border) { getRootPane().setBorder(border); this.border = null; }
@Override
- public void paint(Graphics g) {
+ public void paint(final Graphics g) {
if (getSkin().update(this)) {
if (this.border != null) { setBorder(this.border); }
}
@@ -1828,6 +1887,7 @@
private static final long serialVersionUID = -8325505112790327931L;
private JComponentSkin<JLayeredPane> skin;
+ @Override
public JComponentSkin<JLayeredPane> getSkin() {
if (skin == null) { skin = new JComponentSkin<JLayeredPane>(); }
return skin;
@@ -1835,11 +1895,11 @@
public SkinnedLayeredPane() { super(); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -1848,6 +1908,7 @@
private static final long serialVersionUID = -183434586261989294L;
private JComponentSkin<JMenuBar> skin;
+ @Override
public JComponentSkin<JMenuBar> getSkin() {
if (skin == null) {skin = new JComponentSkin<JMenuBar>(); }
return skin;
@@ -1855,23 +1916,23 @@
public SkinnedMenuBar() { super(); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -1880,34 +1941,35 @@
private static final long serialVersionUID = 7046941724535782054L;
private JLabelSkin<JLabel> skin;
+ @Override
public JLabelSkin<JLabel> getSkin() {
if (skin == null) { skin = new JLabelSkin<JLabel>(); }
return skin;
}
public SkinnedLabel() { super(); }
- public SkinnedLabel(String text) { super(text); }
+ public SkinnedLabel(final String text) { super(text); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
- public void setIcon(SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
- @Override public void setIcon(Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
+ public void setIcon(final SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
+ @Override public void setIcon(final Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -1916,33 +1978,34 @@
private static final long serialVersionUID = 9032839876990765149L;
private JComponentSkin<JComboBox<E>> skin;
+ @Override
public JComponentSkin<JComboBox<E>> getSkin() {
if (skin == null) { skin = new JComponentSkin<JComboBox<E>>(); }
return skin;
}
public SkinnedComboBox() { super(); }
- public SkinnedComboBox(ComboBoxModel<E> model0) { super(model0); }
- public SkinnedComboBox(E[] items) { super(items); }
- public SkinnedComboBox(Vector<E> items) { super(items); }
+ public SkinnedComboBox(final ComboBoxModel<E> model0) { super(model0); }
+ public SkinnedComboBox(final E[] items) { super(items); }
+ public SkinnedComboBox(final Vector<E> items) { super(items); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -1951,38 +2014,39 @@
private static final long serialVersionUID = -2449981390420167627L;
private JSkinSkin<JList<E>> skin;
+ @Override
public JSkinSkin<JList<E>> getSkin() {
if (skin == null) { skin = new JSkinSkin<JList<E>>(); }
return skin;
}
public SkinnedList() { super(); }
- public SkinnedList(ListModel<E> model0) { super(model0); }
- public SkinnedList(E[] items) { super(items); }
+ public SkinnedList(final ListModel<E> model0) { super(model0); }
+ public SkinnedList(final E[] items) { super(items); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
- public void setSelectionForeground(SkinColor skinColor) { getSkin().setSelectionForeground(this, skinColor); }
- @Override public void setSelectionForeground(Color color) { getSkin().resetSelectionForeground(); super.setSelectionForeground(color); }
+ public void setSelectionForeground(final SkinColor skinColor) { getSkin().setSelectionForeground(this, skinColor); }
+ @Override public void setSelectionForeground(final Color color) { getSkin().resetSelectionForeground(); super.setSelectionForeground(color); }
- public void setSelectionBackground(SkinColor skinColor) { getSkin().setSelectionBackground(this, skinColor); }
- @Override public void setSelectionBackground(Color color) { getSkin().resetSelectionBackground(); super.setSelectionBackground(color); }
+ public void setSelectionBackground(final SkinColor skinColor) { getSkin().setSelectionBackground(this, skinColor); }
+ @Override public void setSelectionBackground(final Color color) { getSkin().resetSelectionBackground(); super.setSelectionBackground(color); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -1991,6 +2055,7 @@
private static final long serialVersionUID = -1842620489613307379L;
private JComponentSkin<JPanel> skin;
+ @Override
public JComponentSkin<JPanel> getSkin() {
if (skin == null) { skin = new JComponentSkin<JPanel>(); }
return skin;
@@ -1999,23 +2064,23 @@
public SkinnedPanel() { super(); }
public SkinnedPanel(final LayoutManager layoutManager) { super(layoutManager); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2044,7 +2109,7 @@
public final void setBackgroundTextureOverlay(final Color color) { onSetBackgroundTextureOverlay(color); this.backgroundTextureOverlay = null; }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
if (getSkin().update(this)) {
if (this.foregroundImage != null) { this.setForegroundImage(this.foregroundImage); }
if (this.backgroundTexture != null) { this.setBackgroundTexture(this.backgroundTexture); }
@@ -2057,15 +2122,16 @@
private static final long serialVersionUID = 8958616297664604107L;
private JComponentSkin<JScrollPane> skin;
+ @Override
public JComponentSkin<JScrollPane> getSkin() {
if (skin == null) { skin = new JComponentSkin<JScrollPane>(); }
return skin;
}
public SkinnedScrollPane() { super(); init(); }
- public SkinnedScrollPane(Component comp) { super(comp); init(); }
- public SkinnedScrollPane(int vsbPolicy, int hsbPolicy) { super(vsbPolicy, hsbPolicy); init(); }
- public SkinnedScrollPane(Component comp, int vsbPolicy, int hsbPolicy) { super(comp, vsbPolicy, hsbPolicy); init(); }
+ public SkinnedScrollPane(final Component comp) { super(comp); init(); }
+ public SkinnedScrollPane(final int vsbPolicy, final int hsbPolicy) { super(vsbPolicy, hsbPolicy); init(); }
+ public SkinnedScrollPane(final Component comp, final int vsbPolicy, final int hsbPolicy) { super(comp, vsbPolicy, hsbPolicy); init(); }
private void init() {
new SkinScrollBarUI(getVerticalScrollBar(), true);
@@ -2089,18 +2155,18 @@
private final boolean vertical;
private boolean hovered;
- private SkinScrollBarUI(JScrollBar scrollbar, boolean vertical0) {
+ private SkinScrollBarUI(final JScrollBar scrollbar, final boolean vertical0) {
vertical = vertical0;
scrollbar.setOpaque(false);
scrollbar.addMouseListener(new MouseAdapter() {
@Override
- public void mouseEntered(MouseEvent e) {
+ public void mouseEntered(final MouseEvent e) {
hovered = true;
repaintSelf();
}
@Override
- public void mouseExited(MouseEvent e) {
+ public void mouseExited(final MouseEvent e) {
hovered = false;
repaintSelf();
}
@@ -2115,22 +2181,22 @@
}
@Override
- protected JButton createIncreaseButton(int orientation) {
+ protected JButton createIncreaseButton(final int orientation) {
return hiddenButton; //hide increase button
}
@Override
- protected JButton createDecreaseButton(int orientation) {
+ protected JButton createDecreaseButton(final int orientation) {
return hiddenButton; //hide decrease button
}
@Override
- protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
+ protected void paintTrack(final Graphics g, final JComponent c, final Rectangle trackBounds) {
//make track transparent
}
@Override
- protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
+ protected void paintThumb(final Graphics g, final JComponent c, final Rectangle thumbBounds) {
int x = thumbBounds.x;
int y = thumbBounds.y;
int width = thumbBounds.width - 1;
@@ -2141,8 +2207,8 @@
if (vertical) {
x += 2;
width -= 4;
- int x2 = x + width / 2;
- int x3 = x + width;
+ final int x2 = x + width / 2;
+ final int x3 = x + width;
int arrowThickness = width / 2;
int maxArrowThickness = height / 2 - grooveSpace * 2;
@@ -2152,9 +2218,9 @@
if (arrowThickness > maxArrowThickness) {
arrowThickness = maxArrowThickness;
}
- int y2 = y + arrowThickness;
- int y3 = y + height - arrowThickness;
- int y4 = y + height;
+ final int y2 = y + arrowThickness;
+ final int y3 = y + height - arrowThickness;
+ final int y4 = y + height;
xPoints = new int[] { x, x2, x3, x3, x2, x };
yPoints = new int[] { y2, y, y2, y3, y4, y3 };
@@ -2162,8 +2228,8 @@
else {
y += 2;
height -= 4;
- int y2 = y + height / 2;
- int y3 = y + height;
+ final int y2 = y + height / 2;
+ final int y3 = y + height;
int arrowThickness = height / 2;
int maxArrowThickness = width / 2 - grooveSpace * 2;
@@ -2173,16 +2239,16 @@
if (arrowThickness > maxArrowThickness) {
arrowThickness = maxArrowThickness;
}
- int x2 = x + arrowThickness;
- int x3 = x + width - arrowThickness;
- int x4 = x + width;
+ final int x2 = x + arrowThickness;
+ final int x3 = x + width - arrowThickness;
+ final int x4 = x + width;
yPoints = new int[] { y, y2, y3, y3, y2, y };
xPoints = new int[] { x2, x, x2, x3, x4, x3 };
}
//draw thumb
- Graphics2D g2d = (Graphics2D) g;
+ final Graphics2D g2d = (Graphics2D) g;
if (!hovered) {
g2d.setComposite(alphaDim);
}
@@ -2196,11 +2262,11 @@
if (vertical) {
if (height > grooveSpace * 4) {
setGraphicsColor(g2d, grooveColor);
- int x2 = x + grooveSpace;
- int x3 = x + width - grooveSpace;
- int y3 = y + height / 2;
- int y2 = y3 - grooveSpace;
- int y4 = y3 + grooveSpace;
+ final int x2 = x + grooveSpace;
+ final int x3 = x + width - grooveSpace;
+ final int y3 = y + height / 2;
+ final int y2 = y3 - grooveSpace;
+ final int y4 = y3 + grooveSpace;
g2d.drawLine(x2, y2, x3, y2);
g2d.drawLine(x2, y3, x3, y3);
g2d.drawLine(x2, y4, x3, y4);
@@ -2208,11 +2274,11 @@
}
else if (width > grooveSpace * 4) {
setGraphicsColor(g2d, grooveColor);
- int y2 = y + grooveSpace;
- int y3 = y + height - grooveSpace;
- int x3 = x + width / 2;
- int x2 = x3 - grooveSpace;
- int x4 = x3 + grooveSpace;
+ final int y2 = y + grooveSpace;
+ final int y3 = y + height - grooveSpace;
+ final int x3 = x + width / 2;
+ final int x2 = x3 - grooveSpace;
+ final int x4 = x3 + grooveSpace;
g2d.drawLine(x2, y2, x2, y3);
g2d.drawLine(x3, y2, x3, y3);
g2d.drawLine(x4, y2, x4, y3);
@@ -2220,23 +2286,23 @@
}
}
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2245,6 +2311,7 @@
private static final long serialVersionUID = 6069807433509074270L;
private JComponentSkin<JTabbedPane> skin;
+ @Override
public JComponentSkin<JTabbedPane> getSkin() {
if (skin == null) { skin = new JComponentSkin<JTabbedPane>(); }
return skin;
@@ -2252,23 +2319,23 @@
public SkinnedTabbedPane() { super(); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2277,40 +2344,41 @@
private static final long serialVersionUID = -1868724405885582324L;
private AbstractButtonSkin<JButton> skin;
+ @Override
public AbstractButtonSkin<JButton> getSkin() {
if (skin == null) { skin = new AbstractButtonSkin<JButton>(); }
return skin;
}
public SkinnedButton() { super(); }
- public SkinnedButton(String text) { super(text); }
+ public SkinnedButton(final String text) { super(text); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
- public void setIcon(SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
- @Override public void setIcon(Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
+ public void setIcon(final SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
+ @Override public void setIcon(final Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
- public void setPressedIcon(SkinImage skinImage) { getSkin().setPressedIcon(this, skinImage); }
- @Override public void setPressedIcon(Icon icon) { getSkin().resetPressedIcon(); super.setPressedIcon(icon); }
+ public void setPressedIcon(final SkinImage skinImage) { getSkin().setPressedIcon(this, skinImage); }
+ @Override public void setPressedIcon(final Icon icon) { getSkin().resetPressedIcon(); super.setPressedIcon(icon); }
- public void setRolloverIcon(SkinImage skinImage) { getSkin().setRolloverIcon(this, skinImage); }
- @Override public void setRolloverIcon(Icon icon) { getSkin().resetRolloverIcon(); super.setRolloverIcon(icon); }
+ public void setRolloverIcon(final SkinImage skinImage) { getSkin().setRolloverIcon(this, skinImage); }
+ @Override public void setRolloverIcon(final Icon icon) { getSkin().resetRolloverIcon(); super.setRolloverIcon(icon); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2319,31 +2387,32 @@
private static final long serialVersionUID = 6283239481504889377L;
private AbstractButtonSkin<JCheckBox> skin;
+ @Override
public AbstractButtonSkin<JCheckBox> getSkin() {
if (skin == null) { skin = new AbstractButtonSkin<JCheckBox>(); }
return skin;
}
public SkinnedCheckBox() { super(); }
- public SkinnedCheckBox(String text) { super(text); }
+ public SkinnedCheckBox(final String text) { super(text); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2352,31 +2421,32 @@
private static final long serialVersionUID = 2724598726704588129L;
private AbstractButtonSkin<JRadioButton> skin;
+ @Override
public AbstractButtonSkin<JRadioButton> getSkin() {
if (skin == null) { skin = new AbstractButtonSkin<JRadioButton>(); }
return skin;
}
public SkinnedRadioButton() { super(); }
- public SkinnedRadioButton(String text) { super(text); }
+ public SkinnedRadioButton(final String text) { super(text); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2385,20 +2455,21 @@
private static final long serialVersionUID = -1067731457894672601L;
private AbstractButtonSkin<JMenu> skin;
+ @Override
public AbstractButtonSkin<JMenu> getSkin() {
if (skin == null) { skin = new AbstractButtonSkin<JMenu>(); }
return skin;
}
public SkinnedMenu() { super(); }
- public SkinnedMenu(String text) { super(text); }
- public SkinnedMenu(Action a) { super(a); }
+ public SkinnedMenu(final String text) { super(text); }
+ public SkinnedMenu(final Action a) { super(a); }
- public void setIcon(SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
- @Override public void setIcon(Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
+ public void setIcon(final SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
+ @Override public void setIcon(final Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2407,20 +2478,21 @@
private static final long serialVersionUID = 3738616219203986847L;
private AbstractButtonSkin<JMenuItem> skin;
+ @Override
public AbstractButtonSkin<JMenuItem> getSkin() {
if (skin == null) { skin = new AbstractButtonSkin<JMenuItem>(); }
return skin;
}
public SkinnedMenuItem() { super(); }
- public SkinnedMenuItem(String text) { super(text); }
- public SkinnedMenuItem(Action a) { super(a); }
+ public SkinnedMenuItem(final String text) { super(text); }
+ public SkinnedMenuItem(final Action a) { super(a); }
- public void setIcon(SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
- @Override public void setIcon(Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
+ public void setIcon(final SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
+ @Override public void setIcon(final Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2429,20 +2501,21 @@
private static final long serialVersionUID = 7972531296466954594L;
private AbstractButtonSkin<JCheckBoxMenuItem> skin;
+ @Override
public AbstractButtonSkin<JCheckBoxMenuItem> getSkin() {
if (skin == null) { skin = new AbstractButtonSkin<JCheckBoxMenuItem>(); }
return skin;
}
public SkinnedCheckBoxMenuItem() { super(); }
- public SkinnedCheckBoxMenuItem(String text) { super(text); }
- public SkinnedCheckBoxMenuItem(Action a) { super(a); }
+ public SkinnedCheckBoxMenuItem(final String text) { super(text); }
+ public SkinnedCheckBoxMenuItem(final Action a) { super(a); }
- public void setIcon(SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
- @Override public void setIcon(Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
+ public void setIcon(final SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
+ @Override public void setIcon(final Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2451,20 +2524,21 @@
private static final long serialVersionUID = -3609854793671399210L;
private AbstractButtonSkin<JRadioButtonMenuItem> skin;
+ @Override
public AbstractButtonSkin<JRadioButtonMenuItem> getSkin() {
if (skin == null) { skin = new AbstractButtonSkin<JRadioButtonMenuItem>(); }
return skin;
}
public SkinnedRadioButtonMenuItem() { super(); }
- public SkinnedRadioButtonMenuItem(String text) { super(text); }
- public SkinnedRadioButtonMenuItem(Action a) { super(a); }
+ public SkinnedRadioButtonMenuItem(final String text) { super(text); }
+ public SkinnedRadioButtonMenuItem(final Action a) { super(a); }
- public void setIcon(SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
- @Override public void setIcon(Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
+ public void setIcon(final SkinImage skinImage) { getSkin().setIcon(this, skinImage); }
+ @Override public void setIcon(final Icon icon) { getSkin().resetIcon(); super.setIcon(icon); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2473,34 +2547,35 @@
private static final long serialVersionUID = 5133370343400427635L;
private JTextComponentSkin<JTextField> skin;
+ @Override
public JTextComponentSkin<JTextField> getSkin() {
if (skin == null) { skin = new JTextComponentSkin<JTextField>(); }
return skin;
}
public SkinnedTextField() { super(); }
- public SkinnedTextField(String text) { super(text); }
+ public SkinnedTextField(final String text) { super(text); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
- public void setCaretColor(SkinColor skinColor) { getSkin().setCaretColor(this, skinColor); }
- @Override public void setCaretColor(Color color) { getSkin().resetCaretColor(); super.setCaretColor(color); }
+ public void setCaretColor(final SkinColor skinColor) { getSkin().setCaretColor(this, skinColor); }
+ @Override public void setCaretColor(final Color color) { getSkin().resetCaretColor(); super.setCaretColor(color); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2509,6 +2584,7 @@
private static final long serialVersionUID = 1557674285031452868L;
private JTextComponentSkin<JTextField> skin;
+ @Override
public JTextComponentSkin<JTextField> getSkin() {
if (skin == null) { skin = new JTextComponentSkin<JTextField>(); }
return skin;
@@ -2516,26 +2592,26 @@
public SkinnedPasswordField() { super(); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
- public void setCaretColor(SkinColor skinColor) { getSkin().setCaretColor(this, skinColor); }
- @Override public void setCaretColor(Color color) { getSkin().resetCaretColor(); super.setCaretColor(color); }
+ public void setCaretColor(final SkinColor skinColor) { getSkin().setCaretColor(this, skinColor); }
+ @Override public void setCaretColor(final Color color) { getSkin().resetCaretColor(); super.setCaretColor(color); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2544,34 +2620,35 @@
private static final long serialVersionUID = 4191648156716570907L;
private JTextComponentSkin<JTextArea> skin;
+ @Override
public JTextComponentSkin<JTextArea> getSkin() {
if (skin == null) { skin = new JTextComponentSkin<JTextArea>(); }
return skin;
}
public SkinnedTextArea() { super(); }
- public SkinnedTextArea(String text) { super(text); }
+ public SkinnedTextArea(final String text) { super(text); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
- public void setCaretColor(SkinColor skinColor) { getSkin().setCaretColor(this, skinColor); }
- @Override public void setCaretColor(Color color) { getSkin().resetCaretColor(); super.setCaretColor(color); }
+ public void setCaretColor(final SkinColor skinColor) { getSkin().setCaretColor(this, skinColor); }
+ @Override public void setCaretColor(final Color color) { getSkin().resetCaretColor(); super.setCaretColor(color); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2580,6 +2657,7 @@
private static final long serialVersionUID = -209191600467610844L;
private JTextComponentSkin<JTextPane> skin;
+ @Override
public JTextComponentSkin<JTextPane> getSkin() {
if (skin == null) { skin = new JTextComponentSkin<JTextPane>(); }
return skin;
@@ -2587,26 +2665,26 @@
public SkinnedTextPane() { super(); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
- public void setCaretColor(SkinColor skinColor) { getSkin().setCaretColor(this, skinColor); }
- @Override public void setCaretColor(Color color) { getSkin().resetCaretColor(); super.setCaretColor(color); }
+ public void setCaretColor(final SkinColor skinColor) { getSkin().setCaretColor(this, skinColor); }
+ @Override public void setCaretColor(final Color color) { getSkin().resetCaretColor(); super.setCaretColor(color); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2615,6 +2693,7 @@
private static final long serialVersionUID = 88434642461539322L;
private JTextComponentSkin<JEditorPane> skin;
+ @Override
public JTextComponentSkin<JEditorPane> getSkin() {
if (skin == null) { skin = new JTextComponentSkin<JEditorPane>(); }
return skin;
@@ -2622,26 +2701,26 @@
public SkinnedEditorPane() { super(); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
- public void setCaretColor(SkinColor skinColor) { getSkin().setCaretColor(this, skinColor); }
- @Override public void setCaretColor(Color color) { getSkin().resetCaretColor(); super.setCaretColor(color); }
+ public void setCaretColor(final SkinColor skinColor) { getSkin().setCaretColor(this, skinColor); }
+ @Override public void setCaretColor(final Color color) { getSkin().resetCaretColor(); super.setCaretColor(color); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2651,6 +2730,7 @@
//special case to treat as text component
private JTextComponentSkin<JFormattedTextField> skin;
+ @Override
public JTextComponentSkin<JFormattedTextField> getSkin() {
if (skin == null) { skin = new JTextComponentSkin<JFormattedTextField>(); }
return skin;
@@ -2664,7 +2744,7 @@
}
@Override
- public void setEditor(JComponent editor) {
+ public void setEditor(final JComponent editor) {
super.setEditor(editor);
updateTextField();
}
@@ -2673,28 +2753,28 @@
try {
textField = ((JSpinner.NumberEditor)this.getEditor()).getTextField();
}
- catch (Exception ex) {
+ catch (final Exception ex) {
textField = null;
}
}
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(textField, skinColor); }
- @Override public void setForeground(Color color) { if (textField == null) { super.setForeground(color); return; } getSkin().resetForeground(); textField.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(textField, skinColor); }
+ @Override public void setForeground(final Color color) { if (textField == null) { super.setForeground(color); return; } getSkin().resetForeground(); textField.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(textField, skinColor); }
- @Override public void setBackground(Color color) { if (textField == null) { super.setBackground(color); return; } getSkin().resetBackground(); textField.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(textField, skinColor); }
+ @Override public void setBackground(final Color color) { if (textField == null) { super.setBackground(color); return; } getSkin().resetBackground(); textField.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(textField, skinFont); }
- @Override public void setFont(Font font) { if (textField == null) { super.setFont(font); return; } getSkin().resetFont(); textField.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(textField, skinFont); }
+ @Override public void setFont(final Font font) { if (textField == null) { super.setFont(font); return; } getSkin().resetFont(); textField.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(textField, skinCursor); }
- @Override public void setCursor(Cursor cursor) { if (textField == null) { super.setCursor(cursor); return; } getSkin().resetCursor(); textField.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(textField, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { if (textField == null) { super.setCursor(cursor); return; } getSkin().resetCursor(); textField.setCursor(cursor); }
- public void setCaretColor(SkinColor skinColor) { getSkin().setCaretColor(textField, skinColor); }
- public void setCaretColor(Color color) { if (textField == null) { return; } getSkin().resetCaretColor(); textField.setCaretColor(color); }
+ public void setCaretColor(final SkinColor skinColor) { getSkin().setCaretColor(textField, skinColor); }
+ public void setCaretColor(final Color color) { if (textField == null) { return; } getSkin().resetCaretColor(); textField.setCaretColor(color); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(textField);
super.paintComponent(g);
}
@@ -2703,34 +2783,35 @@
private static final long serialVersionUID = -7846549500200072420L;
private JComponentSkin<JSlider> skin;
+ @Override
public JComponentSkin<JSlider> getSkin() {
if (skin == null) { skin = new JComponentSkin<JSlider>(); }
return skin;
}
public SkinnedSlider() { super(); }
- public SkinnedSlider(int orientation) { super(orientation); }
- public SkinnedSlider(int min, int max) { super(min, max); }
- public SkinnedSlider(int min, int max, int value) { super(min, max, value); }
- public SkinnedSlider(int orientation, int min, int max, int value) { super(orientation, min, max, value); }
+ public SkinnedSlider(final int orientation) { super(orientation); }
+ public SkinnedSlider(final int min, final int max) { super(min, max); }
+ public SkinnedSlider(final int min, final int max, final int value) { super(min, max, value); }
+ public SkinnedSlider(final int orientation, final int min, final int max, final int value) { super(orientation, min, max, value); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2739,6 +2820,7 @@
private static final long serialVersionUID = -4194423897092773473L;
private JTableSkin<JTable> skin;
+ @Override
public JTableSkin<JTable> getSkin() {
if (skin == null) { skin = new JTableSkin<JTable>(); }
return skin;
@@ -2746,32 +2828,32 @@
public SkinnedTable() { super(); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
- public void setSelectionForeground(SkinColor skinColor) { getSkin().setSelectionForeground(this, skinColor); }
- @Override public void setSelectionForeground(Color color) { getSkin().resetSelectionForeground(); super.setSelectionForeground(color); }
+ public void setSelectionForeground(final SkinColor skinColor) { getSkin().setSelectionForeground(this, skinColor); }
+ @Override public void setSelectionForeground(final Color color) { getSkin().resetSelectionForeground(); super.setSelectionForeground(color); }
- public void setSelectionBackground(SkinColor skinColor) { getSkin().setSelectionBackground(this, skinColor); }
- @Override public void setSelectionBackground(Color color) { getSkin().resetSelectionBackground(); super.setSelectionBackground(color); }
+ public void setSelectionBackground(final SkinColor skinColor) { getSkin().setSelectionBackground(this, skinColor); }
+ @Override public void setSelectionBackground(final Color color) { getSkin().resetSelectionBackground(); super.setSelectionBackground(color); }
- public void setGridColor(SkinColor skinColor) { getSkin().setGridColor(this, skinColor); }
- @Override public void setGridColor(Color color) { getSkin().resetGridColor(); super.setGridColor(color); }
+ public void setGridColor(final SkinColor skinColor) { getSkin().setGridColor(this, skinColor); }
+ @Override public void setGridColor(final Color color) { getSkin().resetGridColor(); super.setGridColor(color); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
@@ -2780,31 +2862,32 @@
private static final long serialVersionUID = -1842620489613307379L;
private JComponentSkin<JTableHeader> skin;
+ @Override
public JComponentSkin<JTableHeader> getSkin() {
if (skin == null) { skin = new JComponentSkin<JTableHeader>(); }
return skin;
}
public SkinnedTableHeader() { super(); }
- public SkinnedTableHeader(TableColumnModel columnModel0) { super(columnModel0); }
+ public SkinnedTableHeader(final TableColumnModel columnModel0) { super(columnModel0); }
- public void setForeground(SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
- @Override public void setForeground(Color color) { getSkin().resetForeground(); super.setForeground(color); }
+ public void setForeground(final SkinColor skinColor) { getSkin().setForeground(this, skinColor); }
+ @Override public void setForeground(final Color color) { getSkin().resetForeground(); super.setForeground(color); }
- public void setBackground(SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
- @Override public void setBackground(Color color) { getSkin().resetBackground(); super.setBackground(color); }
+ public void setBackground(final SkinColor skinColor) { getSkin().setBackground(this, skinColor); }
+ @Override public void setBackground(final Color color) { getSkin().resetBackground(); super.setBackground(color); }
- public void setFont(SkinFont skinFont) { getSkin().setFont(this, skinFont); }
- @Override public void setFont(Font font) { getSkin().resetFont(); super.setFont(font); }
+ public void setFont(final SkinFont skinFont) { getSkin().setFont(this, skinFont); }
+ @Override public void setFont(final Font font) { getSkin().resetFont(); super.setFont(font); }
- public void setCursor(SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
- @Override public void setCursor(Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
+ public void setCursor(final SkinCursor skinCursor) { getSkin().setCursor(this, skinCursor); }
+ @Override public void setCursor(final Cursor cursor) { getSkin().resetCursor(); super.setCursor(cursor); }
- public void setBorder(SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
- @Override public void setBorder(Border border) { getSkin().resetBorder(); super.setBorder(border); }
+ public void setBorder(final SkinBorder skinBorder) { getSkin().setBorder(this, skinBorder); }
+ @Override public void setBorder(final Border border) { getSkin().resetBorder(); super.setBorder(border); }
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(final Graphics g) {
getSkin().update(this);
super.paintComponent(g);
}
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CStatistics.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CStatistics.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CStatistics.java (revision 29317)
@@ -1,9 +1,12 @@
package forge.screens.deckeditor.controllers;
+import java.util.Map.Entry;
+
+import javax.swing.JLabel;
+
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
-import forge.UiCommand;
import forge.card.CardRules;
import forge.card.CardRulesPredicates;
import forge.card.MagicColor;
@@ -16,14 +19,9 @@
import forge.screens.deckeditor.views.VStatistics;
import forge.util.ItemPool;
-import javax.swing.*;
-
-import java.util.Map.Entry;
-
-
-/**
+/**
* Controls the "analysis" panel in the deck editor UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -33,15 +31,7 @@
//========== Overridden methods
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
@Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
-
- @Override
public void register() {
}
@@ -60,8 +50,8 @@
analyze();
}
- private void setLabelValue(JLabel label, ItemPool<PaperCard> deck, Predicate<CardRules> predicate, int total) {
- int tmp = deck.countAll(Predicates.compose(predicate, PaperCard.FN_GET_RULES));
+ private void setLabelValue(final JLabel label, final ItemPool<PaperCard> deck, final Predicate<CardRules> predicate, final int total) {
+ final int tmp = deck.countAll(Predicates.compose(predicate, PaperCard.FN_GET_RULES));
label.setText(tmp + " (" + calculatePercentage(tmp, total) + "%)");
}
@@ -76,7 +66,7 @@
final ItemPool<PaperCard> deck = ItemPool.createFrom(ed.getDeckManager().getPool(), PaperCard.class);
int total = deck.countAll();
- int[] shardCount = calculateShards(deck);
+ final int[] shardCount = calculateShards(deck);
// Hack-ish: avoid /0 cases, but still populate labels :)
if (total == 0) { total = 1; }
@@ -115,7 +105,7 @@
for (final Entry<PaperCard, Integer> e : deck) {
tmc += e.getKey().getRules().getManaCost().getCMC() * e.getValue();
}
- double amc = Math.round((double) tmc / (double) total * 100) / 100.0d;
+ final double amc = Math.round((double) tmc / (double) total * 100) / 100.0d;
VStatistics.SINGLETON_INSTANCE.getLblTotal().setText("TOTAL CARDS: " + deck.countAll());
VStatistics.SINGLETON_INSTANCE.getLblTMC().setText("TOTAL MANA COST: " + tmc);
@@ -124,7 +114,7 @@
/**
* Divides X by Y, multiplies by 100, rounds, returns.
- *
+ *
* @param x0 &emsp; Numerator (int)
* @param y0 &emsp; Denominator (int)
* @return rounded result (int)
@@ -133,10 +123,10 @@
return (int) Math.round((double) (x0 * 100) / (double) y0);
}
- public static int[] calculateShards(ItemPool<PaperCard> deck) {
- int[] counts = new int[5]; // in WUBRG order
- for (PaperCard c : deck.toFlatList()) {
- int[] cShards = c.getRules().getManaCost().getColorShardCounts();
+ public static int[] calculateShards(final ItemPool<PaperCard> deck) {
+ final int[] counts = new int[5]; // in WUBRG order
+ for (final PaperCard c : deck.toFlatList()) {
+ final int[] cShards = c.getRules().getManaCost().getColorShardCounts();
for (int i = 0; i < 5; i++) {
counts[i] += cShards[i];
}
Index: forge-gui-desktop/src/main/java/forge/gui/GuiUtils.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/GuiUtils.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/GuiUtils.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -35,11 +35,15 @@
* <p>
* GuiUtils class.
* </p>
- *
+ *
* @author Forge
* @version $Id: GuiUtils.java 24769 2014-02-09 13:56:04Z Hellfish $
*/
public final class GuiUtils {
+
+ /**
+ * Private constructor to prevent instantiation.
+ */
private GuiUtils() {
throw new AssertionError();
}
@@ -47,10 +51,9 @@
/**
* Attempts to create a font from a filename. Concise error reported if
* exceptions found.
- *
+ *
* @param filename
- * String
- * @return Font
+ * the name of the font file.
*/
public static Font newFont(final String filename) {
final File file = new File(filename);
@@ -69,7 +72,7 @@
private static final int minItemWidth = 100;
private static final int itemHeight = 25;
- public static void setMenuItemSize(JMenuItem item) {
+ public static void setMenuItemSize(final JMenuItem item) {
item.setPreferredSize(new Dimension(Math.max(item.getPreferredSize().width, minItemWidth), itemHeight));
}
@@ -77,19 +80,19 @@
if (label.startsWith("<html>")) { //adjust label if HTML
label = "<html>" + "<div style='height: " + itemHeight + "px; margin-top: 6px;'>" + label.substring(6, label.length() - 7) + "</div></html>";
}
- JMenu menu = new JMenu(label);
+ final JMenu menu = new JMenu(label);
setMenuItemSize(menu);
return menu;
}
- public static JMenuItem createMenuItem(String label, KeyStroke accelerator, final Runnable onClick, boolean enabled, boolean bold) {
+ public static JMenuItem createMenuItem(String label, final KeyStroke accelerator, final Runnable onClick, final boolean enabled, final boolean bold) {
if (label.startsWith("<html>")) { //adjust label if HTML
- label = "<html>" + "<div style='height: " + itemHeight + "px; margin-top: 6px;'>" + label.substring(6, label.length() - 7) + "</div></html>";
+ label = "<html>" + "<div style='height: " + itemHeight + "px; margin-top: 6px;'>" + label.substring(6, label.length() - 7) + "</div></html>";
}
- JMenuItem item = new JMenuItem(label);
+ final JMenuItem item = new JMenuItem(label);
item.addActionListener(new ActionListener() {
@Override
- public void actionPerformed(ActionEvent arg0) {
+ public void actionPerformed(final ActionEvent arg0) {
if (null != onClick) {
onClick.run();
}
@@ -104,35 +107,35 @@
return item;
}
- public static void addMenuItem(JPopupMenu parent, String label, KeyStroke accelerator, Runnable onClick) {
+ public static void addMenuItem(final JPopupMenu parent, final String label, final KeyStroke accelerator, final Runnable onClick) {
parent.add(createMenuItem(label, accelerator, onClick, true, false));
}
-
+
- public static void addMenuItem(JMenuItem parent, String label, KeyStroke accelerator, Runnable onClick) {
+ public static void addMenuItem(final JMenuItem parent, final String label, final KeyStroke accelerator, final Runnable onClick) {
parent.add(createMenuItem(label, accelerator, onClick, true, false));
}
-
+
- public static void addMenuItem(JPopupMenu parent, String label, KeyStroke accelerator, Runnable onClick, boolean enabled) {
+ public static void addMenuItem(final JPopupMenu parent, final String label, final KeyStroke accelerator, final Runnable onClick, final boolean enabled) {
parent.add(createMenuItem(label, accelerator, onClick, enabled, false));
}
-
+
- public static void addMenuItem(JMenuItem parent, String label, KeyStroke accelerator, Runnable onClick, boolean enabled) {
+ public static void addMenuItem(final JMenuItem parent, final String label, final KeyStroke accelerator, final Runnable onClick, final boolean enabled) {
parent.add(createMenuItem(label, accelerator, onClick, enabled, false));
}
-
+
- public static void addMenuItem(JPopupMenu parent, String label, KeyStroke accelerator, Runnable onClick, boolean enabled, boolean bold) {
+ public static void addMenuItem(final JPopupMenu parent, final String label, final KeyStroke accelerator, final Runnable onClick, final boolean enabled, final boolean bold) {
parent.add(createMenuItem(label, accelerator, onClick, enabled, bold));
}
-
+
- public static void addMenuItem(JMenuItem parent, String label, KeyStroke accelerator, Runnable onClick, boolean enabled, boolean bold) {
+ public static void addMenuItem(final JMenuItem parent, final String label, final KeyStroke accelerator, final Runnable onClick, final boolean enabled, final boolean bold) {
parent.add(createMenuItem(label, accelerator, onClick, enabled, bold));
}
- public static void addSeparator(JPopupMenu parent) {
+ public static void addSeparator(final JPopupMenu parent) {
parent.add(new JSeparator());
}
- public static void addSeparator(JMenuItem parent) {
+ public static void addSeparator(final JMenuItem parent) {
parent.add(new JSeparator());
}
}
Index: forge-gui-mobile/src/forge/screens/settings/FilesPage.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-mobile/src/forge/screens/settings/FilesPage.java (revision 29316)
+++ forge-gui-mobile/src/forge/screens/settings/FilesPage.java (revision 29317)
@@ -142,7 +142,7 @@
@Override
public void select() {
- new GuiDownloader(createService());
+ new GuiDownloader(createService()).show();
}
protected abstract GuiDownloadService createService();
}
Index: forge-gui-desktop/src/main/java/forge/gui/framework/FScreen.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/framework/FScreen.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/framework/FScreen.java (revision 29317)
@@ -23,7 +23,7 @@
import forge.toolbox.FSkin.SkinImage;
import forge.view.FView;
-/**
+/**
* Definitions for Forge screens
*/
public class FScreen {
@@ -81,15 +81,6 @@
"Close Editor",
ForgeConstants.EDITOR_LAYOUT_FILE,
false);
- public static final FScreen DECK_EDITOR_VANGUARD = new FScreen(
- VDeckEditorUI.SINGLETON_INSTANCE,
- CDeckEditorUI.SINGLETON_INSTANCE,
- "Vanguard Deck Editor",
- FSkin.getImage(FSkinProp.IMG_PACK),
- true,
- "Close Editor",
- ForgeConstants.EDITOR_LAYOUT_FILE,
- false);
public static final FScreen DECK_EDITOR_DRAFT = new FScreen(
VDeckEditorUI.SINGLETON_INSTANCE,
CDeckEditorUI.SINGLETON_INSTANCE,
@@ -188,14 +179,14 @@
public static FScreen getMatchScreen(final CMatchUI controller, final VMatchUI view) {
return new FScreen(
- view,
- controller,
- "Game",
- FSkin.getIcon(FSkinProp.ICO_ALPHASTRIKE), //TODO: Create icon for match screen
- true,
- "Concede Game",
- ForgeConstants.MATCH_LAYOUT_FILE,
- true);
+ view,
+ controller,
+ "Game",
+ FSkin.getIcon(FSkinProp.ICO_ALPHASTRIKE), //TODO: Create icon for match screen
+ true,
+ "Concede Game",
+ ForgeConstants.MATCH_LAYOUT_FILE,
+ true);
}
public IVTopLevelUI getView() {
@@ -226,14 +217,14 @@
return closeButtonTooltip;
}
- public boolean onSwitching(FScreen toScreen) {
+ public boolean onSwitching(final FScreen toScreen) {
return view.onSwitching(this, toScreen);
}
-
+
public boolean onClosing() {
return view.onClosing(this);
}
-
+
public FileLocation getLayoutFile() {
return layoutFile;
}
@@ -247,7 +238,7 @@
}
private static boolean deleteLayoutFile(final FileLocation file) {
try {
- File f = new File(file.userPrefLoc);
+ final File f = new File(file.userPrefLoc);
f.delete();
return true;
} catch (final Exception e) {
@@ -255,13 +246,9 @@
FOptionPane.showErrorDialog("Failed to delete layout file.");
}
return false;
-
+
- }
-
- public void open() {
- Singletons.getControl().setCurrentScreen(this);
}
-
+
public void close() {
Singletons.getView().getNavigationBar().closeTab(this);
}
Index: forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemView.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemView.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/itemmanager/views/ItemView.java (revision 29317)
@@ -70,7 +70,7 @@
this.model = model0;
this.scroller = new FScrollPane(false) {
@Override
- protected void processMouseWheelEvent(MouseWheelEvent e) {
+ protected void processMouseWheelEvent(final MouseWheelEvent e) {
if (e.isControlDown()) {
onMouseWheelZoom(e);
return;
@@ -81,9 +81,13 @@
this.pnlOptions.setOpaque(false);
this.pnlOptions.setBorder(new FSkin.MatteSkinBorder(1, 0, 0, 0, BORDER_COLOR));
this.scroller.setBorder(new FSkin.LineSkinBorder(BORDER_COLOR));
- this.button = new FLabel.Builder().hoverable().selectable(true)
- .icon(getIcon()).iconScaleAuto(false)
- .tooltip(getCaption()).build();
+ this.button = new FLabel.Builder()
+ .hoverable()
+ .selectable(true)
+ .icon(getIcon())
+ .iconScaleAuto(false)
+ .tooltip(getCaption())
+ .build();
}
public void initialize(final int index) {
@@ -92,16 +96,14 @@
//hook incremental search functionality
final IncrementalSearch incrementalSearch = new IncrementalSearch();
comp.addFocusListener(new FocusAdapter() {
- @Override
- public void focusLost(FocusEvent arg0) {
+ @Override public void focusLost(final FocusEvent arg0) {
incrementalSearch.cancel();
}
});
comp.addKeyListener(incrementalSearch);
this.button.setCommand(new Runnable() {
- @Override
- public void run() {
+ @Override public void run() {
if (button.isSelected()) {
itemManager.setViewIndex(index);
}
@@ -114,11 +116,10 @@
this.scroller.setViewportView(comp);
this.scroller.getVerticalScrollBar().addAdjustmentListener(new ToolTipListener());
this.scroller.addComponentListener(new ComponentAdapter() {
- @Override
- public void componentResized(ComponentEvent e) {
+ @Override public void componentResized(final ComponentEvent e) {
onResize();
//scroll selection into view whenever view height changes
- int height = e.getComponent().getHeight();
+ final int height = e.getComponent().getHeight();
if (height != heightBackup) {
heightBackup = height;
scrollSelectionIntoView();
@@ -143,11 +144,11 @@
return scroller.getVerticalScrollBar().getValue();
}
- public void setScrollValue(int value) {
+ public void setScrollValue(final int value) {
scroller.getVerticalScrollBar().setValue(value);
}
- protected void onMouseWheelZoom(MouseWheelEvent e) {
+ protected void onMouseWheelZoom(final MouseWheelEvent e) {
}
public boolean isIncrementalSearchActive() {
@@ -178,9 +179,9 @@
}
public final Collection<T> getSelectedItems() {
- List<T> items = new ArrayList<T>();
- for (Integer i : getSelectedIndices()) {
- T item = getItemAtIndex(i);
+ final List<T> items = new ArrayList<T>();
+ for (final Integer i : getSelectedIndices()) {
+ final T item = getItemAtIndex(i);
if (item != null) {
items.add(item);
}
@@ -188,11 +189,11 @@
return items;
}
- public final boolean setSelectedItem(T item) {
+ public final boolean setSelectedItem(final T item) {
return setSelectedItem(item, true);
}
- public final boolean setSelectedItem(T item, boolean scrollIntoView) {
- int index = getIndexOfItem(item);
+ public final boolean setSelectedItem(final T item, final boolean scrollIntoView) {
+ final int index = getIndexOfItem(item);
if (index != -1) {
setSelectedIndex(index, scrollIntoView);
return true;
@@ -200,13 +201,13 @@
return false;
}
- public final boolean setSelectedItems(Iterable<T> items) {
+ public final boolean setSelectedItems(final Iterable<T> items) {
return setSelectedItems(items, true);
}
- public final boolean setSelectedItems(Iterable<T> items, boolean scrollIntoView) {
- List<Integer> indices = new ArrayList<Integer>();
- for (T item : items) {
- int index = getIndexOfItem(item);
+ public final boolean setSelectedItems(final Iterable<T> items, final boolean scrollIntoView) {
+ final List<Integer> indices = new ArrayList<Integer>();
+ for (final T item : items) {
+ final int index = getIndexOfItem(item);
if (index != -1) {
indices.add(index);
}
@@ -221,11 +222,11 @@
return false;
}
- public void setSelectedIndex(int index) {
+ public void setSelectedIndex(final int index) {
setSelectedIndex(index, true);
}
- public void setSelectedIndex(int index, boolean scrollIntoView) {
- int count = getCount();
+ public void setSelectedIndex(int index, final boolean scrollIntoView) {
+ final int count = getCount();
if (count == 0) { return; }
if (index < 0) {
@@ -241,22 +242,22 @@
}
}
- public void setSelectedIndices(Iterable<Integer> indices) {
+ public void setSelectedIndices(final Iterable<Integer> indices) {
setSelectedIndices(indices, true);
}
- public void setSelectedIndices(Iterable<Integer> indices, boolean scrollIntoView) {
- int count = getCount();
+ public void setSelectedIndices(final Iterable<Integer> indices, final boolean scrollIntoView) {
+ final int count = getCount();
if (count == 0) { return; }
- List<Integer> indexList = new ArrayList<Integer>();
- for (Integer index : indices) {
+ final List<Integer> indexList = new ArrayList<Integer>();
+ for (final Integer index : indices) {
if (index >= 0 && index < count) {
indexList.add(index);
}
}
if (indexList.isEmpty()) { //if no index in range, set selected index based on first index
- for (Integer index : indices) {
+ for (final Integer index : indices) {
setSelectedIndex(index);
return;
}
@@ -272,15 +273,15 @@
protected void onSelectionChange() {
final int index = getSelectedIndex();
if (index != -1) {
- ListSelectionEvent event = new ListSelectionEvent(itemManager, index, index, false);
- for (ListSelectionListener listener : itemManager.getSelectionListeners()) {
+ final ListSelectionEvent event = new ListSelectionEvent(itemManager, index, index, false);
+ for (final ListSelectionListener listener : itemManager.getSelectionListeners()) {
listener.valueChanged(event);
}
}
}
public void scrollSelectionIntoView() {
- Container parent = getComponent().getParent();
+ final Container parent = getComponent().getParent();
if (parent instanceof JViewport) {
onScrollSelectionIntoView((JViewport)parent);
}
@@ -334,13 +335,13 @@
private void setPopupSize() {
// resize popup to size of label (ensure there's room for the next character so the label
// doesn't show '...' in the time between when we set the text and when we increase the size
- Dimension labelDimension = popupLabel.getPreferredSize();
- Dimension popupDimension = new Dimension(labelDimension.width + 12, labelDimension.height + 4);
+ final Dimension labelDimension = popupLabel.getPreferredSize();
+ final Dimension popupDimension = new Dimension(labelDimension.width + 12, labelDimension.height + 4);
SwingUtilities.getRoot(popupLabel).setSize(popupDimension);
}
- private void findNextMatch(int startIdx, boolean reverse) {
- int numItems = itemManager.getItemCount();
+ private void findNextMatch(int startIdx, final boolean reverse) {
+ final int numItems = itemManager.getItemCount();
if (0 == numItems) {
cancel();
return;
@@ -349,11 +350,11 @@
// find the next item that matches the string
startIdx %= numItems;
final int increment = reverse ? numItems - 1 : 1;
- int stopIdx = (startIdx + numItems - increment) % numItems;
- String searchStr = str.toString();
+ final int stopIdx = (startIdx + numItems - increment) % numItems;
+ final String searchStr = str.toString();
boolean found = false;
for (int idx = startIdx;; idx = (idx + increment) % numItems) {
- T item = ItemView.this.getItemAtIndex(idx);
+ final T item = ItemView.this.getItemAtIndex(idx);
if (item == null) {
break;
}
@@ -388,14 +389,13 @@
popupTimer.restart();
}
else {
- PopupFactory factory = PopupFactory.getSharedInstance();
- Point tableLoc = ItemView.this.getLocationOnScreen();
+ final PopupFactory factory = PopupFactory.getSharedInstance();
+ final Point tableLoc = ItemView.this.getLocationOnScreen();
popup = factory.getPopup(null, popupLabel, tableLoc.x + 10, tableLoc.y + 10);
FSkin.setTempBackground(SwingUtilities.getRoot(popupLabel), FSkin.getColor(FSkin.Colors.CLR_INACTIVE));
popupTimer = new Timer(5000, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
+ @Override public void actionPerformed(final ActionEvent e) {
cancel();
}
});
@@ -424,14 +424,14 @@
}
@Override
- public void keyPressed(KeyEvent e) {
+ public void keyPressed(final KeyEvent e) {
if (popupShowing) {
if (KeyEvent.VK_ESCAPE == e.getKeyCode()) {
cancel();
}
}
else {
- for (KeyListener keyListener : itemManager.getKeyListeners()) {
+ for (final KeyListener keyListener : itemManager.getKeyListeners()) {
keyListener.keyPressed(e);
if (e.isConsumed()) { return; }
}
@@ -445,9 +445,9 @@
}
@Override
- public void keyTyped(KeyEvent e) {
+ public void keyTyped(final KeyEvent e) {
if (!popupShowing) {
- for (KeyListener keyListener : itemManager.getKeyListeners()) {
+ for (final KeyListener keyListener : itemManager.getKeyListeners()) {
keyListener.keyTyped(e);
if (e.isConsumed()) { return; }
}
@@ -478,11 +478,11 @@
return;
}
- //$FALL-THROUGH$
+ //$FALL-THROUGH$
default:
// shift and/or alt-graph down is ok. anything else is a hotkey (e.g. ctrl-f)
if (okModifiers != (e.getModifiers() | okModifiers)
- || !CharUtils.isAsciiPrintable(e.getKeyChar())) { // escape sneaks in here on Windows
+ || !CharUtils.isAsciiPrintable(e.getKeyChar())) { // escape sneaks in here on Windows
return;
}
str.append(e.getKeyChar());
@@ -492,9 +492,9 @@
}
@Override
- public void keyReleased(KeyEvent e) {
+ public void keyReleased(final KeyEvent e) {
if (!popupShowing) {
- for (KeyListener keyListener : itemManager.getKeyListeners()) {
+ for (final KeyListener keyListener : itemManager.getKeyListeners()) {
keyListener.keyReleased(e);
if (e.isConsumed()) { return; }
}
Index: forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/QuickGauntletLister.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/QuickGauntletLister.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/gauntlet/QuickGauntletLister.java (revision 29317)
@@ -1,5 +1,18 @@
package forge.screens.home.gauntlet;
+import java.awt.Color;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.Border;
+
+import net.miginfocom.swing.MigLayout;
import forge.UiCommand;
import forge.assets.FSkinProp;
import forge.gauntlet.GauntletData;
@@ -12,26 +25,13 @@
import forge.toolbox.FSkin.SkinIcon;
import forge.toolbox.FSkin.SkinnedButton;
import forge.toolbox.FSkin.SkinnedPanel;
-import net.miginfocom.swing.MigLayout;
-import javax.swing.*;
-import javax.swing.border.Border;
-
-import java.awt.*;
-import java.awt.event.MouseEvent;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-/**
+/**
* Creates file list/table for quick deleting, editing, and basic info.
- *
*/
@SuppressWarnings("serial")
public class QuickGauntletLister extends JPanel {
- private SkinIcon icoDelete, icoDeleteOver, icoEdit, icoEditOver;
+ private final SkinIcon icoDelete, icoDeleteOver, icoEdit, icoEditOver;
private RowPanel previousSelect;
private RowPanel[] rows;
private UiCommand cmdRowSelect, cmdRowDelete, cmdRowActivate;
@@ -39,7 +39,6 @@
private final FSkin.SkinColor clrHover, clrActive, clrBorders;
private List<GauntletData> gauntlets;
- /** */
public QuickGauntletLister() {
super();
@@ -57,17 +56,16 @@
icoEditOver = FSkin.getIcon(FSkinProp.ICO_EDIT_OVER);
}
- /** @param gd0 &emsp; {@link forge.gauntlet.GauntletData}[] */
- public void setGauntlets(List<GauntletData> gd0) {
+ public void setGauntlets(final List<GauntletData> gd0) {
gauntlets = gd0;
refresh();
}
public void refresh() {
this.removeAll();
- List<RowPanel> tempRows = new ArrayList<RowPanel>();
- List<GauntletData> sorted = new ArrayList<GauntletData>();
- for (GauntletData gd : gauntlets) { sorted.add(gd); }
+ final List<RowPanel> tempRows = new ArrayList<RowPanel>();
+ final List<GauntletData> sorted = new ArrayList<GauntletData>();
+ for (final GauntletData gd : gauntlets) { sorted.add(gd); }
Collections.sort(sorted, new Comparator<GauntletData>() {
@Override
public int compare(final GauntletData x, final GauntletData y) {
@@ -95,7 +93,7 @@
RowPanel row;
String name;
- for (GauntletData gd : sorted) {
+ for (final GauntletData gd : sorted) {
name = gd.getName();
row = new RowPanel(gd);
@@ -124,7 +122,6 @@
revalidate();
}
- /** @return {@link forge.deck.Deck} */
public File getSelectedGauntletFile() {
if (previousSelect == null) {
return null;
@@ -149,21 +146,21 @@
this.addMouseListener(new FMouseAdapter() {
@Override
- public void onMouseEnter(MouseEvent e) {
+ public void onMouseEnter(final MouseEvent e) {
if (!r0.selected) {
r0.setBackground(clrHover);
r0.setOpaque(true);
}
}
@Override
- public void onMouseExit(MouseEvent e) {
+ public void onMouseExit(final MouseEvent e) {
if (!r0.selected) {
r0.setBackground(clrDefault);
r0.setOpaque(false);
}
}
@Override
- public void onLeftClick(MouseEvent e) {
+ public void onLeftClick(final MouseEvent e) {
deleteFile(r0);
}
});
@@ -185,21 +182,21 @@
this.addMouseListener(new FMouseAdapter() {
@Override
- public void onMouseEnter(MouseEvent e) {
+ public void onMouseEnter(final MouseEvent e) {
if (!r0.selected) {
r0.setBackground(clrHover);
r0.setOpaque(true);
}
}
@Override
- public void onMouseExit(MouseEvent e) {
+ public void onMouseExit(final MouseEvent e) {
if (!r0.selected) {
r0.setBackground(clrDefault);
r0.setOpaque(false);
}
}
@Override
- public void onLeftClick(MouseEvent e) {
+ public void onLeftClick(final MouseEvent e) {
renameGauntlet(r0.getGauntletData());
}
});
@@ -209,9 +206,9 @@
private class RowPanel extends SkinnedPanel {
private boolean selected = false;
private boolean hovered = false;
- private GauntletData gauntletData;
+ private final GauntletData gauntletData;
- public RowPanel(GauntletData gd0) {
+ public RowPanel(final GauntletData gd0) {
super();
setOpaque(false);
setBackground(new Color(0, 0, 0, 0));
@@ -267,7 +264,6 @@
}
}
- /** @return {@link java.lang.Integer} */
public int getSelectedIndex() {
for (int i = 0; i < rows.length; i++) {
if (rows[i].isSelected()) { return i; }
@@ -279,42 +275,28 @@
* @param i0 &emsp; int
* @return boolean success
*/
- public boolean setSelectedIndex(int i0) {
+ public boolean setSelectedIndex(final int i0) {
if (i0 >= rows.length) { return false; }
selectHandler(rows[Math.max(0, i0)]);
return true;
}
- /**
- * @param qd0 &emsp; Gauntlet data object to select (if exists in list)
- * @return boolean success
- */
- public boolean setSelectedGauntletData(GauntletData qd0) {
- /*for (RowPanel r : rows) {
- if (r.getQuestData().getName().equals(qd0.getName())) {
- selectHandler(r);
- return true;
- }
- }*/
- return false;
- }
-
/** @param c0 &emsp; {@link forge.UiCommand} command executed on row select. */
- public void setCmdSelect(UiCommand c0) {
+ public void setCmdSelect(final UiCommand c0) {
this.cmdRowSelect = c0;
}
/** @param c0 &emsp; {@link forge.UiCommand} command executed on row delete. */
- public void setCmdDelete(UiCommand c0) {
+ public void setCmdDelete(final UiCommand c0) {
this.cmdRowDelete = c0;
}
/** @param c0 &emsp; {@link forge.UiCommand} command executed on row activate. */
- public void setCmdActivate(UiCommand c0) {
+ public void setCmdActivate(final UiCommand c0) {
this.cmdRowActivate = c0;
}
- private void selectHandler(RowPanel r0) {
+ private void selectHandler(final RowPanel r0) {
if (previousSelect != null) {
previousSelect.setSelected(false);
}
@@ -324,9 +306,9 @@
if (cmdRowSelect != null) { cmdRowSelect.run(); }
}
- private void renameGauntlet(GauntletData gauntlet) {
+ private void renameGauntlet(final GauntletData gauntlet) {
String gauntletName;
- String oldGauntletName = gauntlet.getName();
+ final String oldGauntletName = gauntlet.getName();
while (true) {
gauntletName = FOptionPane.showInputDialog("Rename gauntlet to:", "Gauntlet Rename", null, oldGauntletName);
if (gauntletName == null) { return; }
@@ -340,7 +322,7 @@
}
boolean exists = false;
- for (RowPanel r : rows) {
+ for (final RowPanel r : rows) {
if (r.getGauntletData().getName().equalsIgnoreCase(gauntletName)) {
exists = true;
break;
@@ -357,7 +339,7 @@
refresh();
}
- private void deleteFile(RowPanel r0) {
+ private void deleteFile(final RowPanel r0) {
final GauntletData gd = r0.getGauntletData();
if (!FOptionPane.showConfirmDialog(
Index: forge-gui-desktop/src/main/java/forge/screens/home/quest/CSubmenuQuestDraft.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/quest/CSubmenuQuestDraft.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/quest/CSubmenuQuestDraft.java (revision 29317)
@@ -23,7 +23,6 @@
import forge.gui.CardListChooser;
import forge.gui.CardListViewer;
import forge.gui.GuiChoose;
-import forge.gui.framework.EDocID;
import forge.gui.framework.FScreen;
import forge.gui.framework.ICDoc;
import forge.interfaces.IGuiGame;
@@ -34,7 +33,6 @@
import forge.model.CardBlock;
import forge.model.FModel;
import forge.properties.ForgePreferences.FPref;
-import forge.quest.QuestController;
import forge.quest.QuestDraftUtils;
import forge.quest.QuestEventDraft;
import forge.quest.QuestUtil;
@@ -43,7 +41,6 @@
import forge.screens.deckeditor.controllers.CEditorQuestDraftingProcess;
import forge.screens.deckeditor.controllers.CEditorQuestLimited;
import forge.screens.deckeditor.views.VCurrentDeck;
-import forge.screens.home.CHomeUI;
import forge.screens.home.quest.VSubmenuQuestDraft.Mode;
import forge.screens.home.sanctioned.CSubmenuDraft;
import forge.screens.match.controllers.CDetailPicture;
@@ -52,255 +49,259 @@
import forge.toolbox.FSkin.SkinImage;
import forge.toolbox.JXButtonPanel;
-/**
+/**
* Controls the quest draft submenu in the home UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
public enum CSubmenuQuestDraft implements ICDoc {
-
SINGLETON_INSTANCE;
-
+
private static final DecimalFormat NUMBER_FORMATTER = new DecimalFormat("#,###");
-
+
private boolean drafting = false;
private IGuiGame gui = null;
@Override
public void register() {
}
-
+
@SuppressWarnings("serial")
@Override
public void initialize() {
final VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
-
+
view.getBtnStartDraft().addActionListener(selectTournamentStart);
view.getBtnStartTournament().addActionListener(prepareDeckStart);
view.getBtnStartMatch().addActionListener(nextMatchStart);
-
+
- view.getBtnStartMatchSmall().setCommand(
- new UiCommand() { @Override
- public void run() { CSubmenuQuestDraft.this.startNextMatch(); } });
+ view.getBtnStartMatchSmall().setCommand(new UiCommand() {
+ @Override public void run() {
+ CSubmenuQuestDraft.this.startNextMatch();
+ }
+ });
+ view.getBtnSpendToken().setCommand(new UiCommand() {
+ @Override public void run() {
+ CSubmenuQuestDraft.this.spendToken();
+ }
+ });
+ view.getBtnEditDeck().setCommand(new UiCommand() {
+ @Override public void run() {
+ CSubmenuQuestDraft.this.editDeck();
+ }
+ });
+ view.getBtnLeaveTournament().setCommand(new UiCommand() {
+ @Override public void run() {
+ CSubmenuQuestDraft.this.endTournamentAndAwardPrizes();
+ }
+ });
-
+
- view.getBtnSpendToken().setCommand(
- new UiCommand() { @Override
- public void run() { CSubmenuQuestDraft.this.spendToken(); } });
-
- view.getBtnEditDeck().setCommand(
- new UiCommand() { @Override
- public void run() { CSubmenuQuestDraft.this.editDeck(); } });
-
- view.getBtnLeaveTournament().setCommand(
- new UiCommand() { @Override
- public void run() { CSubmenuQuestDraft.this.endTournamentAndAwardPrizes(); } });
-
- QuestAchievements achievements = FModel.getQuest().getAchievements();
+ final QuestAchievements achievements = FModel.getQuest().getAchievements();
FModel.getQuest().getDraftDecks();
-
+
if (achievements == null) {
-
+
view.setMode(Mode.EMPTY);
-
+
} else if (achievements.getDraftEvents() == null || achievements.getDraftEvents().isEmpty()) {
-
+
achievements.generateDrafts();
-
+
if (achievements.getDraftEvents().isEmpty()) {
view.setMode(Mode.EMPTY);
} else {
view.setMode(Mode.SELECT_TOURNAMENT);
}
-
+
} else if (FModel.getQuest().getDraftDecks() == null || !FModel.getQuest().getDraftDecks().contains(QuestEventDraft.DECK_NAME)) {
- achievements.generateDrafts();
+ achievements.generateDrafts();
view.setMode(Mode.SELECT_TOURNAMENT);
-
+
} else if (!achievements.getCurrentDraft().isStarted()) {
-
+
view.setMode(Mode.PREPARE_DECK);
-
+
} else {
-
+
view.setMode(Mode.TOURNAMENT_ACTIVE);
-
+
}
-
+
}
private void endTournamentAndAwardPrizes() {
- QuestEventDraft draft = FModel.getQuest().getAchievements().getCurrentDraft();
+ final QuestEventDraft draft = FModel.getQuest().getAchievements().getCurrentDraft();
-
+
if (!draft.isStarted()) {
-
+
- boolean shouldQuit = FOptionPane.showOptionDialog("If you leave now, this tournament will be forever gone."
+ final boolean shouldQuit = FOptionPane.showOptionDialog("If you leave now, this tournament will be forever gone."
+ "\nYou will keep the cards you drafted, but will receive no other prizes."
+ "\n\nWould you still like to quit the tournament?", "Really Quit?", FSkin.getImage(FSkinProp.ICO_WARNING).scale(2.0), new String[] { "Yes", "No" }, 1) == 0;
if (!shouldQuit) {
return;
}
-
+
} else {
-
+
if (draft.playerHasMatchesLeft()) {
- boolean shouldQuit = FOptionPane.showOptionDialog("You have matches left to play!\nLeaving the tournament early will forfeit your potential future winnings."
+ final boolean shouldQuit = FOptionPane.showOptionDialog("You have matches left to play!\nLeaving the tournament early will forfeit your potential future winnings."
+ "\nYou will still receive winnings as if you conceded your next match and you will keep the cards you drafted."
+ "\n\nWould you still like to quit the tournament?", "Really Quit?", FSkin.getImage(FSkinProp.ICO_WARNING).scale(2.0), new String[] { "Yes", "No" }, 1) == 0;
if (!shouldQuit) {
return;
}
}
-
+
- String placement = draft.getPlacementString();
+ final String placement = draft.getPlacementString();
-
+
- QuestEventDraft.QuestDraftPrizes prizes = draft.collectPrizes();
+ final QuestEventDraft.QuestDraftPrizes prizes = draft.collectPrizes();
-
+
if (prizes.hasCredits()) {
FOptionPane.showMessageDialog("For placing " + placement + ", you have been awarded " + prizes.credits + " credits!", "Credits Awarded", FSkin.getImage(FSkinProp.ICO_QUEST_GOLD));
}
-
+
if (prizes.hasIndividualCards()) {
- final CardListViewer c = new CardListViewer("Tournament Reward", "For participating in the tournament, you have been awarded the following promotional card:", prizes.individualCards);
- c.setVisible(true);
- c.dispose();
+ final CardListViewer c = new CardListViewer("Tournament Reward", "For participating in the tournament, you have been awarded the following promotional card:", prizes.individualCards);
+ c.setVisible(true);
+ c.dispose();
}
-
+
if (prizes.hasBoosterPacks()) {
-
+
- String packPlural = (prizes.boosterPacks.size() == 1) ? "" : "s";
+ final String packPlural = (prizes.boosterPacks.size() == 1) ? "" : "s";
-
- FOptionPane.showMessageDialog("For placing " + placement + ", you have been awarded " + prizes.boosterPacks.size() + " booster pack" + packPlural + "!", "Booster Pack" + packPlural + " Awarded", FSkin.getImage(FSkinProp.ICO_QUEST_BOX));
-
- if (FModel.getPreferences().getPrefBoolean(FPref.UI_OPEN_PACKS_INDIV) && prizes.boosterPacks.size() > 1) {
-
- boolean skipTheRest = false;
+
+ FOptionPane.showMessageDialog("For placing " + placement + ", you have been awarded " + prizes.boosterPacks.size() + " booster pack" + packPlural + "!", "Booster Pack" + packPlural + " Awarded", FSkin.getImage(FSkinProp.ICO_QUEST_BOX));
+
+ if (FModel.getPreferences().getPrefBoolean(FPref.UI_OPEN_PACKS_INDIV) && prizes.boosterPacks.size() > 1) {
+
+ boolean skipTheRest = false;
- List<PaperCard> remainingCards = new ArrayList<>();
- int totalPacks = prizes.boosterPacks.size();
+ final List<PaperCard> remainingCards = new ArrayList<>();
+ final int totalPacks = prizes.boosterPacks.size();
- int currentPack = 0;
-
- while (prizes.boosterPacks.size() > 0) {
-
+ int currentPack = 0;
+
+ while (prizes.boosterPacks.size() > 0) {
+
- BoosterPack pack = prizes.boosterPacks.remove(0);
+ final BoosterPack pack = prizes.boosterPacks.remove(0);
- currentPack++;
-
- if (skipTheRest) {
- remainingCards.addAll(pack.getCards());
- continue;
- }
-
- final BoxedProductCardListViewer c = new BoxedProductCardListViewer(pack.getName(), "You have found the following cards inside (Booster Pack " + currentPack + " of " + totalPacks + "):", pack.getCards());
- c.setVisible(true);
- c.dispose();
- skipTheRest = c.skipTheRest();
-
- }
-
- if (skipTheRest && !remainingCards.isEmpty()) {
- final CardListViewer c = new CardListViewer("Tournament Reward", "You have found the following cards inside:", remainingCards);
- c.setVisible(true);
- c.dispose();
- }
-
- } else {
-
+ currentPack++;
+
+ if (skipTheRest) {
+ remainingCards.addAll(pack.getCards());
+ continue;
+ }
+
+ final BoxedProductCardListViewer c = new BoxedProductCardListViewer(pack.getName(), "You have found the following cards inside (Booster Pack " + currentPack + " of " + totalPacks + "):", pack.getCards());
+ c.setVisible(true);
+ c.dispose();
+ skipTheRest = c.skipTheRest();
+
+ }
+
+ if (skipTheRest && !remainingCards.isEmpty()) {
+ final CardListViewer c = new CardListViewer("Tournament Reward", "You have found the following cards inside:", remainingCards);
+ c.setVisible(true);
+ c.dispose();
+ }
+
+ } else {
+
- List<PaperCard> cards = new ArrayList<>();
+ final List<PaperCard> cards = new ArrayList<>();
-
- while (prizes.boosterPacks.size() > 0) {
+
+ while (prizes.boosterPacks.size() > 0) {
- BoosterPack pack = prizes.boosterPacks.remove(0);
+ final BoosterPack pack = prizes.boosterPacks.remove(0);
- cards.addAll(pack.getCards());
- }
-
- final CardListViewer c = new CardListViewer("Tournament Reward", "You have found the following cards inside:", cards);
- c.setVisible(true);
- c.dispose();
-
- }
-
+ cards.addAll(pack.getCards());
+ }
+
+ final CardListViewer c = new CardListViewer("Tournament Reward", "You have found the following cards inside:", cards);
+ c.setVisible(true);
+ c.dispose();
+
+ }
+
}
-
+
if (prizes.selectRareFromSets()) {
-
+
FOptionPane.showMessageDialog("For placing " + placement + ", you may select a rare or mythic rare card from the drafted block.", "Rare Awarded", FSkin.getImage(FSkinProp.ICO_QUEST_STAKES));
- CardListChooser cardListChooser = new CardListChooser("Select a Card", "Select a card to keep:", prizes.selectRareCards);
+ final CardListChooser cardListChooser = new CardListChooser("Select a Card", "Select a card to keep:", prizes.selectRareCards);
cardListChooser.setVisible(true);
cardListChooser.dispose();
prizes.addSelectedCard(cardListChooser.getSelectedCard());
-
+
FOptionPane.showMessageDialog("'" + cardListChooser.getSelectedCard().getName() + "' has been added to your collection!", "Card Added", FSkin.getImage(FSkinProp.ICO_QUEST_STAKES));
-
+
}
-
+
if (draft.getPlayerPlacement() == 1) {
FOptionPane.showMessageDialog("For placing " + placement + ", you have been awarded a token!\nUse tokens to create new drafts to play.", "Bonus Token", FSkin.getImage(FSkinProp.ICO_QUEST_NOTES));
FModel.getQuest().getAchievements().addDraftToken();
}
-
+
}
-
+
- boolean saveDraft = FOptionPane.showOptionDialog("Would you like to save this draft to the regular draft mode?", "Save Draft?", FSkin.getImage(FSkinProp.ICO_QUESTION).scale(2.0), new String[] { "Yes", "No" }, 0) == 0;
+ final boolean saveDraft = FOptionPane.showOptionDialog("Would you like to save this draft to the regular draft mode?", "Save Draft?", FSkin.getImage(FSkinProp.ICO_QUESTION).scale(2.0), new String[] { "Yes", "No" }, 0) == 0;
-
+
if (saveDraft) {
draft.saveToRegularDraft();
CSubmenuDraft.SINGLETON_INSTANCE.update();
}
-
+
draft.addToQuestDecks();
-
+
- VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
+ final VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
CSubmenuQuestDraft.SINGLETON_INSTANCE.update();
view.populate();
-
+
}
-
-
-
+
+
+
private final ActionListener selectTournamentStart = new ActionListener() {
@Override
- public void actionPerformed(ActionEvent event) {
+ public void actionPerformed(final ActionEvent event) {
CSubmenuQuestDraft.this.startDraft();
}
};
-
+
private final ActionListener prepareDeckStart = new ActionListener() {
@Override
- public void actionPerformed(ActionEvent event) {
+ public void actionPerformed(final ActionEvent event) {
CSubmenuQuestDraft.this.startTournament();
}
};
-
+
private final ActionListener nextMatchStart = new ActionListener() {
@Override
- public void actionPerformed(ActionEvent event) {
+ public void actionPerformed(final ActionEvent event) {
CSubmenuQuestDraft.this.startNextMatch();
}
};
private final KeyAdapter startOnEnter = new KeyAdapter() {
@Override
- public void keyPressed(KeyEvent e) {
+ public void keyPressed(final KeyEvent e) {
if (KeyEvent.VK_ENTER == e.getKeyChar()) {
VSubmenuQuestDraft.SINGLETON_INSTANCE.getBtnStartDraft().doClick();
}
}
};
-
+
private final MouseAdapter startOnDblClick = new MouseAdapter() {
@Override
- public void mouseClicked(MouseEvent e) {
+ public void mouseClicked(final MouseEvent e) {
if (MouseEvent.BUTTON1 == e.getButton() && 2 == e.getClickCount()) {
VSubmenuQuestDraft.SINGLETON_INSTANCE.getBtnStartDraft().doClick();
}
}
};
-
+
private void spendToken() {
-
+
- QuestAchievements achievements = FModel.getQuest().getAchievements();
+ final QuestAchievements achievements = FModel.getQuest().getAchievements();
-
+
if (achievements != null) {
final CardBlock block = GuiChoose.oneOrNone("Choose Draft Format", QuestEventDraft.getAvailableBlocks(FModel.getQuest()));
@@ -313,82 +314,82 @@
VSubmenuQuestDraft.SINGLETON_INSTANCE.populate();
}
-
+
}
-
+
}
-
+
@Override
public void update() {
-
+
- VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
+ final VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
-
+
if (FModel.getQuest().getAchievements() == null) {
view.setMode(Mode.EMPTY);
return;
}
-
+
- QuestAchievements achievements = FModel.getQuest().getAchievements();
+ final QuestAchievements achievements = FModel.getQuest().getAchievements();
achievements.generateDrafts();
-
+
if (FModel.getQuest().getAchievements().getDraftEvents().isEmpty()) {
view.setMode(Mode.EMPTY);
updatePlacementLabelsText();
return;
}
-
+
if ((FModel.getQuest().getDraftDecks() == null
- || !FModel.getQuest().getDraftDecks().contains(QuestEventDraft.DECK_NAME)
- || FModel.getQuest().getAchievements().getCurrentDraftIndex() == -1)) {
+ || !FModel.getQuest().getDraftDecks().contains(QuestEventDraft.DECK_NAME)
+ || FModel.getQuest().getAchievements().getCurrentDraftIndex() == -1)) {
view.setMode(Mode.SELECT_TOURNAMENT);
} else if (!FModel.getQuest().getAchievements().getCurrentDraft().isStarted()) {
view.setMode(Mode.PREPARE_DECK);
} else {
view.setMode(Mode.TOURNAMENT_ACTIVE);
}
-
+
QuestDraftUtils.update(gui);
-
+
switch (view.getMode()) {
-
- case SELECT_TOURNAMENT:
- updateSelectTournament();
- break;
-
- case PREPARE_DECK:
- updatePrepareDeck();
- break;
-
- case TOURNAMENT_ACTIVE:
- updateTournamentActive();
- break;
-
- default:
- break;
-
+
+ case SELECT_TOURNAMENT:
+ updateSelectTournament();
+ break;
+
+ case PREPARE_DECK:
+ updatePrepareDeck();
+ break;
+
+ case TOURNAMENT_ACTIVE:
+ updateTournamentActive();
+ break;
+
+ default:
+ break;
+
}
-
+
}
-
+
private void updateSelectTournament() {
-
+
- VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
+ final VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
view.getLblCredits().setText("Available Credits: " + NUMBER_FORMATTER.format(FModel.getQuest().getAssets().getCredits()));
-
+
- QuestAchievements achievements = FModel.getQuest().getAchievements();
+ final QuestAchievements achievements = FModel.getQuest().getAchievements();
achievements.generateDrafts();
view.getPnlTournaments().removeAll();
- JXButtonPanel grpPanel = new JXButtonPanel();
+ final JXButtonPanel grpPanel = new JXButtonPanel();
-
+
boolean firstPanel = true;
-
+
- for (QuestEventDraft draft : FModel.getQuest().getAchievements().getDraftEvents()) {
+ for (final QuestEventDraft draft : FModel.getQuest().getAchievements().getDraftEvents()) {
-
+
- PnlDraftEvent draftPanel = new PnlDraftEvent(draft);
+ final PnlDraftEvent draftPanel = new PnlDraftEvent(draft);
final JRadioButton button = draftPanel.getRadioButton();
-
+
if (firstPanel) {
button.setSelected(true);
SwingUtilities.invokeLater(new Runnable() {
@@ -396,112 +397,112 @@
});
firstPanel = false;
}
-
+
grpPanel.add(draftPanel, button, "w 100%!, h 135px!, gapy 15px");
-
+
button.addKeyListener(startOnEnter);
button.addMouseListener(startOnDblClick);
-
+
}
-
+
view.getPnlTournaments().add(grpPanel, "w 100%!");
-
+
updatePlacementLabelsText();
-
+
}
-
+
private void updatePlacementLabelsText() {
- VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
- QuestAchievements achievements = FModel.getQuest().getAchievements();
+ final VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
+ final QuestAchievements achievements = FModel.getQuest().getAchievements();
-
+
if (view.getMode().equals(Mode.EMPTY)) {
view.getPnlTournaments().removeAll();
}
-
- view.getLblFirst().setText("1st Place: " + achievements.getWinsForPlace(1) + " time" + (achievements.getWinsForPlace(1) == 1 ? "" : "s"));
- view.getLblSecond().setText("2nd Place: " + achievements.getWinsForPlace(2) + " time" + (achievements.getWinsForPlace(2) == 1 ? "" : "s"));
- view.getLblThird().setText("3rd Place: " + achievements.getWinsForPlace(3) + " time" + (achievements.getWinsForPlace(3) == 1 ? "" : "s"));
+
+ view.getLblFirst().setText("1st Place: " + achievements.getWinsForPlace(1) + " time" + (achievements.getWinsForPlace(1) == 1 ? "" : "s"));
+ view.getLblSecond().setText("2nd Place: " + achievements.getWinsForPlace(2) + " time" + (achievements.getWinsForPlace(2) == 1 ? "" : "s"));
+ view.getLblThird().setText("3rd Place: " + achievements.getWinsForPlace(3) + " time" + (achievements.getWinsForPlace(3) == 1 ? "" : "s"));
view.getLblFourth().setText("4th Place: " + achievements.getWinsForPlace(4) + " time" + (achievements.getWinsForPlace(4) == 1 ? "" : "s"));
-
+
view.getLblTokens().setText("Tokens: " + achievements.getDraftTokens());
view.getBtnSpendToken().setEnabled(achievements.getDraftTokens() > 0);
-
+
}
-
+
private void updatePrepareDeck() {
}
-
+
private void updateTournamentActive() {
-
+
- VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
+ final VSubmenuQuestDraft view = VSubmenuQuestDraft.SINGLETON_INSTANCE;
-
+
if (FModel.getQuest().getAchievements().getCurrentDraft() == null) {
return;
}
-
+
for (int i = 0; i < 15; i++) {
-
+
String playerID = FModel.getQuest().getAchievements().getCurrentDraft().getStandings()[i];
int iconID = 0;
switch (playerID) {
- case QuestEventDraft.HUMAN:
- playerID = FModel.getPreferences().getPref(FPref.PLAYER_NAME);
- if (FModel.getPreferences().getPref(FPref.UI_AVATARS).split(",").length > 0) {
- iconID = Integer.parseInt(FModel.getPreferences().getPref(FPref.UI_AVATARS).split(",")[0]);
- }
- break;
- case QuestEventDraft.UNDETERMINED:
- playerID = "Undetermined";
- iconID = GuiBase.getInterface().getAvatarCount() - 1;
- break;
- default:
- iconID = FModel.getQuest().getAchievements().getCurrentDraft().getAIIcons()[Integer.parseInt(playerID) - 1];
- playerID = FModel.getQuest().getAchievements().getCurrentDraft().getAINames()[Integer.parseInt(playerID) - 1];
- break;
+ case QuestEventDraft.HUMAN:
+ playerID = FModel.getPreferences().getPref(FPref.PLAYER_NAME);
+ if (FModel.getPreferences().getPref(FPref.UI_AVATARS).split(",").length > 0) {
+ iconID = Integer.parseInt(FModel.getPreferences().getPref(FPref.UI_AVATARS).split(",")[0]);
+ }
+ break;
+ case QuestEventDraft.UNDETERMINED:
+ playerID = "Undetermined";
+ iconID = GuiBase.getInterface().getAvatarCount() - 1;
+ break;
+ default:
+ iconID = FModel.getQuest().getAchievements().getCurrentDraft().getAIIcons()[Integer.parseInt(playerID) - 1];
+ playerID = FModel.getQuest().getAchievements().getCurrentDraft().getAINames()[Integer.parseInt(playerID) - 1];
+ break;
}
-
+
- boolean first = i % 2 == 0;
- int box = i / 2;
+ final boolean first = i % 2 == 0;
+ final int box = i / 2;
-
+
SkinImage icon = FSkin.getAvatars().get(iconID);
-
+
if (icon == null) {
icon = FSkin.getAvatars().get(0);
}
-
+
if (first) {
view.getLblsMatchups()[box].setPlayerOne(playerID, icon);
} else {
view.getLblsMatchups()[box].setPlayerTwo(playerID, icon);
}
-
+
}
-
+
if (FModel.getQuest().getAchievements().getCurrentDraft().playerHasMatchesLeft()) {
view.getBtnLeaveTournament().setText("Leave Tournament");
} else {
view.getBtnLeaveTournament().setText("Collect Prizes");
}
-
+
}
- public void setCompletedDraft(DeckGroup finishedDraft) {
+ public void setCompletedDraft(final DeckGroup finishedDraft) {
-
- QuestDraftUtils.completeDraft(finishedDraft);
-
+
+ QuestDraftUtils.completeDraft(finishedDraft);
+
Singletons.getControl().setCurrentScreen(FScreen.DECK_EDITOR_QUEST_TOURNAMENT);
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(new CEditorQuestLimited(FModel.getQuest(), CDeckEditorUI.SINGLETON_INSTANCE.getCDetailPicture()));
-
+
drafting = false;
VSubmenuQuestDraft.SINGLETON_INSTANCE.setMode(Mode.PREPARE_DECK);
VSubmenuQuestDraft.SINGLETON_INSTANCE.populate();
-
+
}
-
+
private void editDeck() {
final CDetailPicture cDetailPicture = CDeckEditorUI.SINGLETON_INSTANCE.getCDetailPicture();
VCurrentDeck.SINGLETON_INSTANCE.setItemManager(new DeckManager(GameType.Draft, cDetailPicture));
@@ -509,60 +510,60 @@
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(new CEditorQuestLimited(FModel.getQuest(), cDetailPicture));
FModel.getQuest().save();
}
-
+
private void startDraft() {
-
+
if (drafting) {
return;
}
-
+
final QuestEventDraft draftEvent = QuestUtil.getDraftEvent();
-
+
final long creditsAvailable = FModel.getQuest().getAssets().getCredits();
if (draftEvent.canEnter()) {
FOptionPane.showMessageDialog("You need " + NUMBER_FORMATTER.format(draftEvent.getEntryFee() - creditsAvailable) + " more credits to enter this tournament.", "Not Enough Credits", FSkin.getImage(FSkinProp.ICO_WARNING).scale(2.0));
return;
}
-
+
final boolean okayToEnter = FOptionPane.showOptionDialog("This tournament costs " + draftEvent.getEntryFee() + " credits to enter.\nAre you sure you wish to enter?", "Enter Draft Tournament?", FSkin.getImage(FSkinProp.ICO_QUEST_GOLD), new String[] { "Yes", "No" }, 1) == 0;
-
+
if (!okayToEnter) {
return;
}
-
+
drafting = true;
final BoosterDraft draft = draftEvent.enter();
-
+
final CEditorQuestDraftingProcess draftController = new CEditorQuestDraftingProcess(CDeckEditorUI.SINGLETON_INSTANCE.getCDetailPicture());
draftController.showGui(draft);
draftController.setDraftQuest(CSubmenuQuestDraft.this);
-
+
Singletons.getControl().setCurrentScreen(FScreen.DRAFTING_PROCESS);
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(draftController);
-
+
}
-
+
private void startTournament() {
-
+
FModel.getQuest().save();
-
+
- String message = GameType.QuestDraft.getDeckFormat().getDeckConformanceProblem(FModel.getQuest().getAssets().getDraftDeckStorage().get(QuestEventDraft.DECK_NAME).getHumanDeck());
+ final String message = GameType.QuestDraft.getDeckFormat().getDeckConformanceProblem(FModel.getQuest().getAssets().getDraftDeckStorage().get(QuestEventDraft.DECK_NAME).getHumanDeck());
if (message != null && FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
FOptionPane.showMessageDialog(message, "Deck Invalid");
return;
}
-
+
FModel.getQuest().getAchievements().getCurrentDraft().start();
-
+
VSubmenuQuestDraft.SINGLETON_INSTANCE.setMode(Mode.TOURNAMENT_ACTIVE);
VSubmenuQuestDraft.SINGLETON_INSTANCE.populate();
-
+
update();
-
+
}
-
+
private void startNextMatch() {
final String message = QuestDraftUtils.getDeckLegality();
@@ -574,21 +575,7 @@
gui = GuiBase.getInterface().getNewGuiGame();
QuestDraftUtils.startNextMatch(gui);
-
+
- }
-
- @Override
- public UiCommand getCommandOnSelect() {
- final QuestController qc = FModel.getQuest();
- return new UiCommand() {
- private static final long serialVersionUID = 6153589785507038445L;
- @Override
- public void run() {
- if (qc.getAchievements() == null) {
- CHomeUI.SINGLETON_INSTANCE.itemClick(EDocID.HOME_QUESTDATA);
- }
- }
- };
}
-
+
}
Index: forge-gui-desktop/src/main/java/forge/screens/home/PlayerPanel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/PlayerPanel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/PlayerPanel.java (revision 29317)
@@ -74,8 +74,8 @@
private FRadioButton radioOpen;
private FCheckBox chkReady;
- private FComboBoxWrapper<Object> teamComboBox = new FComboBoxWrapper<Object>();
- private FComboBoxWrapper<Object> aeTeamComboBox = new FComboBoxWrapper<Object>();
+ private final FComboBoxWrapper<Object> teamComboBox = new FComboBoxWrapper<Object>();
+ private final FComboBoxWrapper<Object> aeTeamComboBox = new FComboBoxWrapper<Object>();
private final FLabel closeBtn;
private final FLabel deckBtn = new FLabel.ButtonBuilder().text("Select a deck").build();
@@ -236,18 +236,18 @@
* Listens to name text fields and gives the appropriate player focus. Also
* saves the name preference when leaving player one's text field.
*/
- private FocusAdapter nameFocusListener = new FocusAdapter() {
+ private final FocusAdapter nameFocusListener = new FocusAdapter() {
@Override
- public void focusGained(FocusEvent e) {
+ public void focusGained(final FocusEvent e) {
lobby.changePlayerFocus(index);
}
@Override
- public void focusLost(FocusEvent e) {
+ public void focusLost(final FocusEvent e) {
final Object source = e.getSource();
if (source instanceof FTextField) { // the text box
- FTextField nField = (FTextField)source;
- String newName = nField.getText().trim();
+ final FTextField nField = (FTextField)source;
+ final String newName = nField.getText().trim();
if (index == 0 && !StringUtils.isBlank(newName)
&& StringUtils.isAlphanumericSpace(newName) && prefs.getPref(FPref.PLAYER_NAME) != newName) {
prefs.setPref(FPref.PLAYER_NAME, newName);
@@ -259,14 +259,14 @@
};
/** Listens to avatar buttons and gives the appropriate player focus. */
- private FocusAdapter avatarFocusListener = new FocusAdapter() {
+ private final FocusAdapter avatarFocusListener = new FocusAdapter() {
@Override
- public void focusGained(FocusEvent e) {
+ public void focusGained(final FocusEvent e) {
lobby.changePlayerFocus(index);
}
};
- private FMouseAdapter avatarMouseListener = new FMouseAdapter() {
+ private final FMouseAdapter avatarMouseListener = new FMouseAdapter() {
@Override public final void onLeftClick(final MouseEvent e) {
if (!avatarLabel.isEnabled()) {
return;
@@ -297,6 +297,7 @@
lobby.firePlayerChangeListener(index);
}
+
@Override public final void onRightClick(final MouseEvent e) {
if (!avatarLabel.isEnabled()) {
return;
@@ -314,13 +315,13 @@
};
private void updateVariantControlsVisibility() {
- boolean isCommanderApplied = mayEdit && (lobby.hasVariant(GameType.Commander) || lobby.hasVariant(GameType.TinyLeaders));
- boolean isPlanechaseApplied = mayEdit && lobby.hasVariant(GameType.Planechase);
- boolean isVanguardApplied = mayEdit && lobby.hasVariant(GameType.Vanguard);
- boolean isArchenemyApplied = mayEdit && lobby.hasVariant(GameType.Archenemy);
- boolean archenemyVisiblity = mayEdit && lobby.hasVariant(GameType.ArchenemyRumble) || (isArchenemyApplied && isArchenemy());
+ final boolean isCommanderApplied = mayEdit && (lobby.hasVariant(GameType.Commander) || lobby.hasVariant(GameType.TinyLeaders));
+ final boolean isPlanechaseApplied = mayEdit && lobby.hasVariant(GameType.Planechase);
+ final boolean isVanguardApplied = mayEdit && lobby.hasVariant(GameType.Vanguard);
+ final boolean isArchenemyApplied = mayEdit && lobby.hasVariant(GameType.Archenemy);
+ final boolean archenemyVisiblity = mayEdit && lobby.hasVariant(GameType.ArchenemyRumble) || (isArchenemyApplied && isArchenemy());
// Commander deck building replaces normal one, so hide it
- boolean isDeckBuildingAllowed = mayEdit && !isCommanderApplied && !lobby.hasVariant(GameType.MomirBasic);
+ final boolean isDeckBuildingAllowed = mayEdit && !isCommanderApplied && !lobby.hasVariant(GameType.MomirBasic);
deckLabel.setVisible(isDeckBuildingAllowed);
deckBtn.setVisible(isDeckBuildingAllowed);
@@ -344,7 +345,7 @@
}
@Override
- public void paintComponent(Graphics g) {
+ public void paintComponent(final Graphics g) {
super.paintComponent(g);
if (!hasFocusInLobby()) {
FSkin.setGraphicsColor(g, unfocusedPlayerOverlay);
@@ -356,10 +357,6 @@
return lobby.hasFocus(index);
}
- int getIndex() {
- return index;
- }
-
LobbySlotType getType() {
return type;
}
@@ -417,11 +414,11 @@
}
}
- public void setVanguardButtonText(String text) {
+ public void setVanguardButtonText(final String text) {
vgdSelectorBtn.setText(text);
}
- public void setDeckSelectorButtonText(String text) {
+ public void setDeckSelectorButtonText(final String text) {
deckBtn.setText(text);
}
@@ -439,7 +436,7 @@
teamComboBox.setEnabled(true);
}
- private ActionListener teamListener = new ActionListener() {
+ private final ActionListener teamListener = new ActionListener() {
@SuppressWarnings("unchecked")
@Override public final void actionPerformed(final ActionEvent e) {
final FComboBox<Object> cb = (FComboBox<Object>) e.getSource();
@@ -460,7 +457,7 @@
// Archenemy buttons
scmDeckSelectorBtn.setCommand(new Runnable() {
@Override public final void run() {
- lobby.setCurrentGameMode(lobby.getVntArchenemy().isSelected() ? GameType.Archenemy : GameType.ArchenemyRumble);
+ lobby.setCurrentGameMode(lobby.hasVariant(GameType.Archenemy) ? GameType.Archenemy : GameType.ArchenemyRumble);
scmDeckSelectorBtn.requestFocusInWindow();
lobby.changePlayerFocus(index);
}
@@ -469,8 +466,8 @@
scmDeckEditor.setCommand(new UiCommand() {
@Override
public void run() {
- lobby.setCurrentGameMode(lobby.getVntArchenemy().isSelected() ? GameType.Archenemy : GameType.ArchenemyRumble);
- Predicate<PaperCard> predSchemes = new Predicate<PaperCard>() {
+ lobby.setCurrentGameMode(lobby.hasVariant(GameType.Archenemy) ? GameType.Archenemy : GameType.ArchenemyRumble);
+ final Predicate<PaperCard> predSchemes = new Predicate<PaperCard>() {
@Override public final boolean apply(final PaperCard arg0) {
return arg0.getRules().getType().isScheme();
}
@@ -486,7 +483,7 @@
cmdDeckSelectorBtn.setCommand(new Runnable() {
@Override
public void run() {
- lobby.setCurrentGameMode(lobby.getVntTinyLeaders().isSelected() ? GameType.TinyLeaders : GameType.Commander);
+ lobby.setCurrentGameMode(lobby.hasVariant(GameType.TinyLeaders) ? GameType.TinyLeaders : GameType.Commander);
cmdDeckSelectorBtn.requestFocusInWindow();
lobby.changePlayerFocus(index);
}
@@ -495,7 +492,7 @@
cmdDeckEditor.setCommand(new UiCommand() {
@Override
public void run() {
- lobby.setCurrentGameMode(lobby.getVntTinyLeaders().isSelected() ? GameType.TinyLeaders : GameType.Commander);
+ lobby.setCurrentGameMode(lobby.hasVariant(GameType.TinyLeaders) ? GameType.TinyLeaders : GameType.Commander);
Singletons.getControl().setCurrentScreen(FScreen.DECK_EDITOR_COMMANDER);
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(new CEditorCommander(CDeckEditorUI.SINGLETON_INSTANCE.getCDetailPicture()));
}
@@ -515,9 +512,9 @@
@Override
public void run() {
lobby.setCurrentGameMode(GameType.Planechase);
- Predicate<PaperCard> predPlanes = new Predicate<PaperCard>() {
+ final Predicate<PaperCard> predPlanes = new Predicate<PaperCard>() {
@Override
- public boolean apply(PaperCard arg0) {
+ public boolean apply(final PaperCard arg0) {
return arg0.getRules().getType().isPlane() || arg0.getRules().getType().isPhenomenon();
}
};
@@ -600,7 +597,7 @@
newNameBtn.setCommand(new UiCommand() {
@Override
public void run() {
- String newName = lobby.getNewName();
+ final String newName = lobby.getNewName();
if (null == newName) {
return;
}
@@ -656,7 +653,7 @@
}
private void createAvatar() {
- String[] currentPrefs = FModel.getPreferences().getPref(FPref.UI_AVATARS).split(",");
+ final String[] currentPrefs = FModel.getPreferences().getPref(FPref.UI_AVATARS).split(",");
if (index < currentPrefs.length) {
avatarIndex = Integer.parseInt(currentPrefs[index]);
avatarLabel.setIcon(FSkin.getAvatars().get(avatarIndex));
@@ -690,7 +687,7 @@
private final FSkin.LineSkinBorder focusedBorder = new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS).alphaColor(255), 3);
private final FSkin.LineSkinBorder defaultBorder = new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_THEME).alphaColor(200), 2);
- public void setFocused(boolean focused) {
+ public void setFocused(final boolean focused) {
avatarLabel.setBorder(focused ? focusedBorder : defaultBorder);
}
\ No newline at end of file
This file has been truncated, but you can view the full file.
Index: forge-gui/src/main/java/forge/download/GuiDownloadService.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/download/GuiDownloadService.java (revision 29316)
+++ forge-gui/src/main/java/forge/download/GuiDownloadService.java (revision 29317)
@@ -320,12 +320,10 @@
protected Proxy getProxy() {
if (type == 0) {
return Proxy.NO_PROXY;
- }
- else {
+ } else {
try {
return new Proxy(TYPES[type], new InetSocketAddress(txtAddress.getText(), Integer.parseInt(txtPort.getText())));
- }
- catch (final Exception ex) {
+ } catch (final Exception ex) {
BugReporter.reportException(ex,
"Proxy connection could not be established!\nProxy address: %s\nProxy port: %s",
txtAddress.getText(), txtPort.getText());
Index: forge-gui-desktop/src/main/java/forge/gui/CardListViewer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/CardListViewer.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/CardListViewer.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -43,7 +43,7 @@
/**
* A simple class that shows a list of cards in a dialog with preview in its
* right part.
- *
+ *
* @author Forge
* @version $Id: ListChooser.java 9708 2011-08-09 19:34:12Z jendave $
*/
@@ -60,7 +60,7 @@
/**
* Instantiates a new card list viewer.
- *
+ *
* @param title
* the title
* @param list
@@ -72,7 +72,7 @@
/**
* Instantiates a new card list viewer.
- *
+ *
* @param title
* the title
* @param message
@@ -86,7 +86,7 @@
/**
* Instantiates a new card list viewer.
- *
+ *
* @param title
* the title
* @param message
@@ -104,16 +104,16 @@
this.picture.setOpaque(false);
this.setTitle(title);
-
+
if (FModel.getPreferences().getPrefBoolean(FPref.UI_LARGE_CARD_VIEWERS)) {
this.setSize(1200, 825);
} else {
this.setSize(720, 374);
}
-
+
this.addWindowFocusListener(new CardListFocuser());
- FButton btnOK = new FButton("OK");
+ final FButton btnOK = new FButton("OK");
btnOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
Index: forge-gui-desktop/src/main/java/forge/toolbox/FList.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FList.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FList.java (revision 29317)
@@ -1,16 +1,21 @@
package forge.toolbox;
-import forge.Singletons;
-import forge.toolbox.FSkin.SkinnedList;
+import java.awt.Component;
+import java.awt.FontMetrics;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
-import javax.swing.*;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+import javax.swing.ListModel;
import javax.swing.border.EmptyBorder;
-import java.awt.*;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
+import forge.Singletons;
+import forge.toolbox.FSkin.SkinnedList;
-/**
+/**
* A JList object using Forge skin properties.
*
*/
@@ -22,7 +27,8 @@
super();
initialize();
}
+
- /**
+ /**
* A JList object using Forge skin properties.
* This constructor assumes list contents are null and will be set later.
* This constructor is used for applying a list model at instantiation.
@@ -33,17 +39,6 @@
initialize();
}
- /**
- * A JList object using Forge skin properties.
- * This constructor may be passed an object array of list contents.
- *
- * @param o0 {@link java.lang.Object}[]
- */
- public FList(E[] o0) {
- super(o0);
- initialize();
- }
-
private void initialize() {
this.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
@@ -53,12 +48,12 @@
this.addFocusListener(new FocusListener() {
@Override
- public void focusGained(FocusEvent arg0) {
+ public void focusGained(final FocusEvent arg0) {
updateSelectionBackground();
}
@Override
- public void focusLost(FocusEvent arg0) {
+ public void focusLost(final FocusEvent arg0) {
updateSelectionBackground();
}
});
@@ -70,22 +65,22 @@
}
public int getAutoSizeWidth() {
- FontMetrics metrics = this.getFontMetrics(this.getFont());
+ final FontMetrics metrics = this.getFontMetrics(this.getFont());
int width = 0;
for (int i = 0; i < this.getModel().getSize(); i++) {
- int itemWidth = metrics.stringWidth(this.getModel().getElementAt(i).toString());
+ final int itemWidth = metrics.stringWidth(this.getModel().getElementAt(i).toString());
if (itemWidth > width) {
width = itemWidth;
}
}
width += itemBorder.getBorderInsets().left + itemBorder.getBorderInsets().right; //account for item border insets
- int minWidth = 150;
+ final int minWidth = 150;
if (width < minWidth) {
width = minWidth;
}
else {
- int maxWidth = Singletons.getView().getFrame().getWidth() - 50;
+ final int maxWidth = Singletons.getView().getFrame().getWidth() - 50;
if (width > maxWidth) {
width = maxWidth;
}
@@ -98,13 +93,13 @@
}
private class ComplexCellRenderer<E1> implements ListCellRenderer<E1> {
- private DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
+ private final DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
@Override
- public Component getListCellRendererComponent(JList<? extends E1> lst0, E1 val0, int i0,
- boolean isSelected, boolean cellHasFocus) {
+ public Component getListCellRendererComponent(final JList<? extends E1> lst0, final E1 val0, final int i0,
+ final boolean isSelected, final boolean cellHasFocus) {
- JLabel lblItem = (JLabel) defaultRenderer.getListCellRendererComponent(
+ final JLabel lblItem = (JLabel) defaultRenderer.getListCellRendererComponent(
lst0, val0, i0, isSelected, cellHasFocus);
lblItem.setBorder(itemBorder);
return lblItem;
Index: forge-gui-desktop/src/test/java/forge/GuiDownloadPicturesLQTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/test/java/forge/GuiDownloadPicturesLQTest.java (revision 29316)
+++ forge-gui-desktop/src/test/java/forge/GuiDownloadPicturesLQTest.java (revision 29317)
@@ -1,10 +1,10 @@
package forge;
+import org.testng.annotations.Test;
+
import forge.download.GuiDownloadPicturesLQ;
import forge.download.GuiDownloader;
-import org.testng.annotations.Test;
-
/**
* Created by IntelliJ IDEA. User: dhudson
*/
@@ -16,6 +16,6 @@
*/
@Test(enabled = false, timeOut = 1000)
public void guiDownloadPicturesTest1() {
- new GuiDownloader(new GuiDownloadPicturesLQ());
+ new GuiDownloader(new GuiDownloadPicturesLQ()).show();
}
}
Index: forge-core/src/main/java/forge/util/storage/IStorage.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-core/src/main/java/forge/util/storage/IStorage.java (revision 29316)
+++ forge-core/src/main/java/forge/util/storage/IStorage.java (revision 29317)
@@ -6,35 +6,31 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package forge.util.storage;
+import java.util.Collection;
+
import com.google.common.base.Predicate;
+
import forge.util.IHasName;
-import java.util.Collection;
-
-/**
- * TODO: Write javadoc for this type.
- *
- * @param <T> the generic type
- */
public interface IStorage<T> extends Iterable<T>, IHasName {
- T get(final String name);
- T find(final Predicate<T> condition);
+ T get(String name);
+ T find(Predicate<T> condition);
Collection<String> getItemNames();
- boolean contains(final String name);
+ boolean contains(String name);
int size();
- void add(final T deck);
- void delete(final String deckName);
+ void add(T item);
+ void delete(String deckName);
IStorage<IStorage<T>> getFolders();
IStorage<T> tryGetFolder(String path);
IStorage<T> getFolderOrCreate(String path);
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/screens/workshop/CWorkshopUI.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/workshop/CWorkshopUI.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/workshop/CWorkshopUI.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -22,7 +22,6 @@
import javax.swing.JMenu;
import forge.Singletons;
-import forge.UiCommand;
import forge.gui.framework.EDocID;
import forge.gui.framework.ICDoc;
import forge.menus.IMenuProvider;
@@ -35,7 +34,7 @@
* top-level control for child UIs. Tasks targeting the view of individual
* components are found in a separate controller for that component and
* should not be included here.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*/
public enum CWorkshopUI implements ICDoc, IMenuProvider {
@@ -51,14 +50,6 @@
@Override
public List<JMenu> getMenus() {
return new CWorkshopUIMenus().getMenus();
- }
-
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
}
@Override
Index: forge-gui/src/main/java/forge/limited/GauntletMini.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/limited/GauntletMini.java (revision 29316)
+++ forge-gui/src/main/java/forge/limited/GauntletMini.java (revision 29317)
@@ -6,12 +6,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -33,7 +33,7 @@
* <p>
* GauntletMini class.
* </p>
- *
+ *
* @author Forge
* @version $Id: GauntletMini.java $
* @since 1.2.xx
@@ -47,7 +47,7 @@
private int losses;
private boolean gauntletDraft; // Means: Draft game is in Gauntlet-mode, not a single match
private GameType gauntletType;
- private List<RegisteredPlayer> aiOpponents = new ArrayList<RegisteredPlayer>();
+ private final List<RegisteredPlayer> aiOpponents = new ArrayList<RegisteredPlayer>();
public GauntletMini() {
currentRound = 1;
@@ -87,10 +87,10 @@
}
/**
- *
+ *
* Setup and launch the gauntlet.
* Note: The AI decks are connected to the human deck.
- *
+ *
* @param rounds0
* the number of rounds (opponent decks) in this tournament
* @param humanDeck0
@@ -98,7 +98,7 @@
* @param gauntletType0
* game type (Sealed, Draft, Constructed...)
*/
- public void launch(int rounds0, Deck humanDeck0, final GameType gauntletType0) {
+ public void launch(final int rounds0, final Deck humanDeck0, final GameType gauntletType0) {
rounds = rounds0;
humanDeck = humanDeck0;
gauntletType = gauntletType0;
Index: forge-gui-desktop/src/main/java/forge/toolbox/LayoutHelper.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/LayoutHelper.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/LayoutHelper.java (revision 29317)
@@ -1,19 +1,20 @@
package forge.toolbox;
-import javax.swing.*;
+import javax.swing.JComponent;
-/**
+/**
* Helper class for doing custom layout
*
*/
public final class LayoutHelper {
private final int parentWidth, parentHeight;
- private int x, y, lineBottom, gapX, gapY;
+ private int x, y, lineBottom;
+ private final int gapX, gapY;
- public LayoutHelper(JComponent parent) {
+ public LayoutHelper(final JComponent parent) {
this(parent, 3, 3);
}
- public LayoutHelper(JComponent parent, int gapX0, int gapY0) {
+ public LayoutHelper(final JComponent parent, final int gapX0, final int gapY0) {
parentWidth = parent.getWidth();
parentHeight = parent.getHeight();
gapX = gapX0;
@@ -34,7 +35,7 @@
* @param comp
* @param height
*/
- public void fillLine(final JComponent comp, int height) {
+ public void fillLine(final JComponent comp, final int height) {
fillLine(comp, height, 0);
}
@@ -44,7 +45,7 @@
* @param height
* @param rightPadding
*/
- public void fillLine(final JComponent comp, int height, int rightPadding) {
+ public void fillLine(final JComponent comp, final int height, final int rightPadding) {
if (x >= parentWidth) {
newLine();
}
@@ -57,7 +58,7 @@
* @param widthPercent
* @param height
*/
- public void include(final JComponent comp, float widthPercent, int height) {
+ public void include(final JComponent comp, final float widthPercent, final int height) {
include(comp, Math.round(parentWidth * widthPercent), height);
}
@@ -67,7 +68,7 @@
* @param width
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment