From a0ff08b0b96f36bda22cc65bc450e8d49e8cd523 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 10 Feb 2016 08:31:21 +0100 Subject: [PATCH] Some more changes to GUI to better support high screen resolutions. --- .../src/main/java/mage/client/MageFrame.java | 30 +- .../java/mage/client/cards/CardsList.java | 15 +- .../mage/client/deckeditor/CardSelector.java | 90 +++--- .../java/mage/client/deckeditor/DeckArea.java | 30 +- .../client/deckeditor/DeckEditorPane.java | 42 +-- .../client/deckeditor/DeckEditorPanel.java | 283 +++++++++--------- .../mage/client/table/PlayersChatPanel.java | 3 +- .../java/mage/client/table/TablesPanel.java | 5 +- .../client/tournament/TournamentPane.java | 20 +- .../client/tournament/TournamentPanel.java | 17 ++ .../java/mage/client/util/FontSizeHelper.java | 32 ++ .../client/util/stats/UpdateMemUsageTask.java | 21 +- .../org/mage/card/arcane/ManaSymbols.java | 73 +++-- 13 files changed, 388 insertions(+), 273 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index aba96e9114..b76bcecf3e 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -234,18 +234,17 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { TConfig config = TConfig.current(); config.setArchiveDetector(new TArchiveDetector("zip")); config.setAccessPreference(FsAccessOption.STORE, true); - try { UIManager.put("desktop", new Color(0, 0, 0, 0)); UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); // Change default font and row size for JTables Font font = FontSizeHelper.getTableFont(); UIManager.put("Table.font", font); - UIManager.put("Table.rowHeight", FontSizeHelper.getTableRowHeight()); + UIManager.put("Table.rowHeight", FontSizeHelper.tableRowHeight); } catch (Exception ex) { LOGGER.fatal(null, ex); } - + FontSizeHelper.setGUISize(); ManaSymbols.loadImages(); Plugins.getInstance().loadPlugins(); @@ -531,6 +530,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { MagePane window = (MagePane) windows[i]; if (window.isVisible()) { menuItem = new MagePaneMenuItem(window); + menuItem.setFont(FontSizeHelper.getToolbarFont()); menuItem.setState(i == 0); menuItem.addActionListener(new ActionListener() { @Override @@ -1068,11 +1068,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { if (setActive) { setActive(tablesPane); } else // if other panel was already shown, mamke sure it's topmost again - { - if (topPanebefore != null) { + if (topPanebefore != null) { setActive(topPanebefore); } - } } public void hideGames() { @@ -1270,6 +1268,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { public void setStatusText(String status) { this.lblStatus.setText(status); + changeGUISize(); // Needed to layout the tooltbar after text length chnage } public static MageUI getUI() { @@ -1403,14 +1402,29 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } public void changeGUISize() { - tablesPane.changeGUISize(); + // Tables + if (tablesPane != null) { + tablesPane.changeGUISize(); + } + // Deck editor + JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER); + for (JInternalFrame window : windows) { + if (window instanceof DeckEditorPane) { + ((DeckEditorPane) window).getPanel().changeGUISize(); + } + } + // Tournament panels + for (Component component : desktopPane.getComponents()) { + if (component instanceof TournamentPane) { + ((TournamentPane) component).changeGUISize(); + } + } setGUISize(); this.revalidate(); this.repaint(); } private void setGUISize() { - Font font = FontSizeHelper.getToolbarFont(); mageToolbar.setFont(font); int newHeight = font.getSize() + 6; diff --git a/Mage.Client/src/main/java/mage/client/cards/CardsList.java b/Mage.Client/src/main/java/mage/client/cards/CardsList.java index e4bf5d2b67..79616816d4 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardsList.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardsList.java @@ -26,7 +26,7 @@ * or implied, of BetaSteward_at_googlemail.com. */ -/* + /* * CardsList.java * * Created on Dec 18, 2009, 10:40:12 AM @@ -36,6 +36,7 @@ package mage.client.cards; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.Font; import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -72,6 +73,7 @@ import mage.client.util.CardViewNameComparator; import mage.client.util.CardViewRarityComparator; import mage.client.util.Config; import mage.client.util.Event; +import mage.client.util.FontSizeHelper; import mage.client.util.Listener; import mage.client.util.gui.TableSpinnerEditor; import mage.constants.CardType; @@ -105,6 +107,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar initComponents(); makeTransparent(); initListViewComponents(); + setGUISize(); } public void cleanUp() { @@ -140,6 +143,16 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar } + public void changeGUISize() { + setGUISize(); + } + + private void setGUISize() { + Font font = FontSizeHelper.getTableFont(); + mainTable.getTableHeader().setFont(font); + mainTable.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight)); + } + private void makeTransparent() { panelCardArea.setOpaque(false); cardArea.setOpaque(false); diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java index dee42eb34a..c84b9cc986 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java @@ -24,18 +24,19 @@ * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. -*/ + */ -/* + /* * CardSelector.java * * Created on Feb 18, 2010, 2:49:03 PM */ - package mage.client.deckeditor; import java.awt.Color; import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; @@ -64,6 +65,7 @@ import mage.client.cards.CardGrid; import mage.client.cards.ICardGrid; import mage.client.constants.Constants.SortBy; import mage.client.deckeditor.table.TableModel; +import mage.client.util.FontSizeHelper; import mage.client.util.sets.ConstructedFormats; import mage.constants.CardType; import mage.filter.FilterCard; @@ -76,7 +78,6 @@ import mage.filter.predicate.other.CardTextPredicate; import mage.filter.predicate.other.ExpansionSetPredicate; import mage.view.CardsView; - /** * * @author BetaSteward_at_googlemail.com, nantuko @@ -95,22 +96,25 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene } }; - /** Creates new form CardSelector */ + /** + * Creates new form CardSelector + */ public CardSelector() { sortSetting = SortSettingBase.getInstance(); initComponents(); cardGrid = new CardGrid(); makeTransparent(); initListViewComponents(); - currentView = mainModel; // by default we use List View + setGUISize(); + currentView = mainModel; // by default we use List View } private void makeTransparent() { this.addComponentListener(this); setOpaque(false); - + cardGrid.setOpaque(false); - + cardSelectorScrollPane.setOpaque(false); cardSelectorScrollPane.getViewport().setOpaque(false); cbSortBy.setModel(new DefaultComboBoxModel<>(SortBy.values())); @@ -158,27 +162,37 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene if (e.getClickCount() == 2 && !e.isConsumed()) { e.consume(); if (e.isAltDown()) { - jButtonAddToSideboardActionPerformed(null); + jButtonAddToSideboardActionPerformed(null); } else { jButtonAddToMainActionPerformed(null); } } } }); - + jToggleCardView.setToolTipText(jToggleCardView.getToolTipText() + " (works only up to " + CardGrid.MAX_IMAGES + " cards)."); } - + /** * Free all references - * + * */ public void cleanUp() { this.cardGrid.clear(); this.mainModel.clear(); } - public void switchToGrid(){ + public void changeGUISize() { + setGUISize(); + } + + private void setGUISize() { + Font font = FontSizeHelper.getTableFont(); + mainTable.getTableHeader().setFont(font); + mainTable.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight)); + } + + public void switchToGrid() { jToggleListView.setSelected(false); jToggleCardView.setSelected(true); currentView = cardGrid; @@ -199,7 +213,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene this.cbExpansionSet.setVisible(false); this.limited = true; this.cards.clear(); - for (Card card: sideboard) { + for (Card card : sideboard) { this.cards.add(card); } filterCards(); @@ -268,7 +282,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene } filter.add(Predicates.or(predicates)); - if (this.cbExpansionSet.isVisible()) { String expansionSelection = this.cbExpansionSet.getSelectedItem().toString(); if (!expansionSelection.equals("- All Sets")) { @@ -313,11 +326,9 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene } if (this.tbPlaneswalkers.isSelected()) { criteria.types(CardType.PLANESWALKER); - } + } // criteria.types(CardType.TRIBAL); // criteria.types(CardType.CONSPIRACY); - - if (this.cbExpansionSet.isVisible()) { String expansionSelection = this.cbExpansionSet.getSelectedItem().toString(); @@ -337,7 +348,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene return !string1.equals(string2); } } - + private void filterCardsColor(int modifiers, String actionCommand) { // ALT or CTRL button was pushed if ((modifiers & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK || (modifiers & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) { @@ -348,10 +359,10 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene tbGreen.setSelected(inverter(invert, tbGreen.getActionCommand(), actionCommand)); tbRed.setSelected(inverter(invert, tbRed.getActionCommand(), actionCommand)); tbWhite.setSelected(inverter(invert, tbWhite.getActionCommand(), actionCommand)); - } - filterCards(); + } + filterCards(); } - + private void filterCardsType(int modifiers, String actionCommand) { // ALT or CTRL button was pushed if ((modifiers & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK || (modifiers & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) { @@ -363,38 +374,36 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene tbLand.setSelected(inverter(invert, tbLand.getActionCommand(), actionCommand)); tbPlaneswalkers.setSelected(inverter(invert, tbPlaneswalkers.getActionCommand(), actionCommand)); tbSorceries.setSelected(inverter(invert, tbSorceries.getActionCommand(), actionCommand)); - } - filterCards(); + } + filterCards(); } - + private void filterCards() { FilterCard filter = buildFilter(); try { List filteredCards = new ArrayList<>(); setCursor(new Cursor(Cursor.WAIT_CURSOR)); if (limited) { - for (Card card: cards) { + for (Card card : cards) { if (filter.match(card, null)) { filteredCards.add(card); } } - } - else { + } else { List foundCards = CardRepository.instance.findCards(buildCriteria()); for (CardInfo cardInfo : foundCards) { Card card = cardInfo.getMockCard(); if (filter.match(card, null)) { filteredCards.add(card); } - } + } } if (currentView instanceof CardGrid && filteredCards.size() > CardGrid.MAX_IMAGES) { this.toggleViewMode(); } this.currentView.loadCards(new CardsView(filteredCards), sortSetting, bigCard, null, false); this.cardCount.setText(String.valueOf(filteredCards.size())); - } - finally { + } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } } @@ -413,7 +422,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene public void removeCard(UUID cardId) { this.mainModel.removeCard(cardId); this.cardGrid.removeCard(cardId); - for (Card card: cards) { + for (Card card : cards) { if (card.getId().equals(cardId)) { cards.remove(card); break; @@ -421,10 +430,10 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene } } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents @@ -1032,7 +1041,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene mainModel.removeFromSideEvent(0); }//GEN-LAST:event_jButtonRemoveFromSideboardActionPerformed - private void jButtonSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSearchActionPerformed filterCards(); }//GEN-LAST:event_jButtonSearchActionPerformed @@ -1059,11 +1067,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene }//GEN-LAST:event_tbBlackActionPerformed private void tbWhiteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbWhiteActionPerformed - filterCardsColor(evt.getModifiers(), evt.getActionCommand()); + filterCardsColor(evt.getModifiers(), evt.getActionCommand()); }//GEN-LAST:event_tbWhiteActionPerformed private void tbColorlessActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbColorlessActionPerformed - filterCardsColor(evt.getModifiers(), evt.getActionCommand()); + filterCardsColor(evt.getModifiers(), evt.getActionCommand()); }//GEN-LAST:event_tbColorlessActionPerformed private void tbCreaturesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbCreaturesActionPerformed @@ -1103,7 +1111,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene cbSortBy.setEnabled(false); chkPiles.setEnabled(false); jButtonAddToMain.setEnabled(true); - jButtonAddToSideboard.setEnabled(true); + jButtonAddToSideboard.setEnabled(true); } else { jToggleCardView.setSelected(true); jToggleListView.setSelected(false); @@ -1112,7 +1120,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene cbSortBy.setEnabled(true); chkPiles.setEnabled(true); jButtonAddToMain.setEnabled(false); - jButtonAddToSideboard.setEnabled(false); + jButtonAddToSideboard.setEnabled(false); } } diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java b/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java index e1cca05a93..7d67cacc32 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/DeckArea.java @@ -24,15 +24,12 @@ * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. -*/ - - -/* + */ + /* * DeckArea.java * * Created on Feb 18, 2010, 3:10:39 PM */ - package mage.client.deckeditor; import mage.cards.decks.Deck; @@ -49,7 +46,9 @@ import mage.view.CardsView; */ public class DeckArea extends javax.swing.JPanel { - /** Creates new form DeckArea */ + /** + * Creates new form DeckArea + */ public DeckArea() { initComponents(); deckAreaSplitPane.setOpaque(false); @@ -66,6 +65,15 @@ public class DeckArea extends javax.swing.JPanel { sideboardList.cleanUp(); } + public void changeGUISize() { + setGUISize(); + deckList.changeGUISize(); + sideboardList.changeGUISize(); + } + + private void setGUISize() { + } + public void showSideboard(boolean show) { this.sideboardList.setVisible(show); } @@ -74,7 +82,7 @@ public class DeckArea extends javax.swing.JPanel { this.deckList.setDeckEditorMode(mode); this.sideboardList.setDeckEditorMode(mode); } - + public void loadDeck(Deck deck, BigCard bigCard) { deckList.loadCards(new CardsView(deck.getCards()), bigCard, null); if (sideboardList.isVisible()) { @@ -98,10 +106,10 @@ public class DeckArea extends javax.swing.JPanel { sideboardList.clearCardEventListeners(); } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPane.java b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPane.java index 37ec154d5e..3edb7d5178 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPane.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPane.java @@ -24,14 +24,13 @@ * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. -*/ + */ -/* + /* * DeckEditorPane.java * * Created on Dec 17, 2009, 9:21:42 AM */ - package mage.client.deckeditor; import java.awt.Component; @@ -44,14 +43,15 @@ import mage.client.MagePane; import mage.client.constants.Constants.DeckEditorMode; import mage.client.plugins.impl.Plugins; - /** * * @author BetaSteward_at_googlemail.com */ public class DeckEditorPane extends MagePane { - /** Creates new form TablesPane */ + /** + * Creates new form TablesPane + */ public DeckEditorPane() { this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); boolean initialized = false; @@ -75,14 +75,10 @@ public class DeckEditorPane extends MagePane { public void show(DeckEditorMode mode, Deck deck, String name, UUID tableId, int time) { if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) { this.setTitle("Deck Editor - " + tableId.toString()); - } - else { - if (deck != null) { - this.setTitle("Deck Editor - " + deck.getName()); - } - else { - this.setTitle("Deck Editor"); - } + } else if (deck != null) { + this.setTitle("Deck Editor - " + deck.getName()); + } else { + this.setTitle("Deck Editor"); } this.deckEditorPanel1.showDeckEditor(mode, deck, tableId, time); this.repaint(); @@ -92,10 +88,10 @@ public class DeckEditorPane extends MagePane { return this.deckEditorPanel1.getDeckEditorMode(); } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents @@ -122,17 +118,21 @@ public class DeckEditorPane extends MagePane { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE) + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE) ); layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE) + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(container, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE) ); pack(); } + public DeckEditorPanel getPanel() { + return deckEditorPanel1; + } + // Variables declaration - do not modify//GEN-BEGIN:variables private mage.client.deckeditor.DeckEditorPanel deckEditorPanel1; // End of variables declaration//GEN-END:variables diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java index f66949a0ee..de56a98fef 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java @@ -81,7 +81,7 @@ import org.apache.log4j.Logger; */ public class DeckEditorPanel extends javax.swing.JPanel { - private static final Logger logger = Logger.getLogger(DeckEditorPanel.class); + private static final Logger LOGGER = Logger.getLogger(DeckEditorPanel.class); private final JFileChooser fcSelectDeck; private final JFileChooser fcImportDeck; private Deck deck = new Deck(); @@ -109,20 +109,20 @@ public class DeckEditorPanel extends javax.swing.JPanel { jSplitPane1.setOpaque(false); countdown = new Timer(1000, new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (--timeout > 0) { - setTimeout(timeout); - } else { - if (updateDeckTask != null) { - updateDeckTask.cancel(true); - } - setTimeout(0); - countdown.stop(); - removeDeckEditor(); - } + @Override + public void actionPerformed(ActionEvent e) { + if (--timeout > 0) { + setTimeout(timeout); + } else { + if (updateDeckTask != null) { + updateDeckTask.cancel(true); } - }); + setTimeout(0); + countdown.stop(); + removeDeckEditor(); + } + } + }); } /** @@ -147,6 +147,11 @@ public class DeckEditorPanel extends javax.swing.JPanel { this.bigCard = null; } + public void changeGUISize() { + this.cardSelector.changeGUISize(); + this.deckArea.changeGUISize(); + } + public void showDeckEditor(DeckEditorMode mode, Deck deck, UUID tableId, int time) { if (deck != null) { this.deck = deck; @@ -209,145 +214,145 @@ public class DeckEditorPanel extends javax.swing.JPanel { component.clearCardEventListeners(); component.addCardEventListener( new Listener() { - @Override - public void event(Event event) { - switch (event.getEventName()) { - case "double-click": - moveSelectorCardToDeck(event); - break; - case "alt-double-click": - if (mode == DeckEditorMode.FREE_BUILDING) { - moveSelectorCardToSideboard(event); - } else { - // because in match mode selector is used as sideboard the card goes to deck also for shift click - moveSelectorCardToDeck(event); - } - break; - case "remove-main": - DeckEditorPanel.this.deckArea.getDeckList().handleDoubleClick(); - break; - case "remove-sideboard": - DeckEditorPanel.this.deckArea.getSideboardList().handleDoubleClick(); - break; + @Override + public void event(Event event) { + switch (event.getEventName()) { + case "double-click": + moveSelectorCardToDeck(event); + break; + case "alt-double-click": + if (mode == DeckEditorMode.FREE_BUILDING) { + moveSelectorCardToSideboard(event); + } else { + // because in match mode selector is used as sideboard the card goes to deck also for shift click + moveSelectorCardToDeck(event); } - refreshDeck(); - } - }); + break; + case "remove-main": + DeckEditorPanel.this.deckArea.getDeckList().handleDoubleClick(); + break; + case "remove-sideboard": + DeckEditorPanel.this.deckArea.getSideboardList().handleDoubleClick(); + break; + } + refreshDeck(); + } + }); } this.deckArea.clearDeckEventListeners(); this.deckArea.addDeckEventListener( new Listener() { - @Override - public void event(Event event) { - if (mode.equals(DeckEditorMode.FREE_BUILDING)) { - switch (event.getEventName()) { - case "double-click": { - SimpleCardView cardView = (SimpleCardView) event.getSource(); - for (Card card : deck.getCards()) { - if (card.getId().equals(cardView.getId())) { - deck.getCards().remove(card); - break; - } - } - hidePopup(); - refreshDeck(); - break; - } - case "alt-double-click": { - SimpleCardView cardView = (SimpleCardView) event.getSource(); - for (Card card : deck.getCards()) { - if (card.getId().equals(cardView.getId())) { - deck.getCards().remove(card); - deck.getSideboard().add(card); - break; - } - } - hidePopup(); - refreshDeck(); - break; - } - case "set-number": { - setCardNumberToCardsList(event, deck.getCards()); - } - } - } else { - // constructing phase or sideboarding during match -> card goes always to sideboard - switch (event.getEventName()) { - case "double-click": - case "alt-double-click": { - SimpleCardView cardView = (SimpleCardView) event.getSource(); - for (Card card : deck.getCards()) { - if (card.getId().equals(cardView.getId())) { - deck.getCards().remove(card); - deck.getSideboard().add(card); - cardSelector.loadSideboard(new ArrayList<>(deck.getSideboard()), getBigCard()); - break; - } - } - hidePopup(); - refreshDeck(); + @Override + public void event(Event event) { + if (mode.equals(DeckEditorMode.FREE_BUILDING)) { + switch (event.getEventName()) { + case "double-click": { + SimpleCardView cardView = (SimpleCardView) event.getSource(); + for (Card card : deck.getCards()) { + if (card.getId().equals(cardView.getId())) { + deck.getCards().remove(card); break; } } + hidePopup(); + refreshDeck(); + break; + } + case "alt-double-click": { + SimpleCardView cardView = (SimpleCardView) event.getSource(); + for (Card card : deck.getCards()) { + if (card.getId().equals(cardView.getId())) { + deck.getCards().remove(card); + deck.getSideboard().add(card); + break; + } + } + hidePopup(); + refreshDeck(); + break; + } + case "set-number": { + setCardNumberToCardsList(event, deck.getCards()); } } - }); + } else { + // constructing phase or sideboarding during match -> card goes always to sideboard + switch (event.getEventName()) { + case "double-click": + case "alt-double-click": { + SimpleCardView cardView = (SimpleCardView) event.getSource(); + for (Card card : deck.getCards()) { + if (card.getId().equals(cardView.getId())) { + deck.getCards().remove(card); + deck.getSideboard().add(card); + cardSelector.loadSideboard(new ArrayList<>(deck.getSideboard()), getBigCard()); + break; + } + } + hidePopup(); + refreshDeck(); + break; + } + } + } + } + }); this.deckArea.addSideboardEventListener( new Listener() { - @Override - public void event(Event event) { - if (mode.equals(DeckEditorMode.FREE_BUILDING)) { - // normal edit mode - switch (event.getEventName()) { - case "double-click": - // remove card from sideboard (don't add it to deck) - SimpleCardView cardView = (SimpleCardView) event.getSource(); - for (Card card : deck.getSideboard()) { - if (card.getId().equals(cardView.getId())) { - deck.getSideboard().remove(card); - break; - } - } - hidePopup(); - refreshDeck(); + @Override + public void event(Event event) { + if (mode.equals(DeckEditorMode.FREE_BUILDING)) { + // normal edit mode + switch (event.getEventName()) { + case "double-click": + // remove card from sideboard (don't add it to deck) + SimpleCardView cardView = (SimpleCardView) event.getSource(); + for (Card card : deck.getSideboard()) { + if (card.getId().equals(cardView.getId())) { + deck.getSideboard().remove(card); break; - case "alt-double-click": - // remove card from sideboard - cardView = (SimpleCardView) event.getSource(); - for (Card card : deck.getSideboard()) { - if (card.getId().equals(cardView.getId())) { - deck.getSideboard().remove(card); - deck.getCards().add(card); - break; - } - } - hidePopup(); - refreshDeck(); - break; - case "set-number": { - setCardNumberToCardsList(event, deck.getSideboard()); } } - } else { - // construct phase or sideboarding during match - switch (event.getEventName()) { - case "double-click": - case "alt-double-click": - SimpleCardView cardView = (SimpleCardView) event.getSource(); - for (Card card : deck.getSideboard()) { - if (card.getId().equals(cardView.getId())) { - deck.getSideboard().remove(card); - deck.getCards().add(card); - break; - } - } - hidePopup(); - refreshDeck(); + hidePopup(); + refreshDeck(); + break; + case "alt-double-click": + // remove card from sideboard + cardView = (SimpleCardView) event.getSource(); + for (Card card : deck.getSideboard()) { + if (card.getId().equals(cardView.getId())) { + deck.getSideboard().remove(card); + deck.getCards().add(card); break; + } } + hidePopup(); + refreshDeck(); + break; + case "set-number": { + setCardNumberToCardsList(event, deck.getSideboard()); } } - }); + } else { + // construct phase or sideboarding during match + switch (event.getEventName()) { + case "double-click": + case "alt-double-click": + SimpleCardView cardView = (SimpleCardView) event.getSource(); + for (Card card : deck.getSideboard()) { + if (card.getId().equals(cardView.getId())) { + deck.getSideboard().remove(card); + deck.getCards().add(card); + break; + } + } + hidePopup(); + refreshDeck(); + break; + } + } + } + }); refreshDeck(); this.setVisible(true); @@ -685,7 +690,7 @@ public class DeckEditorPanel extends javax.swing.JPanel { } catch (GameException ex) { JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage(), "Error loading deck", JOptionPane.ERROR_MESSAGE); } catch (Exception ex) { - logger.fatal(ex); + LOGGER.fatal(ex); } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @@ -717,7 +722,7 @@ public class DeckEditorPanel extends javax.swing.JPanel { setCursor(new Cursor(Cursor.WAIT_CURSOR)); Sets.saveDeck(fileName, deck.getDeckCardLists()); } catch (Exception ex) { - logger.fatal(ex); + LOGGER.fatal(ex); } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @@ -766,7 +771,7 @@ public class DeckEditorPanel extends javax.swing.JPanel { JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Unknown deck format", "Error importing deck", JOptionPane.ERROR_MESSAGE); } } catch (Exception ex) { - logger.fatal(ex); + LOGGER.fatal(ex); } finally { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } @@ -872,7 +877,7 @@ class ImportFilter extends FileFilter { class UpdateDeckTask extends SwingWorker { - private static final Logger logger = Logger.getLogger(UpdateDeckTask.class); + private static final Logger LOGGER = Logger.getLogger(UpdateDeckTask.class); private final Session session; private final UUID tableId; private final Deck deck; @@ -897,7 +902,7 @@ class UpdateDeckTask extends SwingWorker { try { get(); } catch (InterruptedException | ExecutionException ex) { - logger.fatal("Update Matches Task error", ex); + LOGGER.fatal("Update Matches Task error", ex); } catch (CancellationException ex) { } } diff --git a/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java b/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java index 6aad810947..a81529f32f 100644 --- a/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java @@ -124,8 +124,7 @@ public class PlayersChatPanel extends javax.swing.JPanel { private void setGUISize() { Font font = FontSizeHelper.getTableFont(); jTablePlayers.getTableHeader().setFont(font); - int rowHeight = FontSizeHelper.getTableRowHeight(); - jTablePlayers.getTableHeader().setPreferredSize(new Dimension(rowHeight, rowHeight)); + jTablePlayers.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight)); font = FontSizeHelper.getTabFont(); jTabbedPaneText.setFont(font); this.revalidate(); diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index afc641d4fa..d469b8c7a1 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -288,10 +288,9 @@ public class TablesPanel extends javax.swing.JPanel { private void setGUISize() { Font font = FontSizeHelper.getTableFont(); tableTables.getTableHeader().setFont(font); - int rowHeight = FontSizeHelper.getTableRowHeight(); - tableTables.getTableHeader().setPreferredSize(new Dimension(rowHeight, rowHeight)); + tableTables.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight)); tableCompleted.getTableHeader().setFont(font); - tableCompleted.getTableHeader().setPreferredSize(new Dimension(rowHeight, rowHeight)); + tableCompleted.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight)); } private void saveDividerLocations() { diff --git a/Mage.Client/src/main/java/mage/client/tournament/TournamentPane.java b/Mage.Client/src/main/java/mage/client/tournament/TournamentPane.java index 516ff1b99f..b181108dd7 100644 --- a/Mage.Client/src/main/java/mage/client/tournament/TournamentPane.java +++ b/Mage.Client/src/main/java/mage/client/tournament/TournamentPane.java @@ -26,12 +26,11 @@ * or implied, of BetaSteward_at_googlemail.com. */ -/* + /* * TournamentPane.java * * Created on 22-Jan-2011, 11:41:47 PM */ - package mage.client.tournament; import java.util.UUID; @@ -43,7 +42,9 @@ import mage.client.MagePane; */ public class TournamentPane extends MagePane { - /** Creates new form TournamentPane */ + /** + * Creates new form TournamentPane + */ public TournamentPane() { initComponents(); } @@ -59,6 +60,10 @@ public class TournamentPane extends MagePane { removeFrame(); } + public void changeGUISize() { + tournamentPanel.changeGUISize(); + } + public UUID getTournamentId() { if (this.tournamentPanel == null) { return null; @@ -66,10 +71,10 @@ public class TournamentPane extends MagePane { return tournamentPanel.getTournamentId(); } - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents @@ -91,7 +96,6 @@ public class TournamentPane extends MagePane { pack(); }// //GEN-END:initComponents - // Variables declaration - do not modify//GEN-BEGIN:variables private mage.client.tournament.TournamentPanel tournamentPanel; // End of variables declaration//GEN-END:variables diff --git a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java index 3a033341ac..b8ef2bc9f3 100644 --- a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java +++ b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java @@ -34,6 +34,8 @@ package mage.client.tournament; import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.text.DateFormat; @@ -56,6 +58,7 @@ import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_MATCH_COLUMNS_ import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_PLAYER_COLUMNS_ORDER; import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_PLAYER_COLUMNS_WIDTH; import mage.client.util.ButtonColumn; +import mage.client.util.FontSizeHelper; import mage.client.util.Format; import mage.client.util.gui.TableUtil; import mage.client.util.gui.countryBox.CountryCellRenderer; @@ -105,6 +108,8 @@ public class TournamentPanel extends javax.swing.JPanel { tableMatches.createDefaultColumnsFromModel(); TableUtil.setColumnWidthAndOrder(tableMatches, DEFAULT_COLUMNS_WIDTH_MATCHES, KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH, KEY_TOURNAMENT_MATCH_COLUMNS_ORDER); + setGUISize(); + chatPanel1.useExtendedView(ChatPanelBasic.VIEW_MODE.NONE); chatPanel1.setChatType(ChatPanelBasic.ChatType.TOURNAMENT); @@ -142,6 +147,18 @@ public class TournamentPanel extends javax.swing.JPanel { } + public void changeGUISize() { + setGUISize(); + } + + private void setGUISize() { + Font font = FontSizeHelper.getTableFont(); + tablePlayers.getTableHeader().setFont(font); + tablePlayers.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight)); + tableMatches.getTableHeader().setFont(font); + tableMatches.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight)); + } + private void saveDividerLocations() { // save panel sizes and divider locations. Rectangle rec = MageFrame.getDesktop().getBounds(); diff --git a/Mage.Client/src/main/java/mage/client/util/FontSizeHelper.java b/Mage.Client/src/main/java/mage/client/util/FontSizeHelper.java index d4fd0f35fe..883a981190 100644 --- a/Mage.Client/src/main/java/mage/client/util/FontSizeHelper.java +++ b/Mage.Client/src/main/java/mage/client/util/FontSizeHelper.java @@ -16,6 +16,13 @@ import mage.client.dialog.PreferencesDialog; */ public class FontSizeHelper { + public static String basicSymbolSize = "small"; + public static int symbolCardSize = 15; + public static int symbolTooltipSize = 15; + public static int symbolPaySize = 15; + public static int tableHeaderHeight = 24; + public static int tableRowHeight = 20; + public static Font getChatFont() { int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14); return new java.awt.Font("Arial", 0, fontSize); @@ -42,9 +49,34 @@ public class FontSizeHelper { } public static void changeGUISize() { + setGUISize(); for (ChatPanelBasic chatPanel : MageFrame.getChatPanels().values()) { chatPanel.changeGUISize(getChatFont()); } MageFrame.getInstance().changeGUISize(); } + + public static void setGUISize() { + // Set basic symbol size + int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14); + if (fontSize < 25) { + basicSymbolSize = "small"; + } else if (fontSize < 45) { + basicSymbolSize = "medium"; + } else { + basicSymbolSize = "large"; + } + if (fontSize > 15) { + symbolTooltipSize = fontSize - 5; + symbolPaySize = fontSize - 5; + symbolCardSize = fontSize - 5; + } else { + symbolTooltipSize = fontSize; + symbolPaySize = fontSize; + symbolCardSize = fontSize; + } + + tableRowHeight = fontSize + 4; + tableHeaderHeight = fontSize + 10; + } } diff --git a/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java b/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java index f0b2170fbe..8851fd7d7c 100644 --- a/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java +++ b/Mage.Client/src/main/java/mage/client/util/stats/UpdateMemUsageTask.java @@ -1,14 +1,14 @@ package mage.client.util.stats; -import org.apache.log4j.Logger; - -import javax.swing.*; import java.util.List; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; +import javax.swing.*; +import org.apache.log4j.Logger; /** - * This updates the mem usage info in the Mage client every MEM_USAGE_UPDATE_TIME ms. + * This updates the mem usage info in the Mage client every + * MEM_USAGE_UPDATE_TIME ms. * * @author noxx */ @@ -16,9 +16,9 @@ public class UpdateMemUsageTask extends SwingWorker { private static final int MEM_USAGE_UPDATE_TIME = 2000; - private JLabel jLabelToDisplayInfo; + private final JLabel jLabelToDisplayInfo; - private static final Logger logger = Logger.getLogger(UpdateMemUsageTask.class); + private static final Logger LOGGER = Logger.getLogger(UpdateMemUsageTask.class); public UpdateMemUsageTask(JLabel jLabelToDisplayInfo) { this.jLabelToDisplayInfo = jLabelToDisplayInfo; @@ -28,7 +28,7 @@ public class UpdateMemUsageTask extends SwingWorker { protected Void doInBackground() throws Exception { while (!isCancelled()) { float memUsage = MemoryUsageStatUtil.getMemoryFreeStatPercentage(); - this.publish(memUsage >= 0 ? Float.valueOf(memUsage) : null); + this.publish(memUsage >= 0 ? memUsage : null); Thread.sleep(MEM_USAGE_UPDATE_TIME); } return null; @@ -51,8 +51,9 @@ public class UpdateMemUsageTask extends SwingWorker { try { get(); } catch (InterruptedException | ExecutionException ex) { - logger.fatal("Update Memory Usage error", ex); - } catch (CancellationException ex) {} + LOGGER.fatal("Update Memory Usage error", ex); + } catch (CancellationException ex) { + } } -} \ No newline at end of file +} diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java index b645c0ae29..7885aff324 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/ManaSymbols.java @@ -14,6 +14,7 @@ import java.util.regex.Pattern; import javax.imageio.ImageIO; import mage.cards.repository.ExpansionRepository; import mage.client.dialog.PreferencesDialog; +import mage.client.util.FontSizeHelper; import mage.client.util.ImageHelper; import mage.client.util.gui.BufferedImageBuilder; import org.apache.log4j.Logger; @@ -21,12 +22,12 @@ import org.mage.plugins.card.constants.Constants; public class ManaSymbols { - private static final Logger log = Logger.getLogger(ManaSymbols.class); - private static final Map manaImages = new HashMap<>(); - private static final Map manaImagesOriginal = new HashMap<>(); - private static final Map setImages = new HashMap<>(); - private static final Map setImagesExist = new HashMap<>(); - private static final Pattern replaceSymbolsPattern = Pattern.compile("\\{([^}/]*)/?([^}]*)\\}"); + private static final Logger LOGGER = Logger.getLogger(ManaSymbols.class); + private static final Map MANA_IMAGES = new HashMap<>(); + private static final Map MANA_IMAGES_ORIGINAL = new HashMap<>(); + private static final Map SET_IMAGES = new HashMap<>(); + private static final Map SET_IMAGES_EXIST = new HashMap<>(); + private static final Pattern REPLACE_SYMBOLS_PATTERN = Pattern.compile("\\{([^}/]*)/?([^}]*)\\}"); private static String cachedPath; public static void loadImages() { @@ -40,21 +41,21 @@ public class ManaSymbols { try { Image image = UI.getImageIcon(file.getAbsolutePath()).getImage(); BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r); - manaImages.put(symbol, resized); + MANA_IMAGES.put(symbol, resized); } catch (Exception e) { - log.error("Error for symbol:" + symbol); + LOGGER.error("Error for symbol:" + symbol); } file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_MANA_MEDIUM + "/" + symbol + ".jpg"); try { Image image = UI.getImageIcon(file.getAbsolutePath()).getImage(); - manaImagesOriginal.put(symbol, image); + MANA_IMAGES_ORIGINAL.put(symbol, image); } catch (Exception e) { } } List setCodes = ExpansionRepository.instance.getSetCodes(); if (setCodes == null) { // the cards db file is probaly not included in the client. It will be created after the first connect to a server. - log.warn("No db information for sets found. Connect to a server to create database file on client side. Then try to restart the client."); + LOGGER.warn("No db information for sets found. Connect to a server to create database file on client side. Then try to restart the client."); return; } for (String set : setCodes) { @@ -67,10 +68,10 @@ public class ManaSymbols { if (h > 0) { Rectangle r = new Rectangle(21, (int) (h * 21.0f / width)); BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r); - setImages.put(set, resized); + SET_IMAGES.put(set, resized); } } else { - setImages.put(set, image); + SET_IMAGES.put(set, image); } } catch (Exception e) { } @@ -123,7 +124,7 @@ public class ManaSymbols { Image image = UI.getImageIcon(file.getAbsolutePath()).getImage(); int width = image.getWidth(null); int height = image.getHeight(null); - setImagesExist.put(set, new Dimension(width, height)); + SET_IMAGES_EXIST.put(set, new Dimension(width, height)); } catch (Exception e) { } } @@ -158,7 +159,7 @@ public class ManaSymbols { } public static Image getManaSymbolImage(String symbol) { - return manaImagesOriginal.get(symbol); + return MANA_IMAGES_ORIGINAL.get(symbol); } public static void draw(Graphics g, String manaCost, int x, int y) { @@ -170,7 +171,7 @@ public class ManaSymbols { StringTokenizer tok = new StringTokenizer(manaCost, " "); while (tok.hasMoreTokens()) { String symbol = tok.nextToken().substring(0); - Image image = manaImages.get(symbol); + Image image = MANA_IMAGES.get(symbol); if (image == null) { //log.error("Symbol not recognized \"" + symbol + "\" in mana cost: " + manaCost); continue; @@ -210,15 +211,29 @@ public class ManaSymbols { value = value.replace("{source}", "|source|"); value = value.replace("{this}", "|this|"); String replaced = value; - if (!manaImages.isEmpty()) { - if (type.equals(Type.TOOLTIP)) { - replaced = replaceSymbolsPattern.matcher(value).replaceAll("$1$2"); - } else if (type.equals(Type.CARD)) { - value = value.replace("{slash}", "slash"); - replaced = replaceSymbolsPattern.matcher(value).replaceAll("$1$2"); - } else if (type.equals(Type.PAY)) { - value = value.replace("{slash}", "slash"); - replaced = replaceSymbolsPattern.matcher(value).replaceAll("$1$2"); + + if (!MANA_IMAGES.isEmpty()) { + switch (type) { + case TOOLTIP: + replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("$1$2"); +// replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("$1$2"); + break; + case CARD: + value = value.replace("{slash}", "slash"); + replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("$1$2"); + break; + case PAY: + value = value.replace("{slash}", "slash"); + replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("$1$2"); + break; + default: + break; } } replaced = replaced.replace("|source|", "{source}"); @@ -228,9 +243,9 @@ public class ManaSymbols { public static String replaceSetCodeWithHTML(String set, String rarity) { String _set = set; - if (setImagesExist.containsKey(_set)) { - Integer width = setImagesExist.get(_set).width; - Integer height = setImagesExist.get(_set).height; + if (SET_IMAGES_EXIST.containsKey(_set)) { + Integer width = SET_IMAGES_EXIST.get(_set).width; + Integer height = SET_IMAGES_EXIST.get(_set).height; return "" + rarity + " "; } else { return set; @@ -238,10 +253,10 @@ public class ManaSymbols { } public static Image getSetSymbolImage(String set) { - return setImages.get(set); + return SET_IMAGES.get(set); } public static BufferedImage getManaSymbolImageSmall(String symbol) { - return manaImages.get(symbol); + return MANA_IMAGES.get(symbol); } }