mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Fix import NPE.
This commit is contained in:
parent
ad9d00843f
commit
a155477eff
@ -351,7 +351,7 @@ public class FreemindImporter
|
||||
* 3 -> 2
|
||||
* 4 -> 4
|
||||
*/
|
||||
private int calcFirstLevelOrder(@NotNull List<Object> freeChilden, @Nullable Node freeChild) {
|
||||
private int calcFirstLevelOrder(@NotNull List<Object> freeChilden, @NotNull Node freeChild) {
|
||||
final List<Node> nodes = new ArrayList<Node>();
|
||||
int result;
|
||||
|
||||
@ -361,7 +361,7 @@ public class FreemindImporter
|
||||
Node node = (Node) child;
|
||||
|
||||
final String side = node.getPOSITION();
|
||||
if (freeChild.getPOSITION().equals(side)) {
|
||||
if (side == freeChild.getPOSITION() || freeChild.getPOSITION().equals(side)) {
|
||||
nodes.add(node);
|
||||
}
|
||||
}
|
||||
@ -408,8 +408,7 @@ public class FreemindImporter
|
||||
if (depth == 1) {
|
||||
|
||||
final String side = freeChild.getPOSITION();
|
||||
assert side != null : "This should not happen";
|
||||
x = x * (POSITION_LEFT.equals(side) ? -1 : 1);
|
||||
x = x * (side!=null && POSITION_LEFT.equals(side) ? -1 : 1);
|
||||
} else {
|
||||
final Coord coord = Coord.parse(wiseParent.getPosition());
|
||||
x = x * (coord.isOnLeftSide() ? -1 : 1);
|
||||
@ -574,7 +573,7 @@ public class FreemindImporter
|
||||
wiseFontSize = FONT_SIZE_HUGE;
|
||||
} else if (fontSize >= 16) {
|
||||
wiseFontSize = FONT_SIZE_LARGE;
|
||||
}else if (fontSize >= 12) {
|
||||
} else if (fontSize >= 12) {
|
||||
wiseFontSize = FONT_SIZE_NORMAL;
|
||||
}
|
||||
fontStyle.append(wiseFontSize);
|
||||
@ -622,16 +621,15 @@ public class FreemindImporter
|
||||
String getShapeFormFromNode(@NotNull Node node) {
|
||||
String result = node.getSTYLE();
|
||||
// In freemind a node without style is a line
|
||||
if ("bubble".equals(result))
|
||||
{
|
||||
if ("bubble".equals(result)) {
|
||||
result = ShapeStyle.ROUNDED_RECTANGLE.getStyle();
|
||||
} else {
|
||||
if(node.getBACKGROUNDCOLOR()!=null){
|
||||
// This the node has background color defined. It's better to change the default shape.
|
||||
result = ShapeStyle.RECTANGLE.getStyle();
|
||||
} else {
|
||||
if (node.getBACKGROUNDCOLOR() != null) {
|
||||
// This the node has background color defined. It's better to change the default shape.
|
||||
result = ShapeStyle.RECTANGLE.getStyle();
|
||||
} else {
|
||||
result = ShapeStyle.LINE.getStyle();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
97
wise-webapp/src/test/resources/data/freemind/bug.mm
Normal file
97
wise-webapp/src/test/resources/data/freemind/bug.mm
Normal file
@ -0,0 +1,97 @@
|
||||
<map version="0.9.0">
|
||||
<node
|
||||
TEXT="Baugruppe :: Systemanforderungen">
|
||||
<node TEXT="[1] Motor
">
|
||||
<node TEXT="[27] Isolationssystem
">
|
||||
</node>
|
||||
<node TEXT="8[2]
">
|
||||
</node>
|
||||
<node TEXT="[170] Multiumrichterbetrieb
">
|
||||
</node>
|
||||
<node TEXT="[22] Thermistor
">
|
||||
</node>
|
||||
<node TEXT="[2] Stecker
">
|
||||
<node TEXT="[169]
">
|
||||
</node>
|
||||
<node TEXT="[5] Kabel
">
|
||||
</node>
|
||||
<node TEXT="8[31] Strombuchse
">
|
||||
<node TEXT="8[2] Stecker
">
|
||||
</node>
|
||||
<node TEXT="8[173] Stecker
">
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="8[173] Stecker
">
|
||||
<node TEXT="8[2] Stecker
">
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="8[1]
">
|
||||
</node>
|
||||
<node TEXT="8[5]
">
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="[185] Motor
">
|
||||
</node>
|
||||
<node TEXT="3 Umrichter">
|
||||
<node TEXT="[31] Strombuchse
">
|
||||
</node>
|
||||
<node TEXT="8[2] Stecker
">
|
||||
<node TEXT="8[31] Strombuchse
">
|
||||
</node>
|
||||
<node TEXT="8[173] Stecker
">
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="8[173] Stecker
">
|
||||
<node TEXT="8[2] Stecker
">
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="[4] max. Außenleiterspannung
">
|
||||
</node>
|
||||
<node TEXT="[13]">
|
||||
<node TEXT="[14]">
|
||||
<node TEXT="[15]
">
|
||||
</node>
|
||||
<node TEXT="[16]
">
|
||||
</node>
|
||||
<node TEXT="[17]
">
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="[18]">
|
||||
<node TEXT="[19]
">
|
||||
</node>
|
||||
<node TEXT="[20]
">
|
||||
</node>
|
||||
<node TEXT="[21]
">
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="3.3 Steuerung">
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="4 Bremse">
|
||||
<node TEXT="[172] Bremsansteuerung
">
|
||||
</node>
|
||||
<node TEXT="[173] Stecker
">
|
||||
<node TEXT="[175] Kabel
">
|
||||
</node>
|
||||
<node TEXT="8[2] Stecker
">
|
||||
<node TEXT="8[31] Strombuchse
">
|
||||
</node>
|
||||
<node TEXT="8[173] Stecker
">
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="[178] Bremslufthebel
">
|
||||
</node>
|
||||
<node TEXT="[179] Reaktionszeit
">
|
||||
</node>
|
||||
<node TEXT="[180] Bremsmoment
">
|
||||
</node>
|
||||
<node TEXT="[181] Notbetriebsart
">
|
||||
</node>
|
||||
<node TEXT="[182] Bremsüberwachung
">
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</map>
|
64
wise-webapp/src/test/resources/data/freemind/bug.mmr
Normal file
64
wise-webapp/src/test/resources/data/freemind/bug.mmr
Normal file
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<map version="0.9.0">
|
||||
<node TEXT="Baugruppe :: Systemanforderungen" ID="ID_0">
|
||||
<node TEXT="[1] Motor
" POSITION="right" ID="ID_1">
|
||||
<node TEXT="[27] Isolationssystem
" POSITION="right" ID="ID_2"/>
|
||||
<node TEXT="8[2]
" POSITION="right" ID="ID_3"/>
|
||||
<node TEXT="[170] Multiumrichterbetrieb
" POSITION="right" ID="ID_4"/>
|
||||
<node TEXT="[22] Thermistor
" POSITION="right" ID="ID_5"/>
|
||||
<node TEXT="[2] Stecker
" POSITION="right" ID="ID_6">
|
||||
<node TEXT="[169]
" POSITION="right" ID="ID_7"/>
|
||||
<node TEXT="[5] Kabel
" POSITION="right" ID="ID_8"/>
|
||||
<node TEXT="8[31] Strombuchse
" POSITION="right" ID="ID_9">
|
||||
<node TEXT="8[2] Stecker
" POSITION="right" ID="ID_10"/>
|
||||
<node TEXT="8[173] Stecker
" POSITION="right" ID="ID_11"/>
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="8[173] Stecker
" POSITION="right" ID="ID_12">
|
||||
<node TEXT="8[2] Stecker
" POSITION="right" ID="ID_13"/>
|
||||
</node>
|
||||
<node TEXT="8[1]
" POSITION="right" ID="ID_14"/>
|
||||
<node TEXT="8[5]
" POSITION="right" ID="ID_15"/>
|
||||
</node>
|
||||
<node TEXT="[185] Motor
" POSITION="right" ID="ID_16"/>
|
||||
<node TEXT="3 Umrichter" POSITION="right" ID="ID_17">
|
||||
<node TEXT="[31] Strombuchse
" POSITION="right" ID="ID_18"/>
|
||||
<node TEXT="8[2] Stecker
" POSITION="right" ID="ID_19">
|
||||
<node TEXT="8[31] Strombuchse
" POSITION="right" ID="ID_20"/>
|
||||
<node TEXT="8[173] Stecker
" POSITION="right" ID="ID_21"/>
|
||||
</node>
|
||||
<node TEXT="8[173] Stecker
" POSITION="right" ID="ID_22">
|
||||
<node TEXT="8[2] Stecker
" POSITION="right" ID="ID_23"/>
|
||||
</node>
|
||||
<node TEXT="[4] max. Außenleiterspannung
" POSITION="right" ID="ID_24"/>
|
||||
<node TEXT="[13]" POSITION="right" ID="ID_25">
|
||||
<node TEXT="[14]" POSITION="right" ID="ID_26">
|
||||
<node TEXT="[15]
" POSITION="right" ID="ID_27"/>
|
||||
<node TEXT="[16]
" POSITION="right" ID="ID_28"/>
|
||||
<node TEXT="[17]
" POSITION="right" ID="ID_29"/>
|
||||
</node>
|
||||
<node TEXT="[18]" POSITION="right" ID="ID_30">
|
||||
<node TEXT="[19]
" POSITION="right" ID="ID_31"/>
|
||||
<node TEXT="[20]
" POSITION="right" ID="ID_32"/>
|
||||
<node TEXT="[21]
" POSITION="right" ID="ID_33"/>
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="3.3 Steuerung" POSITION="right" ID="ID_34"/>
|
||||
</node>
|
||||
<node TEXT="4 Bremse" POSITION="right" ID="ID_35">
|
||||
<node TEXT="[172] Bremsansteuerung
" POSITION="right" ID="ID_36"/>
|
||||
<node TEXT="[173] Stecker
" POSITION="right" ID="ID_37">
|
||||
<node TEXT="[175] Kabel
" POSITION="right" ID="ID_38"/>
|
||||
<node TEXT="8[2] Stecker
" POSITION="right" ID="ID_39">
|
||||
<node TEXT="8[31] Strombuchse
" POSITION="right" ID="ID_40"/>
|
||||
<node TEXT="8[173] Stecker
" POSITION="right" ID="ID_41"/>
|
||||
</node>
|
||||
</node>
|
||||
<node TEXT="[178] Bremslufthebel
" POSITION="right" ID="ID_42"/>
|
||||
<node TEXT="[179] Reaktionszeit
" POSITION="right" ID="ID_43"/>
|
||||
<node TEXT="[180] Bremsmoment
" POSITION="right" ID="ID_44"/>
|
||||
<node TEXT="[181] Notbetriebsart
" POSITION="right" ID="ID_45"/>
|
||||
<node TEXT="[182] Bremsüberwachung
" POSITION="right" ID="ID_46"/>
|
||||
</node>
|
||||
</node>
|
||||
</map>
|
144
wise-webapp/src/test/resources/data/freemind/bug.wxml
Normal file
144
wise-webapp/src/test/resources/data/freemind/bug.wxml
Normal file
@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="tango" name="basic">
|
||||
<topic id="0" central="true" position="0,0" shape="rounded rectagle">
|
||||
<text><![CDATA[Baugruppe :: Systemanforderungen]]></text>
|
||||
<topic id="1" position="200,-100" order="3" shape="line">
|
||||
<text><![CDATA[[1] Motor
]]></text>
|
||||
<topic id="2" position="290,-200" order="0" shape="line">
|
||||
<text><![CDATA[[27] Isolationssystem
]]></text>
|
||||
</topic>
|
||||
<topic id="3" position="290,-175" order="1" shape="line">
|
||||
<text><![CDATA[8[2]
]]></text>
|
||||
</topic>
|
||||
<topic id="4" position="290,-150" order="2" shape="line">
|
||||
<text><![CDATA[[170] Multiumrichterbetrieb
]]></text>
|
||||
</topic>
|
||||
<topic id="5" position="290,-125" order="3" shape="line">
|
||||
<text><![CDATA[[22] Thermistor
]]></text>
|
||||
</topic>
|
||||
<topic id="6" position="290,-100" order="4" shape="line">
|
||||
<text><![CDATA[[2] Stecker
]]></text>
|
||||
<topic id="7" position="380,-125" order="0" shape="line">
|
||||
<text><![CDATA[[169]
]]></text>
|
||||
</topic>
|
||||
<topic id="8" position="380,-100" order="1" shape="line">
|
||||
<text><![CDATA[[5] Kabel
]]></text>
|
||||
</topic>
|
||||
<topic id="9" position="380,-75" order="2" shape="line">
|
||||
<text><![CDATA[8[31] Strombuchse
]]></text>
|
||||
<topic id="10" position="470,-100" order="0" shape="line">
|
||||
<text><![CDATA[8[2] Stecker
]]></text>
|
||||
</topic>
|
||||
<topic id="11" position="470,-75" order="1" shape="line">
|
||||
<text><![CDATA[8[173] Stecker
]]></text>
|
||||
</topic>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic id="12" position="290,-75" order="5" shape="line">
|
||||
<text><![CDATA[8[173] Stecker
]]></text>
|
||||
<topic id="13" position="380,-75" order="0" shape="line">
|
||||
<text><![CDATA[8[2] Stecker
]]></text>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic id="14" position="290,-50" order="6" shape="line">
|
||||
<text><![CDATA[8[1]
]]></text>
|
||||
</topic>
|
||||
<topic id="15" position="290,-25" order="7" shape="line">
|
||||
<text><![CDATA[8[5]
]]></text>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic id="16" position="200,0" order="0" shape="line">
|
||||
<text><![CDATA[[185] Motor
]]></text>
|
||||
</topic>
|
||||
<topic id="17" position="200,100" order="4" shape="line">
|
||||
<text><![CDATA[3 Umrichter]]></text>
|
||||
<topic id="18" position="290,25" order="0" shape="line">
|
||||
<text><![CDATA[[31] Strombuchse
]]></text>
|
||||
</topic>
|
||||
<topic id="19" position="290,50" order="1" shape="line">
|
||||
<text><![CDATA[8[2] Stecker
]]></text>
|
||||
<topic id="20" position="380,25" order="0" shape="line">
|
||||
<text><![CDATA[8[31] Strombuchse
]]></text>
|
||||
</topic>
|
||||
<topic id="21" position="380,50" order="1" shape="line">
|
||||
<text><![CDATA[8[173] Stecker
]]></text>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic id="22" position="290,75" order="2" shape="line">
|
||||
<text><![CDATA[8[173] Stecker
]]></text>
|
||||
<topic id="23" position="380,75" order="0" shape="line">
|
||||
<text><![CDATA[8[2] Stecker
]]></text>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic id="24" position="290,100" order="3" shape="line">
|
||||
<text><![CDATA[[4] max. Außenleiterspannung
]]></text>
|
||||
</topic>
|
||||
<topic id="25" position="290,125" order="4" shape="line">
|
||||
<text><![CDATA[[13]]]></text>
|
||||
<topic id="26" position="380,100" order="0" shape="line">
|
||||
<text><![CDATA[[14]]]></text>
|
||||
<topic id="27" position="470,75" order="0" shape="line">
|
||||
<text><![CDATA[[15]
]]></text>
|
||||
</topic>
|
||||
<topic id="28" position="470,100" order="1" shape="line">
|
||||
<text><![CDATA[[16]
]]></text>
|
||||
</topic>
|
||||
<topic id="29" position="470,125" order="2" shape="line">
|
||||
<text><![CDATA[[17]
]]></text>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic id="30" position="380,125" order="1" shape="line">
|
||||
<text><![CDATA[[18]]]></text>
|
||||
<topic id="31" position="470,100" order="0" shape="line">
|
||||
<text><![CDATA[[19]
]]></text>
|
||||
</topic>
|
||||
<topic id="32" position="470,125" order="1" shape="line">
|
||||
<text><![CDATA[[20]
]]></text>
|
||||
</topic>
|
||||
<topic id="33" position="470,150" order="2" shape="line">
|
||||
<text><![CDATA[[21]
]]></text>
|
||||
</topic>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic id="34" position="290,150" order="5" shape="line">
|
||||
<text><![CDATA[3.3 Steuerung]]></text>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic id="35" position="200,200" order="8" shape="line">
|
||||
<text><![CDATA[4 Bremse]]></text>
|
||||
<topic id="36" position="290,125" order="0" shape="line">
|
||||
<text><![CDATA[[172] Bremsansteuerung
]]></text>
|
||||
</topic>
|
||||
<topic id="37" position="290,150" order="1" shape="line">
|
||||
<text><![CDATA[[173] Stecker
]]></text>
|
||||
<topic id="38" position="380,125" order="0" shape="line">
|
||||
<text><![CDATA[[175] Kabel
]]></text>
|
||||
</topic>
|
||||
<topic id="39" position="380,150" order="1" shape="line">
|
||||
<text><![CDATA[8[2] Stecker
]]></text>
|
||||
<topic id="40" position="470,125" order="0" shape="line">
|
||||
<text><![CDATA[8[31] Strombuchse
]]></text>
|
||||
</topic>
|
||||
<topic id="41" position="470,150" order="1" shape="line">
|
||||
<text><![CDATA[8[173] Stecker
]]></text>
|
||||
</topic>
|
||||
</topic>
|
||||
</topic>
|
||||
<topic id="42" position="290,175" order="2" shape="line">
|
||||
<text><![CDATA[[178] Bremslufthebel
]]></text>
|
||||
</topic>
|
||||
<topic id="43" position="290,200" order="3" shape="line">
|
||||
<text><![CDATA[[179] Reaktionszeit
]]></text>
|
||||
</topic>
|
||||
<topic id="44" position="290,225" order="4" shape="line">
|
||||
<text><![CDATA[[180] Bremsmoment
]]></text>
|
||||
</topic>
|
||||
<topic id="45" position="290,250" order="5" shape="line">
|
||||
<text><![CDATA[[181] Notbetriebsart
]]></text>
|
||||
</topic>
|
||||
<topic id="46" position="290,275" order="6" shape="line">
|
||||
<text><![CDATA[[182] Bremsüberwachung
]]></text>
|
||||
</topic>
|
||||
</topic>
|
||||
</topic>
|
||||
</map>
|
Loading…
Reference in New Issue
Block a user