From 6d1b678c4869ae7e4aa0f36940c1c05ad9085dc3 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 28 Mar 2011 00:22:20 -0300 Subject: [PATCH] - Fix remove icon position - Import don't use elipse for freemind anymore - --- mindplot/src/main/javascript/ImageIcon.js | 3 +- mindplot/src/main/javascript/Tip.js | 36 +++++++++------ .../exporter/freemind/FreemindExporter.java | 44 +++++++++++-------- .../importer/freemind/FreemindImporter.java | 18 ++++---- wise-webapp/src/test/data/freemind/ToDo.txt | 2 +- wise-webapp/src/test/data/freemind/basic.mmr | 2 +- wise-webapp/src/test/data/freemind/fonts.mmr | 2 +- wise-webapp/src/test/data/freemind/icons.mmr | 2 +- wise-webapp/src/test/data/freemind/links.mmr | 2 +- .../src/test/data/freemind/node-styles.mmr | 2 +- 10 files changed, 65 insertions(+), 48 deletions(-) diff --git a/mindplot/src/main/javascript/ImageIcon.js b/mindplot/src/main/javascript/ImageIcon.js index 693f31da..463c0b86 100644 --- a/mindplot/src/main/javascript/ImageIcon.js +++ b/mindplot/src/main/javascript/ImageIcon.js @@ -149,6 +149,7 @@ mindplot.ImageIcon.prototype.getUiId = function() -mindplot.ImageIcon.prototype.ICON_FAMILIES = [{"id": "flag", "icons" : ["flag_blue","flag_green","flag_orange","flag_pink","flag_purple","flag_yellow"]},{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]},{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]},{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]},{"id": "funy", "icons" : ["funy_angel","funy_devilish","funy_glasses","funy_grin","funy_kiss","funy_monkey"]},{"id": "arrow", "icons" : ["arrow_up","arrow_down","arrow_left","arrow_right"]},{"id": "arrowc", "icons" : ["arrowc_rotate_anticlockwise","arrowc_rotate_clockwise","arrowc_turn_left","arrowc_turn_right"]},{"id": "conn", "icons" : ["conn_connect","conn_disconnect"]},{"id": "sport", "icons" : ["sport_basketball","sport_football","sport_golf","sport_raquet","sport_shuttlecock","sport_soccer","sport_tennis"]},{"id": "bulb", "icons" : ["bulb_light_on","bulb_light_off"]},{"id": "thumb", "icons" : ["thumb_thumb_up","thumb_thumb_down"]},{"id": "tick", "icons" : ["tick_tick","tick_cross"]},{"id": "onoff", "icons" : ["onoff_clock","onoff_clock_red","onoff_add","onoff_delete","onoff_status_offline","onoff_status_online"]},{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]},{"id": "time", "icons" : ["time_calendar","time_clock","time_hourglass"]},{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]},{"id": "sign", "icons" : ["sign_warning","sign_info","sign_stop","sign_help","sign_cancel"]},{"id": "hard", "icons" : ["hard_cd","hard_computer","hard_controller","hard_driver_disk","hard_ipod","hard_keyboard","hard_mouse","hard_printer"]},{"id": "soft", "icons" : ["soft_bug","soft_cursor","soft_database_table","soft_database","soft_feed","soft_folder_explore","soft_rss"]},{"id": "people", "icons" : ["people_group","people_male1","people_male2","people_female1","people_female2"]},{"id": "mail", "icons" : ["mail_envelop","mail_mailbox","mail_edit","mail_list"]},{"id": "object", "icons" : ["object_penguin","object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house"]}] +mindplot.ImageIcon.prototype.ICON_FAMILIES = [{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]},{"id": "funy", "icons" : ["funy_angel","funy_devilish","funy_glasses","funy_grin","funy_kiss","funy_monkey"]},{"id": "conn", "icons" : ["conn_connect","conn_disconnect"]},{"id": "sport", "icons" : ["sport_basketball","sport_football","sport_golf","sport_raquet","sport_shuttlecock","sport_soccer","sport_tennis"]},{"id": "bulb", "icons" : ["bulb_light_on","bulb_light_off"]},{"id": "thumb", "icons" : ["thumb_thumb_up","thumb_thumb_down"]},{"id": "tick", "icons" : ["tick_tick","tick_cross"]},{"id": "onoff", "icons" : ["onoff_clock","onoff_clock_red","onoff_add","onoff_delete","onoff_status_offline","onoff_status_online"]},{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]},{"id": "time", "icons" : ["time_calendar","time_clock","time_hourglass"]},{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]},{"id": "sign", "icons" : ["sign_warning","sign_info","sign_stop","sign_help","sign_cancel"]},{"id": "hard", "icons" : ["hard_cd","hard_computer","hard_controller","hard_driver_disk","hard_ipod","hard_keyboard","hard_mouse","hard_printer"]},{"id": "soft", "icons" : ["soft_bug","soft_cursor","soft_database_table","soft_database","soft_feed","soft_folder_explore","soft_rss","soft_penguin"]},{"id": "arrow", "icons" : ["arrow_up","arrow_down","arrow_left","arrow_right"]},{"id": "arrowc", "icons" : ["arrowc_rotate_anticlockwise","arrowc_rotate_clockwise","arrowc_turn_left","arrowc_turn_right"]},{"id": "people", "icons" : ["people_group","people_male1","people_male2","people_female1","people_female2"]},{"id": "mail", "icons" : ["mail_envelop","mail_mailbox","mail_edit","mail_list"]},{"id": "flag", "icons" : ["flag_blue","flag_green","flag_orange","flag_pink","flag_purple","flag_yellow"]},{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]},{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]},{"id": "object", "icons" : ["object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house","object_cake","object_camera","object_palette","object_rainbow"]}] + diff --git a/mindplot/src/main/javascript/Tip.js b/mindplot/src/main/javascript/Tip.js index 330ba9c5..8f987f7e 100644 --- a/mindplot/src/main/javascript/Tip.js +++ b/mindplot/src/main/javascript/Tip.js @@ -18,7 +18,8 @@ mindplot.Tip = function(divContainer){ this.initialize(divContainer); - }; +}; + mindplot.Tip.prototype.initialize=function(divContainer){ this.options={ panel:null, @@ -34,7 +35,8 @@ mindplot.Tip.prototype.initialize=function(divContainer){ this.buildTip(); this._isMouseOver=false; this._open=false; - }; +}; + mindplot.Tip.prototype.buildTip=function(){ var opts = this.options; var panel = new Element('div').addClass('bubbleContainer'); @@ -52,15 +54,18 @@ mindplot.Tip.prototype.buildTip=function(){ opts.panel.addEvent('mouseover',function(){this._isMouseOver=true;}.bind(this)); opts.panel.addEvent('mouseleave',function(event){this.close(event);}.bindWithEvent(this));//this.close.bindWithEvent(this) - }; +}; + mindplot.Tip.prototype.click= function(event, el) { return this.open(event, el); - }; +}; + mindplot.Tip.prototype.open= function(event, content, source){ this._isMouseOver=true; this._evt = new Event(event); this.doOpen.delay(500, this,[content,source]); - }; +}; + mindplot.Tip.prototype.doOpen= function(content, source){ if($chk(this._isMouseOver) &&!$chk(this._open) && !$chk(this._opening)) { @@ -73,14 +78,17 @@ mindplot.Tip.prototype.doOpen= function(content, source){ this.init(this._evt,source); $(this.options.panel).effect('opacity',{duration:500, onComplete:function(){this._open=true; this._opening = false;}.bind(this)}).start(0,100); } - }; +}; + mindplot.Tip.prototype.updatePosition=function(event){ this._evt = new Event(event); - }; +}; + mindplot.Tip.prototype.close=function(event){ this._isMouseOver=false; this.doClose.delay(50,this,new Event(event)); - }; +}; + mindplot.Tip.prototype.doClose=function(event){ if(!$chk(this._isMouseOver) && $chk(this._opening)) @@ -90,14 +98,16 @@ mindplot.Tip.prototype.doClose=function(event){ { this.forceClose(); } - }; +}; + mindplot.Tip.prototype.forceClose=function(){ this.options.panel.effect('opacity',{duration:100, onComplete:function(){ this._open=false; $(this.options.panel).setStyles({left:0,top:0}); $(this.options.container).remove(); }.bind(this)}).start(100,0); - }; +}; + mindplot.Tip.prototype.init=function(event,source){ var opts = this.options; var coordinates = $(opts.panel).getCoordinates(); @@ -114,13 +124,13 @@ mindplot.Tip.prototype.init=function(event,source){ this.buildTip(); $(this.options.container).inject(this.options.panel); this.moveTopic(offset, $(opts.panel).getCoordinates().height); - }; +}; mindplot.Tip.prototype.moveTopic=function(offset, panelHeight){ var opts = this.options; var width = $(opts.panel).getCoordinates().width; - $(opts.panel).setStyles({left:offset.x - (width/2), top:offset.y - (panelHeight*2)}); - }; + $(opts.panel).setStyles({left:offset.x - (width/2), top:offset.y - (panelHeight*2) + 35}); +}; mindplot.Tip.getInstance = function(divContainer) { diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/freemind/FreemindExporter.java b/wise-webapp/src/main/java/com/wisemapping/exporter/freemind/FreemindExporter.java index 2bdd19e1..d3b4ba27 100755 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/freemind/FreemindExporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/freemind/FreemindExporter.java @@ -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 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) { diff --git a/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java b/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java index d929d5fc..ddd2db6a 100755 --- a/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java @@ -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 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 topics = centralTopic.getTopic(); List leftTopics = new ArrayList(); List rightTopics = new ArrayList(); @@ -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; } } diff --git a/wise-webapp/src/test/data/freemind/ToDo.txt b/wise-webapp/src/test/data/freemind/ToDo.txt index 192fca58..41870ec6 100644 --- a/wise-webapp/src/test/data/freemind/ToDo.txt +++ b/wise-webapp/src/test/data/freemind/ToDo.txt @@ -1,4 +1,4 @@ -- Node Links +- Done: Node Links - Relationship between nodes - HTML embedded in nodes. diff --git a/wise-webapp/src/test/data/freemind/basic.mmr b/wise-webapp/src/test/data/freemind/basic.mmr index 7c198754..c145329e 100644 --- a/wise-webapp/src/test/data/freemind/basic.mmr +++ b/wise-webapp/src/test/data/freemind/basic.mmr @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/wise-webapp/src/test/data/freemind/fonts.mmr b/wise-webapp/src/test/data/freemind/fonts.mmr index 63458dfb..2bed53a3 100644 --- a/wise-webapp/src/test/data/freemind/fonts.mmr +++ b/wise-webapp/src/test/data/freemind/fonts.mmr @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/wise-webapp/src/test/data/freemind/icons.mmr b/wise-webapp/src/test/data/freemind/icons.mmr index bae0223d..1d464f26 100644 --- a/wise-webapp/src/test/data/freemind/icons.mmr +++ b/wise-webapp/src/test/data/freemind/icons.mmr @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/wise-webapp/src/test/data/freemind/links.mmr b/wise-webapp/src/test/data/freemind/links.mmr index cbf30856..050ce1d3 100644 --- a/wise-webapp/src/test/data/freemind/links.mmr +++ b/wise-webapp/src/test/data/freemind/links.mmr @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/wise-webapp/src/test/data/freemind/node-styles.mmr b/wise-webapp/src/test/data/freemind/node-styles.mmr index 9a700c04..41a26b82 100644 --- a/wise-webapp/src/test/data/freemind/node-styles.mmr +++ b/wise-webapp/src/test/data/freemind/node-styles.mmr @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file