Fix freeming import issue with fonts.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user