From: lingutln Date: Mon, 5 Mar 2012 18:55:24 +0000 (+0000) Subject: Saving as a zip functionality. Done by Nikhil. X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=27c43d9469d16e5106f5fc7b70466c60f4fa5ef9;p=old-jaiswallab-svn%2F.git Saving as a zip functionality. Done by Nikhil. svn path=/; revision=305 --- diff --git a/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java b/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java index 29bbf79..196d869 100644 --- a/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java +++ b/Annotation/src/ie/dcu/apps/ist/actions/ExportImageMapAction.java @@ -44,6 +44,9 @@ public class ExportImageMapAction extends AppAction{ Exporter exporter = new Exporter(image); exporter.setEffect(result.effect); exporter.setHtmlFile(result.html); + int dotIndex = result.html.indexOf('.'); + String zipFile = result.html.substring(0, dotIndex); + exporter.setZipFile(zipFile+".zip"); exporter.setImageFile(result.image); exporter.setObjectLink(result.link); exporter.setExportShape(result.shape); diff --git a/Annotation/src/ie/dcu/apps/ist/export/imagemap/Exporter.java b/Annotation/src/ie/dcu/apps/ist/export/imagemap/Exporter.java index a4e00e0..9017f93 100644 --- a/Annotation/src/ie/dcu/apps/ist/export/imagemap/Exporter.java +++ b/Annotation/src/ie/dcu/apps/ist/export/imagemap/Exporter.java @@ -26,6 +26,7 @@ public class Exporter { private RolloverEffect effect; private String htmlFile = "imagemap.html"; + private String zipFile = "imagemap.zip"; private String imageFile = "image.png"; private String imageName = "image"; private String objectDescription = ""; @@ -51,6 +52,14 @@ public class Exporter { public void setHtmlFile(String htmlFile) { this.htmlFile = htmlFile; } + + public String getZipFile() { + return zipFile; + } + + public void setZipFile(String zipFile) { + this.zipFile = zipFile; + } public String getImageFile() { return imageFile; @@ -95,7 +104,7 @@ public class Exporter { public void export(File folder, List masks) throws IOException, ExportException { // Create a zip file for saving imageMaps - file = new File("/home/lingutln/practice/example.zip"); + file = new File(folder,zipFile); ZipOutputStream out = new ZipOutputStream(new FileOutputStream(file)); // Create image map