Project

General

Profile

« Previous | Next » 

Revision 2187

Improve handling of default values.
Call fileNew() if no default Harvest List file is specified.
Improve documentation for default properties.

View differences:

HarvestListEditor.java
82 82
  String clipboardScope = "";
83 83
	JButton copyButton;
84 84
	JButton cutButton;
85
  String defaultDocumentType;
86
  String defaultDocumentURL;
87
  String defaultHarvestList;
88
  String defaultIdentifier;
89
  String defaultRevision;
90
  String defaultScope;
85
  String defaultDocumentType = "eml://ecoinformatics.org/eml-2.0.0";
86
  String defaultDocumentURL = "http://";
87
  String defaultHarvestList = "";
88
  String defaultIdentifier = "1";
89
  String defaultRevision = "1";
90
  String defaultScope = "dataset";
91 91
	Document doc;
92 92
	JScrollPane docPane;
93 93
  JFileChooser fileChooser = new JFileChooser();
......
310 310
        }        
311 311
      }
312 312
    }
313
    else {
314
      fileNew();
315
    }
313 316

  
314 317
    try {    
315 318
      tempFile = File.createTempFile("harvestListTemp", ".xml");
......
726 729

  
727 730
    properties = new Properties();
728 731

  
729
    try {
730
      properties.load(new FileInputStream(propertiesFile));
731
      defaultHarvestList = properties.getProperty("defaultHarvestList");
732
      defaultDocumentType = properties.getProperty("defaultDocumentType");
733
      defaultDocumentURL = properties.getProperty("defaultDocumentURL");
734
      defaultIdentifier = properties.getProperty("defaultIdentifier");
735
      defaultRevision = properties.getProperty("defaultRevision");
736
      defaultScope = properties.getProperty("defaultScope");    
732
    if (propertiesFile.exists()) {
733
      try {
734
        properties.load(new FileInputStream(propertiesFile));
735
        defaultHarvestList = properties.getProperty("defaultHarvestList");
736
        defaultDocumentType = properties.getProperty("defaultDocumentType");
737
        defaultDocumentURL = properties.getProperty("defaultDocumentURL");
738
        defaultIdentifier = properties.getProperty("defaultIdentifier");
739
        defaultRevision = properties.getProperty("defaultRevision");
740
        defaultScope = properties.getProperty("defaultScope");    
741
      }
742
      catch (IOException ioe) {
743
        System.out.println("Error loading properties file: " + ioe.getMessage());
744
      }  
737 745
    }
738
    catch (IOException ioe) {
739
      System.out.println("Error loading properties file: " + ioe.getMessage());
740
    }    
741 746
  }
742 747
  
743 748

  

Also available in: Unified diff