mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-24 04:13:47 +01:00
Improve detection of version in freemind.
This commit is contained in:
parent
4c3483006e
commit
1d0d907284
@ -18,10 +18,12 @@
|
|||||||
|
|
||||||
package com.wisemapping.importer;
|
package com.wisemapping.importer;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class VersionNumber
|
public class VersionNumber
|
||||||
implements Comparable {
|
implements Comparable<VersionNumber> {
|
||||||
|
|
||||||
protected String version_d;
|
protected String version_d;
|
||||||
|
|
||||||
@ -58,13 +60,13 @@ public class VersionNumber
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int compareTo(final Object otherObject) {
|
public int compareTo(@NotNull final VersionNumber otherObject) {
|
||||||
if (this.equals(otherObject)) {
|
if (this.equals(otherObject)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final StringTokenizer ownTokenizer = this.getTokenizer();
|
final StringTokenizer ownTokenizer = this.getTokenizer();
|
||||||
final StringTokenizer otherTokenizer = ((VersionNumber) otherObject).getTokenizer();
|
final StringTokenizer otherTokenizer = otherObject.getTokenizer();
|
||||||
|
|
||||||
while (ownTokenizer.hasMoreTokens()) {
|
while (ownTokenizer.hasMoreTokens()) {
|
||||||
final int ownNumber;
|
final int ownNumber;
|
||||||
@ -112,8 +114,8 @@ public class VersionNumber
|
|||||||
return (version_d != null ? version_d.hashCode() : 0);
|
return (version_d != null ? version_d.hashCode() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
protected StringTokenizer getTokenizer() {
|
private StringTokenizer getTokenizer() {
|
||||||
return new StringTokenizer(this.getVersion(), ".");
|
return new StringTokenizer(this.getVersion(), ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,8 +96,9 @@ public class FreemindImporter
|
|||||||
final Map freemindMap = (Map) JAXBUtils.getMapObject(input, "com.wisemapping.jaxb.freemind");
|
final Map freemindMap = (Map) JAXBUtils.getMapObject(input, "com.wisemapping.jaxb.freemind");
|
||||||
|
|
||||||
final String version = freemindMap.getVersion();
|
final String version = freemindMap.getVersion();
|
||||||
if (version != null) {
|
if (version == null || version.startsWith("freeplane")) {
|
||||||
|
throw new ImporterException("You seems to be be trying to import a Freeplane map. FreePlane is not supported format.");
|
||||||
|
} else {
|
||||||
final VersionNumber mapVersion = new VersionNumber(version);
|
final VersionNumber mapVersion = new VersionNumber(version);
|
||||||
if (mapVersion.isGreaterThan(FreemindConstant.SUPPORTED_FREEMIND_VERSION)) {
|
if (mapVersion.isGreaterThan(FreemindConstant.SUPPORTED_FREEMIND_VERSION)) {
|
||||||
throw new ImporterException("FreeMind version " + mapVersion.getVersion() + " is not supported.");
|
throw new ImporterException("FreeMind version " + mapVersion.getVersion() + " is not supported.");
|
||||||
@ -134,11 +135,7 @@ public class FreemindImporter
|
|||||||
result.setTitle(mapName);
|
result.setTitle(mapName);
|
||||||
result.setDescription(description);
|
result.setDescription(description);
|
||||||
|
|
||||||
} catch (JAXBException e) {
|
} catch (JAXBException | IOException | TransformerException e) {
|
||||||
throw new ImporterException(e);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new ImporterException(e);
|
|
||||||
} catch (TransformerException e) {
|
|
||||||
throw new ImporterException(e);
|
throw new ImporterException(e);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -500,14 +497,10 @@ public class FreemindImporter
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Boolean folded = Boolean.valueOf(freeNode.getFOLDED());
|
final Boolean folded = Boolean.valueOf(freeNode.getFOLDED());
|
||||||
if (folded) {
|
|
||||||
wiseTopic.setShrink(folded);
|
wiseTopic.setShrink(folded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private String generateFontStyle(@NotNull Node node, @Nullable Font font) {
|
private String generateFontStyle(@NotNull Node node, @Nullable Font font) {
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user