Exemplo n.º 1
0
 public void secureAnalysis() {
   int rw = tblItems.getSelectedRow();
   if (rw != -1) {
     int idx = tblItems.convertRowIndexToModel(rw);
     String desc = store.describe(idx);
     if (JOptionPane.showConfirmDialog(frm, desc, "Details", JOptionPane.OK_CANCEL_OPTION)
         == JOptionPane.CANCEL_OPTION) return;
   }
   if (JOptionPane.showConfirmDialog(frm, store.tagDesc(), "Tags", JOptionPane.OK_CANCEL_OPTION)
       == JOptionPane.CANCEL_OPTION) return;
   if (JOptionPane.showConfirmDialog(
           frm, store.storeDesc(), "Storage", JOptionPane.OK_CANCEL_OPTION)
       == JOptionPane.CANCEL_OPTION) return;
 }
  /**
   * Queries the user as to whether they would like to save their sessions.
   *
   * @return true if the transaction was ended successfully, false if not (that is, canceled).
   */
  public boolean closeAllSessions() {
    while (existsSession()) {
      SessionEditor sessionEditor = getFrontmostSessionEditor();
      SessionEditorWorkbench workbench = sessionEditor.getSessionWorkbench();
      SessionWrapper wrapper = workbench.getSessionWrapper();

      if (!wrapper.isSessionChanged()) {
        closeFrontmostSession();
        continue;
      }

      String name = sessionEditor.getName();

      int ret =
          JOptionPane.showConfirmDialog(
              JOptionUtils.centeringComp(),
              "Would you like to save the changes you made to " + name + "?",
              "Advise needed...",
              JOptionPane.YES_NO_CANCEL_OPTION);

      if (ret == JOptionPane.NO_OPTION) {
        closeFrontmostSession();
        continue;
      } else if (ret == JOptionPane.CANCEL_OPTION) {
        return false;
      }

      SaveSessionAsAction action = new SaveSessionAsAction();
      action.actionPerformed(
          new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Dummy close action"));

      if (!action.isSaved()) {
        int ret2 =
            JOptionPane.showConfirmDialog(
                JOptionUtils.centeringComp(),
                "This session was not saved. Close session and continue anyway?",
                "Advise needed...",
                JOptionPane.OK_CANCEL_OPTION);

        if (ret2 == JOptionPane.CANCEL_OPTION) {
          return false;
        }
      }

      closeFrontmostSession();
    }

    return true;
  }
Exemplo n.º 3
0
  public void play(int lv) {
    jl.setText("Level " + level);
    Game game = new Game(lv); // An object representing the game
    View view = new View(game); // An object representing the view of the game
    game.newGame();
    view.print();
    gameBoardPanel = view.mainPanel;
    ButtonPanel buttonPanel = new ButtonPanel(game);
    container.add(buttonPanel, BorderLayout.EAST);
    container.add(gameBoardPanel, BorderLayout.WEST);
    mainFrame.pack();

    // Main game loop
    while (true) {

      view.print();
      gameBoardPanel = view.mainPanel;

      // Win/lose conditions
      if (game.isWin()) {
        view.print();
        gameBoardPanel = view.mainPanel;
        int choice;
        choice = JOptionPane.showConfirmDialog(null, "You win!", "", JOptionPane.OK_OPTION);
        if (choice == JOptionPane.OK_OPTION) {
          level++;
          mainFrame.remove(buttonPanel);
          mainFrame.remove(gameBoardPanel);
          play(level);
        }
      }
      if (game.isLose()) {
        view.print();
        gameBoardPanel = view.mainPanel;
        int choice;
        choice =
            JOptionPane.showConfirmDialog(
                null, "You lose!", "Would you like to play again?", JOptionPane.YES_NO_OPTION);
        if (choice == JOptionPane.YES_OPTION) {
          level = 1;
          mainFrame.remove(buttonPanel);
          mainFrame.remove(gameBoardPanel);
          play(level);
        } else {
          System.exit(0);
        }
      }
    }
  }
 private boolean readyToClose() {
   File f;
   if (newFile.isSelected()) {
     if (newNameTf.getText().isEmpty()) {
       if (tableModel.getRowCount() > 0) {
         JOptionPane.showMessageDialog(
             this,
             Localization.lang("You must choose a filename to store journal abbreviations"),
             Localization.lang("Store journal abbreviations"),
             JOptionPane.ERROR_MESSAGE);
         return false;
       } else {
         return true;
       }
     } else {
       f = new File(newNameTf.getText());
       return !f.exists()
           || (JOptionPane.showConfirmDialog(
                   this,
                   Localization.lang("'%0' exists. Overwrite file?", f.getName()),
                   Localization.lang("Store journal abbreviations"),
                   JOptionPane.OK_CANCEL_OPTION)
               == JOptionPane.OK_OPTION);
     }
   }
   return true;
 }
Exemplo n.º 5
0
  private boolean checkForSave() {
    // build warning message
    String message;
    if (file == null) {
      message = "File has been modified.  Save changes?";
    } else {
      message = "File \"" + file.getName() + "\" has been modified.  Save changes?";
    }

    // show confirm dialog
    int r =
        JOptionPane.showConfirmDialog(
            this,
            new JLabel(message),
            "Warning!",
            JOptionPane.YES_NO_CANCEL_OPTION,
            JOptionPane.WARNING_MESSAGE);

    if (r == JOptionPane.YES_OPTION) {
      // Save File
      if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
        // write the file
        physWriteTextFile(fileChooser.getSelectedFile(), textView.getText());
      } else {
        // user cancelled save after all
        return false;
      }
    }
    return r != JOptionPane.CANCEL_OPTION;
  }
Exemplo n.º 6
0
  // Set the buttons displayed in the panel
  // textFilePath - The path to the sound effect definition file
  // Returns 0 (an error occurred and a new project was opened), 1 (an error occurred), 2 (the
  // project opened normally)
  public int loadFile(String textFilePath) {
    clearBoard();

    // Get the sounds contained in the given project file
    ArrayList<SoundInfo> readSounds = soundManager.readFile(textFilePath);

    // Add buttons to the interface for each sound in the file
    for (int s = 0; s < readSounds.size(); s++) {
      SoundInfo curr = readSounds.get(s);
      if (checkValidKey(curr.getKeyName())) {
        addSound(readSounds.get(s));
      } else {
        soundManager.deleteSound(curr.getKeyCode());
      }
    }

    // Report if an error occurred while opening the project
    // Allow the user to close the project without proceeding
    if (soundManager.getProjectModified()) {
      int choice =
          JOptionPane.showConfirmDialog(
              frame,
              "One or more errors were encountered while reading the project file. "
                  + "The file may be missing, not well-formatted, or not a Cue Masher project file. Do you want to proceed?",
              "Keep Project Open?",
              JOptionPane.YES_NO_OPTION);
      if (choice == JOptionPane.NO_OPTION) {
        openNewProject();
        return 0;
      }
      return 1;
    }
    return 2;
  }
Exemplo n.º 7
0
 @Override
 public void actionPerformed(ActionEvent e) {
   CompanionSupportFacade support = character.getCompanionSupport();
   if (REMOVE_COMMAND.equals(e.getActionCommand())) {
     CompanionFacade companion = (CompanionFacade) selectedElement;
     int ret =
         JOptionPane.showConfirmDialog(
             button,
             LanguageBundle.getFormattedString(
                 "in_companionConfirmRemovalMsg",
                 companion //$NON-NLS-1$
                     .getNameRef()
                     .getReference()),
             LanguageBundle.getString("in_companionConfirmRemoval"), // $NON-NLS-1$
             JOptionPane.YES_NO_OPTION);
     if (ret == JOptionPane.YES_OPTION) {
       support.removeCompanion(companion);
     }
   }
   if (CREATE_COMMAND.equals(e.getActionCommand())) {
     initDialog();
     String type = (String) selectedElement;
     companionDialog.setCharacter(character);
     companionDialog.setCompanionType(type);
     Utility.setDialogRelativeLocation(CompanionInfoTab.this, companionDialog);
     companionDialog.setVisible(true);
     CharacterFacade comp = companionDialog.getNewCompanion();
     if (comp != null) {
       selectCompanion(comp);
     }
   }
   cancelCellEditing();
 }
    @Override
    public void actionPerformed(ActionEvent e) {
      if (e.getSource() == add) {
        // int sel = userTable.getSelectedRow();
        // if (sel < 0)
        //    sel = 0;

        nameTf.setText("");
        abbrTf.setText("");
        if (JOptionPane.showConfirmDialog(
                dialog,
                journalEditPanel,
                Localization.lang("Edit journal"),
                JOptionPane.OK_CANCEL_OPTION)
            == JOptionPane.OK_OPTION) {
          journals.add(new JournalEntry(nameTf.getText(), abbrTf.getText()));
          // setValueAt(nameTf.getText(), sel, 0);
          // setValueAt(abbrTf.getText(), sel, 1);
          Collections.sort(journals);
          fireTableDataChanged();
        }
      } else if (e.getSource() == remove) {
        int[] rows = userTable.getSelectedRows();
        if (rows.length > 0) {
          for (int i = rows.length - 1; i >= 0; i--) {
            journals.remove(rows[i]);
          }
          fireTableDataChanged();
        }
      }
    }
Exemplo n.º 9
0
 public void secureDelete() {
   int rw = tblItems.getSelectedRow();
   if (rw == -1) {
     JOptionPane.showMessageDialog(frm, "No item selected", "Error", JOptionPane.ERROR_MESSAGE);
     return;
   }
   int idx = tblItems.convertRowIndexToModel(rw);
   if (JOptionPane.showConfirmDialog(
           frm,
           "Delete " + store.plainName(idx) + "?",
           "Confirm Delete",
           JOptionPane.YES_NO_OPTION)
       != JOptionPane.YES_OPTION) return;
   File del = store.delete(idx);
   store.fireTableDataChanged();
   if (del != null) {
     if (del.delete()) {
       // successful
       needsSave = true;
     } else {
       System.err.println("Delete " + del.getAbsolutePath() + " failed");
     }
   }
   updateStatus();
 }
Exemplo n.º 10
0
  public static void preferences() {
    if (pref == null) {
      JFrame parent = null;
      if (window.isVisible()) {
        parent = window;
      }
      PrefPanel panel;
      if (prefclass == null) {
        panel = new PrefPanel();
      } else {
        panel = (PrefPanel) newInstance(prefclass);
      }
      panel.setParentFrame(parent);
      int result =
          JOptionPane.showConfirmDialog(
              parent,
              panel,
              "Preferences",
              JOptionPane.OK_CANCEL_OPTION,
              JOptionPane.PLAIN_MESSAGE,
              new ImageIcon());
      if (result == JOptionPane.OK_OPTION) {
        panel.savePreferences();
      } else {

      }
    } else {
      pref.setVisible(true);
    }
  }
Exemplo n.º 11
0
  /** Invoked when removing selected reading list is required. */
  private void onRemoveReadingList() {
    int[] rows = tblReadingLists.getSelectedRows();
    boolean haveFeeds = false;
    for (int i = 0; !haveFeeds && i < rows.length; i++) {
      int row = rows[i];
      haveFeeds = readingListsModel.getLists()[row].getFeeds().length > 0;
    }

    boolean delete = true;
    if (haveFeeds) {
      String msg =
          rows.length == 1
              ? Strings.message("guide.dialog.readinglists.has.feeds")
              : Strings.message("guide.dialog.readinglists.have.feeds");

      delete =
          JOptionPane.showConfirmDialog(
                  this,
                  msg,
                  Strings.message("guide.dialog.delete.readinglist"),
                  JOptionPane.YES_NO_OPTION)
              == JOptionPane.YES_OPTION;
    }

    if (delete) readingListsModel.removeRows(rows);
  }
Exemplo n.º 12
0
  public void onRemovePressed(final ContributedLibrary lib) {
    boolean managedByIndex = indexer.getIndex().getLibraries().contains(lib);

    if (!managedByIndex) {
      int chosenOption = JOptionPane.showConfirmDialog(this, _("This library is not listed on Library Manager. You won't be able to resinstall it from here.\nAre you sure you want to delete it?"), _("Please confirm library deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
      if (chosenOption != JOptionPane.YES_OPTION) {
        return;
      }
    }

    clearErrorMessage();
    installerThread = new Thread(new Runnable() {
      @Override
      public void run() {
        try {
          setProgressVisible(true, _("Removing..."));
          installer.remove(lib);
          onIndexesUpdated(); // TODO: Do a better job in refreshing only the needed element
          //getContribModel().updateLibrary(lib);
        } catch (Exception e) {
          throw new RuntimeException(e);
        } finally {
          setProgressVisible(false, "");
        }
      }
    });
    installerThread.setUncaughtExceptionHandler(new InstallerJDialogUncaughtExceptionHandler(this, noConnectionErrorMessage));
    installerThread.start();
  }
Exemplo n.º 13
0
 public void actionPerformed(ActionEvent event) {
   if (typePanel.getSelection().equals("Confirm"))
     JOptionPane.showConfirmDialog(
         OptionDialogFrame.this,
         getMessage(),
         "Title",
         getType(optionTypePanel),
         getType(messageTypePanel));
   else if (typePanel.getSelection().equals("Input")) {
     if (inputPanel.getSelection().equals("Text field"))
       JOptionPane.showInputDialog(
           OptionDialogFrame.this, getMessage(), "Title", getType(messageTypePanel));
     else
       JOptionPane.showInputDialog(
           OptionDialogFrame.this,
           getMessage(),
           "Title",
           getType(messageTypePanel),
           null,
           new String[] {"Yellow", "Blue", "Red"},
           "Blue");
   } else if (typePanel.getSelection().equals("Message"))
     JOptionPane.showMessageDialog(
         OptionDialogFrame.this, getMessage(), "Title", getType(messageTypePanel));
   else if (typePanel.getSelection().equals("Option"))
     JOptionPane.showOptionDialog(
         OptionDialogFrame.this,
         getMessage(),
         "Title",
         getType(optionTypePanel),
         getType(messageTypePanel),
         null,
         getOptions(),
         getOptions()[0]);
 }
Exemplo n.º 14
0
  private void typeDeletion(String name) {
    BibtexEntryType type = BibtexEntryType.getType(name);

    if (type instanceof CustomEntryType) {
      if (BibtexEntryType.getStandardType(name) == null) {
        int reply =
            JOptionPane.showConfirmDialog(
                frame,
                Globals.lang(
                    "All entries of this " + "type will be declared " + "typeless. Continue?"),
                Globals.lang("Delete custom format") + " '" + StringUtil.nCase(name) + '\'',
                JOptionPane.YES_NO_OPTION,
                JOptionPane.WARNING_MESSAGE);
        if (reply != JOptionPane.YES_OPTION) {
          return;
        }
      }
      BibtexEntryType.removeType(name);
      updateTypesForEntries(StringUtil.nCase(name));
      changed.remove(name);
      reqLists.remove(name);
      optLists.remove(name);
      if (biblatexMode) {
        opt2Lists.remove(name);
      }
    }
    // messageLabel.setText("'"+type.getName()+"' "+
    //        Globals.lang("is a standard type."));

  }
 private void btnSalirActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnSalirActionPerformed
   int respuesta = JOptionPane.showConfirmDialog(null, "¿Confirma que desea salir?");
   if (respuesta == 0) {
     dispose();
   }
 } // GEN-LAST:event_btnSalirActionPerformed
Exemplo n.º 16
0
    public void actionPerformed(java.awt.event.ActionEvent arg0) {
      if (JTable1.getSelectedRowCount() != 1) {
        Utilities.errorMessage(resourceBundle.getString("Please select a view to delete"));
        return;
      }

      if (JOptionPane.showConfirmDialog(
              null,
              resourceBundle.getString("Are you sure you want to delete the selected view "),
              resourceBundle.getString("Warning!"),
              JOptionPane.YES_NO_OPTION,
              JOptionPane.WARNING_MESSAGE,
              null)
          == JOptionPane.NO_OPTION) return;

      Vector viewvec = model.getAllViews();
      for (int i = 0; i < viewvec.size(); i++) {
        String viewname = ((AuthViewWithOperations) viewvec.elementAt(i)).getAuthorizedViewName();
        if (JTable1.getValueAt(JTable1.getSelectedRow(), 0).toString().equals(viewname)) {
          AuthViewWithOperations avop = (AuthViewWithOperations) viewvec.elementAt(i);

          model.delViewOp(
              avop.getAuthorizedViewName(), avop.getViewProperties(), avop.getOperations());
        }
      }

      disableButtons();
    }
Exemplo n.º 17
0
 public void actionPerformed(ActionEvent e) {
   int selection =
       JOptionPane.showConfirmDialog(
           OpenMapCFrame.this, "Would you like to exit this application?");
   if (selection == JOptionPane.OK_OPTION) {
     System.exit(0);
   }
 }
Exemplo n.º 18
0
 public boolean edtImport(File fi, String date, String tags) {
   if (!fi.exists()) {
     System.err.println("import: file " + fi.getAbsolutePath() + " doesnt exist");
     return false;
   }
   String pname = fi.getName();
   if (store.containsEntry(pname)) {
     System.err.println("import: already have a file named " + pname);
     return false;
   }
   long size = fi.length() / KILOBYTE;
   File save = sec.encryptMainFile(fi, storeLocs.get(0), true);
   if (save == null) {
     System.err.println("import: Encryption failure");
     return false;
   }
   if (checkImports) {
     boolean success = true;
     File checkfi = new File(idx + ".check");
     File checkOut = sec.encryptSpecialFile(save, checkfi, false);
     if (checkOut == null) success = false;
     else {
       String fiHash = sec.digest(fi);
       String outHash = sec.digest(checkOut);
       if (fiHash == null || outHash == null || fiHash.length() < 1 || !fiHash.equals(outHash))
         success = false;
     }
     checkfi.delete();
     if (!success) {
       save.delete();
       if (JOptionPane.showConfirmDialog(
               frm,
               "Confirming "
                   + fi.getName()
                   + "failed\n\n - Would you like to re-import the file?",
               "Import failed",
               JOptionPane.YES_NO_OPTION)
           == JOptionPane.YES_OPTION) {
         String j = impJob(fi, date, tags);
         synchronized (jobs) {
           if (priorityExport) jobs.addLast(j);
           else jobs.addFirst(j);
         }
       }
       return false;
     }
   }
   if (!fi.delete()) {
     System.err.println("import: Couldnt delete old file - continuing");
   }
   store.add(save.getName(), pname, date, size, tags, 0);
   needsSave = true;
   return true;
 }
Exemplo n.º 19
0
 protected void onOptions() {
   if (JOptionPane.showConfirmDialog(
           new JFrame(),
           "This will reset any current games. Continue?",
           "Options Change",
           JOptionPane.YES_NO_OPTION)
       == JOptionPane.YES_OPTION) {
     _optionsDialog = new OptionsDialog(this);
     _optionsDialog.setVisible(true);
   }
 }
    @Override
    public void actionPerformed(ActionEvent e) {
      if (fc == null) {
        fc = new IDEFileChooser();
        fc.setFileView(new IDEFileView());
        fc.setAcceptAllFileFilterUsed(false);
        fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fc.setMultiSelectionEnabled(false);
        fc.setDialogTitle(
            messagesBundle.getString("ImageViewerPanelSaveAction.Choose_filename_to_save_4"));

        //$NON-NLS-1$

        // prepare file filters
        IIORegistry theRegistry = IIORegistry.getDefaultInstance();
        Iterator it = theRegistry.getServiceProviders(ImageWriterSpi.class, false);
        while (it.hasNext()) {
          ImageWriterSpi writer = (ImageWriterSpi) it.next();
          if ((imageType == BufferedImage.TYPE_INT_ARGB
                  || imageType == BufferedImage.TYPE_INT_ARGB_PRE)
              && "JPEG".equals(writer.getFormatNames()[0].toUpperCase())) continue;
          ImageWriterSpiFileFilter ff = new ImageWriterSpiFileFilter(writer);
          fc.addChoosableFileFilter(ff);
        }
      }

      if (fc.showSaveDialog(viewerPanel) == JFileChooser.APPROVE_OPTION) {
        File selectedFile = fc.getSelectedFile();

        if (selectedFile != null) {
          String fileName = selectedFile.getAbsolutePath();
          ImageWriterSpiFileFilter ff = (ImageWriterSpiFileFilter) fc.getFileFilter();
          if (!ff.hasCorrectSuffix(fileName)) fileName = ff.addSuffix(fileName);
          selectedFile = new File(fileName);
          if (selectedFile.exists()) {
            String message =
                MessageFormat.format(
                    messagesBundle.getString("ImageViewerPanelSaveAction.Overwrite_question_5"),
                    //$NON-NLS-1$
                    fileName);
            if (JOptionPane.NO_OPTION
                == JOptionPane.showConfirmDialog(
                    viewerPanel,
                    message,
                    messagesBundle.getString("ImageViewerPanelSaveAction.Warning_6"),
                    //$NON-NLS-1$
                    JOptionPane.YES_NO_OPTION,
                    JOptionPane.WARNING_MESSAGE)) return;
          }
          writeToFile(selectedFile, ff);
        }
      }
    }
Exemplo n.º 21
0
  /**
   * Use a JFileChooser in Save mode to select files to open. Use a filter for FileFilter subclass
   * to select for "*.java" files. If a file is selected, then this file will be used as final
   * output
   */
  boolean saveFile() {
    File file = null;
    JFileChooser fc = new JFileChooser();

    // Start in current directory
    fc.setCurrentDirectory(new File("."));

    // Set filter for Java source files.
    fc.setFileFilter(fJavaFilter);

    // Set to a default name for save.
    fc.setSelectedFile(fFile);

    // Open chooser dialog
    int result = fc.showSaveDialog(this);

    if (result == JFileChooser.CANCEL_OPTION) {
      return true;
    } else if (result == JFileChooser.APPROVE_OPTION) {
      fFile = fc.getSelectedFile();
      String textFile = fFile.toString();
      if (fileNo.equalsIgnoreCase("SAVE")) {
        UpLoadFile.outputfile.setText(textFile);
      } else if (fileNo.equalsIgnoreCase("SAVE2")) {
        UpLoadMAGEMLFile.outputfile1.setText(textFile);
      } else if (fileNo.equalsIgnoreCase("SAVE3")) {
        UpLoadMAGEMLFile.outputfile2.setText(textFile);
      } else if (fileNo.equalsIgnoreCase("SAVEJPAG")) {
        JPEGFileName = textFile;
        // System.out.println ("JPG filename OpenFileDir= " +JPEGFileName);
        File fFile = new File(JPEGFileName);
        if (fFile.exists()) {
          int response =
              JOptionPane.showConfirmDialog(
                  null,
                  "Overwrite existing file " + JPEGFileName + " ??",
                  "Confirm Overwrite",
                  JOptionPane.OK_CANCEL_OPTION,
                  JOptionPane.QUESTION_MESSAGE);
          if (response == JOptionPane.CANCEL_OPTION) {
            /* go back to reload the file*/
            return false;
          }
        }
        SetUpPlotWindow.saveComponentAsJPEG(SetUpPlotWindow.content, JPEGFileName);
      }
      return true;

    } else {
      return false;
    }
  } // saveFile
Exemplo n.º 22
0
 public void actionPerformed(ActionEvent event) {
   if (event.getSource() == okButton) {
     this.setVisible(false);
   } else if (event.getSource() == rightArrow) {
     try {
       araucaria
           .getArgument()
           .addOwnersToSelected(araucaria, ownerSourceTableModel.getSelectedOwners());
       ownerNodesTableModel.updateTable(araucaria.getArgument().getSelectedVertexOwners());
       araucaria.undoStack.push(new EditAction(araucaria, "adding owners"));
     } catch (Exception ex) {
       return;
     }
   } else if (event.getSource() == leftArrow) {
     // Delete owners only from selected vertices
     araucaria.getArgument().deleteOwners(ownerNodesTableModel.getSelectedOwners(), true);
     ownerNodesTableModel.updateTable(araucaria.getArgument().getSelectedVertexOwners());
     araucaria.undoStack.push(new EditAction(araucaria, "removing owners"));
   } else if (event.getSource() == addOwnerButton) {
     String newOwnerName = ownerText.getText();
     if (newOwnerName.length() == 0) {
       return;
     }
     ownerSourceTableModel.addOwner(newOwnerName);
     ownerText.setText("");
     ownerText.requestFocus();
   } else if (event.getSource() == deleteSourceButton) {
     Vector selected = null;
     try {
       selected = ownerSourceTableModel.getSelectedOwners();
     } catch (Exception ex) {
       return;
     }
     if (selected == null || selected.size() == 0) return;
     int action =
         JOptionPane.showConfirmDialog(
             this,
             "<html><center><font color=red face=helvetica><b>Delete selected owners?</b></font></center></html>",
             "Delete owners?",
             JOptionPane.YES_NO_OPTION,
             JOptionPane.WARNING_MESSAGE,
             null);
     if (action == 1) return;
     araucaria.getArgument().deleteOwners(selected);
     // Delete owners from ALL vertices
     araucaria.getArgument().deleteOwners(selected, false);
     ownerSourceTableModel.updateTable(araucaria.getArgument().getOwnerList());
     ownerNodesTableModel.updateTable(araucaria.getArgument().getSelectedVertexOwners());
   }
 }
Exemplo n.º 23
0
 private void btnEliminarRenglonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnEliminarRenglonActionPerformed
   // TODO add your handling code here:
   int IDRenglon = this.tablaPrincipal.getSelectedRow();
   if (IDRenglon != -1) {
     if (JOptionPane.showConfirmDialog(
             null,
             "¿Realmente desea eliminar el renglón seleccionado?",
             "¿Eliminar?",
             JOptionPane.OK_CANCEL_OPTION)
         == JOptionPane.OK_OPTION) {
       ((DefaultTableModel) tablaPrincipal.getModel()).removeRow(IDRenglon);
     }
   }
 } // GEN-LAST:event_btnEliminarRenglonActionPerformed
Exemplo n.º 24
0
 private void doCancel() {
   if (isRunning.get()) {
     int result =
         JOptionPane.showConfirmDialog(
             myFrame,
             "The patch has not been applied yet.\nAre you sure you want to abort the operation?",
             TITLE,
             JOptionPane.YES_NO_OPTION);
     if (result == JOptionPane.YES_OPTION) {
       isCancelled.set(true);
       myCancelButton.setEnabled(false);
     }
   } else {
     exit();
   }
 }
Exemplo n.º 25
0
  public void askSampleDataIfNoRacersExist(JPanel panel) {
    if (Race.getInstance().getRacers().size() == 0) {
      int n =
          JOptionPane.showConfirmDialog(
              panel,
              "No Course or Racers Exist, would you like to load a sample race ?",
              "Load Sample Data",
              JOptionPane.YES_NO_OPTION,
              JOptionPane.YES_OPTION,
              Race.getInstance().getSlalomCourseSmall());

      if (n == 0) {
        new TestData().load();
      }
    }
  }
Exemplo n.º 26
0
  private void clearConfigForSelectedCharacters() {
    int confirmation =
        JOptionPane.showConfirmDialog(
            panel,
            "WARNING:  this will erase the current configuration for all selected characters. \nAre you certain you wish to do this?",
            "Clear Selected Configurations?",
            JOptionPane.YES_NO_OPTION);

    if (confirmation == JOptionPane.YES_OPTION) {
      for (Object character : herolabsCharacterList.getSelectedValues()) {
        config.remove(((Character) character).getName());
      }
    }

    herolabsCharacterList.repaint();
  }
Exemplo n.º 27
0
  private void resetToDefaultsForSelectedCharacters() {
    int confirmation =
        JOptionPane.showConfirmDialog(
            panel,
            "NOTE:  this will attempt to replace any custom configuration for the selected characters with the Portfolio defaults. \nAre you certain you wish to do this?",
            "Reset to portfolio defaults?",
            JOptionPane.YES_NO_OPTION);

    if (confirmation == JOptionPane.YES_OPTION) {
      for (Object character : herolabsCharacterList.getSelectedValues()) {
        config.populateCharacterWithDefaults(((Character) character).getName(), true);
      }
    }

    herolabsCharacterList.repaint();
  }
Exemplo n.º 28
0
 public void secureMove() {
   int rw = tblItems.getSelectedRow();
   if (rw == -1) {
     JOptionPane.showMessageDialog(frm, "No item selected", "Error", JOptionPane.ERROR_MESSAGE);
     return;
   }
   int idx = tblItems.convertRowIndexToModel(rw);
   String[] opts = new String[storeLocs.size()];
   for (int i = 0; i < opts.length; i++) opts[i] = storeLocs.get(i).getAbsolutePath();
   JComboBox cmbMove = new JComboBox(opts);
   cmbMove.setSelectedIndex(store.curStore(idx));
   if (JOptionPane.showConfirmDialog(frm, cmbMove, "Move item", JOptionPane.OK_CANCEL_OPTION)
       != JOptionPane.OK_OPTION) return;
   File newLoc = store.move(idx, cmbMove.getSelectedIndex());
   if (newLoc == null) System.err.println("move " + store.plainName(idx) + " unsuccessful");
   else needsSave = true;
 }
Exemplo n.º 29
0
  private boolean checkReferencedRastersIncluded() {
    final Set<String> notIncludedNames = new TreeSet<String>();
    final List<String> includedNodeNames = Arrays.asList(productSubsetDef.getNodeNames());
    for (final String nodeName : includedNodeNames) {
      final RasterDataNode rasterDataNode = product.getRasterDataNode(nodeName);
      if (rasterDataNode != null) {
        collectNotIncludedReferences(rasterDataNode, notIncludedNames);
      }
    }

    boolean ok = true;
    if (!notIncludedNames.isEmpty()) {
      StringBuilder nameListText = new StringBuilder();
      for (String notIncludedName : notIncludedNames) {
        nameListText.append("  '").append(notIncludedName).append("'\n");
      }

      final String pattern =
          "The following dataset(s) are referenced but not included\n"
              + "in your current subset definition:\n"
              + "{0}\n"
              + "If you do not include these dataset(s) into your selection,\n"
              + "you might get unexpected results while working with the\n"
              + "resulting product.\n\n"
              + "Do you wish to include the referenced dataset(s) into your\n"
              + "subset definition?\n"; /*I18N*/
      final MessageFormat format = new MessageFormat(pattern);
      int status =
          JOptionPane.showConfirmDialog(
              getJDialog(),
              format.format(new Object[] {nameListText.toString()}),
              "Incomplete Subset Definition", /*I18N*/
              JOptionPane.YES_NO_CANCEL_OPTION);
      if (status == JOptionPane.YES_OPTION) {
        final String[] nodenames = notIncludedNames.toArray(new String[notIncludedNames.size()]);
        productSubsetDef.addNodeNames(nodenames);
        ok = true;
      } else if (status == JOptionPane.NO_OPTION) {
        ok = true;
      } else if (status == JOptionPane.CANCEL_OPTION) {
        ok = false;
      }
    }
    return ok;
  }
Exemplo n.º 30
0
  boolean maybeSave() {
    if (tournament.isDirty()) {

      int rv =
          JOptionPane.showConfirmDialog(
              this,
              strings.getString("main.save_query"),
              PRODUCT_NAME,
              JOptionPane.YES_NO_CANCEL_OPTION,
              JOptionPane.WARNING_MESSAGE);
      if (rv == JOptionPane.CANCEL_OPTION) return false;

      if (rv == JOptionPane.YES_OPTION) {
        return onSaveFileClicked();
      }
    }
    return true;
  }