Merge branch 'master' of ssh://wisemapping.com/var/git-repos/wise-source
This commit is contained in:
@@ -39,6 +39,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";
|
||||
|
||||
@@ -58,6 +59,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");
|
||||
@@ -93,7 +96,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) {
|
||||
@@ -136,6 +139,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);
|
||||
@@ -155,7 +160,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) {
|
||||
|
@@ -55,8 +55,10 @@ public class MindmapManagerImpl
|
||||
hibernateCriteria.add(Restrictions.eq("mindmapId",mindmapId));
|
||||
hibernateCriteria.addOrder( Order.desc("creationTime"));
|
||||
// Mientras no haya paginacion solo los 10 primeros
|
||||
hibernateCriteria.setMaxResults(10);
|
||||
return hibernateCriteria.list();
|
||||
// This line throws errors in some environments, so getting all history and taking firsts 10 records
|
||||
// hibernateCriteria.setMaxResults(10);
|
||||
List list = hibernateCriteria.list();
|
||||
return list.subList(0,(10<list.size()?10:list.size()));
|
||||
}
|
||||
|
||||
public MindMapHistory getHistory(int historyId)
|
||||
|
@@ -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