Quich fix for export error
This commit is contained in:
@@ -38,6 +38,7 @@ import java.io.IOException;
|
||||
public class ExportController extends BaseMultiActionController {
|
||||
private static final String IMG_EXPORT_FORMAT = "IMG_EXPORT_FORMAT";
|
||||
private static final String MAP_ID_PARAMETER = "mapId";
|
||||
private static final String MAP_SVG_PARAMETER = "mapSvg";
|
||||
private static final String EXPORT_FORMAT_PARAMETER = "exportFormat";
|
||||
private static final String IMG_SIZE_PARAMETER = "imgSize";
|
||||
|
||||
@@ -57,6 +58,8 @@ public class ExportController extends BaseMultiActionController {
|
||||
|
||||
int mindmapId = Integer.parseInt(mapIdStr);
|
||||
|
||||
final String mapSvg = request.getParameter(MAP_SVG_PARAMETER);
|
||||
|
||||
String formatStr = request.getParameter(EXPORT_FORMAT_PARAMETER);
|
||||
if (IMG_EXPORT_FORMAT.endsWith(formatStr)) {
|
||||
formatStr = request.getParameter("imgFormat");
|
||||
@@ -92,7 +95,7 @@ public class ExportController extends BaseMultiActionController {
|
||||
|
||||
// Write content ...
|
||||
final ServletOutputStream outputStream = response.getOutputStream();
|
||||
mindMap.export(properties, outputStream);
|
||||
mindMap.export(properties, outputStream, mapSvg);
|
||||
|
||||
|
||||
} catch (Throwable e) {
|
||||
@@ -135,6 +138,8 @@ public class ExportController extends BaseMultiActionController {
|
||||
logger.info("Export Controller: generating image WiseMap action");
|
||||
|
||||
final String mapIdStr = request.getParameter(MAP_ID_PARAMETER);
|
||||
final String mapSvg = request.getParameter(MAP_SVG_PARAMETER);
|
||||
|
||||
int mindmapId = Integer.parseInt(mapIdStr);
|
||||
final MindmapService service = getMindmapService();
|
||||
final MindMap mindMap = service.getMindmapById(mindmapId);
|
||||
@@ -154,7 +159,7 @@ public class ExportController extends BaseMultiActionController {
|
||||
|
||||
// Write content ...
|
||||
final ServletOutputStream outputStream = response.getOutputStream();
|
||||
mindMap.export(imageProperties, outputStream);
|
||||
mindMap.export(imageProperties, outputStream, mapSvg);
|
||||
|
||||
|
||||
} catch (Throwable e) {
|
||||
|
@@ -52,7 +52,7 @@ public class SvgExporter {
|
||||
private SvgExporter() {
|
||||
}
|
||||
|
||||
public static void export(ExportProperties properties, MindMap map, OutputStream output) throws TranscoderException, IOException, ParserConfigurationException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException {
|
||||
public static void export(ExportProperties properties, MindMap map, OutputStream output, String mapSvg) throws TranscoderException, IOException, ParserConfigurationException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException {
|
||||
final ExportFormat format = properties.getFormat();
|
||||
|
||||
final String imgPath = properties.getBaseImgPath();
|
||||
@@ -66,7 +66,7 @@ public class SvgExporter {
|
||||
transcoder.addTranscodingHint(ImageTranscoder.KEY_WIDTH, size.getWidth());
|
||||
|
||||
// Create the transcoder input.
|
||||
char[] xml = map.generateSvgXml();
|
||||
char[] xml = map.generateSvgXml(mapSvg);
|
||||
xml = normalizeSvg(xml, imgPath);
|
||||
final CharArrayReader is = new CharArrayReader(xml);
|
||||
TranscoderInput input = new TranscoderInput(is);
|
||||
@@ -87,7 +87,7 @@ public class SvgExporter {
|
||||
transcoder.addTranscodingHint(ImageTranscoder.KEY_WIDTH, size.getWidth());
|
||||
|
||||
// Create the transcoder input.
|
||||
final char[] xml = map.generateSvgXml();
|
||||
final char[] xml = map.generateSvgXml(mapSvg);
|
||||
char[] svgXml = normalizeSvg(xml, imgPath);
|
||||
final CharArrayReader is = new CharArrayReader(svgXml);
|
||||
TranscoderInput input = new TranscoderInput(is);
|
||||
@@ -102,7 +102,7 @@ public class SvgExporter {
|
||||
final Transcoder transcoder = new PDFTranscoder();
|
||||
|
||||
// Create the transcoder input.
|
||||
final char[] xml = map.generateSvgXml();
|
||||
final char[] xml = map.generateSvgXml(mapSvg);
|
||||
char[] svgXml = normalizeSvg(xml, imgPath);
|
||||
final CharArrayReader is = new CharArrayReader(svgXml);
|
||||
TranscoderInput input = new TranscoderInput(is);
|
||||
@@ -113,7 +113,7 @@ public class SvgExporter {
|
||||
break;
|
||||
}
|
||||
case SVG: {
|
||||
final char[] xml = map.generateSvgXml();
|
||||
final char[] xml = map.generateSvgXml(mapSvg);
|
||||
char[] svgXml = normalizeSvg(xml, imgPath);
|
||||
output.write(new String(svgXml).getBytes("UTF-8"));
|
||||
break;
|
||||
|
@@ -215,10 +215,13 @@ public class MindMap {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public char[] generateSvgXml()
|
||||
public char[] generateSvgXml(String mapSvg)
|
||||
throws IOException, JAXBException {
|
||||
String svgText = mapSvg;
|
||||
final MindMapNative mindmapNativeBrowser = this.getNativeBrowser();
|
||||
String svgText = mindmapNativeBrowser.getUnzippedSvgXml();
|
||||
if(svgText==null){
|
||||
svgText = mindmapNativeBrowser.getUnzippedSvgXml();
|
||||
}
|
||||
|
||||
if (svgText == null || svgText.length() == 0) {
|
||||
// The map must be saved using IE. Convert VML to SVG.
|
||||
@@ -265,8 +268,8 @@ public class MindMap {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
public void export(final ExportProperties properties, OutputStream output) throws JAXBException, TranscoderException, TransformerException, IOException, ParserConfigurationException, ExportException, SAXException, XMLStreamException {
|
||||
SvgExporter.export(properties, this, output);
|
||||
public void export(final ExportProperties properties, OutputStream output, String mapSvg) throws JAXBException, TranscoderException, TransformerException, IOException, ParserConfigurationException, ExportException, SAXException, XMLStreamException {
|
||||
SvgExporter.export(properties, this, output, mapSvg);
|
||||
}
|
||||
|
||||
public void setOwner(User owner) {
|
||||
|
Reference in New Issue
Block a user