|
@@ -237,11 +237,19 @@ public class LoadController {
|
|
|
model.setObjectsOnCanvas(new ArrayList<AbstractCpsObject>());
|
|
|
model.setEdgesOnCanvas(new ArrayList<CpsEdge>());
|
|
|
model.setTrackingObj(new ArrayList<>());
|
|
|
+ model.setCanvasX(json.get("CANVAS_SIZE_X").getAsInt());
|
|
|
+ model.setCanvasX(json.get("CANVAS_SIZE_Y").getAsInt());
|
|
|
+ IdCounter.setCounter(json.get("IDCOUNTER").getAsInt());
|
|
|
+ IdCounterElem.setCounter(json.get("IDCOUNTERELEMENT").getAsInt());
|
|
|
break;
|
|
|
case PARTIAL:
|
|
|
model.setCvsObjIdx(new HashMap<Integer, Integer>());
|
|
|
model.setObjectsOnCanvas(new ArrayList<AbstractCpsObject>());
|
|
|
model.setEdgesOnCanvas(new ArrayList<CpsEdge>());
|
|
|
+ model.setCanvasX(json.get("CANVAS_SIZE_X").getAsInt());
|
|
|
+ model.setCanvasX(json.get("CANVAS_SIZE_Y").getAsInt());
|
|
|
+ IdCounter.setCounter(json.get("IDCOUNTER").getAsInt());
|
|
|
+ IdCounterElem.setCounter(json.get("IDCOUNTERELEMENT").getAsInt());
|
|
|
break;
|
|
|
case CATEGORY:
|
|
|
model.setCgIdx(new HashMap<String, Integer>());
|
|
@@ -250,10 +258,7 @@ public class LoadController {
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- model.setCanvasX(json.get("CANVAS_SIZE_X").getAsInt());
|
|
|
- model.setCanvasX(json.get("CANVAS_SIZE_Y").getAsInt());
|
|
|
- IdCounter.setCounter(json.get("IDCOUNTER").getAsInt());
|
|
|
- IdCounterElem.setCounter(json.get("IDCOUNTERELEMENT").getAsInt());
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -276,6 +281,7 @@ public class LoadController {
|
|
|
|
|
|
|
|
|
AbstractCpsObject temp = gson.fromJson(jsonElement.getAsJsonObject(), AbstractCpsObject.class);
|
|
|
+ temp.setImage(checkOS(temp.getImage()));
|
|
|
initObjects(temp);
|
|
|
if (mpC.searchCatObj(mpC.searchCat(temp.getSav()), temp.getObjName()) != null)
|
|
|
cgC.deleteObject(temp.getSav(), temp.getObjName());
|
|
@@ -283,6 +289,13 @@ public class LoadController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private String refreshPath(String image) {
|
|
|
+
|
|
|
+ if(!image.contains("/HolonGUI/"))
|
|
|
+ return image;
|
|
|
+ return (System.getProperty("user.home") + image.substring(image.indexOf("/HolonGUI/"), image.length())).replace("\\", "/");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
* Load a given Element in Category by Deserialization
|
|
|
*
|
|
@@ -306,6 +319,7 @@ public class LoadController {
|
|
|
|
|
|
AbstractCpsObject temp = gson.fromJson(jsonElement.getAsJsonObject(), AbstractCpsObject.class);
|
|
|
initObjects(temp);
|
|
|
+ temp.setImage(checkOS(temp.getImage()));
|
|
|
|
|
|
if (temp.getSav().equals("CVS")) {
|
|
|
cvsC.addObject(temp);
|
|
@@ -483,8 +497,8 @@ public class LoadController {
|
|
|
|
|
|
ArchiveEntry entry = stream.getNextEntry();
|
|
|
while (entry != null) {
|
|
|
- String entryName = checkOS(entry.getName());
|
|
|
- File file = new File(tmp, entryName);
|
|
|
+
|
|
|
+ File file = new File(tmp, entry.getName());
|
|
|
file.getParentFile().mkdirs();
|
|
|
OutputStream output = new FileOutputStream(file);
|
|
|
IOUtils.copy(stream, output);
|
|
@@ -503,17 +517,28 @@ public class LoadController {
|
|
|
|
|
|
String os = System.getProperty("os.name").toLowerCase();
|
|
|
String ret = entryName;
|
|
|
- String partition = null;
|
|
|
+ String partition = System.getProperty("user.home");
|
|
|
+
|
|
|
+ if(!ret.contains("HolonGUI"))
|
|
|
+ return ret;
|
|
|
|
|
|
if (os.contains("windows")) {
|
|
|
- partition = System.getProperty("user.home").substring(0, entryName.indexOf(":"));
|
|
|
- ret = partition + ret;
|
|
|
+ ret = ret.replace("/", "\\");
|
|
|
+ ret = System.getProperty("user.home") + ret.substring(ret.indexOf("\\HolonGUI\\"), ret.length());
|
|
|
+
|
|
|
}
|
|
|
if (os.contains("mac")) {
|
|
|
|
|
|
+ ret = ret.replace("\\", "/");
|
|
|
+ ret = System.getProperty("user.home") + ret.substring(ret.indexOf("/HolonGUI/"), ret.length());
|
|
|
}
|
|
|
if (os.contains("linux")) {
|
|
|
|
|
|
+ ret = ret.replace("\\", "/");
|
|
|
+ ret = System.getProperty("user.home") + ret.substring(ret.indexOf("/HolonGUI/"), ret.length());
|
|
|
+ }
|
|
|
+ if(os.contains("solaris")) {
|
|
|
+
|
|
|
}
|
|
|
return ret;
|
|
|
}
|