mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-21 21:57:56 +01:00
Fix freeming import issue with fonts.
This commit is contained in:
parent
334c9820b3
commit
308250ab73
@ -31,6 +31,7 @@ import com.wisemapping.xml.freemind.Node;
|
||||
import com.wisemapping.xml.mindmap.RelationshipType;
|
||||
import com.wisemapping.xml.mindmap.TopicType;
|
||||
import com.wisemapping.xml.mindmap.Link;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
@ -421,23 +422,23 @@ public class FreemindImporter
|
||||
|
||||
boolean hasBold = Boolean.parseBoolean(font.getBOLD());
|
||||
|
||||
fontStyle.append(hasBold ? BOLD : null);
|
||||
fontStyle.append(hasBold ? BOLD : "");
|
||||
fontStyle.append(";");
|
||||
|
||||
boolean hasItalic = Boolean.parseBoolean(font.getITALIC());
|
||||
fontStyle.append(hasItalic ? ITALIC : null);
|
||||
fontStyle.append(hasItalic ? ITALIC : "");
|
||||
fontStyle.append(";");
|
||||
}
|
||||
|
||||
return fontStyle.toString();
|
||||
}
|
||||
|
||||
private String fixFontName(Font font) {
|
||||
String fontName = com.wisemapping.model.Font.ARIAL.getFontName(); // Default Font
|
||||
private @NotNull String fixFontName(@NotNull Font font) {
|
||||
String result = com.wisemapping.model.Font.ARIAL.getFontName(); // Default Font
|
||||
if (com.wisemapping.model.Font.isValidFont(font.getNAME())) {
|
||||
fontName = font.getNAME();
|
||||
result = font.getNAME();
|
||||
}
|
||||
return fontName;
|
||||
return result;
|
||||
}
|
||||
|
||||
private String getShapeFormFromNode(Node node) {
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
package com.wisemapping.model;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public enum Font {
|
||||
|
||||
VERDANA("Verdana"),
|
||||
@ -37,7 +39,7 @@ public enum Font {
|
||||
return fontName;
|
||||
}
|
||||
|
||||
public static boolean isValidFont(String font) {
|
||||
public static boolean isValidFont(@NotNull String font) {
|
||||
boolean isValid = false;
|
||||
try {
|
||||
if (font != null) {
|
||||
@ -45,6 +47,7 @@ public enum Font {
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException ignote) {
|
||||
// Ignore ...
|
||||
}
|
||||
|
||||
return isValid;
|
||||
|
40
wise-webapp/src/test/data/freemind/fonts.mm
Normal file
40
wise-webapp/src/test/data/freemind/fonts.mm
Normal file
@ -0,0 +1,40 @@
|
||||
<map version="0.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">
|
||||
<node CREATED="1301246795175" ID="ID_377120709" MODIFIED="1301246807857" TEXT="Bold">
|
||||
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
|
||||
</node>
|
||||
<node CREATED="1301246801304" ID="ID_634022293" MODIFIED="1301246805049" TEXT="Italic">
|
||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1301246811914" ID="ID_985556570" MODIFIED="1301246828567" POSITION="left" TEXT="Sizes">
|
||||
<node CREATED="1301246830694" ID="ID_1639638373" MODIFIED="1301247011414" TEXT="Normal----">
|
||||
<font NAME="SansSerif" SIZE="8"/>
|
||||
</node>
|
||||
<node CREATED="1301246896679" ID="ID_75566823" MODIFIED="1301247008837" TEXT="Normal---">
|
||||
<font NAME="SansSerif" SIZE="9"/>
|
||||
</node>
|
||||
<node CREATED="1301246906578" ID="ID_1461302973" MODIFIED="1301247006341" TEXT="Normal--">
|
||||
<font NAME="SansSerif" SIZE="10"/>
|
||||
</node>
|
||||
<node CREATED="1301246910322" ID="ID_665416540" MODIFIED="1301247003973" TEXT="Normal-">
|
||||
<font NAME="SansSerif" SIZE="11"/>
|
||||
</node>
|
||||
<node CREATED="1301246912939" ID="ID_233600021" MODIFIED="1301246915096" TEXT="Normal"/>
|
||||
<node CREATED="1301246859184" ID="ID_896947877" MODIFIED="1301247013502" TEXT="Nomal+">
|
||||
<font NAME="SansSerif" SIZE="13"/>
|
||||
</node>
|
||||
<node CREATED="1301246865377" ID="ID_1683824358" MODIFIED="1301247015230" TEXT="Normal++">
|
||||
<font NAME="SansSerif" SIZE="14"/>
|
||||
</node>
|
||||
<node CREATED="1301246869962" ID="ID_1125002733" MODIFIED="1301247017383" TEXT="Normal+++">
|
||||
<font NAME="SansSerif" SIZE="15"/>
|
||||
</node>
|
||||
<node CREATED="1301246885853" ID="ID_878767930" MODIFIED="1301247021344" TEXT="Normal++++">
|
||||
<font NAME="SansSerif" SIZE="16"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</map>
|
1
wise-webapp/src/test/data/freemind/fonts.mmr
Normal file
1
wise-webapp/src/test/data/freemind/fonts.mmr
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="Fonts" STYLE="elipse" ID="ID_0"><node TEXT="Styles" POSITION="right" ID="ID_1"><node TEXT="Bold" POSITION="right" ID="ID_2"><font SIZE="12" NAME="Arial" BOLD="true"/></node><node TEXT="Italic" POSITION="right" ID="ID_3"><font SIZE="12" NAME="Arial" ITALIC="true"/></node></node><node TEXT="Sizes" POSITION="left" ID="ID_4"><node TEXT="Normal----" POSITION="left" ID="ID_5"><font SIZE="8" NAME="Arial"/></node><node TEXT="Normal---" POSITION="left" ID="ID_6"><font SIZE="9" NAME="Arial"/></node><node TEXT="Normal--" POSITION="left" ID="ID_7"><font SIZE="10" NAME="Arial"/></node><node TEXT="Normal-" POSITION="left" ID="ID_8"><font SIZE="11" NAME="Arial"/></node><node TEXT="Normal" POSITION="left" ID="ID_9"/><node TEXT="Nomal+" POSITION="left" ID="ID_10"><font SIZE="13" NAME="Arial"/></node><node TEXT="Normal++" POSITION="left" ID="ID_11"><font SIZE="14" NAME="Arial"/></node><node TEXT="Normal+++" POSITION="left" ID="ID_12"><font SIZE="15" NAME="Arial"/></node><node TEXT="Normal++++" POSITION="left" ID="ID_13"><font SIZE="16" NAME="Arial"/></node></node></node></map>
|
Loading…
Reference in New Issue
Block a user