- Fix remove icon position

- Import don't use elipse for freemind anymore
-
This commit is contained in:
Paulo Gustavo Veiga
2011-03-28 00:22:20 -03:00
parent a527404aa2
commit 6d1b678c48
10 changed files with 65 additions and 48 deletions

View File

@@ -22,7 +22,9 @@ import com.wisemapping.exporter.ExportException;
import com.wisemapping.exporter.Exporter;
import com.wisemapping.importer.freemind.FreemindIconConverter;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.ShapeStyle;
import com.wisemapping.util.JAXBUtils;
import com.wisemapping.xml.Style;
import com.wisemapping.xml.freemind.*;
import com.wisemapping.xml.mindmap.RelationshipType;
import com.wisemapping.xml.mindmap.TopicType;
@@ -90,7 +92,7 @@ public class FreemindExporter
freemindMap.setNode(main);
if (centerTopic != null) {
nodesMap.put(centerTopic.getId(), main);
setTopicPropertiesToNode(main, centerTopic);
setTopicPropertiesToNode(main, centerTopic, true);
addNodeFromTopic(centerTopic, main);
}
List<RelationshipType> relationships = mindmapMap.getRelationship();
@@ -119,7 +121,7 @@ public class FreemindExporter
for (TopicType topicType : currentTopic) {
final Node newNode = objectFactory.createNode();
nodesMap.put(topicType.getId(), newNode);
setTopicPropertiesToNode(newNode, topicType);
setTopicPropertiesToNode(newNode, topicType, false);
destNode.getArrowlinkOrCloudOrEdge().add(newNode);
addNodeFromTopic(topicType, newNode);
final String position = topicType.getPosition();
@@ -131,29 +133,33 @@ public class FreemindExporter
}
}
private void setTopicPropertiesToNode(com.wisemapping.xml.freemind.Node freemindNode, com.wisemapping.xml.mindmap.TopicType mindmapTopic) {
private void setTopicPropertiesToNode(@NotNull com.wisemapping.xml.freemind.Node freemindNode, @NotNull com.wisemapping.xml.mindmap.TopicType mindmapTopic, boolean isRoot) {
freemindNode.setID("ID_" + mindmapTopic.getId());
freemindNode.setTEXT(mindmapTopic.getText());
freemindNode.setBACKGROUNDCOLOR(mindmapTopic.getBgColor());
if (mindmapTopic.getShape() != null && !mindmapTopic.getShape().equals("line")) {
String style = mindmapTopic.getShape();
if ("rounded rectagle".equals(mindmapTopic.getShape())) {
style = "bubble";
final String shape = mindmapTopic.getShape();
if (shape != null && !shape.isEmpty()) {
if ( isRoot && !ShapeStyle.ROUNDED_RETAGLE.getStyle().endsWith(shape) || !isRoot && !ShapeStyle.LINE.getStyle().endsWith(shape) ) {
String style = shape;
if (ShapeStyle.ROUNDED_RETAGLE.getStyle().equals(shape)) {
style = "bubble";
}
freemindNode.setSTYLE(style);
}
freemindNode.setSTYLE(style);
addIconNode(freemindNode, mindmapTopic);
addLinkNode(freemindNode, mindmapTopic);
addFontNode(freemindNode, mindmapTopic);
addEdgeNode(freemindNode, mindmapTopic);
addNote(freemindNode, mindmapTopic);
Boolean shrink = mindmapTopic.isShrink();
if (shrink != null && shrink)
freemindNode.setFOLDED(String.valueOf(shrink));
}
addIconNode(freemindNode, mindmapTopic);
addLinkNode(freemindNode, mindmapTopic);
addFontNode(freemindNode, mindmapTopic);
addEdgeNode(freemindNode, mindmapTopic);
addNote(freemindNode, mindmapTopic);
Boolean shrink = mindmapTopic.isShrink();
if (shrink != null && shrink)
freemindNode.setFOLDED(String.valueOf(shrink));
}
private void addNote(com.wisemapping.xml.freemind.Node freemindNode, com.wisemapping.xml.mindmap.TopicType mindmapTopic) {

View File

@@ -74,7 +74,7 @@ public class FreemindImporter
centralTopic.setCentral(true);
setNodePropertiesToTopic(centralTopic, centralNode);
centralTopic.setShape(ShapeStyle.ELIPSE.getStyle());
centralTopic.setShape(ShapeStyle.ROUNDED_RETAGLE.getStyle());
mindmapMap.getTopic().add(centralTopic);
mindmapMap.setName(mapName);
@@ -104,7 +104,7 @@ public class FreemindImporter
return map;
}
private void addRelationships(com.wisemapping.xml.mindmap.Map mindmapMap) {
private void addRelationships(@NotNull com.wisemapping.xml.mindmap.Map mindmapMap) {
List<RelationshipType> mapRelationships = mindmapMap.getRelationship();
for (RelationshipType relationship : relationships) {
relationship.setId(String.valueOf(currentId++));
@@ -155,7 +155,7 @@ public class FreemindImporter
}
private void fixCentralTopicChildOrder(TopicType centralTopic) {
private void fixCentralTopicChildOrder(@NotNull TopicType centralTopic) {
List<TopicType> topics = centralTopic.getTopic();
List<TopicType> leftTopics = new ArrayList<TopicType>();
List<TopicType> rightTopics = new ArrayList<TopicType>();
@@ -479,14 +479,14 @@ public class FreemindImporter
return result;
}
private String getShapeFormFromNode(Node node) {
String shape = node.getSTYLE();
private @NotNull String getShapeFormFromNode(@NotNull Node node) {
String result = node.getSTYLE();
// In freemind a node without style is a line
if ("bubble".equals(shape)) {
shape = ShapeStyle.ROUNDED_RETAGLE.getStyle();
if ("bubble".equals(result)) {
result = ShapeStyle.ROUNDED_RETAGLE.getStyle();
} else {
shape = ShapeStyle.LINE.getStyle();
result = ShapeStyle.LINE.getStyle();
}
return shape;
return result;
}
}