diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java index 29dc8c15..fdc9d7b1 100755 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java @@ -42,6 +42,7 @@ import java.io.OutputStream; import java.io.ByteArrayInputStream; import java.io.UnsupportedEncodingException; import java.math.BigInteger; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -136,6 +137,7 @@ public class FreemindExporter private void addNodeFromTopic(@NotNull final TopicType mainTopic, @NotNull final Node destNode) throws IOException, SAXException, ParserConfigurationException { final List currentTopic = mainTopic.getTopic(); + Collections.sort(currentTopic, new VerticalPositionComparator()); for (TopicType topicType : currentTopic) { final Node newNode = objectFactory.createNode(); nodesMap.put(topicType.getId(), newNode); diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/VerticalPositionComparator.java b/wise-webapp/src/main/java/com/wisemapping/exporter/VerticalPositionComparator.java new file mode 100644 index 00000000..ccac4dd2 --- /dev/null +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/VerticalPositionComparator.java @@ -0,0 +1,18 @@ +package com.wisemapping.exporter; + +import com.wisemapping.jaxb.wisemap.TopicType; + +import java.util.Comparator; + +public class VerticalPositionComparator implements Comparator { + + @Override + public int compare(TopicType o1, TopicType o2) { + final String myPosition = o1.getPosition(); + final String otherPosition = o2.getPosition(); + int myPositionY = Integer.parseInt(myPosition.split(",")[1]); + int otherPositionY = Integer.parseInt(otherPosition.split(",")[1]); + return myPositionY - otherPositionY; + } + +}