mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 12:31:59 -08:00
Refactor Sets.saveDeck into a deck exporter series of classes.
This commit is contained in:
parent
83d8f5a538
commit
0ea73b19df
9 changed files with 310 additions and 80 deletions
|
|
@ -11,7 +11,6 @@ import javax.swing.*;
|
|||
import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.EtchedBorder;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
|
|
@ -19,6 +18,8 @@ import mage.client.util.gui.ColorsChooser;
|
|||
import mage.client.util.gui.FastSearchUtil;
|
||||
import mage.client.util.sets.ConstructedFormats;
|
||||
|
||||
import static mage.cards.decks.DeckFormats.DCK;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Simown
|
||||
|
|
@ -328,7 +329,7 @@ public class DeckGeneratorDialog {
|
|||
tmp.getParentFile().mkdirs();
|
||||
tmp.createNewFile();
|
||||
deck.setName(deckName);
|
||||
Sets.saveDeck(tmp.getAbsolutePath(), deck.getDeckCardLists());
|
||||
DCK.getExporter().writeDeck(tmp.getAbsolutePath(), deck.getDeckCardLists());
|
||||
cleanUp();
|
||||
return tmp.getAbsolutePath();
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package mage.client.deckeditor;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.decks.DnDDeckTargetListener;
|
||||
|
|
@ -35,12 +34,13 @@ import java.awt.*;
|
|||
import java.awt.dnd.DropTarget;
|
||||
import java.awt.event.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import static mage.cards.decks.DeckFormats.DCK;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -965,8 +965,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
DeckCardLists cardLists = deck.getDeckCardLists();
|
||||
cardLists.setCardLayout(deckArea.getCardLayout());
|
||||
cardLists.setSideboardLayout(deckArea.getSideboardLayout());
|
||||
Sets.saveDeck(fileName, cardLists);
|
||||
} catch (FileNotFoundException ex) {
|
||||
DCK.getExporter().writeDeck(fileName, cardLists);
|
||||
} catch (IOException ex) {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage() + "\nTry ensuring that the selected directory is writable.", "Error saving deck", JOptionPane.ERROR_MESSAGE);
|
||||
} finally {
|
||||
MageFrame.getDesktop().setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue