Complete mindjet integration.

This commit is contained in:
Paulo Gustavo Veiga
2013-03-29 11:49:59 -03:00
parent ed508d646c
commit 2c355205d0
79 changed files with 3156 additions and 11770 deletions

View File

@@ -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;

View File

@@ -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:

View File

@@ -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++;

View File

@@ -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() {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -32,7 +32,7 @@ final public class Utils {
}
@SuppressWarnings({"ConstantConditions"})
@NotNull
@Nullable
public static User getUser() {
return getUser(false);
}

View File

@@ -23,18 +23,18 @@
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:ap="http://schemas.mindjet.com/MindManager/Application/2003"
xmlns:cor="http://schemas.mindjet.com/MindManager/Core/2003"
xmlns:pri="http://schemas.mindjet.com/MindManager/Primitive/2003"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.mindjet.com/MindManager/Application/2003 http://schemas.mindjet.com/MindManager/Application/2003 http://schemas.mindjet.com/MindManager/Core/2003 http://schemas.mindjet.com/MindManager/Core/2003 http://schemas.mindjet.com/MindManager/Delta/2003 http://schemas.mindjet.com/MindManager/Delta/2003 http://schemas.mindjet.com/MindManager/Primitive/2003 http://schemas.mindjet.com/MindManager/Primitive/2003">
xmlns:ap="http://schemas.mindjet.com/MindManager/Application/2003"
xmlns:cor="http://schemas.mindjet.com/MindManager/Core/2003"
xmlns:pri="http://schemas.mindjet.com/MindManager/Primitive/2003"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.mindjet.com/MindManager/Application/2003 http://schemas.mindjet.com/MindManager/Application/2003 http://schemas.mindjet.com/MindManager/Core/2003 http://schemas.mindjet.com/MindManager/Core/2003 http://schemas.mindjet.com/MindManager/Delta/2003 http://schemas.mindjet.com/MindManager/Delta/2003 http://schemas.mindjet.com/MindManager/Primitive/2003 http://schemas.mindjet.com/MindManager/Primitive/2003">
<xsl:template match="map">
<xsl:element name="ap:Map">
<xsl:element name="ap:OneTopic">
<xsl:apply-templates select="node"/>
</xsl:element>
<xsl:element name="ap:Relationships">
<xsl:apply-templates select="descendant-or-self::arrowlink"> </xsl:apply-templates>
<xsl:apply-templates select="descendant-or-self::arrowlink"></xsl:apply-templates>
</xsl:element>
</xsl:element>
</xsl:template>
@@ -43,8 +43,8 @@
<xsl:element name="ap:Topic">
<xsl:attribute name="OId">
<xsl:value-of
select="concat(substring-after(@ID, '_'), substring('rW54nezC90m8NYAi2fjQvw==', string-length(substring-after(@ID, '_'))+1))"
/>
select="concat(substring-after(@ID, '_'), substring('rW54nezC90m8NYAi2fjQvw==', string-length(substring-after(@ID, '_'))+1))"
/>
</xsl:attribute>
<xsl:if test="node">
<xsl:element name="ap:SubTopics">
@@ -73,7 +73,7 @@
<xsl:element name="ap:Color">
<xsl:attribute name="FillColor">
<xsl:value-of select="concat('ff', substring-after(@BACKGROUND_COLOR, '#'))"
/>
/>
</xsl:attribute>
</xsl:element>
</xsl:if>
@@ -82,7 +82,8 @@
<xsl:element name="ap:SubTopicShape">
<xsl:if test="@STYLE = 'bubble'">
<xsl:attribute name="SubTopicShape"
>urn:mindjet:RoundedRectangle</xsl:attribute>
>urn:mindjet:RoundedRectangle
</xsl:attribute>
</xsl:if>
<xsl:if test="@STYLE = 'fork'">
<xsl:attribute name="SubTopicShape">urn:mindjet:Line</xsl:attribute>
@@ -94,7 +95,8 @@
<xsl:element name="ap:SubTopicShape">
<xsl:if test="parent::map">
<xsl:attribute name="SubTopicShape"
>urn:mindjet:RoundedRectangle</xsl:attribute>
>urn:mindjet:RoundedRectangle
</xsl:attribute>
</xsl:if>
<xsl:if test="not(parent::map)">
<xsl:attribute name="SubTopicShape">urn:mindjet:Line</xsl:attribute>
@@ -102,7 +104,8 @@
<xsl:for-each select="ancestor::node">
<xsl:if test="@STYLE = 'bubble'">
<xsl:attribute name="SubTopicShape"
>urn:mindjet:RoundedRectangle</xsl:attribute>
>urn:mindjet:RoundedRectangle
</xsl:attribute>
</xsl:if>
<xsl:if test="@STYLE = 'fork'">
<xsl:attribute name="SubTopicShape">urn:mindjet:Line</xsl:attribute>
@@ -115,17 +118,20 @@
<xsl:element name="ap:SubTopicsShape">
<xsl:if test="contains(child::edge/@STYLE, 'bezier')">
<xsl:attribute name="SubTopicsConnectionStyle"
>urn:mindjet:Curve</xsl:attribute>
>urn:mindjet:Curve
</xsl:attribute>
</xsl:if>
<xsl:if test="contains(child::edge/@STYLE, 'linear')">
<xsl:attribute name="SubTopicsConnectionStyle"
>urn:mindjet:Straight</xsl:attribute>
>urn:mindjet:Straight
</xsl:attribute>
</xsl:if>
<xsl:if test="parent::map">
<xsl:attribute name="SubTopicsAlignment">urn:mindjet:Center</xsl:attribute>
<xsl:attribute name="SubTopicsGrowth">urn:mindjet:Horizontal</xsl:attribute>
<xsl:attribute name="SubTopicsGrowthDirection"
>urn:mindjet:AutomaticHorizontal</xsl:attribute>
>urn:mindjet:AutomaticHorizontal
</xsl:attribute>
<xsl:attribute name="VerticalDistanceBetweenSiblings">150</xsl:attribute>
</xsl:if>
</xsl:element>
@@ -172,7 +178,7 @@
<xsl:element name="ap:Image">
<xsl:element name="ap:ImageData">
<xsl:attribute name="ImageType">urn:mindjet:PngImage</xsl:attribute>
<xsl:attribute name="CustomImageType"> </xsl:attribute>
<xsl:attribute name="CustomImageType"></xsl:attribute>
<xsl:element name="cor:Uri">
<xsl:attribute name="xsi:nil">false</xsl:attribute>
<xsl:text>mmarch://bin/</xsl:text>
@@ -184,37 +190,37 @@
</xsl:template>
<xsl:template match="arrowlink">
<xsl:element name="ap:Relationship">
<xsl:element name="ap:ConnectionGroup">
<xsl:attribute name="Index">0</xsl:attribute>
<xsl:element name="ap:Connection">
<xsl:element name="ap:ObjectReference">
<xsl:attribute name="OIdRef">
<xsl:value-of
<xsl:element name="ap:Relationship">
<xsl:element name="ap:ConnectionGroup">
<xsl:attribute name="Index">0</xsl:attribute>
<xsl:element name="ap:Connection">
<xsl:element name="ap:ObjectReference">
<xsl:attribute name="OIdRef">
<xsl:value-of
select="concat(substring-after(parent::node/@ID, '_'), substring('rW54nezC90m8NYAi2fjQvw==', string-length(substring-after(parent::node/@ID, '_'))+1))"
/>
</xsl:attribute>
</xsl:element>
/>
</xsl:attribute>
</xsl:element>
</xsl:element>
<xsl:element name="ap:ConnectionGroup">
<xsl:attribute name="Index">1</xsl:attribute>
<xsl:element name="ap:Connection">
<xsl:element name="ap:ObjectReference">
<xsl:attribute name="OIdRef">
<xsl:value-of
select="concat(substring-after(@DESTINATION, '_'), substring('rW54nezC90m8NYAi2fjQvw==', string-length(substring-after(@DESTINATION, '_'))+1))"
/>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="ap:AutoRoute">
<xsl:attribute name="AutoRouting">true</xsl:attribute>
</xsl:element>
</xsl:element>
<xsl:element name="ap:ConnectionGroup">
<xsl:attribute name="Index">1</xsl:attribute>
<xsl:element name="ap:Connection">
<xsl:element name="ap:ObjectReference">
<xsl:attribute name="OIdRef">
<xsl:value-of
select="concat(substring-after(@DESTINATION, '_'), substring('rW54nezC90m8NYAi2fjQvw==', string-length(substring-after(@DESTINATION, '_'))+1))"
/>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="ap:AutoRoute">
<xsl:attribute name="AutoRouting">true</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="cloud">
<xsl:element name="ap:OneBoundary">
<xsl:element name="ap:Boundary">
@@ -240,7 +246,8 @@
<xsl:if test="contains(@BUILTIN, 'full-')">
<xsl:element name="ap:Task">
<xsl:attribute name="TaskPriority">urn:mindjet:Prio<xsl:value-of
select="substring-after(@BUILTIN, 'full-')"/></xsl:attribute>
select="substring-after(@BUILTIN, 'full-')"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:if>

View File

@@ -263,6 +263,8 @@ OPEN_OFFICE_EXPORT_FORMAT=OpenOffice Writer
XLS_EXPORT_FORMAT_DETAILS=Get your map as Microsoft Excel (XSL)
TXT_EXPORT_FORMAT_DETAILS=Get your map as a plan text format
OPEN_OFFICE_EXPORT_FORMAT_DETAILS=Get your map as OpenOffice Write Document
MINDJET_EXPORT_FORMAT=(BETA) MindJet 8.x
MINDJET_EXPORT_FORMAT_DETAILS=Export your maps in MindJet 8.x format

View File

@@ -64,6 +64,7 @@
<entry key="txt" value="text/plain"/>
<entry key="xls" value="application/vnd.ms-excel"/>
<entry key="otd" value="application/vnd.oasis.opendocument.text"/>
<entry key="mmap" value="application/vnd.mindjet.mindmanager"/>
</map>
</property>
<property name="viewResolvers">
@@ -130,6 +131,11 @@
<constructor-arg ref="notificationService"/>
</bean>
<bean id="transformViewMMap" class="com.wisemapping.rest.view.TransformView">
<constructor-arg value="application/vnd.mindjet.mindmanager"/>
<constructor-arg ref="notificationService"/>
</bean>
<bean id="transformViewWise" class="com.wisemapping.rest.view.TransformView">
<constructor-arg value="application/wisemapping+xml"/>
<constructor-arg ref="notificationService"/>

View File

@@ -18,6 +18,12 @@
<spring:message code="FREEMIND_EXPORT_FORMAT_DETAILS"/>
</label>
<label for="mmap">
<input type="radio" name="exportFormat" value="mmap" id="mmap"/>
<strong><spring:message code="MINDJET_EXPORT_FORMAT"/></strong><br/>
<spring:message code="MINDJET_EXPORT_FORMAT_DETAILS"/>
</label>
<label for="wisemapping">
<input type="radio" id="wisemapping" name="exportFormat" value="wxml"/>
<strong><spring:message code="WISEMAPPING_EXPORT_FORMAT"/></strong><br/>
@@ -65,6 +71,7 @@
<spring:message code="OPEN_OFFICE_EXPORT_FORMAT_DETAILS"/>
</label>
</fieldset>
</form>
</div>
@@ -80,7 +87,7 @@
// No way to obtain map svg. Hide panels..
if (window.location.pathname.indexOf('exportf') != -1) {
$('#exportInfo').hide();
$('#freemind,#pdf,#svg,#odt,#txt,#xls').click('click', function (event) {
$('#freemind,#pdf,#svg,#odt,#txt,#xls,#mmap').click('click', function (event) {
$('#imgFormat').hide();
});