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