diff --git a/src/main/java/META-INF/sun-jaxb.episode b/src/main/java/META-INF/sun-jaxb.episode
index 5ed18a523..0f291171f 100644
--- a/src/main/java/META-INF/sun-jaxb.episode
+++ b/src/main/java/META-INF/sun-jaxb.episode
@@ -5,7 +5,7 @@
Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 generiert
Siehe http://java.sun.com/xml/jaxb
Ă„nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
-Generiert: 2018.03.15 um 12:09:09 AM CET
+Generiert: 2018.03.15 um 01:12:01 AM CET
-->
diff --git a/src/main/java/de/unihalle/informatik/rhizoTrak/addon/RhizoIO.java b/src/main/java/de/unihalle/informatik/rhizoTrak/addon/RhizoIO.java
index cf6346f44..535ba0ef0 100644
--- a/src/main/java/de/unihalle/informatik/rhizoTrak/addon/RhizoIO.java
+++ b/src/main/java/de/unihalle/informatik/rhizoTrak/addon/RhizoIO.java
@@ -20,10 +20,10 @@
import de.unihalle.informatik.rhizoTrak.Project;
import de.unihalle.informatik.rhizoTrak.xsd.config.Config;
import de.unihalle.informatik.rhizoTrak.xsd.config.GlobalSettings;
-import de.unihalle.informatik.rhizoTrak.xsd.config.Config.StatusList;
import de.unihalle.informatik.rhizoTrak.xsd.config.Config.StatusList.Status;
import de.unihalle.informatik.rhizoTrak.xsd.config.GlobalSettings.GlobalStatusList;
import de.unihalle.informatik.rhizoTrak.xsd.config.GlobalSettings.GlobalStatusList.GlobalStatus;
+import de.unihalle.informatik.rhizoTrak.xsd.config.RhizoTrakProjectConfig;
import de.unihalle.informatik.rhizoTrak.display.Connector;
import de.unihalle.informatik.rhizoTrak.display.Displayable;
import de.unihalle.informatik.rhizoTrak.display.LayerSet;
@@ -185,33 +185,52 @@ public void loadConfigFile(String path)
if(!configFile.exists())
{
+ Utils.showMessage( "config file " + configFile.getPath() + " not found: using default settings");
setDefaultStatus();
return;
}
+
-
- try
- {
- JAXBContext context = JAXBContext.newInstance(Config.class);
- Unmarshaller um = context.createUnmarshaller();
- Config config = (Config) um.unmarshal(configFile);
- List sl = config.getStatusList().getStatus();
-
- for(int i = 0; i < sl.size(); i++)
- {
- statusMap.put(i, sl.get(i));
- }
-
- setFixedStatus();
- updateStatusMap();
- }
- catch (JAXBException e)
- {
- e.printStackTrace();
+ try {
+ JAXBContext context = JAXBContext.newInstance(RhizoTrakProjectConfig.class);
+ Unmarshaller um = context.createUnmarshaller();
+ RhizoTrakProjectConfig config = (RhizoTrakProjectConfig) um.unmarshal(configFile);
+ List sl = config.getStatusList().getStatus();
+
+ for(int i = 0; i < sl.size(); i++)
+ {
+ Status oldStatus = new Status();
+ de.unihalle.informatik.rhizoTrak.xsd.config.RhizoTrakProjectConfig.StatusList.Status newStatus = sl.get(i);
+ oldStatus.setFullName( newStatus.getFullName());
+ oldStatus.setAbbreviation( newStatus.getAbbreviation());
+ statusMap.put(i, oldStatus);
+ }
+
+ setFixedStatus();
+ updateStatusMap();
+ } catch (JAXBException e) {
+ try {
+ JAXBContext context = JAXBContext.newInstance(Config.class);
+ Unmarshaller um = context.createUnmarshaller();
+ Config config = (Config) um.unmarshal(configFile);
+ List sl = config.getStatusList().getStatus();
+
+ for(int i = 0; i < sl.size(); i++)
+ {
+ statusMap.put(i, sl.get(i));
+ }
+
+ setFixedStatus();
+ updateStatusMap();
+ } catch (JAXBException e1) {
+ Utils.showMessage( "cannot parse config file " + configFile.getPath() + ": using default settings");
+ setDefaultStatus();
+
+ }
}
Node.MAX_EDGE_CONFIDENCE = getStatusMapSize();
- }
+ }
//TODO: needs to be recode for non-static behavior
/**
@@ -322,18 +341,23 @@ public void saveConfigFile(File file)
try
{
- JAXBContext context = JAXBContext.newInstance(Config.class);
+ JAXBContext context = JAXBContext.newInstance(RhizoTrakProjectConfig.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- StatusList sl = new StatusList();
- for(int i: statusMap.keySet())
- {
+ de.unihalle.informatik.rhizoTrak.xsd.config.RhizoTrakProjectConfig.StatusList sl =
+ new de.unihalle.informatik.rhizoTrak.xsd.config.RhizoTrakProjectConfig.StatusList();
+ for(int i: statusMap.keySet()) {
// ignore undefined, virtual and connector
- if(i >= 0) sl.getStatus().add(statusMap.get(i));
+ Status oldStatus = statusMap.get(i);
+ de.unihalle.informatik.rhizoTrak.xsd.config.RhizoTrakProjectConfig.StatusList.Status newStatus =
+ new de.unihalle.informatik.rhizoTrak.xsd.config.RhizoTrakProjectConfig.StatusList.Status();
+ newStatus.setFullName( oldStatus.getFullName());
+ newStatus.setAbbreviation( oldStatus.getAbbreviation());
+ if(i >= 0) sl.getStatus().add( newStatus);
}
- Config config = new Config();
+ RhizoTrakProjectConfig config = new RhizoTrakProjectConfig();
config.setStatusList(sl);
m.marshal(config, configFile);