Ejemplo n.º 1
0
 private void generateRandomName(
     final String gender,
     final String type,
     final List<String> usedNames,
     final String title,
     final Callback<String> callback) {
   final String newName = NameGenerator.getRandomName(gender, type, usedNames);
   String confirmMsg = "Would you like to use the name \"" + newName + "\", or try again?";
   FOptionPane.showConfirmDialog(
       confirmMsg,
       title,
       "Use this name",
       "Try again",
       true,
       new Callback<Boolean>() {
         @Override
         public void run(Boolean result) {
           if (result) {
             callback.run(newName);
           } else {
             generateRandomName(gender, type, usedNames, title, callback);
           }
         }
       });
 }
 private void resetWorkshopLayout() {
   final String userPrompt =
       "This will reset the Workshop screen layout.\n"
           + "All tabbed views will be restored to their default positions.\n\n"
           + "Reset layout?";
   if (FOptionPane.showConfirmDialog(userPrompt, "Reset Workshop Layout")) {
     if (FScreen.WORKSHOP_SCREEN.deleteLayoutFile()) {
       FOptionPane.showMessageDialog("Workshop layout has been reset.");
     }
   }
 }
 private void resetDeckEditorLayout() {
   final String userPrompt =
       "This will reset the Deck Editor screen layout.\n"
           + "All tabbed views will be restored to their default positions.\n\n"
           + "Reset layout?";
   if (FOptionPane.showConfirmDialog(userPrompt, "Reset Deck Editor Layout")) {
     if (FScreen.DECK_EDITOR_CONSTRUCTED.deleteLayoutFile()) {
       FOptionPane.showMessageDialog("Deck Editor layout has been reset.");
     }
   }
 }
 private void resetMatchScreenLayout() {
   final String userPrompt =
       "This will reset the layout of the Match screen.\n"
           + "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?";
   if (FOptionPane.showConfirmDialog(userPrompt, "Reset Match Screen Layout")) {
     if (FScreen.deleteMatchLayoutFile()) {
       FOptionPane.showMessageDialog("Match Screen layout has been reset.");
     }
   }
 }
 private void resetForgeSettingsToDefault() {
   final String userPrompt =
       "This will reset all preferences to their defaults and restart Forge.\n\n"
           + "Reset and restart Forge?";
   if (FOptionPane.showConfirmDialog(userPrompt, "Reset Settings")) {
     final ForgePreferences prefs = FModel.getPreferences();
     prefs.reset();
     prefs.save();
     update();
     Singletons.getControl().restartForge();
   }
 }
Ejemplo n.º 6
0
 public boolean canExitForge(final boolean forRestart) {
   final String action = (forRestart ? "Restart" : "Exit");
   String userPrompt = "Are you sure you wish to " + (forRestart ? "restart" : "exit") + " Forge?";
   final boolean hasCurrentMatches = hasCurrentMatches();
   if (hasCurrentMatches) {
     userPrompt = "One or more games are currently active. " + userPrompt;
   }
   if (!FOptionPane.showConfirmDialog(
       userPrompt,
       action + " Forge",
       action,
       "Cancel",
       !hasCurrentMatches)) { // default Yes if no game active
     return false;
   }
   if (!CDeckEditorUI.SINGLETON_INSTANCE.canSwitchAway(true)) {
     return false;
   }
   return true;
 }