Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Huge cleanup of gui and desktop code 2
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
* @param heightPercent
*/
- public void include(final JComponent comp, int width, float heightPercent) {
+ public void include(final JComponent comp, final int width, final float heightPercent) {
include(comp, width, Math.round(parentHeight * heightPercent));
}
@@ -77,7 +78,7 @@
* @param widthPercent
* @param heightPercent
*/
- public void include(final JComponent comp, float widthPercent, float heightPercent) {
+ public void include(final JComponent comp, final float widthPercent, final float heightPercent) {
include(comp, Math.round(parentWidth * widthPercent), Math.round(parentHeight * heightPercent));
}
@@ -87,7 +88,7 @@
* @param width
* @param height
*/
- public void include(final JComponent comp, int width, int height) {
+ public void include(final JComponent comp, int width, final int height) {
if (width <= 0 || height <= 0) { return; }
if (x + width > parentWidth) {
@@ -112,7 +113,7 @@
* @param dx
* @param dy
*/
- public void offset(int dx, int dy) {
+ public void offset(final int dx, final int dy) {
x += dx;
y += dy;
}
@@ -130,7 +131,7 @@
/**
* Start new line of layout
*/
- public void newLine(int dy) {
+ public void newLine(final int dy) {
x = 0;
y = lineBottom + gapY + dy;
lineBottom = y;
Index: forge-gui-desktop/src/main/java/forge/screens/match/views/VLog.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/VLog.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/views/VLog.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,7 +59,7 @@
private final DragTab tab = new DragTab("Log");
// Other fields
- private GameLogPanel gameLog;
+ private final GameLogPanel gameLog;
private JPanel p = null;
private final CLog controller;
@@ -168,17 +168,17 @@
}
private void displayNewGameLogEntries(final GameView model) {
- List<GameLogEntry> newLogEntries = Lists.reverse(getNewGameLogEntries(model));
+ final List<GameLogEntry> newLogEntries = Lists.reverse(getNewGameLogEntries(model));
if (newLogEntries.size() > 0) {
addNewLogEntriesToJPanel(newLogEntries);
}
}
private List<GameLogEntry> getNewGameLogEntries(final GameView model) {
- String logEntryType = FModel.getPreferences().getPref(FPref.DEV_LOG_ENTRY_TYPE);
- GameLogEntryType logVerbosityFilter = GameLogEntryType.valueOf(logEntryType);
+ final String logEntryType = FModel.getPreferences().getPref(FPref.DEV_LOG_ENTRY_TYPE);
+ final GameLogEntryType logVerbosityFilter = GameLogEntryType.valueOf(logEntryType);
if (model != null && model.getGameLog() != null) {
- List<GameLogEntry> logEntries = model.getGameLog().getLogEntries(logVerbosityFilter);
+ final List<GameLogEntry> logEntries = model.getGameLog().getLogEntries(logVerbosityFilter);
// Set subtraction - remove all log entries from new list which are already displayed.
logEntries.removeAll(this.displayedLogEntries);
return logEntries;
@@ -186,16 +186,16 @@
return new ArrayList<GameLogEntry>();
}
- private void addNewLogEntriesToJPanel(List<GameLogEntry> newLogEntries) {
- for (GameLogEntry logEntry : newLogEntries) {
+ private void addNewLogEntriesToJPanel(final List<GameLogEntry> newLogEntries) {
+ for (final GameLogEntry logEntry : newLogEntries) {
gameLog.setTextFont(getJTextAreaFont(logEntry.type));
gameLog.addLogEntry(logEntry.message);
this.displayedLogEntries.add(logEntry);
}
}
- private SkinFont getJTextAreaFont(GameLogEntryType logEntryType) {
- boolean isNewTurn = (logEntryType == GameLogEntryType.TURN);
+ private static SkinFont getJTextAreaFont(final GameLogEntryType logEntryType) {
+ final boolean isNewTurn = (logEntryType == GameLogEntryType.TURN);
return (isNewTurn ? FSkin.getBoldFont() : FSkin.getFont());
}
}
Index: forge-gui/src/main/java/forge/gauntlet/GauntletIO.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/gauntlet/GauntletIO.java (revision 29316)
+++ forge-gui/src/main/java/forge/gauntlet/GauntletIO.java (revision 29317)
@@ -45,35 +45,35 @@
return xStream;
}
- public static File getGauntletFile(String name) {
+ public static File getGauntletFile(final String name) {
return new File(ForgeConstants.GAUNTLET_DIR.userPrefLoc, name + SUFFIX_DATA);
}
- public static File getGauntletFile(GauntletData gd) {
+ public static File getGauntletFile(final GauntletData gd) {
return getGauntletFile(gd.getName());
}
public static File[] getGauntletFilesUnlocked(final String prefix) {
final FilenameFilter filter = new FilenameFilter() {
@Override
- public boolean accept(File dir, String name) {
+ public boolean accept(final File dir, final String name) {
return ((prefix == null || name.startsWith(prefix)) && name.endsWith(SUFFIX_DATA));
}
};
- File folder = new File(ForgeConstants.GAUNTLET_DIR.userPrefLoc);
+ final File folder = new File(ForgeConstants.GAUNTLET_DIR.userPrefLoc);
return folder.listFiles(filter);
}
public static File[] getGauntletFilesLocked() {
final FilenameFilter filter = new FilenameFilter() {
@Override
- public boolean accept(File dir, String name) {
+ public boolean accept(final File dir, final String name) {
return (name.startsWith(PREFIX_LOCKED) && name.endsWith(SUFFIX_DATA));
}
};
- File folder = new File(ForgeConstants.GAUNTLET_DIR.defaultLoc);
+ final File folder = new File(ForgeConstants.GAUNTLET_DIR.defaultLoc);
return folder.listFiles(filter);
}
@@ -101,8 +101,7 @@
if (zin != null) {
try {
zin.close();
- }
- catch (IOException e) {
+ } catch (final IOException e) {
System.out.println("error closing gauntlet data reader: " + e);
}
}
@@ -110,8 +109,7 @@
if (isCorrupt) {
try {
xmlSaveFile.delete();
- }
- catch (Exception e) {
+ } catch (final Exception e) {
System.out.println("error delete corrupt gauntlet file: " + e);
}
}
@@ -145,7 +143,7 @@
@Override
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) {
for (final Entry<PaperCard, Integer> e : (CardPool) source) {
- this.writeCardPrinted(e.getKey(), e.getValue(), writer);
+ writeCardPrinted(e.getKey(), e.getValue(), writer);
}
}
@@ -161,15 +159,15 @@
if ("string".equals(nodename)) {
result.add(FModel.getMagicDb().getCommonCards().getCard(reader.getValue()));
} else if ("card".equals(nodename)) { // new format
- result.add(this.readCardPrinted(reader), cnt);
+ result.add(readCardPrinted(reader), cnt);
}
reader.moveUp();
}
-
+
return result;
}
- private void writeCardPrinted(final PaperCard cref, final Integer count, final HierarchicalStreamWriter writer) {
+ private static void writeCardPrinted(final PaperCard cref, final Integer count, final HierarchicalStreamWriter writer) {
writer.startNode("card");
writer.addAttribute("c", cref.getName());
writer.addAttribute("s", cref.getEdition());
@@ -181,17 +179,19 @@
writer.endNode();
}
- private PaperCard readCardPrinted(final HierarchicalStreamReader reader) {
+ private static PaperCard readCardPrinted(final HierarchicalStreamReader reader) {
final String name = reader.getAttribute("c");
final String set = reader.getAttribute("s");
final String sIndex = reader.getAttribute("i");
final short index = StringUtils.isNumeric(sIndex) ? Short.parseShort(sIndex) : 0;
final boolean foil = "1".equals(reader.getAttribute("foil"));
PaperCard card = FModel.getMagicDb().getCommonCards().getCard(name, set, index);
- if ( null == card )
+ if (null == card) {
card = FModel.getMagicDb().getCommonCards().getCard(name, set, -1);
- if ( null == card )
+ }
+ if (null == card) {
throw new RuntimeException("Unsupported card found in quest save: " + name + " from edition " + set);
+ }
return foil ? FModel.getMagicDb().getCommonCards().getFoiled(card) : card;
}
}
Index: forge-gui-desktop/src/main/java/forge/itemmanager/filters/DeckQuestWorldFilter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/itemmanager/filters/DeckQuestWorldFilter.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/itemmanager/filters/DeckQuestWorldFilter.java (revision 29317)
@@ -1,22 +1,22 @@
package forge.itemmanager.filters;
+import java.util.HashSet;
+import java.util.Set;
+
+import forge.deck.DeckProxy;
import forge.game.GameFormat;
import forge.itemmanager.ItemManager;
-import forge.deck.DeckProxy;
import forge.model.FModel;
import forge.quest.QuestWorld;
-import java.util.HashSet;
-import java.util.Set;
-
public class DeckQuestWorldFilter extends DeckFormatFilter {
private final Set<QuestWorld> questWorlds = new HashSet<QuestWorld>();
- public DeckQuestWorldFilter(ItemManager<? super DeckProxy> itemManager0) {
+ public DeckQuestWorldFilter(final ItemManager<? super DeckProxy> itemManager0) {
super(itemManager0);
}
- public DeckQuestWorldFilter(ItemManager<? super DeckProxy> itemManager0, QuestWorld questWorld0) {
+ public DeckQuestWorldFilter(final ItemManager<? super DeckProxy> itemManager0, final QuestWorld questWorld0) {
super(itemManager0);
this.questWorlds.add(questWorld0);
this.formats.add(getQuestWorldFormat(questWorld0));
@@ -24,9 +24,9 @@
@Override
public ItemFilter<DeckProxy> createCopy() {
- DeckQuestWorldFilter copy = new DeckQuestWorldFilter(itemManager);
+ final DeckQuestWorldFilter copy = new DeckQuestWorldFilter(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<DeckProxy> existingFilter) {
+ public static boolean canAddQuestWorld(final QuestWorld questWorld, final ItemFilter<DeckProxy> 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) {
- DeckQuestWorldFilter cardQuestWorldFilter = (DeckQuestWorldFilter)filter;
+ public boolean merge(final ItemFilter<?> filter) {
+ final DeckQuestWorldFilter cardQuestWorldFilter = (DeckQuestWorldFilter)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-desktop/src/main/java/forge/screens/home/sanctioned/CSubmenuDraft.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/sanctioned/CSubmenuDraft.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/sanctioned/CSubmenuDraft.java (revision 29317)
@@ -31,15 +31,13 @@
import forge.screens.deckeditor.controllers.CEditorDraftingProcess;
import forge.toolbox.FOptionPane;
-/**
+/**
* Controls the draft submenu in the home UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
- *
*/
@SuppressWarnings("serial")
public enum CSubmenuDraft implements ICDoc {
- /** */
SINGLETON_INSTANCE;
private final UiCommand cmdDeckSelect = new UiCommand() {
@@ -114,7 +112,7 @@
}
if (FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
- String errorMessage = gameType.getDeckFormat().getDeckConformanceProblem(humanDeck.getDeck());
+ final String errorMessage = gameType.getDeckFormat().getDeckConformanceProblem(humanDeck.getDeck());
if (null != errorMessage) {
FOptionPane.showErrorDialog("Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid Deck");
return;
@@ -124,7 +122,7 @@
FModel.getGauntletMini().resetGauntletDraft();
if (gauntlet) {
- int rounds = FModel.getDecks().getDraft().get(humanDeck.getName()).getAiDecks().size();
+ final int rounds = FModel.getDecks().getDraft().get(humanDeck.getName()).getAiDecks().size();
FModel.getGauntletMini().launch(rounds, humanDeck.getDeck(), gameType);
return;
}
@@ -147,7 +145,7 @@
final RegisteredPlayer human = new RegisteredPlayer(humanDeck.getDeck()).setPlayer(GamePlayerUtil.getGuiPlayer());
starter.add(human);
starter.add(new RegisteredPlayer(aiDeck).setPlayer(GamePlayerUtil.createAiPlayer()));
- for (RegisteredPlayer pl : starter) {
+ for (final RegisteredPlayer pl : starter) {
pl.assignConspiracies();
}
@@ -168,7 +166,7 @@
final LimitedPoolType poolType = GuiChoose.oneOrNone("Choose Draft Format", LimitedPoolType.values());
if (poolType == null) { return; }
- BoosterDraft draft = BoosterDraft.createDraft(poolType);
+ final BoosterDraft draft = BoosterDraft.createDraft(poolType);
if (draft == null) { return; }
final CEditorDraftingProcess draftController = new CEditorDraftingProcess(CDeckEditorUI.SINGLETON_INSTANCE.getCDetailPicture());
@@ -178,11 +176,4 @@
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(draftController);
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
}
Index: forge-gui/src/main/java/forge/match/input/InputConfirmMulligan.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/input/InputConfirmMulligan.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/input/InputConfirmMulligan.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/>.
*/
@@ -30,15 +30,15 @@
import forge.util.ITriggerEvent;
import forge.util.Lang;
import forge.util.ThreadUtil;
-
+
/**
- * <p>
- * InputConfirmMulligan class.
- * </p>
- *
- * @author Forge
- * @version $Id: InputConfirmMulligan.java 24769 2014-02-09 13:56:04Z Hellfish $
- */
+ * <p>
+ * InputConfirmMulligan class.
+ * </p>
+ *
+ * @author Forge
+ * @version $Id: InputConfirmMulligan.java 24769 2014-02-09 13:56:04Z Hellfish $
+ */
public class InputConfirmMulligan extends InputSyncronizedBase {
/** Constant <code>serialVersionUID=-8112954303001155622L</code>. */
private static final long serialVersionUID = -8112954303001155622L;
@@ -60,9 +60,9 @@
/** {@inheritDoc} */
@Override
public final void showMessage() {
- Game game = player.getGame();
+ final Game game = player.getGame();
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
if (startingPlayer == player) {
sb.append(player).append(", you are going first!\n\n");
}
@@ -116,9 +116,9 @@
@Override
protected boolean onCardSelected(final Card c0, final List<Card> otherCardsToSelect, final ITriggerEvent triggerEvent) { // the only place that would cause troubles - input is supposed only to confirm, not to fire abilities
- boolean fromHand = player.getZone(ZoneType.Hand).contains(c0);
- boolean isSerumPowder = c0.getName().equals("Serum Powder");
- boolean isLegalChoice = fromHand && (isCommander || isSerumPowder);
+ final boolean fromHand = player.getZone(ZoneType.Hand).contains(c0);
+ final boolean isSerumPowder = c0.getName().equals("Serum Powder");
+ final boolean isLegalChoice = fromHand && (isCommander || isSerumPowder);
if (!isLegalChoice || cardSelectLocked) {
return false;
}
@@ -127,9 +127,9 @@
if (isSerumPowder && getController().getGui().confirm(cView, "Use " + cView + "'s ability?")) {
cardSelectLocked = true;
ThreadUtil.invokeInGameThread(new Runnable() {
- public void run() {
- CardCollection hand = new CardCollection(c0.getController().getCardsIn(ZoneType.Hand));
- for (Card c : hand) {
+ @Override public void run() {
+ final CardCollection hand = new CardCollection(c0.getController().getCardsIn(ZoneType.Hand));
+ for (final Card c : hand) {
player.getGame().getAction().exile(c);
}
c0.getController().drawCards(hand.size());
@@ -162,7 +162,7 @@
}
@Override
- public String getActivateAction(Card card) {
+ public String getActivateAction(final Card card) {
return null;
}
}
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CCardCatalog.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/CCardCatalog.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/CCardCatalog.java (revision 29317)
@@ -1,11 +1,10 @@
package forge.screens.deckeditor.controllers;
-import forge.UiCommand;
import forge.gui.framework.ICDoc;
-/**
+/**
* Controls the "card catalog" panel in the deck editor UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -17,14 +16,6 @@
}
//========== Overridden methods
-
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
@Override
public void register() {
@@ -36,7 +27,7 @@
@Override
public void initialize() {
}
-
+
/* (non-Javadoc)
* @see forge.gui.framework.ICDoc#update()
*/
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/ACEditorBase.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/ACEditorBase.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/ACEditorBase.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.screens.deckeditor.controllers;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map.Entry;
+
+import javax.swing.JMenu;
+import javax.swing.JPopupMenu;
+import javax.swing.KeyStroke;
+import javax.swing.SwingUtilities;
+
import forge.UiCommand;
import forge.assets.FSkinProp;
import forge.deck.Deck;
@@ -24,7 +36,11 @@
import forge.deck.DeckSection;
import forge.gui.GuiChoose;
import forge.gui.GuiUtils;
-import forge.gui.framework.*;
+import forge.gui.framework.DragCell;
+import forge.gui.framework.FScreen;
+import forge.gui.framework.ICDoc;
+import forge.gui.framework.IVDoc;
+import forge.gui.framework.SRearrangingUtil;
import forge.item.InventoryItem;
import forge.item.PaperCard;
import forge.itemmanager.ItemManager;
@@ -43,15 +59,6 @@
import forge.util.ItemPool;
import forge.view.FView;
-import javax.swing.*;
-
-import java.awt.*;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map.Entry;
-
/**
* Maintains a generically typed architecture for various editing
* environments. A basic editor instance requires a card catalog, the
@@ -60,7 +67,7 @@
* These requirements are collected in this class and manipulated
* in subclasses for different environments. There are two generic
* types for all card display and filter predicates.
- *
+ *
* <br><br><i>(A at beginning of class name denotes an abstract class.)</i>
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
@@ -138,41 +145,35 @@
return new CDeckEditorUIMenus().getMenus();
}
- public final void addItem(TItem item) {
+ public final void addItem(final TItem item) {
onAddItems(createPoolForItem(item, 1), false);
}
- public final void addItem(TItem item, int qty) {
+ public final void addItem(final TItem item, final int qty) {
onAddItems(createPoolForItem(item, qty), false);
}
- public final void addItem(TItem item, int qty, boolean toAlternate) {
- onAddItems(createPoolForItem(item, qty), toAlternate);
- }
- public final void removeItem(TItem item) {
+ public final void removeItem(final TItem item) {
onRemoveItems(createPoolForItem(item, 1), false);
}
- public final void removeItem(TItem item, int qty) {
+ public final void removeItem(final TItem item, final int qty) {
onRemoveItems(createPoolForItem(item, qty), false);
}
- public final void removeItem(TItem item, int qty, boolean toAlternate) {
- onRemoveItems(createPoolForItem(item, qty), toAlternate);
- }
@SuppressWarnings("unchecked")
private ItemPool<TItem> createPoolForItem(final TItem item, final int qty) {
if (item == null || qty <= 0) { return null; }
- ItemPool<TItem> pool = new ItemPool<TItem>((Class<TItem>)item.getClass());
+ final ItemPool<TItem> pool = new ItemPool<TItem>((Class<TItem>)item.getClass());
pool.add(item, qty);
return pool;
}
- public final void addItems(Iterable<Entry<TItem, Integer>> items, boolean toAlternate) {
+ public final void addItems(final Iterable<Entry<TItem, Integer>> items, final boolean toAlternate) {
if (items == null || !items.iterator().hasNext()) { return; } //do nothing if no items
onAddItems(items, toAlternate);
}
- public final void removeItems(Iterable<Entry<TItem, Integer>> items, boolean toAlternate) {
+ public final void removeItems(final Iterable<Entry<TItem, Integer>> items, final boolean toAlternate) {
if (items == null || !items.iterator().hasNext()) { return; } //do nothing if no items
onRemoveItems(items, toAlternate);
}
@@ -189,15 +190,15 @@
/**
* @return pool of additions allowed to deck
*/
- protected ItemPool<TItem> getAllowedAdditions(Iterable<Entry<TItem, Integer>> itemsToAdd) {
- ItemPool<TItem> additions = new ItemPool<TItem>(getCatalogManager().getGenericType());
- CardLimit limit = getCardLimit();
- DeckController<TModel> controller = getDeckController();
- Deck deck = controller != null && controller.getModel() instanceof Deck ? (Deck)controller.getModel() : null;
+ protected ItemPool<TItem> getAllowedAdditions(final Iterable<Entry<TItem, Integer>> itemsToAdd) {
+ final ItemPool<TItem> additions = new ItemPool<TItem>(getCatalogManager().getGenericType());
+ final CardLimit limit = getCardLimit();
+ final DeckController<TModel> controller = getDeckController();
+ final Deck deck = controller != null && controller.getModel() instanceof Deck ? (Deck)controller.getModel() : null;
- for (Entry<TItem, Integer> itemEntry : itemsToAdd) {
- TItem item = itemEntry.getKey();
- PaperCard card = item instanceof PaperCard ? (PaperCard)item : null;
+ for (final Entry<TItem, Integer> itemEntry : itemsToAdd) {
+ final TItem item = itemEntry.getKey();
+ final PaperCard card = item instanceof PaperCard ? (PaperCard)item : null;
int qty = itemEntry.getValue();
int max;
@@ -228,7 +229,7 @@
protected abstract CardLimit getCardLimit();
- /**
+ /**
* Operation to add selected items to current deck.
*/
protected abstract void onAddItems(Iterable<Entry<TItem, Integer>> items, boolean toAlternate);
@@ -255,7 +256,7 @@
/**
* Called when switching away from or closing the editor wants to exit. Should confirm save options.
- *
+ *
* @return boolean &emsp; true if safe to exit
*/
public abstract boolean canSwitchAway(boolean isClosing);
@@ -272,7 +273,7 @@
/**
* Gets the ItemManager holding the cards in the current deck.
- *
+ *
* @return {@link forge.itemmanager.ItemManager}
*/
public ItemManager<TItem> getDeckManager() {
@@ -281,7 +282,7 @@
/**
* Sets the ItemManager holding the cards in the current deck.
- *
+ *
* @param itemManager &emsp; {@link forge.itemmanager.ItemManager}
*/
@SuppressWarnings("serial")
@@ -289,14 +290,12 @@
this.deckManager = itemManager;
btnRemove.setCommand(new UiCommand() {
- @Override
- public void run() {
+ @Override public void run() {
CDeckEditorUI.SINGLETON_INSTANCE.removeSelectedCards(false, 1);
}
});
btnRemove4.setCommand(new UiCommand() {
- @Override
- public void run() {
+ @Override public void run() {
CDeckEditorUI.SINGLETON_INSTANCE.removeSelectedCards(false, 4);
}
});
@@ -307,7 +306,7 @@
/**
* Gets the ItemManager holding the cards in the current catalog.
- *
+ *
* @return {@link forge.itemmanager.ItemManager}
*/
public ItemManager<TItem> getCatalogManager() {
@@ -316,7 +315,7 @@
/**
* Sets the ItemManager holding the cards in the current catalog.
- *
+ *
* @param itemManager &emsp; {@link forge.itemmanager.ItemManager}
*/
@SuppressWarnings("serial")
@@ -324,14 +323,12 @@
this.catalogManager = itemManager;
btnAdd.setCommand(new UiCommand() {
- @Override
- public void run() {
+ @Override public void run() {
CDeckEditorUI.SINGLETON_INSTANCE.addSelectedCards(false, 1);
}
});
btnAdd4.setCommand(new UiCommand() {
- @Override
- public void run() {
+ @Override public void run() {
CDeckEditorUI.SINGLETON_INSTANCE.addSelectedCards(false, 4);
}
});
@@ -342,7 +339,7 @@
/**
* Removes the specified tab and returns its parent for later re-adding
*/
- protected DragCell removeTab (IVDoc<? extends ICDoc> tab) {
+ protected DragCell removeTab (final IVDoc<? extends ICDoc> tab) {
final DragCell parent;
if (tab.getParentCell() == null) {
parent = null;
@@ -398,7 +395,7 @@
public FLabel getBtnRemove4() { return btnRemove4; }
public FLabel getBtnCycleSection() { return btnCycleSection; }
- public ContextMenuBuilder createContextMenuBuilder(boolean isAddContextMenu0) {
+ public ContextMenuBuilder createContextMenuBuilder(final boolean isAddContextMenu0) {
return new EditorContextMenuBuilder(isAddContextMenu0);
}
@@ -406,7 +403,7 @@
private final boolean isAddContextMenu;
private JPopupMenu menu;
- private EditorContextMenuBuilder(boolean isAddContextMenu0) {
+ private EditorContextMenuBuilder(final boolean isAddContextMenu0) {
isAddContextMenu = isAddContextMenu0;
}
@@ -419,7 +416,7 @@
}
@Override
- public void buildContextMenu(JPopupMenu menu) {
+ public void buildContextMenu(final JPopupMenu menu) {
this.menu = menu; //cache menu while controller populates menu
if (isAddContextMenu) {
buildAddContextMenu(this);
@@ -459,28 +456,27 @@
});
}
- private void addItem(String verb, String dest, final boolean toAlternate, final int qty, int shortcutModifiers) {
+ private void addItem(final String verb, final String dest, final boolean toAlternate, final int qty, final int shortcutModifiers) {
String label = verb + " " + SItemManagerUtil.getItemDisplayString(getItemManager().getSelectedItems(), qty, false);
if (dest != null && !dest.isEmpty()) {
label += " " + dest;
}
GuiUtils.addMenuItem(menu, label,
KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, shortcutModifiers), new Runnable() {
- @Override
- public void run() {
+ @Override public void run() {
- Integer quantity = qty;
- if (quantity < 0) {
- quantity = GuiChoose.getInteger("Choose a value for X", 1, -quantity, 20);
- if (quantity == null) { return; }
- }
- if (isAddContextMenu) {
- CDeckEditorUI.SINGLETON_INSTANCE.addSelectedCards(toAlternate, quantity);
- }
- else {
- CDeckEditorUI.SINGLETON_INSTANCE.removeSelectedCards(toAlternate, quantity);
- }
- }
- }, true, shortcutModifiers == 0);
+ Integer quantity = qty;
+ if (quantity < 0) {
+ quantity = GuiChoose.getInteger("Choose a value for X", 1, -quantity, 20);
+ if (quantity == null) { return; }
+ }
+ if (isAddContextMenu) {
+ CDeckEditorUI.SINGLETON_INSTANCE.addSelectedCards(toAlternate, quantity);
+ }
+ else {
+ CDeckEditorUI.SINGLETON_INSTANCE.removeSelectedCards(toAlternate, quantity);
+ }
+ }
+ }, true, shortcutModifiers == 0);
}
private int getMaxMoveQuantity() {
@@ -492,7 +488,7 @@
return 0;
}
int max = Integer.MAX_VALUE;
- for (Entry<TItem, Integer> itemEntry : selectedItemPool) {
+ for (final Entry<TItem, Integer> itemEntry : selectedItemPool) {
if (itemEntry.getValue() < max) {
max = itemEntry.getValue();
}
@@ -500,8 +496,8 @@
return max;
}
- private void addItems(String verb, String dest, boolean toAlternate, int shortcutModifiers1, int shortcutModifiers2, int shortcutModifiers3) {
- int max = getMaxMoveQuantity();
+ private void addItems(final String verb, final String dest, final boolean toAlternate, final int shortcutModifiers1, final int shortcutModifiers2, final int shortcutModifiers3) {
+ final int max = getMaxMoveQuantity();
if (max == 0) { return; }
addItem(verb, dest, toAlternate, 1, shortcutModifiers1);
@@ -518,11 +514,11 @@
addItem(verb, dest, toAlternate, -max, shortcutModifiers3); //pass -max as quantity to indicate to prompt for specific quantity
}
- public void addMoveItems(String verb, String dest) {
+ public void addMoveItems(final String verb, final String dest) {
addItems(verb, dest, false, 0, InputEvent.SHIFT_DOWN_MASK, InputEvent.ALT_MASK);
}
- public void addMoveAlternateItems(String verb, String dest) {
+ public void addMoveAlternateItems(final String verb, final String dest) {
if (this.menu.getComponentCount() > 0) {
this.menu.addSeparator();
}
Index: forge-gui/src/main/java/forge/sound/SoundSystem.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/sound/SoundSystem.java (revision 29316)
+++ forge-gui/src/main/java/forge/sound/SoundSystem.java (revision 29317)
@@ -14,9 +14,8 @@
import forge.properties.ForgeConstants;
import forge.properties.ForgePreferences.FPref;
-/**
+/**
* Manages playback of all sounds for the client.
- *
*/
public class SoundSystem {
public static final SoundSystem instance = new SoundSystem();
@@ -32,25 +31,25 @@
private SoundSystem() {
this.visualizer = new EventVisualizer(GamePlayerUtil.getGuiPlayer());
}
- private boolean isUsingAltSystem() {
+ private static boolean isUsingAltSystem() {
return FModel.getPreferences().getPrefBoolean(FPref.UI_ALT_SOUND_SYSTEM);
}
/**
* Fetch a resource based on the sound effect type from the SoundEffectType enumeration.
- *
+ *
* @param type the sound effect type.
* @return a clip associated with the loaded resource, or emptySound if the resource
* was unavailable or failed to load.
*/
- protected IAudioClip fetchResource(SoundEffectType type) {
+ protected IAudioClip fetchResource(final SoundEffectType type) {
if (!FModel.getPreferences().getPrefBoolean(FPref.UI_ENABLE_SOUNDS)) {
return emptySound;
}
IAudioClip clip = loadedClips.get(type);
if (clip == null) { // cache miss
- String resource = type.getResourceFileName();
+ final String resource = type.getResourceFileName();
clip = GuiBase.getInterface().createAudioClip(resource);
if (clip == null) {
clip = emptySound;
@@ -66,7 +65,7 @@
* @return a clip associated with the loaded resource, or emptySound if the resource
* was unavailable or failed to load.
*/
- protected IAudioClip fetchResource(String fileName) {
+ protected IAudioClip fetchResource(final String fileName) {
if (!FModel.getPreferences().getPrefBoolean(FPref.UI_ENABLE_SOUNDS)) {
return emptySound;
}
@@ -86,12 +85,12 @@
* Play the sound associated with the resource specified by the file name
* ("synchronized" with other sounds of the same kind means: only one can play at a time).
*/
- public void play(String resourceFileName, boolean isSynchronized) {
+ public void play(final String resourceFileName, final boolean isSynchronized) {
if (isUsingAltSystem()) {
GuiBase.getInterface().startAltSoundSystem(ForgeConstants.SOUND_DIR + resourceFileName, isSynchronized);
}
else {
- IAudioClip snd = fetchResource(resourceFileName);
+ final IAudioClip snd = fetchResource(resourceFileName);
if (!isSynchronized || snd.isDone()) {
snd.play();
}
@@ -101,12 +100,12 @@
/**
* Play the sound associated with the Sounds enumeration element.
*/
- public void play(SoundEffectType type, boolean isSynchronized) {
+ public void play(final SoundEffectType type, final boolean isSynchronized) {
if (isUsingAltSystem()) {
GuiBase.getInterface().startAltSoundSystem(ForgeConstants.SOUND_DIR + type.getResourceFileName(), isSynchronized);
}
else {
- IAudioClip snd = fetchResource(type);
+ final IAudioClip snd = fetchResource(type);
if (!isSynchronized || snd.isDone()) {
snd.play();
}
@@ -116,39 +115,39 @@
/**
* Play the sound in a looping manner until 'stop' is called.
*/
- public void loop(String resourceFileName) {
+ public void loop(final String resourceFileName) {
fetchResource(resourceFileName).loop();
}
/**
* Play the sound in a looping manner until 'stop' is called.
*/
- public void loop(SoundEffectType type) {
+ public void loop(final SoundEffectType type) {
fetchResource(type).loop();
}
/**
* Stop the sound associated with the given resource file name.
*/
- public void stop(String resourceFileName) {
+ public void stop(final String resourceFileName) {
fetchResource(resourceFileName).stop();
}
/**
* Stop the sound associated with the Sounds enumeration element.
*/
- public void stop(SoundEffectType type) {
+ public void stop(final SoundEffectType type) {
fetchResource(type).stop();
}
@Subscribe
- public void receiveEvent(GameEvent evt) {
- SoundEffectType effect = evt.visit(visualizer);
+ public void receiveEvent(final GameEvent evt) {
+ final SoundEffectType effect = evt.visit(visualizer);
if (null == effect) {
return;
}
if (effect == SoundEffectType.ScriptedEffect) {
- String resourceName = visualizer.getScriptedSoundEffectName(evt);
+ final String resourceName = visualizer.getScriptedSoundEffectName(evt);
if (!resourceName.isEmpty()) {
play(resourceName, false);
}
@@ -156,20 +155,20 @@
play(effect, effect.isSynced());
}
}
-
+
@Subscribe
- public void receiveEvent(UiEvent evt) {
- SoundEffectType effect = evt.visit(visualizer);
+ public void receiveEvent(final UiEvent evt) {
+ final SoundEffectType effect = evt.visit(visualizer);
if (null != effect) {
play(effect, effect.isSynced());
}
}
-
+
//Background Music
private IAudioMusic currentTrack;
private MusicPlaylist currentPlaylist;
- public void setBackgroundMusic(MusicPlaylist playlist) {
+ public void setBackgroundMusic(final MusicPlaylist playlist) {
currentPlaylist = playlist;
changeBackgroundTrack();
}
@@ -185,25 +184,22 @@
return;
}
- String filename = currentPlaylist.getRandomFilename();
+ final String filename = currentPlaylist.getRandomFilename();
if (filename == null) { return; }
try {
currentTrack = GuiBase.getInterface().createAudioMusic(filename);
currentTrack.play(new Runnable() {
- @Override
- public void run() {
+ @Override public void run() {
try {
Thread.sleep(SoundSystem.DELAY);
- }
- catch (InterruptedException ex) {
+ } catch (final InterruptedException ex) {
ex.printStackTrace();
}
changeBackgroundTrack(); //change track when music completes on its own
}
});
- }
- catch (Exception ex) {
+ } catch (final Exception ex) {
System.err.println("Unable to load music file: " + filename);
}
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/ToolTipListener.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/ToolTipListener.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/ToolTipListener.java (revision 29317)
@@ -6,21 +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.toolbox;
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.Component;
+import java.awt.Point;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.ToolTipManager;
+
// based on code from http://tips4java.wordpress.com/2009/11/08/tooltips-and-scrollpanes/
/**
@@ -57,57 +67,60 @@
/**
* Create a mouseMoved event to pass to the ToolTipManager.
*/
- private void phantomMouseMoved(Component component)
- {
+ private void phantomMouseMoved(final Component component) {
if (null == component) {
return;
}
// mouse is in the bounds of the component, generate phantom
// mouseMoved event for the ToolTipManager
- Point mouseLocation = component.getMousePosition();
- if (mouseLocation != null)
- {
- MouseEvent phantom = new MouseEvent(
+ final Point mouseLocation = component.getMousePosition();
+ if (mouseLocation != null) {
+ final MouseEvent phantom = new MouseEvent(
- component,
- MouseEvent.MOUSE_MOVED,
- System.currentTimeMillis(),
- 0,
- mouseLocation.x,
- mouseLocation.y,
- 0,
- false);
+ component,
+ MouseEvent.MOUSE_MOVED,
+ System.currentTimeMillis(),
+ 0,
+ mouseLocation.x,
+ mouseLocation.y,
+ 0,
+ false);
ToolTipManager.sharedInstance().mouseMoved(phantom);
}
}
// implement ComponentListener
- public void componentMoved(ComponentEvent e)
- {
+ @Override
+ public void componentMoved(final ComponentEvent e) {
phantomMouseMoved(e.getComponent());
}
- public void componentResized(ComponentEvent e)
- {
+ @Override
+ public void componentResized(final ComponentEvent e) {
phantomMouseMoved(e.getComponent());
}
- public void componentHidden(ComponentEvent e) { }
- public void componentShown(ComponentEvent e) { }
+ @Override
+ public void componentHidden(final ComponentEvent e) {
+ }
-
+
+ @Override
+ public void componentShown(final ComponentEvent e) {
+ }
+
// implement MouseWheelListener
- public void mouseWheelMoved(MouseWheelEvent e)
- {
- JScrollPane scrollPane = (JScrollPane)e.getSource();
+ @Override
+ public void mouseWheelMoved(final MouseWheelEvent e) {
+ final JScrollPane scrollPane = (JScrollPane)e.getSource();
phantomMouseMoved(scrollPane.getViewport().getView());
}
// implement AdjustmentListener
- public void adjustmentValueChanged(AdjustmentEvent e)
- {
- JScrollBar scrollBar = (JScrollBar)e.getSource();
- JScrollPane scrollPane = (JScrollPane)scrollBar.getParent();
+ @Override
+ public void adjustmentValueChanged(final AdjustmentEvent e) {
+ final JScrollBar scrollBar = (JScrollBar)e.getSource();
+ final JScrollPane scrollPane = (JScrollPane)scrollBar.getParent();
phantomMouseMoved(scrollPane.getViewport().getView());
}
}
Index: forge-gui-desktop/src/main/java/forge/screens/home/sanctioned/CSubmenuWinston.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/sanctioned/CSubmenuWinston.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/sanctioned/CSubmenuWinston.java (revision 29317)
@@ -113,7 +113,7 @@
}
if (FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
- String errorMessage = gameType.getDeckFormat().getDeckConformanceProblem(humanDeck.getDeck());
+ final String errorMessage = gameType.getDeckFormat().getDeckConformanceProblem(humanDeck.getDeck());
if (null != errorMessage) {
FOptionPane.showErrorDialog("Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid Deck");
return;
@@ -156,7 +156,7 @@
final LimitedPoolType poolType = GuiChoose.oneOrNone("Choose Draft Format", LimitedPoolType.values());
if (poolType == null) { return; }
- WinstonDraft draft = WinstonDraft.createDraft(poolType);
+ final WinstonDraft draft = WinstonDraft.createDraft(poolType);
if (draft == null) { return; }
final CEditorWinstonProcess draftController = new CEditorWinstonProcess(CDeckEditorUI.SINGLETON_INSTANCE.getCDetailPicture());
@@ -166,11 +166,4 @@
CDeckEditorUI.SINGLETON_INSTANCE.setEditorController(draftController);
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
}
Index: forge-gui-desktop/src/main/java/forge/screens/home/sanctioned/AvatarSelector.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/sanctioned/AvatarSelector.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/sanctioned/AvatarSelector.java (revision 29317)
@@ -1,5 +1,15 @@
package forge.screens.home.sanctioned;
+import java.awt.Dimension;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JPanel;
+import javax.swing.ScrollPaneConstants;
+import javax.swing.SwingConstants;
+
import forge.gui.WrapLayout;
import forge.toolbox.FLabel;
import forge.toolbox.FScrollPane;
@@ -7,18 +17,10 @@
import forge.toolbox.FSkin.SkinImage;
import forge.view.FDialog;
-import javax.swing.*;
-
-import java.awt.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
@SuppressWarnings("serial")
public class AvatarSelector extends FDialog {
- private List<FLabel> selectables = new ArrayList<FLabel>();
+ private final List<FLabel> selectables = new ArrayList<FLabel>();
- private final Map<Integer, SkinImage> avatarMap = FSkin.getAvatars();
+ private final Map<Integer, SkinImage> avatarMap = FSkin.getAvatars();
public AvatarSelector(final String playerName, final int currentIndex, final Collection<Integer> usedIndices) {
this.setTitle("Select avatar for " + playerName);
@@ -28,21 +30,21 @@
pnlAvatarPics.setOpaque(false);
pnlAvatarPics.setOpaque(false);
- FLabel initialSelection = makeAvatarLabel(avatarMap.get(currentIndex), currentIndex, currentIndex);
+ final FLabel initialSelection = makeAvatarLabel(avatarMap.get(currentIndex), currentIndex, currentIndex);
pnlAvatarPics.add(initialSelection);
- for (final Integer i : avatarMap.keySet()) {
- //if (!usedIndices.contains(i)) { // Decided to allow duplicate avatars when manually selecting
- if (currentIndex != i) {
+ for (final Integer i : avatarMap.keySet()) {
+ //if (!usedIndices.contains(i)) { // Decided to allow duplicate avatars when manually selecting
+ if (currentIndex != i) {
pnlAvatarPics.add(makeAvatarLabel(avatarMap.get(i), i, currentIndex));
- }
+ }
}
- final int width = this.getOwner().getWidth() * 3 / 4;
+ final int width = this.getOwner().getWidth() * 3 / 4;
final int height = this.getOwner().getHeight() * 3 / 4;
this.setPreferredSize(new Dimension(width, height));
this.setSize(width, height);
- FScrollPane scroller = new FScrollPane(pnlAvatarPics, false);
+ final FScrollPane scroller = new FScrollPane(pnlAvatarPics, false);
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
this.add(scroller, "w 100%-24px!, pushy, growy, gap 12px 0 0 0");
this.setDefaultFocus(initialSelection);
@@ -50,8 +52,8 @@
private FLabel makeAvatarLabel(final SkinImage img0, final int index0, final int oldIndex) {
final FLabel lbl = new FLabel.Builder().icon(img0).iconScaleFactor(0.95).iconAlignX(SwingConstants.CENTER)
- .iconInBackground(true).hoverable(true).selectable(true).selected(oldIndex == index0)
- .unhoveredAlpha(oldIndex == index0 ? 0.9f : 0.7f).build();
+ .iconInBackground(true).hoverable(true).selectable(true).selected(oldIndex == index0)
+ .unhoveredAlpha(oldIndex == index0 ? 0.9f : 0.7f).build();
final Dimension size = new Dimension(80, 80);
lbl.setPreferredSize(size);
@@ -60,7 +62,7 @@
lbl.setName("AvatarLabel" + index0);
if (oldIndex == index0) {
- lbl.setBorder(new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS).alphaColor(255), 3));
+ lbl.setBorder(new FSkin.LineSkinBorder(FSkin.getColor(FSkin.Colors.CLR_BORDERS).alphaColor(255), 3));
}
selectables.add(lbl);
@@ -69,6 +71,6 @@
}
public List<FLabel> getSelectables() {
- return this.selectables;
+ return this.selectables;
}
}
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/DeckHtmlSerializer.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/DeckHtmlSerializer.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/controllers/DeckHtmlSerializer.java (revision 29317)
@@ -1,5 +1,16 @@
package forge.screens.deckeditor.controllers;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
import forge.deck.Deck;
import forge.item.PaperCard;
import forge.properties.ForgeConstants;
@@ -9,94 +20,87 @@
import freemarker.template.Template;
import freemarker.template.TemplateException;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.*;
-import java.util.Map.Entry;
-
public class DeckHtmlSerializer {
- public static void writeDeckHtml(final Deck d, final File f) {
- try {
- final BufferedWriter writer = new BufferedWriter(new FileWriter(f));
- writeDeckHtml(d, writer);
- writer.close();
- } catch (final IOException e) {
- throw new RuntimeException(e);
- }
- }
+ public static void writeDeckHtml(final Deck d, final File f) {
+ try {
+ final BufferedWriter writer = new BufferedWriter(new FileWriter(f));
+ writeDeckHtml(d, writer);
+ writer.close();
+ } catch (final IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
- /**
- * <p>
- * writeDeck.
- * </p>
- *
- * @param d
- * a {@link forge.deck.Deck} object.
- * @param out
- * a {@link java.io.BufferedWriter} object.
- * @throws java.io.IOException
- * if any.
- */
+ /**
+ * <p>
+ * writeDeck.
+ * </p>
+ *
+ * @param d
+ * a {@link forge.deck.Deck} object.
+ * @param out
+ * a {@link java.io.BufferedWriter} object.
+ * @throws java.io.IOException
+ * if any.
+ */
- private static void writeDeckHtml(final Deck d, final BufferedWriter out) throws IOException {
+ private static void writeDeckHtml(final Deck d, final BufferedWriter out) {
- Template temp = null;
- final int cardBorder = 0;
- final int height = 319;
- final int width = 222;
-
- /* Create and adjust the configuration */
- final Configuration cfg = new Configuration();
- try {
- cfg.setClassForTemplateLoading(DeckHtmlSerializer.class, "/");
- cfg.setObjectWrapper(new DefaultObjectWrapper());
-
- /*
- * ------------------------------------------------------------------
- * -
- */
- /*
- * You usually do these for many times in the application
- * life-cycle:
- */
-
- /* Get or create a template */
- temp = cfg.getTemplate("proxy-template.ftl");
-
- /* Create a data-model */
- final Map<String, Object> root = new HashMap<String, Object>();
- root.put("title", d.getName());
- final List<String> list = new ArrayList<String>();
- for (final Entry<PaperCard, Integer> card : d.getMain()) {
- // System.out.println(card.getSets().get(card.getSets().size() - 1).URL);
- for (int i = card.getValue().intValue(); i > 0; --i ) {
+ Template temp = null;
+ final int cardBorder = 0;
+ final int height = 319;
+ final int width = 222;
+
+ /* Create and adjust the configuration */
+ final Configuration cfg = new Configuration();
+ try {
+ cfg.setClassForTemplateLoading(DeckHtmlSerializer.class, "/");
+ cfg.setObjectWrapper(new DefaultObjectWrapper());
+
+ /*
+ * ------------------------------------------------------------------
+ * -
+ */
+ /*
+ * You usually do these for many times in the application
+ * life-cycle:
+ */
+
+ /* Get or create a template */
+ temp = cfg.getTemplate("proxy-template.ftl");
+
+ /* Create a data-model */
+ final Map<String, Object> root = new HashMap<String, Object>();
+ root.put("title", d.getName());
+ final List<String> list = new ArrayList<String>();
+ for (final Entry<PaperCard, Integer> card : d.getMain()) {
+ // System.out.println(card.getSets().get(card.getSets().size() - 1).URL);
+ for (int i = card.getValue().intValue(); i > 0; --i ) {
- PaperCard r = card.getKey();
- String url = ForgeConstants.URL_PIC_DOWNLOAD + ImageUtil.getDownloadUrl(r, false);
+ final PaperCard r = card.getKey();
+ final String url = ForgeConstants.URL_PIC_DOWNLOAD + ImageUtil.getDownloadUrl(r, false);
- list.add(url);
- }
- }
-
- final TreeMap<String, Integer> map = new TreeMap<String, Integer>();
- for (final Entry<PaperCard, Integer> entry : d.getMain()) {
- map.put(entry.getKey().getName(), entry.getValue());
- // System.out.println(entry.getValue() + " " +
- // entry.getKey().getName());
- }
-
- root.put("urls", list);
- root.put("cardBorder", cardBorder);
- root.put("height", height);
- root.put("width", width);
- root.put("cardlistWidth", width - 11);
- root.put("cardList", map);
-
- /* Merge data-model with template */
- temp.process(root, out);
- out.flush();
- } catch (final IOException e) {
- System.out.println(e.toString());
- } catch (final TemplateException e) {
- System.out.println(e.toString());
- }
- }
+ list.add(url);
+ }
+ }
+
+ final TreeMap<String, Integer> map = new TreeMap<String, Integer>();
+ for (final Entry<PaperCard, Integer> entry : d.getMain()) {
+ map.put(entry.getKey().getName(), entry.getValue());
+ // System.out.println(entry.getValue() + " " +
+ // entry.getKey().getName());
+ }
+
+ root.put("urls", list);
+ root.put("cardBorder", cardBorder);
+ root.put("height", height);
+ root.put("width", width);
+ root.put("cardlistWidth", width - 11);
+ root.put("cardList", map);
+
+ /* Merge data-model with template */
+ temp.process(root, out);
+ out.flush();
+ } catch (final IOException e) {
+ System.out.println(e.toString());
+ } catch (final TemplateException e) {
+ System.out.println(e.toString());
+ }
+ }
}
\ No newline at end of file
Index: forge-gui/src/main/java/forge/match/input/InputQueue.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/input/InputQueue.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/input/InputQueue.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/>.
*/
@@ -28,7 +28,7 @@
* <p>
* InputControl class.
* </p>
- *
+ *
* @author Forge
* @version $Id: InputQueue.java 24769 2014-02-09 13:56:04Z Hellfish $
*/
@@ -50,8 +50,8 @@
return inputStack.isEmpty() ? null : inputStack.peek();
}
- public final void removeInput(Input inp) {
- Input topMostInput = inputStack.isEmpty() ? null : inputStack.pop();
+ public final void removeInput(final Input inp) {
+ final Input topMostInput = inputStack.isEmpty() ? null : inputStack.pop();
if (topMostInput != inp) {
throw new RuntimeException("Cannot remove input " + inp.getClass().getSimpleName() + " because it's not on top of stack. Stack = " + inputStack );
Index: forge-gui-desktop/src/main/java/forge/screens/home/online/COnlineLobby.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/online/COnlineLobby.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/online/COnlineLobby.java (revision 29317)
@@ -1,6 +1,5 @@
package forge.screens.home.online;
-import forge.UiCommand;
import forge.gui.framework.ICDoc;
import forge.screens.home.CLobby;
import forge.screens.home.VLobby;
@@ -10,7 +9,7 @@
private CLobby lobby;
- void setLobby(VLobby lobbyView) {
+ void setLobby(final VLobby lobbyView) {
lobby = new CLobby(lobbyView);
initialize();
}
@@ -37,14 +36,6 @@
if (lobby != null) {
lobby.initialize();
}
- }
-
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
}
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/FOverlay.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FOverlay.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FOverlay.java (revision 29317)
@@ -6,38 +6,39 @@
* 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.gui.SOverlayUtils;
-import forge.toolbox.FSkin.SkinnedPanel;
-
-import javax.swing.*;
-
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Graphics;
import java.awt.event.KeyAdapter;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+
+import forge.gui.SOverlayUtils;
+import forge.toolbox.FSkin.SkinnedPanel;
+
/**
* Semi-transparent overlay panel. Should be used with layered panes.
- *
+ *
*/
// Currently used only once, in top level UI, with layering already in place.
// Getter in AllZone: getOverlay()
@SuppressWarnings("serial")
public enum FOverlay {
- /** */
SINGLETON_INSTANCE;
private final JButton btnClose = new JButton("X");
@@ -74,7 +75,7 @@
* Gets the close button, which must be added dynamically since different
* overlays have different layouts. The overlay does not have the close
* button by default, but a fully working instance is available if required.
- *
+ *
* @return JButton
*/
public JButton getBtnClose() {
@@ -90,7 +91,7 @@
* For some reason, the alpha channel background doesn't work properly on
* Windows 7, so the paintComponent override is required for a
* semi-transparent overlay.
- *
+ *
* @param g
* &emsp; Graphics object
*/
Index: forge-gui-desktop/src/main/java/forge/screens/deckeditor/DeckImport.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/deckeditor/DeckImport.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/deckeditor/DeckImport.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.screens.deckeditor;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowEvent;
+import java.util.List;
+
+import javax.swing.BorderFactory;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
import forge.deck.Deck;
import forge.deck.DeckBase;
import forge.deck.DeckImportController;
@@ -24,19 +33,18 @@
import forge.deck.DeckRecognizer.TokenType;
import forge.item.InventoryItem;
import forge.screens.deckeditor.controllers.ACEditorBase;
-import forge.toolbox.*;
+import forge.toolbox.FButton;
+import forge.toolbox.FCheckBox;
+import forge.toolbox.FComboBox;
+import forge.toolbox.FHtmlViewer;
+import forge.toolbox.FLabel;
+import forge.toolbox.FScrollPane;
+import forge.toolbox.FSkin;
+import forge.toolbox.FTextArea;
import forge.view.FDialog;
-import javax.swing.*;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowEvent;
-import java.util.List;
-
/**
- *
+ *
* Dialog for quick import of decks.
*
* @param <TItem>
@@ -87,7 +95,7 @@
private final ACEditorBase<TItem, TModel> host;
- public DeckImport(final ACEditorBase<TItem, TModel> g, boolean allowCardsFromAllSets) {
+ public DeckImport(final ACEditorBase<TItem, TModel> g, final boolean allowCardsFromAllSets) {
this.controller = new DeckImportController(!g.getDeckController().isEmpty(),
newEditionCheck, dateTimeCheck, onlyCoreExpCheck, monthDropdown, yearDropdown);
this.host = g;
@@ -102,7 +110,7 @@
txtInput.setFocusable(true);
txtInput.setEditable(true);
- FSkin.SkinColor foreColor = FSkin.getColor(FSkin.Colors.CLR_TEXT);
+ final FSkin.SkinColor foreColor = FSkin.getColor(FSkin.Colors.CLR_TEXT);
this.scrollInput.setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Paste or type a decklist", foreColor));
this.scrollOutput.setBorder(new FSkin.TitledSkinBorder(BorderFactory.createEtchedBorder(), "Expect the recognized lines to appear", foreColor));
this.scrollInput.setViewportBorder(BorderFactory.createLoweredBevelBorder());
@@ -144,10 +152,9 @@
}
});
- ActionListener updateDateCheck = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- boolean isSel = dateTimeCheck.isSelected();
+ final ActionListener updateDateCheck = new ActionListener() {
+ @Override public void actionPerformed(final ActionEvent e) {
+ final boolean isSel = dateTimeCheck.isSelected();
monthDropdown.setEnabled(isSel);
yearDropdown.setEnabled(isSel);
parseAndDisplay();
@@ -155,8 +162,10 @@
};
this.dateTimeCheck.addActionListener(updateDateCheck);
- ActionListener reparse = new ActionListener() {
- @Override public void actionPerformed(ActionEvent e) { parseAndDisplay(); }
+ final ActionListener reparse = new ActionListener() {
+ @Override public void actionPerformed(final ActionEvent e) {
+ parseAndDisplay();
+ }
};
this.newEditionCheck.addActionListener(reparse);
this.onlyCoreExpCheck.addActionListener(reparse);
@@ -192,12 +201,12 @@
}
private void parseAndDisplay() {
- List<DeckRecognizer.Token> tokens = controller.parseInput(txtInput.getText());
+ final List<DeckRecognizer.Token> tokens = controller.parseInput(txtInput.getText());
displayTokens(tokens);
updateSummaries(tokens);
}
- private void displayTokens(List<DeckRecognizer.Token> tokens) {
+ private void displayTokens(final List<DeckRecognizer.Token> tokens) {
if (tokens.isEmpty()) {
htmlOutput.setText(HTML_WELCOME_TEXT);
}
@@ -212,7 +221,7 @@
}
}
- private void updateSummaries(List<DeckRecognizer.Token> tokens) {
+ private void updateSummaries(final List<DeckRecognizer.Token> tokens) {
final int[] cardsOk = new int[2];
final int[] cardsUnknown = new int[2];
int idx = 0;
@@ -232,7 +241,7 @@
cmdAccept.setEnabled(cardsOk[0] > 0);
}
- private String makeHtmlViewOfToken(final DeckRecognizer.Token token) {
+ private static String makeHtmlViewOfToken(final DeckRecognizer.Token token) {
switch (token.getType()) {
case KnownCard:
return String.format("<div class='knowncard'>%s * %s [%s] %s</div>", token.getNumber(), token.getCard()
Index: forge-gui-desktop/src/main/java/forge/toolbox/FTextArea.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FTextArea.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FTextArea.java (revision 29317)
@@ -1,18 +1,16 @@
package forge.toolbox;
+import java.awt.FontMetrics;
+
import forge.toolbox.FSkin.SkinnedTextArea;
-import java.awt.*;
-
-/**
+/**
* A custom instance of JTextArea using Forge skin properties.
- *
*/
@SuppressWarnings("serial")
public class FTextArea extends SkinnedTextArea {
private boolean autoSize;
- /** */
public FTextArea() {
super();
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
@@ -23,7 +21,7 @@
this.setFocusable(false);
this.setEditable(false);
}
- /** @param str {@java.lang.String} */
+
public FTextArea(final String str) {
this();
this.setText(str);
@@ -33,7 +31,7 @@
return this.autoSize;
}
- public void setAutoSize(boolean autoSize0) {
+ public void setAutoSize(final boolean autoSize0) {
if (this.autoSize == autoSize0) { return; }
this.autoSize = autoSize0;
if (autoSize0) {
@@ -51,10 +49,10 @@
}
int maxLineWidth = 0;
- FontMetrics metrics = this.getGraphics().getFontMetrics(this.getFont());
- String[] lines = this.getText().split("(\r\n)|(\n)");
+ final FontMetrics metrics = this.getGraphics().getFontMetrics(this.getFont());
+ final String[] lines = this.getText().split("(\r\n)|(\n)");
for (int i = 0; i < lines.length; i++) {
- int lineWidth = metrics.stringWidth(lines[i]);
+ final int lineWidth = metrics.stringWidth(lines[i]);
if (lineWidth > maxLineWidth) {
maxLineWidth = lineWidth;
}
Index: forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuReleaseNotes.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/CSubmenuReleaseNotes.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuReleaseNotes.java (revision 29317)
@@ -6,26 +6,25 @@
* 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.home.settings;
-import forge.UiCommand;
import forge.gui.framework.ICDoc;
import forge.properties.ForgeConstants;
import forge.util.FileUtil;
-/**
+/**
* Controller for VSubmenuReleaseNotes submenu in the home UI.
- *
+ *
* @version $Id$
*
*/
@@ -45,7 +44,7 @@
* @see forge.control.home.IControlSubmenu#update()
*/
@Override
- public void initialize() {
+ public void initialize() {
this.view = VSubmenuReleaseNotes.SINGLETON_INSTANCE;
//this.prefs = FModel.getPreferences();
}
@@ -54,40 +53,32 @@
* @see forge.control.home.IControlSubmenu#update()
*/
@Override
- public void update() {
- this.view = VSubmenuReleaseNotes.SINGLETON_INSTANCE;
- //this.prefs = FModel.getPreferences();
- setReleaseNotesContent();
+ public void update() {
+ this.view = VSubmenuReleaseNotes.SINGLETON_INSTANCE;
+ //this.prefs = FModel.getPreferences();
+ setReleaseNotesContent();
}
-
+
private void setReleaseNotesContent() {
if (!this.isReleaseNotesUpdated) {
this.view.setReleaseNotesContent(getReleaseNotes());
this.isReleaseNotesUpdated = true;
- }
+ }
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
-
/**
* Returns content of CHANGES.txt.
*/
- private String getReleaseNotes() {
+ private static String getReleaseNotes() {
// !! Linux is case-sensitive so file name and extension need to match exactly !!
- String filename = ForgeConstants.CHANGES_FILE;
- String filePath = FileUtil.pathCombine(System.getProperty("user.dir"), filename);
+ final String filename = ForgeConstants.CHANGES_FILE;
+ final String filePath = FileUtil.pathCombine(System.getProperty("user.dir"), filename);
String notes;
-
+
if (FileUtil.doesFileExist(filePath)) {
- notes = filePath + "\n\n" + FileUtil.readFileToString(filePath);
+ notes = filePath + "\n\n" + FileUtil.readFileToString(filePath);
} else {
- notes = filePath + "\nis MISSING!";
+ notes = filePath + "\nis MISSING!";
}
return notes;
Index: forge-gui-desktop/src/main/java/forge/screens/home/CHomeUI.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/screens/home/CHomeUI.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/CHomeUI.java (revision 29317)
@@ -5,7 +5,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;
@@ -32,7 +31,7 @@
/** Programatically selects a menu item.
* @param id0 {@link forge.gui.framework.EDocID} */
- public void itemClick(EDocID id0) {
+ public void itemClick(final EDocID id0) {
final ForgePreferences prefs = FModel.getPreferences();
if (lblSelected != null) {
@@ -87,14 +86,6 @@
*/
@Override
public void update() {
- }
-
- /* (non-Javadoc)
- * @see forge.view.home.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
}
/**
Index: forge-gui-desktop/src/main/java/forge/toolbox/FComboBoxWrapper.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FComboBoxWrapper.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FComboBoxWrapper.java (revision 29317)
@@ -5,7 +5,6 @@
import java.awt.event.ItemListener;
import java.awt.event.KeyListener;
import java.util.ArrayList;
-import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.JComponent;
@@ -17,7 +16,7 @@
import forge.toolbox.FComboBox.TextAlignment;
import forge.toolbox.FSkin.SkinFont;
-/**
+/**
* Wrapper for combo box with extra logic (either FComboBoxWrapper or FComboBoxPanel should be used instead of FComboBox so skinning works)
*
*/
@@ -26,7 +25,7 @@
private static final ArrayList<FComboBoxWrapper<?>> allWrappers = new ArrayList<FComboBoxWrapper<?>>();
public static void refreshAllSkins() {
- for (FComboBoxWrapper<?> wrapper : allWrappers) {
+ for (final FComboBoxWrapper<?> wrapper : allWrappers) {
wrapper.refreshSkin();
}
}
@@ -41,62 +40,50 @@
allWrappers.add(this);
}
- public FComboBoxWrapper(E[] items) {
- super();
- comboBox = new FComboBox<E>(items);
- allWrappers.add(this);
- }
-
- public FComboBoxWrapper(Vector<E> items) {
- super();
- comboBox = new FComboBox<E>(items);
- allWrappers.add(this);
- }
-
- public FComboBoxWrapper(ComboBoxModel<E> aModel) {
- super();
- comboBox = new FComboBox<E>(aModel);
- allWrappers.add(this);
- }
-
- public void addItem(E item) {
+ @Override
+ public void addItem(final E item) {
comboBox.addItem(item);
}
- public void removeItem(E item) {
+ public void removeItem(final E item) {
comboBox.removeItem(item);
}
+ @Override
public void removeAllItems() {
comboBox.removeAllItems();
}
+ @Override
@SuppressWarnings("unchecked")
public E getSelectedItem() {
- Object res = comboBox.getSelectedItem();
+ final Object res = comboBox.getSelectedItem();
return res == null ? null : (E) res;
}
- public void setSelectedItem(Object item) {
+ @Override
+ public void setSelectedItem(final Object item) {
comboBox.setSelectedItem(item);
}
+ @Override
public int getSelectedIndex() {
return comboBox.getSelectedIndex();
}
- public void setSelectedIndex(int index) {
+ @Override
+ public void setSelectedIndex(final int index) {
comboBox.setSelectedIndex(index);
}
public String getText() {
return comboBox.getText();
}
- public void setText(String text0) {
+ public void setText(final String text0) {
comboBox.setText(text0);
}
- public void setMaximumRowCount(int count) {
+ public void setMaximumRowCount(final int count) {
comboBox.setMaximumRowCount(count);
}
@@ -104,15 +91,15 @@
return comboBox.getItemCount();
}
- public E getItemAt(int index) {
+ public E getItemAt(final int index) {
return comboBox.getItemAt(index);
}
- public void addActionListener(ActionListener l) {
+ public void addActionListener(final ActionListener l) {
comboBox.addActionListener(l);
}
- public void addItemListener(ItemListener l) {
+ public void addItemListener(final ItemListener l) {
comboBox.addItemListener(l);
}
@@ -123,7 +110,7 @@
}
suppressedActionListeners = suppressedActionListeners == null
? listeners
- : ObjectArrays.concat(suppressedActionListeners, listeners, ActionListener.class);
+ : ObjectArrays.concat(suppressedActionListeners, listeners, ActionListener.class);
}
public void unsuppressActionListeners() {
if (suppressedActionListeners != null) {
@@ -134,23 +121,23 @@
}
}
- public void addKeyListener(KeyListener l) {
+ public void addKeyListener(final KeyListener l) {
comboBox.addKeyListener(l);
}
- public void setRenderer(ListCellRenderer<? super E> aRenderer) {
+ public void setRenderer(final ListCellRenderer<? super E> aRenderer) {
comboBox.setRenderer(aRenderer);
}
- public void setModel(ComboBoxModel<E> aModel) {
+ public void setModel(final ComboBoxModel<E> aModel) {
comboBox.setModel(aModel);
}
- public void setTextAlignment(TextAlignment align) {
+ public void setTextAlignment(final TextAlignment align) {
comboBox.setTextAlignment(align);
}
- public void setSkinFont(SkinFont skinFont) {
+ public void setSkinFont(final SkinFont skinFont) {
comboBox.setSkinFont(skinFont);
}
@@ -160,7 +147,7 @@
}
@Override
- public void setVisible(boolean aFlag) {
+ public void setVisible(final boolean aFlag) {
comboBox.setVisible(aFlag);
}
@@ -170,7 +157,7 @@
}
@Override
- public void setEnabled(boolean aFlag) {
+ public void setEnabled(final boolean aFlag) {
comboBox.setEnabled(aFlag);
}
@@ -178,10 +165,10 @@
return comboBox.getAutoSizeWidth();
}
- public void addTo(Container container) {
+ public void addTo(final Container container) {
addTo(container, null);
}
- public void addTo(Container container, Object constraints0) {
+ public void addTo(final Container container, final Object constraints0) {
container.add(comboBox, constraints0);
constraints = constraints0;
}
@@ -198,12 +185,12 @@
//refresh combo box skin by replacing it with a copy of itself
//TODO: Figure out if there's a better way, as calling updateUI doesn't seem to work
- public static <E> FComboBox<E> refreshComboBoxSkin(FComboBox<E> comboBox) {
+ public static <E> FComboBox<E> refreshComboBoxSkin(final FComboBox<E> comboBox) {
return refreshComboBoxSkin(comboBox, null);
}
- public static <E> FComboBox<E> refreshComboBoxSkin(FComboBox<E> comboBox, Object constraints) {
+ public static <E> FComboBox<E> refreshComboBoxSkin(final FComboBox<E> comboBox, final Object constraints) {
//find index of combo box within parent
- Container parent = comboBox.getParent();
+ final Container parent = comboBox.getParent();
if (parent == null) { return comboBox; }
int index;
@@ -214,36 +201,36 @@
}
//create copy of combo box
- FComboBox<E> newComboBox = new FComboBox<E>();
+ final FComboBox<E> newComboBox = new FComboBox<E>();
for (int i = 0; i < comboBox.getItemCount(); i++) {
newComboBox.addItem(comboBox.getItemAt(i));
}
newComboBox.setSelectedIndex(comboBox.getSelectedIndex());
ActionListener[] actionListeners = newComboBox.getActionListeners();
- for (ActionListener l : actionListeners) {
+ for (final ActionListener l : actionListeners) {
newComboBox.removeActionListener(l); //remove default action listeners to prevent duplicates
}
actionListeners = comboBox.getActionListeners();
- for (ActionListener l : actionListeners) {
+ for (final ActionListener l : actionListeners) {
newComboBox.addActionListener(l);
}
ItemListener[] itemListeners = newComboBox.getItemListeners();
- for (ItemListener l : itemListeners) {
+ for (final ItemListener l : itemListeners) {
newComboBox.removeItemListener(l); //remove default item listener to prevent duplicates
}
itemListeners = comboBox.getItemListeners();
- for (ItemListener l : itemListeners) {
+ for (final ItemListener l : itemListeners) {
newComboBox.addItemListener(l);
}
KeyListener[] keyListeners = newComboBox.getKeyListeners();
- for (KeyListener l : keyListeners) {
+ for (final KeyListener l : keyListeners) {
newComboBox.removeKeyListener(l); //remove default key listeners to prevent duplicates
}
keyListeners = comboBox.getKeyListeners();
- for (KeyListener l : keyListeners) {
+ for (final KeyListener l : keyListeners) {
newComboBox.addKeyListener(l);
}
\ No newline at end of file
Index: forge-gui/src/main/java/forge/match/input/InputSyncronizedBase.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/match/input/InputSyncronizedBase.java (revision 29316)
+++ forge-gui/src/main/java/forge/match/input/InputSyncronizedBase.java (revision 29317)
@@ -15,16 +15,17 @@
cdlDone = new CountDownLatch(1);
}
+ @Override
public void awaitLatchRelease() {
FThreads.assertExecutedByEdt(false);
try{
cdlDone.await();
- }
- catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
BugReporter.reportException(e);
}
}
+ @Override
public final void relaseLatchWhenGameIsOver() {
cdlDone.countDown();
}
@@ -33,7 +34,7 @@
getController().getInputQueue().setInput(this);
awaitLatchRelease();
}
-
+
protected final void stop() {
onStop();
\ No newline at end of file
Index: forge-gui-desktop/src/main/java/forge/screens/match/controllers/CAntes.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/CAntes.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/controllers/CAntes.java (revision 29317)
@@ -1,13 +1,12 @@
package forge.screens.match.controllers;
-import forge.UiCommand;
import forge.gui.framework.ICDoc;
import forge.screens.match.CMatchUI;
import forge.screens.match.views.VAntes;
-/**
+/**
* Controls the ante panel in the match UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -17,14 +16,6 @@
public CAntes(final CMatchUI matchUI) {
this.matchUI = matchUI;
this.view = new VAntes(this);
- }
-
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
}
@Override
Index: forge-gui/src/main/java/forge/card/CardScriptInfo.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/card/CardScriptInfo.java (revision 29316)
+++ forge-gui/src/main/java/forge/card/CardScriptInfo.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,21 +19,17 @@
import java.io.File;
import java.io.PrintWriter;
-import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.commons.lang3.StringUtils;
-
-import forge.CardStorageReader;
import forge.properties.ForgeConstants;
import forge.util.FileUtil;
public final class CardScriptInfo {
private String text;
- private File file;
+ private final File file;
- public CardScriptInfo(String text0, File file0) {
+ public CardScriptInfo(final String text0, final File file0) {
text = text0;
file = file0;
}
@@ -43,18 +39,18 @@
}
public File getFile() {
- return file;
+ return file;
}
public boolean canEdit() {
- return file != null;
+ return file != null;
}
- public boolean trySetText(String text0) {
+ public boolean trySetText(final String text0) {
if (file == null) { return false; }
try {
- PrintWriter p = new PrintWriter(file);
+ final PrintWriter p = new PrintWriter(file);
p.print(text0);
p.close();
@@ -69,15 +65,11 @@
}
private static Map<String, CardScriptInfo> allScripts = new ConcurrentHashMap<>();
- public static void addCard(String name, String script, File file) {
- allScripts.put(name, new CardScriptInfo(script, file));
- }
-
- public static CardScriptInfo getScriptFor(String name) {
+ public static CardScriptInfo getScriptFor(final String name) {
CardScriptInfo script = allScripts.get(name);
if (script == null) { //attempt to load script if not previously loaded
- String filename = name.toLowerCase().replace(' ', '_').replace('-', '_').replace("'", "").replace(",", "") + ".txt";
- File file = new File(ForgeConstants.CARD_DATA_DIR + filename.charAt(0) + File.separator + filename);
+ final String filename = name.toLowerCase().replace(' ', '_').replace('-', '_').replace("'", "").replace(",", "") + ".txt";
+ final File file = new File(ForgeConstants.CARD_DATA_DIR + filename.charAt(0) + File.separator + filename);
if (file.exists()) {
script = new CardScriptInfo(FileUtil.readFileToString(file), file);
allScripts.put(name, script);
@@ -86,10 +78,4 @@
return script;
}
- public static CardStorageReader.Observer readerObserver = new CardStorageReader.Observer() {
- @Override
- public void cardLoaded(CardRules rules, List<String> lines, File fileOnDisk) {
- allScripts.put(rules.getName(), new CardScriptInfo(StringUtils.join(lines, '\n'), fileOnDisk));
- }
- };
}
Index: forge-gui-desktop/src/main/java/forge/toolbox/FPasswordField.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FPasswordField.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FPasswordField.java (revision 29317)
@@ -1,14 +1,21 @@
package forge.toolbox;
+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.SwingUtilities;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
import forge.gui.MouseUtil;
import forge.interfaces.ITextField;
import forge.toolbox.FSkin.SkinnedPasswordField;
-import javax.swing.*;
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-import java.awt.*;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
/**
* A custom instance of JPasswordField using Forge skin properties.
@@ -16,7 +23,6 @@
*/
@SuppressWarnings("serial")
public class FPasswordField extends SkinnedPasswordField implements ITextField {
- public static final int HEIGHT = 25; //TODO: calculate this somehow instead of hard-coding it
private static final FSkin.SkinColor textColor = FSkin.getColor(FSkin.Colors.CLR_TEXT);
private static final FSkin.SkinColor ghostTextColor = textColor.stepColor(20);
private static final FSkin.SkinColor backColor = FSkin.getColor(FSkin.Colors.CLR_THEME2);
@@ -114,10 +120,6 @@
if (this.isEmpty() && this.hasFocus()) {
this.repaint();
}
- }
-
- public void addChangeListener(ChangeListener listener) {
- this.getDocument().addDocumentListener(listener);
}
public static abstract class ChangeListener implements DocumentListener {
Index: forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuDownloaders.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/CSubmenuDownloaders.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuDownloaders.java (revision 29317)
@@ -1,5 +1,7 @@
package forge.screens.home.settings;
+import javax.swing.SwingUtilities;
+
import forge.UiCommand;
import forge.download.GuiDownloadPicturesLQ;
import forge.download.GuiDownloadPrices;
@@ -10,8 +12,6 @@
import forge.gui.ImportDialog;
import forge.gui.framework.ICDoc;
-import javax.swing.*;
-
/**
* Controls the utilities submenu in the home UI.
*
@@ -22,23 +22,46 @@
public enum CSubmenuDownloaders implements ICDoc {
SINGLETON_INSTANCE;
- private final UiCommand cmdLicensing = new UiCommand() { @Override
- public void run() { VSubmenuDownloaders.SINGLETON_INSTANCE.showLicensing(); } };
- private final UiCommand cmdPicDownload = new UiCommand() { @Override
- public void run() { new GuiDownloader(new GuiDownloadPicturesLQ()); } };
- private final UiCommand cmdSetDownload = new UiCommand() { @Override
- public void run() { new GuiDownloader(new GuiDownloadSetPicturesLQ()); } };
- private final UiCommand cmdQuestImages = new UiCommand() { @Override
- public void run() { new GuiDownloader(new GuiDownloadQuestImages()); } };
- private final UiCommand cmdDownloadPrices = new UiCommand() { @Override
- public void run() { new GuiDownloader(new GuiDownloadPrices()); } };
- private final UiCommand cmdHowToPlay = new UiCommand() { @Override
- public void run() { VSubmenuDownloaders.SINGLETON_INSTANCE.showHowToPlay(); } };
- private final UiCommand cmdImportPictures = new UiCommand() { @Override
- public void run() { new ImportDialog(null, null); } };
- private final UiCommand cmdReportBug = new UiCommand() { @Override
- public void run() { BugReporter.reportBug(null); }
+ private final UiCommand cmdLicensing = new UiCommand() {
+ @Override public void run() {
+ VSubmenuDownloaders.SINGLETON_INSTANCE.showLicensing();
+ }
};
+ private final UiCommand cmdPicDownload = new UiCommand() {
+ @Override public void run() {
+ new GuiDownloader(new GuiDownloadPicturesLQ()).show();
+ }
+ };
+ private final UiCommand cmdSetDownload = new UiCommand() {
+ @Override public void run() {
+ new GuiDownloader(new GuiDownloadSetPicturesLQ()).show();
+ }
+ };
+ private final UiCommand cmdQuestImages = new UiCommand() {
+ @Override public void run() {
+ new GuiDownloader(new GuiDownloadQuestImages()).show();
+ }
+ };
+ private final UiCommand cmdDownloadPrices = new UiCommand() {
+ @Override public void run() {
+ new GuiDownloader(new GuiDownloadPrices()).show();
+ }
+ };
+ private final UiCommand cmdHowToPlay = new UiCommand() {
+ @Override public void run() {
+ VSubmenuDownloaders.SINGLETON_INSTANCE.showHowToPlay();
+ }
+ };
+ private final UiCommand cmdImportPictures = new UiCommand() {
+ @Override public void run() {
+ new ImportDialog(null, null).show();
+ }
+ };
+ private final UiCommand cmdReportBug = new UiCommand() {
+ @Override public void run() {
+ BugReporter.reportBug(null);
+ }
+ };
@Override
public void register() {
@@ -73,11 +96,4 @@
});
}
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
- }
}
Index: forge-gui-mobile/src/forge/screens/settings/GuiDownloader.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-mobile/src/forge/screens/settings/GuiDownloader.java (revision 29316)
+++ forge-gui-mobile/src/forge/screens/settings/GuiDownloader.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,9 +23,13 @@
import forge.UiCommand;
import forge.download.GuiDownloadService;
import forge.download.GuiDownloadZipService;
-import forge.toolbox.*;
+import forge.toolbox.FDialog;
+import forge.toolbox.FEvent;
import forge.toolbox.FEvent.FEventHandler;
+import forge.toolbox.FProgressBar;
+import forge.toolbox.FRadioButton;
import forge.toolbox.FRadioButton.RadioButtonGroup;
+import forge.toolbox.FTextField;
import forge.util.Callback;
import forge.util.Utils;
@@ -42,8 +46,7 @@
@SuppressWarnings("serial")
private final UiCommand cmdClose = new UiCommand() {
- @Override
- public void run() {
+ @Override public void run() {
Forge.stopContinuousRendering();
service.setCancel(true);
hide();
@@ -56,10 +59,10 @@
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) {
super(service0.getTitle(), 2);
service = service0;
callback = callback0;
@@ -69,7 +72,7 @@
txtAddress.setEnabled(false);
txtPort.setEnabled(false);
- RadioButtonGroup group = new RadioButtonGroup();
+ final RadioButtonGroup group = new RadioButtonGroup();
radProxyNone.setGroup(group);
radProxyHTTP.setGroup(group);
radProxySocks.setGroup(group);
@@ -81,8 +84,7 @@
getButton(0).setText("Start");
initButton(1, "Cancel", new FEventHandler() {
- @Override
- public void handleEvent(FEvent e) {
+ @Override public void handleEvent(final FEvent e) {
cmdClose.run();
}
});
@@ -90,6 +92,10 @@
progressBar.reset();
progressBar.setShowProgressTrail(true);
progressBar.setDescription("Scanning for existing items...");
+ }
+
+ @Override
+ public void show() {
Forge.startContinuousRendering();
show();
@@ -113,7 +119,7 @@
}
@Override
- public void handleEvent(FEvent e) {
+ public void handleEvent(final FEvent e) {
if (((FRadioButton) e.getSource()).isSelected()) {
service.setType(this.type);
txtAddress.setEnabled(this.type != 0);
@@ -123,12 +129,12 @@
}
@Override
- protected float layoutAndGetHeight(float width, float maxHeight) {
+ protected float layoutAndGetHeight(final float width, final float maxHeight) {
float x = PADDING;
float y = PADDING;
- float w = width - 2 * PADDING;
- float radioButtonWidth = w / 3;
- float radioButtonHeight = radProxyNone.getAutoSizeBounds().height;
+ final float w = width - 2 * PADDING;
+ final float radioButtonWidth = w / 3;
+ final float radioButtonHeight = radProxyNone.getAutoSizeBounds().height;
radProxyNone.setBounds(x, y, radioButtonWidth, radioButtonHeight);
x += radioButtonWidth;
Index: forge-gui-desktop/src/main/java/forge/screens/match/controllers/CHand.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/CHand.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/controllers/CHand.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 java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
-import java.util.Observable;
import javax.swing.JLayeredPane;
import javax.swing.SwingUtilities;
@@ -32,7 +31,6 @@
import forge.FThreads;
import forge.Singletons;
-import forge.UiCommand;
import forge.game.card.CardView;
import forge.game.player.PlayerView;
import forge.gui.framework.ICDoc;
@@ -55,9 +53,6 @@
/**
* Controls Swing components of a player's hand instance.
- *
- * @param p0 &emsp; {@link forge.game.player.Player}
- * @param v0 &emsp; {@link forge.screens.match.views.VHand}
*/
public CHand(final CMatchUI matchUI, final PlayerView p0, final VHand v0) {
this.matchUI = matchUI;
@@ -65,7 +60,7 @@
this.view = v0;
v0.getHandArea().addCardPanelMouseListener(new CardPanelMouseAdapter() {
@Override
- public void mouseDragEnd(CardPanel dragPanel, MouseEvent evt) {
+ public void mouseDragEnd(final CardPanel dragPanel, final MouseEvent evt) {
//update index of dragged card in hand zone to match new index within hand area
final int index = CHand.this.view.getHandArea().getCardPanels().indexOf(dragPanel);
synchronized (ordering) {
@@ -85,14 +80,6 @@
public void initialize() {
}
- public void update(final Observable a, final Object b) {
- FThreads.invokeInEdtNowOrLater(updateRoutine);
- }
-
- private final Runnable updateRoutine = new Runnable() {
- @Override public void run() { updateHand(); }
- };
-
public void updateHand() {
FThreads.assertExecutedByEdt(true);
@@ -149,7 +136,7 @@
p.setCardPanels(cardPanels);
//animate new cards into positions defined by placeholders
- JLayeredPane layeredPane = Singletons.getView().getFrame().getLayeredPane();
+ final JLayeredPane layeredPane = Singletons.getView().getFrame().getLayeredPane();
int fromZoneX = 0, fromZoneY = 0;
final Point zoneLocation = SwingUtilities.convertPoint(vf.getDetailsPanel().getLblLibrary(),
@@ -178,14 +165,6 @@
Animation.moveCard(placeholder);
}
}
- }
-
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
}
@Override
Index: forge-gui-desktop/src/main/java/forge/sound/AudioClip.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/sound/AudioClip.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/sound/AudioClip.java (revision 29317)
@@ -67,6 +67,7 @@
throw new MissingResourceException("Sound clip failed to load", this.getClass().getName(), filename);
}
+ @Override
public final void play() {
if (null == clip) {
return;
@@ -80,6 +81,7 @@
clip.start();
}
+ @Override
public final void loop() {
if (null == clip) {
return;
@@ -93,6 +95,7 @@
clip.loop(Clip.LOOP_CONTINUOUSLY);
}
+ @Override
public final void stop() {
if (null == clip) {
return;
@@ -100,6 +103,7 @@
clip.stop();
}
+ @Override
public final boolean isDone() {
if (null == clip) {
return false;
Index: forge-gui-desktop/src/main/java/forge/gui/MultiLineLabel.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/gui/MultiLineLabel.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/gui/MultiLineLabel.java (revision 29317)
@@ -6,19 +6,21 @@
* 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 java.awt.*;
+import java.awt.Rectangle;
+
+import javax.swing.JLabel;
+import javax.swing.SwingConstants;
/**
* A {@link JLabel} with support for multi-line text that wraps when the line
@@ -26,7 +28,7 @@
* {@link MultiLineLabelUI}, the default UI delegate of this component. The text
* in the label can be horizontally and vertically aligned, relative to the
* bounds of the component.
- *
+ *
* @author Samuel Sjoberg, http://samuelsjoberg.com
* @version 1.0.0
*/
@@ -62,7 +64,7 @@
/**
* Creates a new label with <code>text</code> value.
- *
+ *
* @param text
* the value of the label
*/
@@ -73,7 +75,7 @@
/**
* {@inheritDoc}
- *
+ *
* @return a {@link java.awt.Rectangle} object.
*/
@Override
@@ -86,7 +88,7 @@
/**
* Set the vertical text alignment.
- *
+ *
* @param alignment
* vertical alignment
*/
@@ -97,7 +99,7 @@
/**
* Set the horizontal text alignment.
- *
+ *
* @param alignment
* horizontal alignment
*/
@@ -108,7 +110,7 @@
/**
* Get the vertical text alignment.
- *
+ *
* @return vertical text alignment
*/
public int getVerticalTextAlignment() {
@@ -117,7 +119,7 @@
/**
* Get the horizontal text alignment.
- *
+ *
* @return horizontal text alignment
*/
public int getHorizontalTextAlignment() {
Index: forge-gui-desktop/src/main/java/forge/screens/match/controllers/CLog.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/CLog.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/screens/match/controllers/CLog.java (revision 29317)
@@ -1,17 +1,16 @@
package forge.screens.match.controllers;
-import forge.UiCommand;
+import java.util.Observable;
+import java.util.Observer;
+
import forge.FThreads;
import forge.gui.framework.ICDoc;
import forge.screens.match.CMatchUI;
import forge.screens.match.views.VLog;
-import java.util.Observable;
-import java.util.Observer;
-
-/**
+/**
* Controls the combat panel in the match UI.
- *
+ *
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
*
*/
@@ -29,14 +28,6 @@
}
public final VLog getView() {
return view;
- }
-
- /* (non-Javadoc)
- * @see forge.gui.framework.ICDoc#getCommandOnSelect()
- */
- @Override
- public UiCommand getCommandOnSelect() {
- return null;
}
@Override
@@ -50,7 +41,7 @@
public void initialize() {
}
-
+
private final Runnable r = new Runnable() {
@Override
public void run() {
Index: forge-gui-desktop/src/main/java/forge/toolbox/FCheckBoxList.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui-desktop/src/main/java/forge/toolbox/FCheckBoxList.java (revision 29316)
+++ forge-gui-desktop/src/main/java/forge/toolbox/FCheckBoxList.java (revision 29317)
@@ -1,31 +1,40 @@
package forge.toolbox;
-import javax.swing.*;
+import java.awt.Component;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+import javax.swing.ListSelectionModel;
+import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
-import java.awt.*;
-import java.awt.event.*;
/**
* A list of FCheckBox items using Forge skin properties.
* Call setListData() with an array of FCheckBox items to populate.
- *
+ *
* based on code at http://www.devx.com/tips/Tip/5342
*/
@SuppressWarnings("serial")
public class FCheckBoxList<E> extends JList<E> {
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
- public FCheckBoxList(boolean keepSelectionWhenFocusLost) {
+ public FCheckBoxList(final boolean keepSelectionWhenFocusLost) {
setCellRenderer(new CellRenderer<E>());
addMouseListener(new MouseAdapter() {
@Override
- public void mousePressed(MouseEvent e) {
- int index = locationToIndex(e.getPoint());
+ public void mousePressed(final MouseEvent e) {
+ final int index = locationToIndex(e.getPoint());
if (index != -1) {
- FCheckBox checkbox = (FCheckBox)getModel().getElementAt(index);
+ final FCheckBox checkbox = (FCheckBox)getModel().getElementAt(index);
if (checkbox.isEnabled()) {
checkbox.setSelected(!checkbox.isSelected());
repaint();
@@ -33,34 +42,34 @@
}
}
});
-
+
addKeyListener(new KeyAdapter() {
@Override
- public void keyPressed(KeyEvent e) {
+ public void keyPressed(final KeyEvent e) {
if (e.getKeyChar() == ' ') {
- FCheckBox item = (FCheckBox)getSelectedValue();
+ final FCheckBox item = (FCheckBox)getSelectedValue();
if (null == item || !item.isEnabled()) {
return;
}
-
+
item.setSelected(!item.isSelected());
repaint();
}
}
});
-
+
if (!keepSelectionWhenFocusLost) {
addFocusListener(new FocusListener() {
int lastSelectedIdx;
-
+
@Override
- public void focusLost(FocusEvent arg0) {
+ public void focusLost(final FocusEvent arg0) {
lastSelectedIdx = Math.max(0, getSelectedIndex());
clearSelection();
}
-
+
@Override
- public void focusGained(FocusEvent arg0) {
+ public void focusGained(final FocusEvent arg0) {
if (-1 == getSelectedIndex()) {
setSelectedIndex(lastSelectedIdx);
}
@@ -70,10 +79,11 @@
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
-
+
protected class CellRenderer<E1> implements ListCellRenderer<E1> {
- public Component getListCellRendererComponent(JList<? extends E1> list, E1 value, int index, boolean isSelected, boolean cellHasFocus) {
- FCheckBox checkbox = (FCheckBox)value;
+ @Override
+ public Component getListCellRendererComponent(final JList<? extends E1> list, final E1 value, final int index, final boolean isSelected, final boolean cellHasFocus) {
+ final FCheckBox checkbox = (FCheckBox)value;
checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground());
checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground());
checkbox.setFont(getFont());
Index: forge-gui/src/main/java/forge/interfaces/ICheckBox.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/interfaces/ICheckBox.java (revision 29316)
+++ forge-gui/src/main/java/forge/interfaces/ICheckBox.java (revision 29317)
@@ -1,10 +1,6 @@
package forge.interfaces;
-public interface ICheckBox {
- boolean isEnabled();
- void setEnabled(boolean b0);
- boolean isVisible();
- void setVisible(boolean b0);
+public interface ICheckBox extends IComponent {
boolean isSelected();
void setSelected(boolean b0);
}
Index: forge-gui/src/main/java/forge/limited/LimitedDeckBuilder.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
--- forge-gui/src/main/java/forge/limited/LimitedDeckBuilder.java (revision 29316)
+++ forge-gui/src/main/java/forge/limited/LimitedDeckBuilder.java (revision 29317)
@@ -1,11 +1,28 @@
package forge.limited;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang3.tuple.Pair;
+
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-import forge.card.*;
+import forge.card.CardAiHints;
+import forge.card.CardEdition;