changing default shapes to be all lines, and fixing text centering bug

This commit is contained in:
Pablo Luna 2011-04-15 16:18:59 +01:00 committed by Paulo Gustavo Veiga
parent d97121ce87
commit 405f0d9998
11 changed files with 192 additions and 13 deletions

View File

@ -18,14 +18,16 @@
package com.wisemapping.importer;
import com.sun.istack.internal.NotNull;
public class ImporterException
extends Exception
{
public ImporterException(String str)
public ImporterException(@NotNull String str)
{
super(str);
}
public ImporterException(Throwable exc)
public ImporterException(@NotNull Throwable exc)
{
super(exc);
}

View File

@ -0,0 +1,104 @@
package com.wisemapping.importer;
import java.util.*;
public class VersionNumber
implements Comparable {
protected String version_d;
//~ Constructors .........................................................................................
public VersionNumber(final String version) {
version_d = version;
}
//~ Methods ..............................................................................................
/**
* Answers whether the receiver is greater then the given version number.
*
* @param versionNumber the version number to compare to
* @return true if the receiver has a greater version number, false otherwise
*/
public boolean isGreaterThan(final VersionNumber versionNumber) {
return this.compareTo(versionNumber) > 0;
}
/**
* Answers whether the receiver is smaller then the given version number.
*
* @param versionNumber the version number to compare to
* @return true if the receiver has a smaller version number, false otherwise
*/
public boolean isSmallerThan(final VersionNumber versionNumber) {
return this.compareTo(versionNumber) < 0;
}
public String getVersion() {
return version_d;
}
public int compareTo(final Object otherObject) {
if (this.equals(otherObject)) {
return 0;
}
final StringTokenizer ownTokenizer = this.getTokenizer();
final StringTokenizer otherTokenizer = ((VersionNumber) otherObject).getTokenizer();
while (ownTokenizer.hasMoreTokens()) {
final int ownNumber;
final int otherNumber;
try {
ownNumber = Integer.parseInt(ownTokenizer.nextToken());
otherNumber = Integer.parseInt(otherTokenizer.nextToken());
} catch (NoSuchElementException nseex) {
// only possible if we have more tokens than the other version -
// if we get to this point then we are always greater
return 1;
}
if (ownNumber > otherNumber) {
return 1;
} else if (ownNumber < otherNumber) {
return -1;
}
}
// if other version still has tokens then it is greater than me!
otherTokenizer.nextToken();
return -1;
}
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof VersionNumber)) {
return false;
}
final VersionNumber versionNumber = (VersionNumber) o;
if (version_d != null ? !version_d.equals(versionNumber.version_d)
: versionNumber.version_d != null) {
return false;
}
return true;
}
public int hashCode() {
return (version_d != null ? version_d.hashCode() : 0);
}
protected StringTokenizer getTokenizer() {
return new StringTokenizer(this.getVersion(), ".");
}
}

View File

@ -21,6 +21,7 @@ package com.wisemapping.importer.freemind;
import com.sun.org.apache.xerces.internal.dom.TextImpl;
import com.wisemapping.importer.Importer;
import com.wisemapping.importer.ImporterException;
import com.wisemapping.importer.VersionNumber;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.ShapeStyle;
import com.wisemapping.util.JAXBUtils;
@ -57,6 +58,8 @@ public class FreemindImporter
private static final String EMPTY_FONT_STYLE = ";;;;;";
private final static Charset UTF_8_CHARSET = Charset.forName("UTF-8");
private final static int ORDER_SEPARATION_FACTOR = 2;
private static final VersionNumber SUPPORTED_FREEMIND_VERSION = new VersionNumber("0.9.0");
private int currentId;
@ -98,6 +101,16 @@ public class FreemindImporter
try {
String wiseXml;
final Map freemindMap = (Map) JAXBUtils.getMapObject(input, "com.wisemapping.xml.freemind");
final String version = freemindMap.getVersion();
if (version != null) {
final VersionNumber mapVersion = new VersionNumber(version);
if (SUPPORTED_FREEMIND_VERSION.isGreaterThan(mapVersion)) {
throw new ImporterException("FreeMind map has been created with '" + mapVersion.getVersion() + "'. Supported FreeMind version is '" + SUPPORTED_FREEMIND_VERSION.getVersion() + "' or greater.");
}
}
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final com.wisemapping.xml.mindmap.Map mindmapMap = mindmapObjectFactory.createMap();

View File

@ -1,4 +1,4 @@
<map version="0.9.0">
<map version="1.9.0">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1301246214383" ID="ID_886000454" MODIFIED="1301246809450" TEXT="Fonts">
<node CREATED="1301246745581" ID="ID_1660145973" MODIFIED="1301246791264" POSITION="right" TEXT="Styles">

View File

@ -0,0 +1,11 @@
<map version="0.9.5">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1302841120232" ID="ID_1765308329" MODIFIED="1302841214123" TEXT="i18n">
<node CREATED="1302841129828" ID="ID_194982023" MODIFIED="1302841153152" POSITION="right"
TEXT="Este es un &#xe9; con acento"/>
<node CREATED="1302841154902" ID="ID_1010738168" MODIFIED="1302841159772" POSITION="left"
TEXT="Este es una &#xf1;"/>
<node CREATED="1302841214544" ID="ID_1876995050" MODIFIED="1302841216196" POSITION="right"
TEXT="&#x9019;&#x662f;&#x4e00;&#x500b;&#x6a23;&#x672c; Japanise&#x3002;"/>
</node>
</map>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="i18n" ID="ID_0"><node WORDER="3" wCOORDS="200,-100" TEXT="Este es un é con acento" POSITION="right" ID="ID_1"/><node WORDER="1" wCOORDS="-200,-50" TEXT="Este es una ñ" POSITION="left" ID="ID_2"/><node WORDER="0" wCOORDS="200,0" TEXT="這是一個樣本 Japanise。" POSITION="right" ID="ID_3"/></node></map>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="pela" name="basic"><topic id="0" central="true" shape="rounded rectagle" text="i18n"><topic id="1" position="200,-100" order="3" shape="line" text="Este es un é con acento"/><topic id="2" position="-200,-50" order="1" shape="line" text="Este es una ñ"/><topic id="3" position="200,0" order="0" shape="line" text="這是一個樣本 Japanise。"/></topic></map>

View File

@ -1,12 +1,15 @@
<map version="0.9.0">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1301250606816" ID="ID_189563190" LINK="http://www.google.com" MODIFIED="1301265199448" TEXT="Node Links">
<icon BUILTIN="closed"/>
<node CREATED="1301265119915" FOLDED="true" ID="ID_955581041" LINK="http://www.bing.com" MODIFIED="1301265556534" POSITION="right" TEXT="Link Topic">
<icon BUILTIN="info"/>
<node CREATED="1301265126777" ID="ID_1127858248" LINK="http://bing.com" MODIFIED="1301265269136" TEXT="Link Topic Topic">
<icon BUILTIN="messagebox_warning"/>
</node>
</node>
</node>
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1301250606816" ID="ID_189563190" LINK="http://www.google.com" MODIFIED="1301265199448"
TEXT="Node Links">
<icon BUILTIN="closed"/>
<node CREATED="1301265119915" FOLDED="true" ID="ID_955581041" LINK="http://www.bing.com"
MODIFIED="1301265556534" POSITION="right" TEXT="Link Topic">
<icon BUILTIN="info"/>
<node CREATED="1301265126777" ID="ID_1127858248" LINK="http://bing.com" MODIFIED="1301265269136"
TEXT="Link Topic Topic">
<icon BUILTIN="messagebox_warning"/>
</node>
</node>
</node>
</map>

View File

@ -0,0 +1,42 @@
<map version="0.9.0">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1302840641936" ID="ID_723624059" MODIFIED="1302840654344" TEXT="I have HTML In Nodes">
<node CREATED="1302840656330" ID="ID_462671278" MODIFIED="1302840878148" POSITION="right">
<richcontent TYPE="NODE">
<html>
<head>
</head>
<body>
<p>
Here is some<font face="Stencil">fonts</font>&#160;
</p>
<p>
</p>
<p>
Add color
<font color="#ff6666">changes ...</font>
</p>
<p>
</p>
<ul>
<li>
Add some bullets:
</li>
</ul>
<ol>
<li>
Different Bullets
</li>
</ol>
<p>
And all aligned !!!!s
</p>
</body>
</html>
</richcontent>
</node>
</node>
</map>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="I have HTML In Nodes" ID="ID_0"><node WORDER="1" wCOORDS="200,-50" TEXT="Here is some fonts   Add color changes ... Add some bullets: Different Bullets And all aligned !!!!s" POSITION="right" ID="ID_1"/></node></map>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="pela" name="basic"><topic id="0" central="true" shape="rounded rectagle" text="I have HTML In Nodes"><topic id="1" position="200,-50" order="1" shape="line" text="Here is some fonts   Add color changes ... Add some bullets: Different Bullets And all aligned !!!!s"/></topic></map>