Fix image export

This commit is contained in:
Paulo Gustavo Veiga 2012-06-20 17:48:29 -03:00
parent cfe78bdf7e
commit 509a31a4ed
8 changed files with 234 additions and 9 deletions

View File

@ -89,7 +89,7 @@ mindplot.widget.Menu = new Class({
this._registerTooltip('fontSize', "Text size");
}
var topicShapeBtn = $('topicShapeBtn');
var topicShapeBtn = $('topicShape');
if (topicShapeBtn) {
var topicShapeModel = {
getValue: function() {

View File

@ -212,6 +212,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-codec</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>

View File

@ -62,7 +62,7 @@ public class TransformView extends AbstractView {
final ExportProperties.ImageProperties.Size size = ExportProperties.ImageProperties.Size.valueOf(sizeStr);
imageProperties.setSize(size);
} else {
imageProperties.setSize(ExportProperties.ImageProperties.Size.LARGE);
imageProperties.setSize(ExportProperties.ImageProperties.Size.MEDIUM);
}
}

View File

@ -12,10 +12,12 @@
<script type="text/javascript">
$('submitBtn').addEvent('click', function() {
var iframeWindow = $('dialogContentIframe').contentWindow;
iframeWindow.submitDialogForm();
var delay = iframeWindow.submitDialogForm();
if (MooDialog.Request.active) {
if (MooDialog.Request.active && !delay) {
MooDialog.Request.active.close();
} else {
MooDialog.Request.active.close.delay(3000,MooDialog.Request.active);
}
});

View File

@ -3,6 +3,7 @@
<p class="alert alert-info">
<spring:message code="EXPORT_DETAILS"/>
</p>
<div>
<form method="GET" class="form-horizontal" action="service/maps/${mindmap.id}"
enctype="application/x-www-form-urlencoded" id="dialogMainForm">
@ -51,7 +52,6 @@
</p>
<script type="text/javascript">
// No way to obtain map svg. Hide panels..
@ -96,6 +96,8 @@
// Close dialog ...
$('#export-dialog-modal').modal('hide');
return true;
}
</script>

View File

@ -56,16 +56,16 @@ public class ExportTest {
public Object[][] parameterIntTestProvider() {
final File dataDir = new File(DATA_DIR_PATH);
final File[] freeMindFiles = dataDir.listFiles(new FilenameFilter() {
final File[] svgFile = dataDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".svg");
}
});
final Object[][] result = new Object[freeMindFiles.length][2];
for (int i = 0; i < freeMindFiles.length; i++) {
File freeMindFile = freeMindFiles[i];
final Object[][] result = new Object[svgFile.length][2];
for (int i = 0; i < svgFile.length; i++) {
File freeMindFile = svgFile[i];
final String name = freeMindFile.getName();
result[i] = new Object[]{freeMindFile, new File(DATA_DIR_PATH, name.substring(0, name.lastIndexOf(".")) + ".png")};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -0,0 +1,216 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg focusable="true" height="384.0"
id="workspace" preserveAspectRatio="xMinYMin" viewBox="-345.0 -130.0 690.0 260.0" width="512.0">
<path d="M0,0 C-20,0 -41,101 -61,101 -41,104 -20,5 0,7 Z" fill="#495879" fill-opacity="1" stroke="#495879"
stroke-opacity="1" stroke-width="1px" style="fill:#495879 " visibility="visible"/>
<path d="M-132,45 C-141,45 -152,68 -161,68" fill="#495879" fill-opacity="1" stroke="#495879" stroke-opacity="1"
stroke-width="1px" style="fill:none " visibility="visible"/>
<path d="M-212,29 C-221,29 -232,41 -241,41" fill="#495879" fill-opacity="1" stroke="#495879" stroke-opacity="1"
stroke-width="1px" style="fill:none " visibility="visible"/>
<path d="M-212,29 C-221,29 -232,15 -241,15" fill="#495879" fill-opacity="1" stroke="#495879" stroke-opacity="1"
stroke-width="1px" style="fill:none " visibility="visible"/>
<path d="M-132,45 C-141,45 -152,28 -161,28" fill="#495879" fill-opacity="1" stroke="#495879" stroke-opacity="1"
stroke-width="1px" style="fill:none " visibility="visible"/>
<path d="M0,0 C-20,0 -41,44 -61,44 -41,47 -20,5 0,7 Z" fill="#495879" fill-opacity="1" stroke="#495879"
stroke-opacity="1" stroke-width="1px" style="fill:#495879 " visibility="visible"/>
<path d="M0,0 C-20,0 -41,-12 -61,-12 -41,-9 -20,5 0,7 Z" fill="#495879" fill-opacity="1" stroke="#495879"
stroke-opacity="1" stroke-width="1px" style="fill:#495879 " visibility="visible"/>
<path d="M0,0 C20,0 42,44 62,44 42,47 20,5 0,7 Z" fill="#495879" fill-opacity="1" stroke="#495879"
stroke-opacity="1" stroke-width="1px" style="fill:#495879 " visibility="visible"/>
<path d="M0,0 C-20,0 -41,-45 -61,-45 -41,-42 -20,5 0,7 Z" fill="#495879" fill-opacity="1" stroke="#495879"
stroke-opacity="1" stroke-width="1px" style="fill:#495879 " visibility="visible"/>
<path d="M0,0 C20,0 42,12 62,12 42,15 20,5 0,7 Z" fill="#495879" fill-opacity="1" stroke="#495879"
stroke-opacity="1" stroke-width="1px" style="fill:#495879 " visibility="visible"/>
<path d="M0,0 C-20,0 -41,-78 -61,-78 -41,-75 -20,5 0,7 Z" fill="#495879" fill-opacity="1" stroke="#495879"
stroke-opacity="1" stroke-width="1px" style="fill:#495879 " visibility="visible"/>
<path d="M0,0 C20,0 42,-21 62,-21 42,-18 20,5 0,7 Z" fill="#495879" fill-opacity="1" stroke="#495879"
stroke-opacity="1" stroke-width="1px" style="fill:#495879 " visibility="visible"/>
<rect fill="#CC0033" fill-opacity="0.4" height="6" rx="0" ry="0" stroke="#FF9933" stroke-opacity="0.4"
stroke-width="1px" visibility="hidden" width="50" x="5" y="5"/>
<path fill-opacity="0.4" stroke="#CC0033" stroke-opacity="0.4" stroke-width="1px" style="fill:none "
visibility="hidden"/>
<path fill-opacity="0.4" stroke="#CC0033" stroke-opacity="0.4" stroke-width="1px" style="fill:none "
visibility="hidden"/>
<rect fill="#CC0033" fill-opacity="0.4" height="6" rx="0" ry="0" stroke="#FF9933" stroke-opacity="0.4"
stroke-width="1px" visibility="hidden" width="50" x="5" y="5"/>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(-31,-19) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(244,184,45)" fill-opacity="1" height="45" rx="6.75" ry="6.75" stroke="rgb(241,163,39)"
stroke-opacity="1" stroke-width="1px" style="cursor: default; " width="67" x="-2" y="-3"/>
<rect fill="rgb(80,157,192)" height="39" rx="5.85" ry="5.85" stroke="rgb(57,113,177)" stroke-width="2px"
style="cursor: default; " width="63" x="0" y="0"/>
<text fill="#ffffff" font-family="verdana" font-size="13.4375" font-style="normal" font-weight="bold"
style="cursor: default; " visibility="visible" x="11" y="11">
<tspan dy="1em" x="11">aaaa</tspan>
</text>
<g focusable="true" height="17" preserveAspectRatio="none" transform="translate(011) scale(00.17)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(62,-44) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="29" rx="4.35" ry="4.35" stroke="rgb(241,163,39)"
stroke-opacity="0" stroke-width="1px" width="74" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="70" y1="23"
y2="23"/>
<text fill="#525c61" font-family="verdana" font-size="10.75" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="4" y="4">
<tspan dy="1em" x="4">Main Topic</tspan>
</text>
<ellipse cx="3" cy="3" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="hidden" width="6"/>
<g focusable="true" height="15" preserveAspectRatio="none" transform="translate(04) scale(00.15)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(-131,-101) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="29" rx="4.35" ry="4.35" stroke="rgb(241,163,39)"
stroke-opacity="0" stroke-width="1px" width="74" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="70" y1="23"
y2="23"/>
<text fill="#525c61" font-family="verdana" font-size="10.75" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="4" y="4">
<tspan dy="1em" x="4">Main Topic</tspan>
</text>
<ellipse cx="3" cy="3" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="hidden" width="6"/>
<g focusable="true" height="15" preserveAspectRatio="none" transform="translate(04) scale(00.15)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(62,-11) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="29" rx="4.35" ry="4.35" stroke="rgb(241,163,39)"
stroke-opacity="0" stroke-width="1px" width="74" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="70" y1="23"
y2="23"/>
<text fill="#525c61" font-family="verdana" font-size="10.75" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="4" y="4">
<tspan dy="1em" x="4">Main Topic</tspan>
</text>
<ellipse cx="3" cy="3" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="hidden" width="6"/>
<g focusable="true" height="15" preserveAspectRatio="none" transform="translate(04) scale(00.15)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(-131,-68) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="29" rx="4.35" ry="4.35" stroke="rgb(241,163,39)"
stroke-opacity="0" stroke-width="1px" width="74" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="70" y1="23"
y2="23"/>
<text fill="#525c61" font-family="verdana" font-size="10.75" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="4" y="4">
<tspan dy="1em" x="4">Main Topic</tspan>
</text>
<ellipse cx="3" cy="3" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="hidden" width="6"/>
<g focusable="true" height="15" preserveAspectRatio="none" transform="translate(04) scale(00.15)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(62,21) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="29" rx="4.35" ry="4.35" stroke="rgb(241,163,39)"
stroke-opacity="0" stroke-width="1px" width="74" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="70" y1="23"
y2="23"/>
<text fill="#525c61" font-family="verdana" font-size="10.75" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="4" y="4">
<tspan dy="1em" x="4">Main Topic</tspan>
</text>
<ellipse cx="3" cy="3" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="hidden" width="6"/>
<g focusable="true" height="15" preserveAspectRatio="none" transform="translate(04) scale(00.15)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(-131,-35) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="29" rx="4.35" ry="4.35" stroke="rgb(241,163,39)"
stroke-opacity="0" stroke-width="1px" width="74" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="70" y1="23"
y2="23"/>
<text fill="#525c61" font-family="verdana" font-size="10.75" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="4" y="4">
<tspan dy="1em" x="4">Main Topic</tspan>
</text>
<ellipse cx="3" cy="3" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="hidden" width="6"/>
<g focusable="true" height="15" preserveAspectRatio="none" transform="translate(04) scale(00.15)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(-131,21) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="29" rx="4.35" ry="4.35" stroke="rgb(241,163,39)"
stroke-opacity="0" stroke-width="1px" width="74" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="70" y1="23"
y2="23"/>
<text fill="#525c61" font-family="verdana" font-size="10.75" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="4" y="4">
<tspan dy="1em" x="4">Main Topic</tspan>
</text>
<ellipse cx="-3" cy="23" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="visible" width="6"/>
<g focusable="true" height="15" preserveAspectRatio="none" transform="translate(04) scale(00.15)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(-211,11) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="23" rx="3.4499999999999997" ry="3.4499999999999997"
stroke="rgb(241,163,39)" stroke-opacity="0" stroke-width="1px" width="54" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="50" y1="17"
y2="17"/>
<text fill="#525c61" font-family="verdana" font-size="8.0625" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="3" y="3">
<tspan dy="1em" x="3">Sub Topic</tspan>
</text>
<ellipse cx="-3" cy="17" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="visible" width="6"/>
<g focusable="true" height="11" preserveAspectRatio="none" transform="translate(03) scale(00.11)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(-291,-2) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="23" rx="3.4499999999999997" ry="3.4499999999999997"
stroke="rgb(241,163,39)" stroke-opacity="0" stroke-width="1px" width="54" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="50" y1="17"
y2="17"/>
<text fill="#525c61" font-family="verdana" font-size="8.0625" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="3" y="3">
<tspan dy="1em" x="3">Sub Topic</tspan>
</text>
<ellipse cx="3" cy="3" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="hidden" width="6"/>
<g focusable="true" height="11" preserveAspectRatio="none" transform="translate(03) scale(00.11)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(-291,24) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="23" rx="3.4499999999999997" ry="3.4499999999999997"
stroke="rgb(241,163,39)" stroke-opacity="0" stroke-width="1px" width="54" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="50" y1="17"
y2="17"/>
<text fill="#525c61" font-family="verdana" font-size="8.0625" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="3" y="3">
<tspan dy="1em" x="3">Sub Topic</tspan>
</text>
<ellipse cx="3" cy="3" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="hidden" width="6"/>
<g focusable="true" height="11" preserveAspectRatio="none" transform="translate(03) scale(00.11)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(-211,51) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="23" rx="3.4499999999999997" ry="3.4499999999999997"
stroke="rgb(241,163,39)" stroke-opacity="0" stroke-width="1px" width="54" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="50" y1="17"
y2="17"/>
<text fill="#525c61" font-family="verdana" font-size="8.0625" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="3" y="3">
<tspan dy="1em" x="3">Sub Topic</tspan>
</text>
<ellipse cx="3" cy="3" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="hidden" width="6"/>
<g focusable="true" height="11" preserveAspectRatio="none" transform="translate(03) scale(00.11)" width="0"/>
</g>
<g focusable="true" height="100" preserveAspectRatio="none" transform="translate(-131,78) scale(1,1)"
visibility="visible" width="100">
<rect fill="rgb(252,235,192)" fill-opacity="0" height="29" rx="4.35" ry="4.35" stroke="rgb(241,163,39)"
stroke-opacity="0" stroke-width="1px" width="74" x="-2" y="-3"/>
<line stroke="#495879" stroke-opacity="1" stroke-width="1px" style="cursor: move; " x1="0" x2="70" y1="23"
y2="23"/>
<text fill="#525c61" font-family="verdana" font-size="10.75" font-style="normal" font-weight="normal"
style="cursor: move; " visibility="visible" x="4" y="4">
<tspan dy="1em" x="4">Main Topic</tspan>
</text>
<ellipse cx="3" cy="3" fill="#E0E5EF" height="6" rx="3" ry="3" stroke="#023BB9" stroke-width="1px"
style="cursor: default; " visibility="hidden" width="6"/>
<g focusable="true" height="15" preserveAspectRatio="none" transform="translate(04) scale(00.15)" width="0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB