mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Skin more message/option/input dialogs
Prevent prompting twice when switching away from modified card in Workshop
This commit is contained in:
@@ -142,8 +142,6 @@ public enum FControl implements KeyEventDispatcher {
|
|||||||
setCloseAction(CloseAction.EXIT_FORGE);
|
setCloseAction(CloseAction.EXIT_FORGE);
|
||||||
windowClosing(e); //call again to apply chosen close action
|
windowClosing(e); //call again to apply chosen close action
|
||||||
return;
|
return;
|
||||||
case 2: //Cancel
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CLOSE_SCREEN:
|
case CLOSE_SCREEN:
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import forge.gui.toolbox.FOptionPane;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GuiDialog {
|
public class GuiDialog {
|
||||||
|
|
||||||
private static final String[] defaultConfirmOptions = { "Yes", "No" };
|
private static final String[] defaultConfirmOptions = { "Yes", "No" };
|
||||||
|
|
||||||
public static boolean confirm(final Card c, final String question) {
|
public static boolean confirm(final Card c, final String question) {
|
||||||
return GuiDialog.confirm(c, question, true, null);
|
return GuiDialog.confirm(c, question, true, null);
|
||||||
}
|
}
|
||||||
@@ -74,5 +74,4 @@ public class GuiDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,10 +128,10 @@ public final class GuiDisplayUtil {
|
|||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
catch (final FileNotFoundException fnfe) {
|
catch (final FileNotFoundException fnfe) {
|
||||||
FOptionPane.showErrorMessageDialog("File not found: " + fc.getSelectedFile().getAbsolutePath());
|
FOptionPane.showErrorDialog("File not found: " + fc.getSelectedFile().getAbsolutePath());
|
||||||
}
|
}
|
||||||
catch (final Exception e) {
|
catch (final Exception e) {
|
||||||
FOptionPane.showErrorMessageDialog("Error loading battle setup file!");
|
FOptionPane.showErrorDialog("Error loading battle setup file!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class ImportDialog {
|
|||||||
if (JFileChooser.APPROVE_OPTION == _fileChooser.showOpenDialog(JOptionPane.getRootFrame())) {
|
if (JFileChooser.APPROVE_OPTION == _fileChooser.showOpenDialog(JOptionPane.getRootFrame())) {
|
||||||
File f = _fileChooser.getSelectedFile();
|
File f = _fileChooser.getSelectedFile();
|
||||||
if (!f.canRead()) {
|
if (!f.canRead()) {
|
||||||
FOptionPane.showErrorMessageDialog("Cannot access selected directory (Permission denied).");
|
FOptionPane.showErrorDialog("Cannot access selected directory (Permission denied).");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
txfSrc.setText(f.getAbsolutePath());
|
txfSrc.setText(f.getAbsolutePath());
|
||||||
@@ -623,8 +623,7 @@ public class ImportDialog {
|
|||||||
sb.append("unless you move or delete them manually.</html>");
|
sb.append("unless you move or delete them manually.</html>");
|
||||||
|
|
||||||
String[] options = { "Whoops, let me fix that!", "Continue with the import, I know what I'm doing." };
|
String[] options = { "Whoops, let me fix that!", "Continue with the import, I know what I'm doing." };
|
||||||
int chosen = FOptionPane.showOptionDialog(sb.toString(), "Migration warning",
|
int chosen = FOptionPane.showOptionDialog(sb.toString(), "Migration warning", FOptionPane.WARNING_ICON, options);
|
||||||
FOptionPane.WARNING_ICON, options, 0);
|
|
||||||
|
|
||||||
if (chosen != 1) {
|
if (chosen != 1) {
|
||||||
// i.e. option 0 was chosen or the dialog was otherwise closed
|
// i.e. option 0 was chosen or the dialog was otherwise closed
|
||||||
|
|||||||
@@ -77,9 +77,9 @@ public class SEditorIO {
|
|||||||
if (!((DeckController<DeckBase>) CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController()).isSaved()) {
|
if (!((DeckController<DeckBase>) CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController().getDeckController()).isSaved()) {
|
||||||
Singletons.getControl().ensureScreenActive(screen); //ensure Deck Editor is active before showing dialog
|
Singletons.getControl().ensureScreenActive(screen); //ensure Deck Editor is active before showing dialog
|
||||||
final int choice = FOptionPane.showOptionDialog("Save changes to current deck?", "Save Changes?",
|
final int choice = FOptionPane.showOptionDialog("Save changes to current deck?", "Save Changes?",
|
||||||
FOptionPane.QUESTION_ICON, new String[] {"Save", "Don't Save", "Cancel"}, 0);
|
FOptionPane.QUESTION_ICON, new String[] {"Save", "Don't Save", "Cancel"});
|
||||||
|
|
||||||
if (choice == 2) { return false; }
|
if (choice == -1 || choice == 2) { return false; }
|
||||||
|
|
||||||
if (choice == 0 && !saveDeck()) { return false; }
|
if (choice == 0 && !saveDeck()) { return false; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ public enum FScreen {
|
|||||||
}
|
}
|
||||||
catch (final Exception e) {
|
catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
FOptionPane.showErrorMessageDialog("Failed to delete layout file.");
|
FOptionPane.showErrorDialog("Failed to delete layout file.");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.SwingWorker;
|
import javax.swing.SwingWorker;
|
||||||
|
|
||||||
@@ -24,6 +23,7 @@ import forge.gui.SOverlayUtils;
|
|||||||
import forge.gui.deckeditor.CDeckEditorUI;
|
import forge.gui.deckeditor.CDeckEditorUI;
|
||||||
import forge.gui.deckeditor.controllers.CEditorQuestCardShop;
|
import forge.gui.deckeditor.controllers.CEditorQuestCardShop;
|
||||||
import forge.gui.framework.FScreen;
|
import forge.gui.framework.FScreen;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.net.FServer;
|
import forge.net.FServer;
|
||||||
import forge.net.Lobby;
|
import forge.net.Lobby;
|
||||||
@@ -249,7 +249,7 @@ public class SSubmenuQuestUtil {
|
|||||||
QuestController qc = Singletons.getModel().getQuest();
|
QuestController qc = Singletons.getModel().getQuest();
|
||||||
if (qc == null || qc.getAssets() == null) {
|
if (qc == null || qc.getAssets() == null) {
|
||||||
String msg = "Please create a Quest before attempting to " + location;
|
String msg = "Please create a Quest before attempting to " + location;
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), msg, "No Quest", JOptionPane.ERROR_MESSAGE);
|
FOptionPane.showErrorDialog(msg, "No Quest");
|
||||||
System.out.println(msg);
|
System.out.println(msg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -288,9 +288,8 @@ public class SSubmenuQuestUtil {
|
|||||||
|
|
||||||
CardEdition unlocked = toUnlock.left;
|
CardEdition unlocked = toUnlock.left;
|
||||||
qData.getAssets().subtractCredits(toUnlock.right);
|
qData.getAssets().subtractCredits(toUnlock.right);
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "You have successfully unlocked " + unlocked.getName() + "!",
|
FOptionPane.showMessageDialog("You have successfully unlocked " + unlocked.getName() + "!",
|
||||||
unlocked.getName() + " unlocked!",
|
unlocked.getName() + " unlocked!", null);
|
||||||
JOptionPane.PLAIN_MESSAGE);
|
|
||||||
|
|
||||||
QuestUtilUnlockSets.doUnlock(qData, unlocked);
|
QuestUtilUnlockSets.doUnlock(qData, unlocked);
|
||||||
}
|
}
|
||||||
@@ -310,7 +309,7 @@ public class SSubmenuQuestUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (worlds.size() < 1) {
|
if (worlds.size() < 1) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "There are currently no worlds you can travel to\nin this version of Forge.", "No worlds", JOptionPane.ERROR_MESSAGE);
|
FOptionPane.showErrorDialog("There are currently no worlds you can travel to\nin this version of Forge.", "No Worlds");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,13 +325,11 @@ public class SSubmenuQuestUtil {
|
|||||||
if (nextChallengeInWins() < 1 && qCtrl.getAchievements().getCurrentChallenges().size() > 0) {
|
if (nextChallengeInWins() < 1 && qCtrl.getAchievements().getCurrentChallenges().size() > 0) {
|
||||||
needRemove = true;
|
needRemove = true;
|
||||||
|
|
||||||
final int confirmLoss = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
|
if (!FOptionPane.showConfirmDialog(
|
||||||
"You have uncompleted challenges in your current world. If you travel now, they will be LOST!"
|
"You have uncompleted challenges in your current world. If you travel now, they will be LOST!"
|
||||||
+ "\nAre you sure you wish to travel anyway?\n"
|
+ "\nAre you sure you wish to travel anyway?\n"
|
||||||
+ "(Click \"No\" to go back and complete your current challenges first.)",
|
+ "(Click \"No\" to go back and complete your current challenges first.)",
|
||||||
"WARNING: Uncompleted challenges", JOptionPane.YES_NO_OPTION);
|
"WARNING: Uncompleted challenges")) {
|
||||||
|
|
||||||
if (confirmLoss == JOptionPane.NO_OPTION) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -377,7 +374,7 @@ public class SSubmenuQuestUtil {
|
|||||||
}
|
}
|
||||||
if (deck == null) {
|
if (deck == null) {
|
||||||
String msg = "Please select a Quest Deck.";
|
String msg = "Please select a Quest Deck.";
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), msg, "No Deck", JOptionPane.ERROR_MESSAGE);
|
FOptionPane.showErrorDialog(msg, "No Deck");
|
||||||
System.out.println(msg);
|
System.out.println(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -385,7 +382,7 @@ public class SSubmenuQuestUtil {
|
|||||||
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
||||||
String errorMessage = GameType.Quest.getDecksFormat().getDeckConformanceProblem(deck);
|
String errorMessage = GameType.Quest.getDecksFormat().getDeckConformanceProblem(deck);
|
||||||
if (null != errorMessage) {
|
if (null != errorMessage) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
FOptionPane.showErrorDialog("Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid Deck");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JMenu;
|
import javax.swing.JMenu;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
@@ -107,7 +106,7 @@ public enum CSubmenuConstructed implements ICDoc, IMenuProvider {
|
|||||||
for(int i=0;i<view.getNumPlayers();i++) {
|
for(int i=0;i<view.getNumPlayers();i++) {
|
||||||
String errMsg = gameType.getDecksFormat().getDeckConformanceProblem(view.getDeckChooser(i).getPlayer().getDeck());
|
String errMsg = gameType.getDecksFormat().getDeckConformanceProblem(view.getDeckChooser(i).getPlayer().getDeck());
|
||||||
if (null != errMsg) {
|
if (null != errMsg) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Player " + i + "'s deck " + errMsg, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
FOptionPane.showErrorDialog("Player " + i + "'s deck " + errMsg, "Invalid Deck");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
@@ -21,6 +20,7 @@ import forge.gui.deckeditor.CDeckEditorUI;
|
|||||||
import forge.gui.deckeditor.controllers.CEditorDraftingProcess;
|
import forge.gui.deckeditor.controllers.CEditorDraftingProcess;
|
||||||
import forge.gui.framework.FScreen;
|
import forge.gui.framework.FScreen;
|
||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.limited.BoosterDraft;
|
import forge.limited.BoosterDraft;
|
||||||
import forge.limited.LimitedPoolType;
|
import forge.limited.LimitedPoolType;
|
||||||
import forge.net.FServer;
|
import forge.net.FServer;
|
||||||
@@ -97,16 +97,14 @@ public enum CSubmenuDraft implements ICDoc {
|
|||||||
final int aiIndex = (int) Math.floor(Math.random() * 7);
|
final int aiIndex = (int) Math.floor(Math.random() * 7);
|
||||||
|
|
||||||
if (humanDeck == null) {
|
if (humanDeck == null) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
FOptionPane.showErrorDialog("No deck selected for human.\n(You may need to build a new deck)", "No Deck");
|
||||||
"No deck selected for human!\r\n(You may need to build a new deck.)",
|
|
||||||
"No deck", JOptionPane.ERROR_MESSAGE);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
||||||
String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(humanDeck);
|
String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(humanDeck);
|
||||||
if (null != errorMessage) {
|
if (null != errorMessage) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
FOptionPane.showErrorDialog("Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid Deck");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -28,6 +27,7 @@ import forge.gui.deckeditor.controllers.ACEditorBase;
|
|||||||
import forge.gui.deckeditor.controllers.CEditorLimited;
|
import forge.gui.deckeditor.controllers.CEditorLimited;
|
||||||
import forge.gui.framework.FScreen;
|
import forge.gui.framework.FScreen;
|
||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
import forge.limited.LimitedPoolType;
|
import forge.limited.LimitedPoolType;
|
||||||
@@ -124,16 +124,14 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
final Deck human = VSubmenuSealed.SINGLETON_INSTANCE.getLstDecks().getSelectedDeck();
|
final Deck human = VSubmenuSealed.SINGLETON_INSTANCE.getLstDecks().getSelectedDeck();
|
||||||
|
|
||||||
if (human == null) {
|
if (human == null) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
FOptionPane.showErrorDialog("Please build and/or select a deck for yourself.", "No Deck");
|
||||||
"Please build and/or select a deck for yourself.",
|
|
||||||
"No deck", JOptionPane.ERROR_MESSAGE);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
||||||
String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(human);
|
String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(human);
|
||||||
if (null != errorMessage) {
|
if (null != errorMessage) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
FOptionPane.showErrorDialog("Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid Deck");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,8 +142,6 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private <T extends DeckBase> void setupSealed() {
|
private <T extends DeckBase> void setupSealed() {
|
||||||
|
|
||||||
|
|
||||||
final String prompt = "Choose Sealed Deck Format:";
|
final String prompt = "Choose Sealed Deck Format:";
|
||||||
final LimitedPoolType o = GuiChoose.oneOrNone(prompt, LimitedPoolType.values());
|
final LimitedPoolType o = GuiChoose.oneOrNone(prompt, LimitedPoolType.values());
|
||||||
if ( o == null ) return;
|
if ( o == null ) return;
|
||||||
@@ -164,17 +160,15 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
Integer rounds = GuiChoose.oneOrNone("How many opponents are you willing to face?", integers);
|
Integer rounds = GuiChoose.oneOrNone("How many opponents are you willing to face?", integers);
|
||||||
if ( null == rounds ) return;
|
if ( null == rounds ) return;
|
||||||
|
|
||||||
|
final String sDeckName = FOptionPane.showInputDialog(
|
||||||
final String sDeckName = JOptionPane.showInputDialog(JOptionPane.getRootFrame(),
|
|
||||||
"Save this card pool as:",
|
"Save this card pool as:",
|
||||||
"Save Card Pool",
|
"Save Card Pool",
|
||||||
JOptionPane.QUESTION_MESSAGE);
|
FOptionPane.QUESTION_ICON);
|
||||||
|
|
||||||
if (StringUtils.isBlank(sDeckName)) {
|
if (StringUtils.isBlank(sDeckName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final Deck deck = new Deck(sDeckName);
|
final Deck deck = new Deck(sDeckName);
|
||||||
deck.getOrCreate(DeckSection.Sideboard).addAll(humanPool);
|
deck.getOrCreate(DeckSection.Sideboard).addAll(humanPool);
|
||||||
|
|
||||||
@@ -185,11 +179,9 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
final IStorage<DeckGroup> sealedDecks = Singletons.getModel().getDecks().getSealed();
|
final IStorage<DeckGroup> sealedDecks = Singletons.getModel().getDecks().getSealed();
|
||||||
|
|
||||||
if (sealedDecks.contains(sDeckName)) {
|
if (sealedDecks.contains(sDeckName)) {
|
||||||
final int deleteDeck = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), "\"" + sDeckName
|
if (!FOptionPane.showConfirmDialog(
|
||||||
+ "\" already exists! Do you want to replace it?",
|
"'" + sDeckName + "' already exists. Do you want to replace it?",
|
||||||
"Sealed Deck Game Exists", JOptionPane.YES_NO_OPTION);
|
"Sealed Deck Game Exists")) {
|
||||||
|
|
||||||
if (deleteDeck == JOptionPane.NO_OPTION) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sealedDecks.delete(sDeckName);
|
sealedDecks.delete(sDeckName);
|
||||||
@@ -230,8 +222,6 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
double value = 0;
|
double value = 0;
|
||||||
double divider = 0;
|
double divider = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (d.getMain().isEmpty()) {
|
if (d.getMain().isEmpty()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -261,7 +251,6 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
return (20.0 / (best + (2 * value)));
|
return (20.0 / (best + (2 * value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Deck o1, Deck o2) {
|
public int compare(Deck o1, Deck o2) {
|
||||||
double delta = getDraftValue(o1) - getDraftValue(o2);
|
double delta = getDraftValue(o1) - getDraftValue(o2);
|
||||||
@@ -269,6 +258,5 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
if ( delta < 0 ) return -1;
|
if ( delta < 0 ) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -131,7 +130,6 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
initializePlayerNameButton();
|
initializePlayerNameButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see forge.control.home.IControlSubmenu#update()
|
* @see forge.control.home.IControlSubmenu#update()
|
||||||
*/
|
*/
|
||||||
@@ -166,8 +164,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
String userPrompt =
|
String userPrompt =
|
||||||
"This will reset all preferences to their defaults and restart Forge.\n\n" +
|
"This will reset all preferences to their defaults and restart Forge.\n\n" +
|
||||||
"Reset and restart Forge?";
|
"Reset and restart Forge?";
|
||||||
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), userPrompt, "Reset Settings", JOptionPane.YES_NO_OPTION);
|
if (FOptionPane.showConfirmDialog(userPrompt, "Reset Settings")) {
|
||||||
if (reply == JOptionPane.YES_OPTION) {
|
|
||||||
ForgePreferences prefs = Singletons.getModel().getPreferences();
|
ForgePreferences prefs = Singletons.getModel().getPreferences();
|
||||||
prefs.reset();
|
prefs.reset();
|
||||||
prefs.save();
|
prefs.save();
|
||||||
@@ -181,8 +178,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
"This will reset the Deck Editor screen layout.\n" +
|
"This will reset the Deck Editor screen layout.\n" +
|
||||||
"All tabbed views will be restored to their default positions.\n\n" +
|
"All tabbed views will be restored to their default positions.\n\n" +
|
||||||
"Reset layout?";
|
"Reset layout?";
|
||||||
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), userPrompt, "Reset Deck Editor Layout", JOptionPane.YES_NO_OPTION);
|
if (FOptionPane.showConfirmDialog(userPrompt, "Reset Deck Editor Layout")) {
|
||||||
if (reply == JOptionPane.YES_OPTION) {
|
|
||||||
if (FScreen.DECK_EDITOR_CONSTRUCTED.deleteLayoutFile()) {
|
if (FScreen.DECK_EDITOR_CONSTRUCTED.deleteLayoutFile()) {
|
||||||
FOptionPane.showMessageDialog("Deck Editor layout has been reset.");
|
FOptionPane.showMessageDialog("Deck Editor layout has been reset.");
|
||||||
}
|
}
|
||||||
@@ -194,8 +190,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
"This will reset the Workshop screen layout.\n" +
|
"This will reset the Workshop screen layout.\n" +
|
||||||
"All tabbed views will be restored to their default positions.\n\n" +
|
"All tabbed views will be restored to their default positions.\n\n" +
|
||||||
"Reset layout?";
|
"Reset layout?";
|
||||||
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), userPrompt, "Reset Workshop Layout", JOptionPane.YES_NO_OPTION);
|
if (FOptionPane.showConfirmDialog(userPrompt, "Reset Workshop Layout")) {
|
||||||
if (reply == JOptionPane.YES_OPTION) {
|
|
||||||
if (FScreen.WORKSHOP_SCREEN.deleteLayoutFile()) {
|
if (FScreen.WORKSHOP_SCREEN.deleteLayoutFile()) {
|
||||||
FOptionPane.showMessageDialog("Workshop layout has been reset.");
|
FOptionPane.showMessageDialog("Workshop layout has been reset.");
|
||||||
}
|
}
|
||||||
@@ -208,8 +203,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
"If you want to save the current layout first, please use " +
|
"If you want to save the current layout first, please use " +
|
||||||
"the Dock tab -> Save Layout option in the Match screen.\n\n" +
|
"the Dock tab -> Save Layout option in the Match screen.\n\n" +
|
||||||
"Reset layout?";
|
"Reset layout?";
|
||||||
int reply = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), userPrompt, "Reset Match Screen Layout", JOptionPane.YES_NO_OPTION);
|
if (FOptionPane.showConfirmDialog(userPrompt, "Reset Match Screen Layout")) {
|
||||||
if (reply == JOptionPane.YES_OPTION) {
|
|
||||||
if (FScreen.MATCH_SCREEN.deleteLayoutFile()) {
|
if (FScreen.MATCH_SCREEN.deleteLayoutFile()) {
|
||||||
FOptionPane.showMessageDialog("Match Screen layout has been reset.");
|
FOptionPane.showMessageDialog("Match Screen layout has been reset.");
|
||||||
}
|
}
|
||||||
@@ -262,7 +256,6 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initializePlayerNameButton() {
|
private void initializePlayerNameButton() {
|
||||||
FLabel btn = view.getBtnPlayerName();
|
FLabel btn = view.getBtnPlayerName();
|
||||||
setPlayerNameButtonText();
|
setPlayerNameButtonText();
|
||||||
@@ -285,5 +278,4 @@ public enum CSubmenuPreferences implements ICDoc {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package forge.gui.home.settings;
|
package forge.gui.home.settings;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -40,22 +38,19 @@ public final class GamePlayerUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getPlayerNameUsingFirstTimePrompt() {
|
private static String getPlayerNameUsingFirstTimePrompt() {
|
||||||
return (String)JOptionPane.showInputDialog(
|
return FOptionPane.showInputDialog(
|
||||||
JOptionPane.getRootFrame(),
|
|
||||||
"By default, Forge will refer to you as the \"Human\" during gameplay.\n" +
|
"By default, Forge will refer to you as the \"Human\" during gameplay.\n" +
|
||||||
"If you would prefer a different name please enter it now.\n",
|
"If you would prefer a different name please enter it now.",
|
||||||
"Personalize Forge Gameplay",
|
"Personalize Forge Gameplay",
|
||||||
JOptionPane.QUESTION_MESSAGE,
|
FOptionPane.QUESTION_ICON);
|
||||||
null, null, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getPlayerNameUsingStandardPrompt(String playerName) {
|
private static String getPlayerNameUsingStandardPrompt(String playerName) {
|
||||||
return (String)JOptionPane.showInputDialog(
|
return FOptionPane.showInputDialog(
|
||||||
JOptionPane.getRootFrame(),
|
"Please enter a new name. (alpha-numeric only)",
|
||||||
"Please enter a new name (alpha-numeric only)\n",
|
|
||||||
"Personalize Forge Gameplay",
|
"Personalize Forge Gameplay",
|
||||||
JOptionPane.PLAIN_MESSAGE,
|
null,
|
||||||
null, null, playerName);
|
playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getVerifiedPlayerName(String newName, String oldName) {
|
private static String getVerifiedPlayerName(String newName, String oldName) {
|
||||||
@@ -68,5 +63,4 @@ public final class GamePlayerUtil {
|
|||||||
}
|
}
|
||||||
return newName;
|
return newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
@@ -23,6 +22,7 @@ import forge.gui.deckeditor.controllers.CEditorCommander;
|
|||||||
import forge.gui.framework.FScreen;
|
import forge.gui.framework.FScreen;
|
||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
import forge.gui.toolbox.FList;
|
import forge.gui.toolbox.FList;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.net.FServer;
|
import forge.net.FServer;
|
||||||
import forge.net.Lobby;
|
import forge.net.Lobby;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
@@ -65,7 +65,6 @@ public enum CSubmenuCommander implements ICDoc {
|
|||||||
if (-1 == deckList.getSelectedIndex() && listData.size() != 0) {
|
if (-1 == deckList.getSelectedIndex() && listData.size() != 0) {
|
||||||
deckList.setSelectedIndex(0);
|
deckList.setSelectedIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@@ -83,7 +82,6 @@ public enum CSubmenuCommander implements ICDoc {
|
|||||||
view.getBtnStart().addActionListener(new ActionListener() {
|
view.getBtnStart().addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
|
|
||||||
startGame();
|
startGame();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -107,15 +105,12 @@ public enum CSubmenuCommander implements ICDoc {
|
|||||||
List<Deck> problemDecks = new ArrayList<Deck>();
|
List<Deck> problemDecks = new ArrayList<Deck>();
|
||||||
|
|
||||||
for (int i = 0; i < view.getNumPlayers(); i++) {
|
for (int i = 0; i < view.getNumPlayers(); i++) {
|
||||||
|
|
||||||
Object o = view.getDeckLists().get(i).getSelectedValue();
|
Object o = view.getDeckLists().get(i).getSelectedValue();
|
||||||
Deck d = null;
|
Deck d = null;
|
||||||
if(o instanceof String)
|
if (o instanceof String) {
|
||||||
{
|
|
||||||
d = view.getAllCommanderDecks().get(rnd.nextInt(view.getAllCommanderDecks().size()));
|
d = view.getAllCommanderDecks().get(rnd.nextInt(view.getAllCommanderDecks().size()));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
d = (Deck)o;
|
d = (Deck)o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,18 +122,17 @@ public enum CSubmenuCommander implements ICDoc {
|
|||||||
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
||||||
String errorMessage = GameType.Commander.getDecksFormat().getDeckConformanceProblem(d);
|
String errorMessage = GameType.Commander.getDecksFormat().getDeckConformanceProblem(d);
|
||||||
if (null != errorMessage) {
|
if (null != errorMessage) {
|
||||||
if(!problemDecks.contains(d))
|
if (!problemDecks.contains(d)) {
|
||||||
{
|
FOptionPane.showErrorDialog("The deck " + d.getName() + " " + errorMessage + " Please edit or choose a different deck.", "Invalid Deck");
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "The deck " + d.getName() + " " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
|
||||||
problemDecks.add(d);
|
problemDecks.add(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
playerDecks.add(d);
|
playerDecks.add(d);
|
||||||
}
|
}
|
||||||
if(problemDecks.size() != 0)
|
if (problemDecks.size() != 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ import java.util.List;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -48,6 +46,7 @@ import forge.gui.framework.ICDoc;
|
|||||||
import forge.gui.framework.SLayoutIO;
|
import forge.gui.framework.SLayoutIO;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.gui.match.views.VDock;
|
import forge.gui.match.views.VDock;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.gui.toolbox.SaveOpenDialog;
|
import forge.gui.toolbox.SaveOpenDialog;
|
||||||
import forge.gui.toolbox.SaveOpenDialog.Filetypes;
|
import forge.gui.toolbox.SaveOpenDialog.Filetypes;
|
||||||
@@ -213,6 +212,7 @@ public enum CDock implements ICDoc {
|
|||||||
refreshArcStateDisplay();
|
refreshArcStateDisplay();
|
||||||
FView.SINGLETON_INSTANCE.getFrame().repaint(); // repaint the match UI
|
FView.SINGLETON_INSTANCE.getFrame().repaint(); // repaint the match UI
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArcState(int state) {
|
public void setArcState(int state) {
|
||||||
arcState = state;
|
arcState = state;
|
||||||
}
|
}
|
||||||
@@ -246,7 +246,6 @@ public enum CDock implements ICDoc {
|
|||||||
deckList.append(s.getValue() + " x " + s.getKey() + nl);
|
deckList.append(s.getValue() + " x " + s.getKey() + nl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String ttl = "Decklist";
|
String ttl = "Decklist";
|
||||||
if (dName != null) {
|
if (dName != null) {
|
||||||
ttl += " - " + dName;
|
ttl += " - " + dName;
|
||||||
@@ -255,15 +254,14 @@ public enum CDock implements ICDoc {
|
|||||||
final StringBuilder msg = new StringBuilder();
|
final StringBuilder msg = new StringBuilder();
|
||||||
if (deckMap.keySet().size() <= 32) {
|
if (deckMap.keySet().size() <= 32) {
|
||||||
msg.append(deckList.toString() + nl);
|
msg.append(deckList.toString() + nl);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
msg.append("Decklist too long for dialog." + nl + nl);
|
msg.append("Decklist too long for dialog." + nl + nl);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.append("Copy Decklist to Clipboard?");
|
msg.append("Copy Decklist to Clipboard?");
|
||||||
|
|
||||||
int rcMsg = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(), msg, ttl, JOptionPane.OK_CANCEL_OPTION);
|
if (FOptionPane.showConfirmDialog(msg.toString(), ttl, "OK", "Cancel")) {
|
||||||
|
|
||||||
if (rcMsg == JOptionPane.OK_OPTION) {
|
|
||||||
final StringSelection ss = new StringSelection(deckList.toString());
|
final StringSelection ss = new StringSelection(deckList.toString());
|
||||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import javax.swing.JMenu;
|
import javax.swing.JMenu;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.model.BuildInfo;
|
import forge.model.BuildInfo;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
|
|
||||||
@@ -42,11 +42,9 @@ public final class HelpMenu {
|
|||||||
return new ActionListener() {
|
return new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JOptionPane.showMessageDialog(
|
FOptionPane.showMessageDialog(
|
||||||
JOptionPane.getRootFrame(),
|
|
||||||
"Version : " + BuildInfo.getVersionString(),
|
"Version : " + BuildInfo.getVersionString(),
|
||||||
"About Forge",
|
"About Forge");
|
||||||
JOptionPane.INFORMATION_MESSAGE);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.MenuElement;
|
import javax.swing.MenuElement;
|
||||||
@@ -72,6 +71,7 @@ import forge.gui.input.InputConfirm;
|
|||||||
import forge.gui.input.InputSelectEntitiesFromList;
|
import forge.gui.input.InputSelectEntitiesFromList;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.gui.match.controllers.CPrompt;
|
import forge.gui.match.controllers.CPrompt;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
@@ -212,14 +212,14 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
boolean conform = Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY);
|
boolean conform = Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY);
|
||||||
do {
|
do {
|
||||||
if (newMain != null) {
|
if (newMain != null) {
|
||||||
|
String errMsg;
|
||||||
if (newMain.size() < deckMinSize) {
|
if (newMain.size() < deckMinSize) {
|
||||||
String errMsg = String.format("Too few cards in your main deck (minimum %d), please make modifications to your deck again.", deckMinSize);
|
errMsg = String.format("Too few cards in your main deck (minimum %d), please make modifications to your deck again.", deckMinSize);
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), errMsg, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String errMsg = String.format("Too many cards in your sideboard (maximum %d), please make modifications to your deck again.", sbMax);
|
errMsg = String.format("Too many cards in your sideboard (maximum %d), please make modifications to your deck again.", sbMax);
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), errMsg, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
}
|
||||||
|
FOptionPane.showErrorDialog(errMsg, "Invalid Deck");
|
||||||
}
|
}
|
||||||
// Sideboard rules have changed for M14, just need to consider min maindeck and max sideboard sizes
|
// Sideboard rules have changed for M14, just need to consider min maindeck and max sideboard sizes
|
||||||
// No longer need 1:1 sideboarding in non-limited formats
|
// No longer need 1:1 sideboarding in non-limited formats
|
||||||
@@ -277,8 +277,8 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
|
|
||||||
String message = String.format("How much will you announce for %s?%s", announce, canChooseZero ? "" : " (X cannot be 0)");
|
String message = String.format("How much will you announce for %s?%s", announce, canChooseZero ? "" : " (X cannot be 0)");
|
||||||
while (true){
|
while (true){
|
||||||
String str = JOptionPane.showInputDialog(JOptionPane.getRootFrame(), message, ability.getSourceCard().getName(), JOptionPane.QUESTION_MESSAGE);
|
String str = FOptionPane.showInputDialog(message, ability.getSourceCard().getName(), FOptionPane.QUESTION_ICON);
|
||||||
if (null == str) return null; // that is 'cancel'
|
if (null == str) { return null; } // that is 'cancel'
|
||||||
|
|
||||||
if (StringUtils.isNumeric(str)) {
|
if (StringUtils.isNumeric(str)) {
|
||||||
Integer val = Integer.valueOf(str);
|
Integer val = Integer.valueOf(str);
|
||||||
|
|||||||
@@ -7,13 +7,11 @@ import java.awt.datatransfer.StringSelection;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.SwingWorker;
|
import javax.swing.SwingWorker;
|
||||||
|
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class FHyperlink extends FLabel {
|
public class FHyperlink extends FLabel {
|
||||||
public static class Builder extends FLabel.Builder {
|
public static class Builder extends FLabel.Builder {
|
||||||
@@ -34,14 +32,16 @@ public class FHyperlink extends FLabel {
|
|||||||
final boolean browsingSupported = _isBrowsingSupported();
|
final boolean browsingSupported = _isBrowsingSupported();
|
||||||
if (browsingSupported) {
|
if (browsingSupported) {
|
||||||
tooltip(bldUrl);
|
tooltip(bldUrl);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
tooltip(bldUrl + " (click to copy to clipboard)");
|
tooltip(bldUrl + " (click to copy to clipboard)");
|
||||||
}
|
}
|
||||||
|
|
||||||
final URI uri;
|
final URI uri;
|
||||||
try {
|
try {
|
||||||
uri = new URI(bldUrl);
|
uri = new URI(bldUrl);
|
||||||
} catch (URISyntaxException e) {
|
}
|
||||||
|
catch (URISyntaxException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,15 +52,17 @@ public class FHyperlink extends FLabel {
|
|||||||
if (browsingSupported) {
|
if (browsingSupported) {
|
||||||
// open link in default browser
|
// open link in default browser
|
||||||
new _LinkRunner(uri).execute();
|
new _LinkRunner(uri).execute();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// copy link to clipboard
|
// copy link to clipboard
|
||||||
StringSelection ss = new StringSelection(bldUrl);
|
StringSelection ss = new StringSelection(bldUrl);
|
||||||
try {
|
try {
|
||||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
|
||||||
} catch (IllegalStateException ex) {
|
}
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
|
catch (IllegalStateException ex) {
|
||||||
|
FOptionPane.showErrorDialog(
|
||||||
"Sorry, a problem occurred while copying this link to your system clipboard.",
|
"Sorry, a problem occurred while copying this link to your system clipboard.",
|
||||||
"A problem occured", JOptionPane.ERROR_MESSAGE);
|
"A problem occurred");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ public class FOptionPane extends FDialog {
|
|||||||
showMessageDialog(message, title, INFORMATION_ICON);
|
showMessageDialog(message, title, INFORMATION_ICON);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showErrorMessageDialog(String message) {
|
public static void showErrorDialog(String message) {
|
||||||
showMessageDialog(message, "Forge", ERROR_ICON);
|
showMessageDialog(message, "Forge", ERROR_ICON);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showErrorMessageDialog(String message, String title) {
|
public static void showErrorDialog(String message, String title) {
|
||||||
showMessageDialog(message, title, ERROR_ICON);
|
showMessageDialog(message, title, ERROR_ICON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +67,10 @@ public class FOptionPane extends FDialog {
|
|||||||
return (reply == 0);
|
return (reply == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int showOptionDialog(String message, String title, SkinImage icon, String[] options) {
|
||||||
|
return showOptionDialog(message, title, icon, options, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public static int showOptionDialog(String message, String title, SkinImage icon, String[] options, int defaultOption) {
|
public static int showOptionDialog(String message, String title, SkinImage icon, String[] options, int defaultOption) {
|
||||||
final FOptionPane optionPane = new FOptionPane(message, title, icon, null, options, defaultOption);
|
final FOptionPane optionPane = new FOptionPane(message, title, icon, null, options, defaultOption);
|
||||||
optionPane.setVisible(true);
|
optionPane.setVisible(true);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public final class CardScriptInfo {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (final Exception ex) {
|
catch (final Exception ex) {
|
||||||
FOptionPane.showErrorMessageDialog("Problem writing file - " + this.file + " : " + ex);
|
FOptionPane.showErrorDialog("Problem writing file - " + this.file + " : " + ex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package forge.gui.workshop.controllers;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
import javax.swing.event.DocumentListener;
|
import javax.swing.event.DocumentListener;
|
||||||
|
|
||||||
@@ -15,6 +14,7 @@ import forge.gui.framework.FScreen;
|
|||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
import forge.gui.match.controllers.CDetail;
|
import forge.gui.match.controllers.CDetail;
|
||||||
import forge.gui.match.controllers.CPicture;
|
import forge.gui.match.controllers.CPicture;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.gui.toolbox.FTextEditor;
|
import forge.gui.toolbox.FTextEditor;
|
||||||
import forge.gui.workshop.CardScriptInfo;
|
import forge.gui.workshop.CardScriptInfo;
|
||||||
import forge.gui.workshop.menus.WorkshopFileMenu;
|
import forge.gui.workshop.menus.WorkshopFileMenu;
|
||||||
@@ -37,6 +37,7 @@ public enum CCardScript implements ICDoc {
|
|||||||
private PaperCard currentCard;
|
private PaperCard currentCard;
|
||||||
private CardScriptInfo currentScriptInfo;
|
private CardScriptInfo currentScriptInfo;
|
||||||
private boolean isTextDirty;
|
private boolean isTextDirty;
|
||||||
|
private boolean switchInProgress;
|
||||||
|
|
||||||
private CCardScript() {
|
private CCardScript() {
|
||||||
VCardScript.SINGLETON_INSTANCE.getTxtScript().addDocumentListener(new DocumentListener() {
|
VCardScript.SINGLETON_INSTANCE.getTxtScript().addDocumentListener(new DocumentListener() {
|
||||||
@@ -71,7 +72,8 @@ public enum CCardScript implements ICDoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showCard(PaperCard card) {
|
public void showCard(PaperCard card) {
|
||||||
if (this.currentCard == card) { return; }
|
if (this.currentCard == card || this.switchInProgress) { return; }
|
||||||
|
|
||||||
if (!canSwitchAway(true)) { //ensure current card saved before changing to a different card
|
if (!canSwitchAway(true)) { //ensure current card saved before changing to a different card
|
||||||
VWorkshopCatalog.SINGLETON_INSTANCE.getCardManager().setSelectedItem(this.currentCard); //return selection to current card //TODO: fix so clicking away again doesn't cause weird selection problems
|
VWorkshopCatalog.SINGLETON_INSTANCE.getCardManager().setSelectedItem(this.currentCard); //return selection to current card //TODO: fix so clicking away again doesn't cause weird selection problems
|
||||||
return;
|
return;
|
||||||
@@ -94,18 +96,21 @@ public enum CCardScript implements ICDoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSwitchAway(boolean isCardChanging) {
|
public boolean canSwitchAway(boolean isCardChanging) {
|
||||||
|
if (this.switchInProgress) { return false; }
|
||||||
if (!hasChanges()) { return true; }
|
if (!hasChanges()) { return true; }
|
||||||
|
|
||||||
|
this.switchInProgress = true;
|
||||||
Singletons.getControl().ensureScreenActive(FScreen.WORKSHOP_SCREEN); //ensure Workshop is active before showing dialog
|
Singletons.getControl().ensureScreenActive(FScreen.WORKSHOP_SCREEN); //ensure Workshop is active before showing dialog
|
||||||
final int choice = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
|
final int choice = FOptionPane.showOptionDialog(
|
||||||
"Save changes to " + this.currentCard + "?",
|
"Save changes to " + this.currentCard + "?",
|
||||||
"Save Changes?",
|
"Save Changes?",
|
||||||
JOptionPane.YES_NO_CANCEL_OPTION,
|
FOptionPane.QUESTION_ICON,
|
||||||
JOptionPane.QUESTION_MESSAGE);
|
new String[] {"Save", "Don't Save", "Cancel"});
|
||||||
|
this.switchInProgress = false;
|
||||||
|
|
||||||
if (choice == JOptionPane.CANCEL_OPTION) { return false; }
|
if (choice == -1 || choice == 2) { return false; }
|
||||||
|
|
||||||
if (choice == JOptionPane.YES_OPTION && !saveChanges()) { return false; }
|
if (choice == 0 && !saveChanges()) { return false; }
|
||||||
|
|
||||||
if (!isCardChanging) {
|
if (!isCardChanging) {
|
||||||
refresh(); //refresh if current card isn't changing to restore script text from file
|
refresh(); //refresh if current card isn't changing to restore script text from file
|
||||||
|
|||||||
@@ -27,11 +27,10 @@ import java.util.NoSuchElementException;
|
|||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
|
||||||
import forge.Constant.Preferences;
|
import forge.Constant.Preferences;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
@@ -40,6 +39,7 @@ import forge.card.UnOpenedProduct;
|
|||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.gui.GuiChoose;
|
import forge.gui.GuiChoose;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
import forge.item.SealedProduct;
|
import forge.item.SealedProduct;
|
||||||
@@ -138,8 +138,9 @@ public final class BoosterDraft implements IBoosterDraft {
|
|||||||
final List<CustomLimited> myDrafts = this.loadCustomDrafts("res/draft/", ".draft");
|
final List<CustomLimited> myDrafts = this.loadCustomDrafts("res/draft/", ".draft");
|
||||||
|
|
||||||
if (myDrafts.isEmpty()) {
|
if (myDrafts.isEmpty()) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "No custom draft files found.", "", JOptionPane.INFORMATION_MESSAGE);
|
FOptionPane.showMessageDialog("No custom draft files found.");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
final CustomLimited draft = GuiChoose.one("Choose Custom Draft", myDrafts);
|
final CustomLimited draft = GuiChoose.one("Choose Custom Draft", myDrafts);
|
||||||
this.setupCustomDraft(draft);
|
this.setupCustomDraft(draft);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -32,6 +30,7 @@ import forge.card.IUnOpenedProduct;
|
|||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.deck.CardPool;
|
import forge.deck.CardPool;
|
||||||
import forge.gui.GuiChoose;
|
import forge.gui.GuiChoose;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.SealedProduct;
|
import forge.item.SealedProduct;
|
||||||
import forge.model.CardBlock;
|
import forge.model.CardBlock;
|
||||||
@@ -152,8 +151,9 @@ public class SealedCardPoolGenerator {
|
|||||||
|
|
||||||
// present list to user
|
// present list to user
|
||||||
if (customs.isEmpty()) {
|
if (customs.isEmpty()) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "No custom sealed files found.", "", JOptionPane.INFORMATION_MESSAGE);
|
FOptionPane.showMessageDialog("No custom sealed files found.");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
final CustomLimited draft = GuiChoose.one("Choose Custom Sealed Pool", customs);
|
final CustomLimited draft = GuiChoose.one("Choose Custom Sealed Pool", customs);
|
||||||
|
|
||||||
UnOpenedProduct toAdd = new UnOpenedProduct(draft.getSealedProductTemplate(), draft.getCardPool());
|
UnOpenedProduct toAdd = new UnOpenedProduct(draft.getSealedProductTemplate(), draft.getCardPool());
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ import java.util.EnumSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@@ -37,6 +35,7 @@ import forge.card.CardEdition;
|
|||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.gui.CardListViewer;
|
import forge.gui.CardListViewer;
|
||||||
import forge.gui.GuiChoose;
|
import forge.gui.GuiChoose;
|
||||||
|
import forge.gui.toolbox.FOptionPane;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.SealedProduct;
|
import forge.item.SealedProduct;
|
||||||
import forge.quest.io.ReadPriceList;
|
import forge.quest.io.ReadPriceList;
|
||||||
@@ -94,20 +93,19 @@ public class QuestUtilUnlockSets {
|
|||||||
CardEdition choosenEdition = toBuy.left;
|
CardEdition choosenEdition = toBuy.left;
|
||||||
|
|
||||||
if (qData.getAssets().getCredits() < price) {
|
if (qData.getAssets().getCredits() < price) {
|
||||||
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Unfortunately, you cannot afford that set yet.\n"
|
FOptionPane.showMessageDialog("Unfortunately, you cannot afford that set yet.\n"
|
||||||
+ "To unlock " + choosenEdition.getName() + ", you need " + price + " credits.\n"
|
+ "To unlock " + choosenEdition.getName() + ", you need " + price + " credits.\n"
|
||||||
+ "You have only " + qData.getAssets().getCredits() + " credits.",
|
+ "You have only " + qData.getAssets().getCredits() + " credits.",
|
||||||
"Failed to unlock " + choosenEdition.getName(),
|
"Failed to unlock " + choosenEdition.getName(),
|
||||||
JOptionPane.PLAIN_MESSAGE);
|
null);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int unlockConfirm = JOptionPane.showConfirmDialog(JOptionPane.getRootFrame(),
|
if (!FOptionPane.showConfirmDialog(
|
||||||
"Unlocking " + choosenEdition.getName() + " will cost you " + price + " credits.\n"
|
"Unlocking " + choosenEdition.getName() + " will cost you " + price + " credits.\n"
|
||||||
+ "You have " + qData.getAssets().getCredits() + " credits.\n\n"
|
+ "You have " + qData.getAssets().getCredits() + " credits.\n\n"
|
||||||
+ "Are you sure you want to unlock " + choosenEdition.getName() + "?",
|
+ "Are you sure you want to unlock " + choosenEdition.getName() + "?",
|
||||||
"Confirm Unlocking " + choosenEdition.getName(), JOptionPane.YES_NO_OPTION);
|
"Confirm Unlocking " + choosenEdition.getName())) {
|
||||||
if (unlockConfirm == JOptionPane.NO_OPTION) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return toBuy;
|
return toBuy;
|
||||||
|
|||||||
Reference in New Issue
Block a user