コード例 #1
0
ファイル: Main.java プロジェクト: joelkuiper/addis
 private XmlFormatType loadDomainFromInputStream(InputStream in) throws IOException {
   BufferedInputStream fis = new BufferedInputStream(in);
   XmlFormatType xmlType = JAXBHandler.determineXmlType(fis);
   if (!xmlType.isValid() || xmlType.isFuture()) {
     return xmlType;
   } else if (xmlType.isLegacy()) {
     d_domainMgr.loadLegacyXMLDomain(fis);
   } else {
     d_domainMgr.loadXMLDomain(fis, xmlType.getVersion());
   }
   attachDomainChangedModel();
   return xmlType;
 }
コード例 #2
0
ファイル: Main.java プロジェクト: joelkuiper/addis
 private boolean loadDomainFromXMLFile(String fileName) {
   File f = new File(fileName);
   if (f.exists() && f.isFile()) {
     try {
       FileInputStream in = new FileInputStream(f);
       d_xmlType = loadDomainFromInputStream(in);
     } catch (Exception e) {
       ErrorDialog.showDialog(
           e, "Error loading file", "Error loading data from \"" + fileName + "\"", false);
       return false;
     }
     if (!d_xmlType.isValid()) {
       JOptionPane.showMessageDialog(
           s_window,
           "The file you are attempting to load is not formatted as a valid ADDIS XML file.",
           "Error loading file",
           JOptionPane.ERROR_MESSAGE);
       return false;
     } else if (d_xmlType.isFuture()) {
       JOptionPane.showMessageDialog(
           s_window,
           "The XML file was created with a newer version of ADDIS than you are using. Please download the new version to read it.",
           "Error loading file",
           JOptionPane.ERROR_MESSAGE);
       return false;
     } else if (d_xmlType.isLegacy()) {
       askToConvertToNew(fileName);
       return true;
     } else {
       setFileNameAndReset(fileName);
       return true;
     }
   } else {
     JOptionPane.showMessageDialog(
         s_window,
         "File \"" + fileName + "\" not found.",
         "Error loading file",
         JOptionPane.ERROR_MESSAGE);
     return false;
   }
 }
コード例 #3
0
ファイル: Main.java プロジェクト: joelkuiper/addis
 private void attachDomainChangedModel() {
   d_domainChanged =
       new DomainChangedModel(getDomain(), d_xmlType != null ? d_xmlType.isPast() : false);
 }