mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Deck Import button moved to first tab.
Some texts with instructions added to the related dialog
This commit is contained in:
@@ -63,7 +63,7 @@ public class DeckImport<TItem extends InventoryItem, TModel extends DeckBase> ex
|
||||
|
||||
private final JTextArea txtInput = new JTextArea();
|
||||
private static final String STYLESHEET = "<style>"
|
||||
+ "body, h1, h2, h3, h4, h5, h6, table, tr, td, p {margin: 1px; padding: 0; font-weight: "
|
||||
+ "body, h1, h2, h3, h4, h5, h6, table, tr, td, p {margin: 3px 1px; padding: 0; font-weight: "
|
||||
+ "normal; font-style: normal; text-decoration: none; font-family: Arial; font-size: 10px;} "
|
||||
+
|
||||
// "h1 {border-bottom: solid 1px black; color: blue; font-size: 12px; margin: 3px 0 9px 0; } "
|
||||
@@ -79,6 +79,10 @@ public class DeckImport<TItem extends InventoryItem, TModel extends DeckBase> ex
|
||||
+ "<li class='knowncard'>Recognized cards will be shown in green. These cards will be auto-imported into a new deck<BR></li>"
|
||||
+ "<li class='unknowncard'>Lines which seem to be cards but are either misspelled or unsupported by Forge, are shown in dark-red<BR></li>"
|
||||
+ "<li class='comment'>Lines that appear unsignificant will be shown in gray<BR><BR></li>" + "</ul>"
|
||||
+ "<div class='section'>Choosing source</div>"
|
||||
+ "<p>In most cases when you paste from clipboard a carefully selected area of a webpage, it works perfectly.</p>"
|
||||
+ "<p>Sometimes to filter out unneeded data you may have to export deck in MTGO format, and paste here downloaded file contents.</p>"
|
||||
+ "<p>Sideboard recognition is supported. Make sure that the sideboard cards are listed after a line that contains the word 'Sideboard'</p>"
|
||||
+ "</html>";
|
||||
|
||||
private final JEditorPane htmlOutput = new JEditorPane("text/html", DeckImport.HTML_WELCOME_TEXT);
|
||||
@@ -111,7 +115,7 @@ public class DeckImport<TItem extends InventoryItem, TModel extends DeckBase> ex
|
||||
this.setSize(wWidth, wHeight);
|
||||
GuiUtils.centerFrame(this);
|
||||
this.setResizable(false);
|
||||
this.setTitle("Deck Import (wip)");
|
||||
this.setTitle("Deck Importer");
|
||||
|
||||
final Font fButtons = new java.awt.Font("Dialog", 0, 13);
|
||||
this.cmdAccept.setFont(fButtons);
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
package forge.gui.deckeditor.controllers;
|
||||
|
||||
import java.awt.Dialog.ModalityType;
|
||||
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
import forge.deck.DeckBase;
|
||||
import forge.gui.deckeditor.CDeckEditorUI;
|
||||
import forge.gui.deckeditor.DeckImport;
|
||||
import forge.gui.deckeditor.views.VAllDecks;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.item.InventoryItem;
|
||||
|
||||
/**
|
||||
* Controls the "all decks" panel in the deck editor UI.
|
||||
@@ -35,19 +28,12 @@ public enum CAllDecks implements ICDoc {
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.ICDoc#initialize()
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@Override
|
||||
public void initialize() {
|
||||
VAllDecks.SINGLETON_INSTANCE.getLstDecks().setDecks(
|
||||
Singletons.getModel().getDecks().getConstructed());
|
||||
|
||||
((FLabel) VAllDecks.SINGLETON_INSTANCE.getBtnImport())
|
||||
.setCommand(new Command() { @Override
|
||||
public void execute() { importDeck(); } });
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.ICDoc#update()
|
||||
*/
|
||||
@@ -55,16 +41,4 @@ public enum CAllDecks implements ICDoc {
|
||||
public void update() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens dialog for importing a deck from a different MTG software.
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private <TItem extends InventoryItem, TModel extends DeckBase> void importDeck() {
|
||||
final ACEditorBase<TItem, TModel> ed = (ACEditorBase<TItem, TModel>)
|
||||
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController();
|
||||
|
||||
final DeckImport dImport = new DeckImport(ed);
|
||||
dImport.setModalityType(ModalityType.APPLICATION_MODAL);
|
||||
dImport.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package forge.gui.deckeditor.controllers;
|
||||
|
||||
import java.awt.Dialog.ModalityType;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.io.File;
|
||||
@@ -15,11 +16,14 @@ import forge.deck.DeckBase;
|
||||
import forge.deck.io.DeckSerializer;
|
||||
import forge.error.BugReporter;
|
||||
import forge.gui.deckeditor.CDeckEditorUI;
|
||||
import forge.gui.deckeditor.DeckImport;
|
||||
import forge.gui.deckeditor.SEditorIO;
|
||||
import forge.gui.deckeditor.tables.DeckController;
|
||||
import forge.gui.deckeditor.views.VAllDecks;
|
||||
import forge.gui.deckeditor.views.VCurrentDeck;
|
||||
import forge.gui.framework.ICDoc;
|
||||
import forge.gui.toolbox.FLabel;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.properties.NewConstants;
|
||||
|
||||
/**
|
||||
@@ -108,7 +112,25 @@ public enum CCurrentDeck implements ICDoc {
|
||||
CDeckEditorUI.SINGLETON_INSTANCE.removeSelectedCards(false, 4);
|
||||
}
|
||||
});
|
||||
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnImport()
|
||||
.setCommand(new Command() { @Override
|
||||
public void execute() { importDeck(); } });
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens dialog for importing a deck from a different MTG software.
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private <TItem extends InventoryItem, TModel extends DeckBase> void importDeck() {
|
||||
final ACEditorBase<TItem, TModel> ed = (ACEditorBase<TItem, TModel>)
|
||||
CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController();
|
||||
|
||||
final DeckImport dImport = new DeckImport(ed);
|
||||
dImport.setModalityType(ModalityType.APPLICATION_MODAL);
|
||||
dImport.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.gui.framework.ICDoc#update()
|
||||
|
||||
@@ -295,6 +295,7 @@ public final class CEditorConstructed extends ACEditorBase<CardPrinted, Deck> {
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnSaveAs().setVisible(showOptions);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnPrintProxies().setVisible(showOptions);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getTxfTitle().setVisible(showOptions);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getBtnImport().setVisible(showOptions);
|
||||
VCurrentDeck.SINGLETON_INSTANCE.getLblTitle().setText(title);
|
||||
|
||||
this.controller.notifyModelChanged();
|
||||
|
||||
@@ -29,11 +29,6 @@ public enum VAllDecks implements IVDoc<CAllDecks> {
|
||||
private final DeckLister lstDecks = new DeckLister(GameType.Constructed);
|
||||
private JScrollPane scroller = new JScrollPane(lstDecks);
|
||||
|
||||
private final JLabel btnImport = new FLabel.Builder()
|
||||
.fontSize(14)
|
||||
.text("Import Deck").tooltip("Attempt to import a deck from a non-Forge format")
|
||||
.opaque(true).hoverable(true).build();
|
||||
|
||||
//========== Constructor
|
||||
private VAllDecks() {
|
||||
scroller.setOpaque(false);
|
||||
@@ -91,8 +86,6 @@ public enum VAllDecks implements IVDoc<CAllDecks> {
|
||||
public void populate() {
|
||||
parentCell.getBody().setLayout(new MigLayout("insets 0, gap 0, wrap, ax center"));
|
||||
|
||||
parentCell.getBody().add(btnImport, "w 120px!, h 30px!, gap 0 0 5px 5px");
|
||||
|
||||
parentCell.getBody().add(scroller, "w 96%!, growy, pushy, gap 2% 0 2% 0");
|
||||
}
|
||||
|
||||
@@ -102,8 +95,4 @@ public enum VAllDecks implements IVDoc<CAllDecks> {
|
||||
return lstDecks;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JLabel} */
|
||||
public JLabel getBtnImport() {
|
||||
return btnImport;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public enum VCurrentDeck implements IVDoc<CCurrentDeck>, ITableContainer {
|
||||
.icon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_SAVEAS))
|
||||
.text(" ").hoverable(true).build();
|
||||
|
||||
private final JLabel btnImport = new FLabel.Builder()
|
||||
private final JLabel btnLoad = new FLabel.Builder()
|
||||
.fontSize(14)
|
||||
.tooltip("Load")
|
||||
.iconInBackground(true)
|
||||
@@ -106,6 +106,12 @@ public enum VCurrentDeck implements IVDoc<CCurrentDeck>, ITableContainer {
|
||||
.icon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_EDIT))
|
||||
.iconScaleAuto(false).hoverable().build();
|
||||
|
||||
private final FLabel btnImport = new FLabel.Builder()
|
||||
.fontSize(14)
|
||||
.text("Import").tooltip("Attempt to import a deck from a non-Forge format")
|
||||
.opaque(true).hoverable(true).build();
|
||||
|
||||
|
||||
private final JTextField txfTitle = new FTextField.Builder().text("[New Deck]").build();
|
||||
|
||||
private final JPanel pnlRemove = new JPanel();
|
||||
@@ -134,9 +140,10 @@ public enum VCurrentDeck implements IVDoc<CCurrentDeck>, ITableContainer {
|
||||
pnlHeader.add(btnSave, "w 26px!, h 26px!, gap 0 5px 0 0");
|
||||
pnlHeader.add(btnNew, "w 26px!, h 26px!, gap 0 5px 0 0");
|
||||
|
||||
pnlHeader.add(btnImport, "w 26px!, h 26px!, gap 0 5px 0 0");
|
||||
pnlHeader.add(btnLoad, "w 26px!, h 26px!, gap 0 5px 0 0");
|
||||
pnlHeader.add(btnExport, "w 26px!, h 26px!, gap 0 5px 0 0");
|
||||
pnlHeader.add(btnPrintProxies, "w 26px!, h 26px!, gap 0 20px 0 0");
|
||||
pnlHeader.add(btnPrintProxies, "w 26px!, h 26px!, gap 0 5px 0 0");
|
||||
pnlHeader.add(btnImport, "w 50px!, h 26px!, gap 0 0 20px 0");
|
||||
|
||||
pnlRemove.setOpaque(false);
|
||||
pnlRemove.setLayout(new MigLayout("insets 0, gap 0, ax center"));
|
||||
@@ -273,7 +280,7 @@ public enum VCurrentDeck implements IVDoc<CCurrentDeck>, ITableContainer {
|
||||
|
||||
/** @return {@link javax.swing.JLabel} */
|
||||
public JLabel getBtnOpen() {
|
||||
return btnImport;
|
||||
return btnLoad;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JLabel} */
|
||||
@@ -339,4 +346,13 @@ public enum VCurrentDeck implements IVDoc<CCurrentDeck>, ITableContainer {
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
* @return
|
||||
*/
|
||||
public FLabel getBtnImport() {
|
||||
// TODO Auto-generated method stub
|
||||
return (FLabel) btnImport;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user