Complete mindjet integration.
This commit is contained in:
@@ -30,8 +30,10 @@ public enum ExportFormat {
|
||||
MICROSOFT_EXCEL("application/vnd.ms-excel", "xls"),
|
||||
MICROSOFT_WORD("application/msword", "doc"),
|
||||
OPEN_OFFICE_WRITER("application/vnd.oasis.opendocument.text", "odt"),
|
||||
MIND_MANAGER("application/vnd.mindjet.mindmanager", "mmap"),
|
||||
WISEMAPPING("application/wisemapping+xml", "wxml");
|
||||
|
||||
|
||||
private String contentType;
|
||||
private String fileExtension;
|
||||
|
||||
|
@@ -54,6 +54,7 @@ public class ExporterFactory {
|
||||
private static final String GROUP_NODE_NAME = "g";
|
||||
private static final String IMAGE_NODE_NAME = "image";
|
||||
public static final int MARGING = 50;
|
||||
public static final String UTF_8_CHARSET_NAME = "UTF-8";
|
||||
private File baseImgDir;
|
||||
|
||||
public ExporterFactory(@NotNull final ServletContext servletContext) throws ParserConfigurationException {
|
||||
@@ -121,27 +122,32 @@ public class ExporterFactory {
|
||||
}
|
||||
case SVG: {
|
||||
final String svgString = normalizeSvg(mapSvg, true);
|
||||
output.write(svgString.getBytes("UTF-8"));
|
||||
output.write(svgString.getBytes(UTF_8_CHARSET_NAME));
|
||||
break;
|
||||
}
|
||||
case TEXT: {
|
||||
final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.TEXT);
|
||||
exporter.export(xml.getBytes("UTF-8"), output);
|
||||
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output);
|
||||
break;
|
||||
}
|
||||
case OPEN_OFFICE_WRITER: {
|
||||
final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.OPEN_OFFICE);
|
||||
exporter.export(xml.getBytes("UTF-8"), output);
|
||||
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output);
|
||||
break;
|
||||
}
|
||||
case MICROSOFT_EXCEL: {
|
||||
final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.MICROSOFT_EXCEL);
|
||||
exporter.export(xml.getBytes("UTF-8"), output);
|
||||
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output);
|
||||
break;
|
||||
}
|
||||
case FREEMIND: {
|
||||
final FreemindExporter exporter = new FreemindExporter();
|
||||
exporter.export(xml.getBytes("UTF-8"), output);
|
||||
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output);
|
||||
break;
|
||||
}
|
||||
case MIND_MANAGER: {
|
||||
final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.MINDJET);
|
||||
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@@ -291,8 +291,11 @@ public class FreemindExporter
|
||||
final String size = part[idx];
|
||||
if (size != null && !size.isEmpty()) {
|
||||
int freeSize = Integer.parseInt(size);
|
||||
font.setSIZE(BigInteger.valueOf(wiseToFreeFontSize.get(freeSize)));
|
||||
updated = true;
|
||||
Integer fsize = wiseToFreeFontSize.get(freeSize);
|
||||
if(fsize!=null){
|
||||
font.setSIZE(BigInteger.valueOf(fsize));
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
idx++;
|
||||
|
@@ -54,11 +54,6 @@ public class XSLTExporter implements Exporter {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Exporter createTextExporter() {
|
||||
return create(Type.TEXT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Exporter create(@NotNull Type type) {
|
||||
return new XSLTExporter(type);
|
||||
@@ -70,6 +65,7 @@ public class XSLTExporter implements Exporter {
|
||||
CSV("mm2csv.xsl"),
|
||||
LATEX("mm2latex.xsl"),
|
||||
MICROSOFT_EXCEL("mm2xls_utf8.xsl"),
|
||||
MINDJET("mm2mj.xsl"),
|
||||
OPEN_OFFICE("mm2oowriter.xsl");
|
||||
|
||||
public String getXsltName() {
|
||||
|
@@ -99,6 +99,17 @@ public class MindmapController extends BaseController {
|
||||
return new ModelAndView("transformViewTxt", values);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/vnd.mindjet.mindmanager"}, params = {"download=mmap"})
|
||||
@ResponseBody
|
||||
public ModelAndView retrieveDocumentAsMindJet(@PathVariable int id) throws IOException {
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
final Map<String, Object> values = new HashMap<String, Object>();
|
||||
values.put("content", mindMap.getXmlStr());
|
||||
values.put("filename", mindMap.getTitle());
|
||||
return new ModelAndView("transformViewMMap", values);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/vnd.ms-excel"}, params = {"download=xls"})
|
||||
@ResponseBody
|
||||
public ModelAndView retrieveDocumentAsExcel(@PathVariable int id) throws IOException {
|
||||
|
@@ -86,7 +86,7 @@ public class TransformView extends AbstractView {
|
||||
final Object mindmap = viewMap.get("mindmap");
|
||||
final StreamResult result = new StreamResult(outputStream);
|
||||
jaxbMarshaller.marshal(mindmap, result);
|
||||
} else if (exportFormat == ExportFormat.MICROSOFT_EXCEL || exportFormat == ExportFormat.TEXT || exportFormat == ExportFormat.OPEN_OFFICE_WRITER) {
|
||||
} else if (exportFormat == ExportFormat.MICROSOFT_EXCEL || exportFormat == ExportFormat.TEXT || exportFormat == ExportFormat.OPEN_OFFICE_WRITER || exportFormat == ExportFormat.MIND_MANAGER) {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
factory.export(properties, content, outputStream, null);
|
||||
} else {
|
||||
|
@@ -32,7 +32,7 @@ final public class Utils {
|
||||
}
|
||||
|
||||
@SuppressWarnings({"ConstantConditions"})
|
||||
@NotNull
|
||||
@Nullable
|
||||
public static User getUser() {
|
||||
return getUser(false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user