From b914bbb8a869019139121f1cd81a242c9c3c7bd5 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 3 Jun 2012 18:12:56 -0300 Subject: [PATCH] Fix PDF export. --- .../src/main/java/com/wisemapping/exporter/ExportFormat.java | 2 +- .../main/java/com/wisemapping/exporter/ExportProperties.java | 2 +- .../main/java/com/wisemapping/exporter/ExporterFactory.java | 3 +-- .../main/java/com/wisemapping/rest/TransformerController.java | 3 +-- .../src/main/java/com/wisemapping/rest/view/TransformView.java | 2 +- wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml | 3 +-- wise-webapp/src/main/webapp/jsp/mindmapExport.jsp | 2 +- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/ExportFormat.java b/wise-webapp/src/main/java/com/wisemapping/exporter/ExportFormat.java index a0d846be..6ef65a11 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExportFormat.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExportFormat.java @@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull; public enum ExportFormat { SVG("image/svg+xml", "svg"), - JPEG("image/jpeg", "jpg"), + JPG("image/jpeg", "jpg"), PNG("image/png", "png"), PDF("application/pdf", "pdf"), FREEMIND("application/freemind", "mm"), diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java b/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java index d0687d19..21856075 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExportProperties.java @@ -32,7 +32,7 @@ public class ExportProperties { public static ExportProperties create(final ExportFormat format) { ExportProperties result; - if (format == ExportFormat.JPEG || format == ExportFormat.PNG) { + if (format == ExportFormat.JPG || format == ExportFormat.PNG) { result = new ImageProperties(format); } else { result = new GenericProperties(format); diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java index 9313c633..1a40ca1c 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java @@ -18,7 +18,6 @@ package com.wisemapping.exporter; -import com.wisemapping.model.MindMap; import org.apache.batik.transcoder.Transcoder; import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderInput; @@ -79,7 +78,7 @@ public class ExporterFactory { transcoder.transcode(input, trascoderOutput); break; } - case JPEG: { + case JPG: { // Create a JPEG transcoder final Transcoder transcoder = new JPEGTranscoder(); transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.99)); diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/TransformerController.java b/wise-webapp/src/main/java/com/wisemapping/rest/TransformerController.java index 4347b173..6fdfce86 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/TransformerController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/TransformerController.java @@ -28,7 +28,6 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -116,7 +115,7 @@ public class TransformerController extends BaseController { case PNG: result = this.transformPng(svg); break; - case JPEG: + case JPG: result = this.transformJpeg(svg); break; case PDF: diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java b/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java index 3a1a8e87..07ff7be6 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java @@ -83,7 +83,7 @@ public class TransformView extends AbstractView { ExporterFactory.export(properties, content, outputStream, null); } else if (exportFormat == ExportFormat.WISEMAPPING) { final Object mindmap = viewMap.get("mindmap"); - StreamResult result = new StreamResult(outputStream); + final StreamResult result = new StreamResult(outputStream); jaxbMarshaller.marshal(mindmap, result); } else { ExporterFactory.export(properties, null, outputStream, content); diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml index 436456f3..38740f44 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-rest.xml @@ -37,9 +37,8 @@ - + - diff --git a/wise-webapp/src/main/webapp/jsp/mindmapExport.jsp b/wise-webapp/src/main/webapp/jsp/mindmapExport.jsp index 014492e0..125b77f7 100644 --- a/wise-webapp/src/main/webapp/jsp/mindmapExport.jsp +++ b/wise-webapp/src/main/webapp/jsp/mindmapExport.jsp @@ -39,7 +39,7 @@