Exemplo n.º 1
0
  private boolean confirmClose(String action, Collection modifiedLayers) {
    if (modifiedLayers.isEmpty()) {
      return true;
    }

    JOptionPane pane =
        new JOptionPane(
            StringUtil.split(
                modifiedLayers.size()
                    + " dataset"
                    + StringUtil.s(modifiedLayers.size())
                    + " "
                    + ((modifiedLayers.size() > 1) ? "have" : "has")
                    + " been modified ("
                    + ((modifiedLayers.size() > 3) ? "e.g. " : "")
                    + StringUtil.toCommaDelimitedString(
                        new ArrayList(modifiedLayers)
                            .subList(0, Math.min(3, modifiedLayers.size())))
                    + "). Continue?",
                80),
            JOptionPane.WARNING_MESSAGE);
    pane.setOptions(new String[] {action, "Cancel"});
    pane.createDialog(this, AppContext.getMessage("GeopistaName")).setVisible(true);

    return pane.getValue().equals(action);
  }
 private void fileBtnActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_fileBtnActionPerformed
   if (importar.equals("true")) {
     fileChooser = GUIUtil.createJFileChooserWithExistenceChecking();
     if (JFileChooser.APPROVE_OPTION == fileChooser.showOpenDialog(aplicacion.getMainFrame())) {
       fileTxt.setText(fileChooser.getSelectedFile().getAbsolutePath());
     } else
       JOptionPane.showMessageDialog(null, aplicacion.getI18nString("SLDStyle.SeleccionFichero"));
   } else {
     fileChooser = GUIUtil.createJFileXMLChooserWithOverwritePrompting();
     FileFilter fileFilter = new MyFileFilter(".xml", "XML");
     fileChooser.setFileFilter(fileFilter);
     fileChooser.setAcceptAllFileFilterUsed(false);
     if (JFileChooser.APPROVE_OPTION == fileChooser.showSaveDialog(aplicacion.getMainFrame())) {
       if (fileChooser.getSelectedFile().getAbsolutePath().endsWith(".xml"))
         fileTxt.setText(fileChooser.getSelectedFile().getAbsolutePath());
       else
         JOptionPane.showMessageDialog(
             null, AppContext.getMessage("SLDStyle.SeleccionFicheroXML"));
     } else
       JOptionPane.showMessageDialog(null, aplicacion.getI18nString("SLDStyle.SeleccionFichero"));
   }
 } // GEN-LAST:event_fileBtnActionPerformed