From c37b632ac9be2fa7344057fad754d923def3698b Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sat, 29 Sep 2012 16:53:43 -0300 Subject: [PATCH] Fix FeeMind size conversion. Now it's mapped to the proper wise size. --- .../persistence/XMLSerializer_Pela.js | 38 +- .../src/main/webapp/samples/welcome.xml | 237 ++++-- .../importer/freemind/FreemindImporter.java | 34 +- .../test/resources/data/freemind/fonts.mmr | 20 +- .../test/resources/data/freemind/fonts.wxml | 20 +- .../resources/data/freemind/richtextnode.mm | 679 ++++++++++-------- .../resources/data/freemind/richtextnode.mmr | 44 +- .../resources/data/freemind/richtextnode.wxml | 53 +- 8 files changed, 677 insertions(+), 448 deletions(-) diff --git a/mindplot/src/main/javascript/persistence/XMLSerializer_Pela.js b/mindplot/src/main/javascript/persistence/XMLSerializer_Pela.js index 3308391f..3157fef7 100644 --- a/mindplot/src/main/javascript/persistence/XMLSerializer_Pela.js +++ b/mindplot/src/main/javascript/persistence/XMLSerializer_Pela.js @@ -255,33 +255,35 @@ mindplot.persistence.XMLSerializer_Pela = new Class({ } var topic = mindmap.createNode(type, id); + + // Set text property is it;s defined... var text = domElem.getAttribute('text'); if ($defined(text) && text) { topic.setText(text); + } - var fontStyle = domElem.getAttribute('fontStyle'); - if ($defined(fontStyle)) { - var font = fontStyle.split(';'); + var fontStyle = domElem.getAttribute('fontStyle'); + if ($defined(fontStyle) && fontStyle) { + var font = fontStyle.split(';'); - if (font[0]) { - topic.setFontFamily(font[0]); - } + if (font[0]) { + topic.setFontFamily(font[0]); + } - if (font[1]) { - topic.setFontSize(font[1]); - } + if (font[1]) { + topic.setFontSize(font[1]); + } - if (font[2]) { - topic.setFontColor(font[2]); - } + if (font[2]) { + topic.setFontColor(font[2]); + } - if (font[3]) { - topic.setFontWeight(font[3]); - } + if (font[3]) { + topic.setFontWeight(font[3]); + } - if (font[4]) { - topic.setFontStyle(font[4]); - } + if (font[4]) { + topic.setFontStyle(font[4]); } } diff --git a/wise-editor/src/main/webapp/samples/welcome.xml b/wise-editor/src/main/webapp/samples/welcome.xml index 5267dbee..69cdd8f8 100644 --- a/wise-editor/src/main/webapp/samples/welcome.xml +++ b/wise-editor/src/main/webapp/samples/welcome.xml @@ -1,52 +1,197 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - \ No newline at end of file + 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 f060d3b0..0687c0b5 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 @@ -58,6 +58,7 @@ public class FreemindImporter public static final int ROOT_LEVEL_TOPIC_HEIGHT = SECOND_LEVEL_TOPIC_HEIGHT; public static final int CENTRAL_TO_TOPIC_DISTANCE = 200; public static final int TOPIC_TO_TOPIC_DISTANCE = 90; + public static final String NODE_TYPE = "NODE"; private com.wisemapping.jaxb.wisemap.ObjectFactory mindmapObjectFactory; private static final String POSITION_LEFT = "left"; private static final String BOLD = "bold"; @@ -72,6 +73,10 @@ public class FreemindImporter private int currentId; + private static final int FONT_SIZE_HUGE = 15; + private static final int FONT_SIZE_LARGE = 10; + public static final int FONT_SIZE_NORMAL = 8; + private static final int FONT_SIZE_SMALL = 6; public static void main(String argv[]) { @@ -297,7 +302,7 @@ public class FreemindImporter final Richcontent content = (Richcontent) element; final String type = content.getTYPE(); - if (type.equals("NODE")) { + if (type.equals(NODE_TYPE)) { String text = html2text(content); currentWiseTopic.setText(text); } else { @@ -513,12 +518,15 @@ public class FreemindImporter final String text = freeNode.getTEXT(); wiseTopic.setText(text); + // Background color ... final String bgcolor = freeNode.getBACKGROUNDCOLOR(); wiseTopic.setBgColor(bgcolor); + final String shape = getShapeFormFromNode(freeNode); wiseTopic.setShape(shape); + // Check for styles ... final String fontStyle = generateFontStyle(freeNode, null); if (fontStyle != null) { wiseTopic.setFontStyle(fontStyle); @@ -540,9 +548,9 @@ public class FreemindImporter } - private + @Nullable - String generateFontStyle(@NotNull Node node, @Nullable Font font) { + private String generateFontStyle(@NotNull Node node, @Nullable Font font) { /* * MindmapFont format : fontName ; size ; color ; bold; italic; * eg: Verdana;10;#ffffff;bold;italic; @@ -556,10 +564,24 @@ public class FreemindImporter } fontStyle.append(";"); - // Size ... + // Freemind size goes from 10 to 28 + // WiseMapping: + // 6 Small + // 8 Normal + // 10 Large + // 15 Huge if (font != null) { - final BigInteger bigInteger = (font.getSIZE() == null || font.getSIZE().intValue() < 8) ? BigInteger.valueOf(8) : font.getSIZE(); - fontStyle.append(bigInteger); + final int fontSize = ((font.getSIZE() == null || font.getSIZE().intValue() < 8) ? BigInteger.valueOf(FONT_SIZE_NORMAL) : font.getSIZE()).intValue(); + int wiseFontSize = FONT_SIZE_SMALL; + if (fontSize >= 24) { + wiseFontSize = FONT_SIZE_HUGE; + } else if (fontSize >= 16) { + wiseFontSize = FONT_SIZE_LARGE; + }else if (fontSize >= 12) { + wiseFontSize = FONT_SIZE_NORMAL; + } + fontStyle.append(wiseFontSize); + } fontStyle.append(";"); diff --git a/wise-webapp/src/test/resources/data/freemind/fonts.mmr b/wise-webapp/src/test/resources/data/freemind/fonts.mmr index 785098f1..8e4014e7 100644 --- a/wise-webapp/src/test/resources/data/freemind/fonts.mmr +++ b/wise-webapp/src/test/resources/data/freemind/fonts.mmr @@ -3,37 +3,37 @@ - + - + - + - + - + - + - + - + - + - + diff --git a/wise-webapp/src/test/resources/data/freemind/fonts.wxml b/wise-webapp/src/test/resources/data/freemind/fonts.wxml index ea07cdfe..8303fff0 100644 --- a/wise-webapp/src/test/resources/data/freemind/fonts.wxml +++ b/wise-webapp/src/test/resources/data/freemind/fonts.wxml @@ -5,49 +5,49 @@ + fontStyle="Arial;8;;bold;;" shape="line"> + fontStyle="Arial;8;;;italic;" shape="line"> + fontStyle="Arial;6;;;;" shape="line"> + fontStyle="Arial;6;;;;" shape="line"> + fontStyle="Arial;6;;;;" shape="line"> + fontStyle="Arial;6;;;;" shape="line"> + fontStyle="Arial;8;;;;" shape="line"> + fontStyle="Arial;8;;;;" shape="line"> + fontStyle="Arial;8;;;;" shape="line"> + fontStyle="Arial;10;;;;" shape="line"> diff --git a/wise-webapp/src/test/resources/data/freemind/richtextnode.mm b/wise-webapp/src/test/resources/data/freemind/richtextnode.mm index 5b25cde7..98ae5c70 100644 --- a/wise-webapp/src/test/resources/data/freemind/richtextnode.mm +++ b/wise-webapp/src/test/resources/data/freemind/richtextnode.mm @@ -1,307 +1,376 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -

- 1) Adapter et améliorer -

-

- notre offre de services -

-

- selon l'évolution des besoins -

- -
- - - - - - - - - - - - - - - - - -

- 1.1. .Renforcer et structurer -

-

- le service "accueil et orientation" -

- -
- - - - - - - - - -

- 1.2. Adapter l'offre Halte-Garderie -

-

- aux besoins des familles -

- -
- - - - - - - - - -

- 1.3. Renforcer et structurer les services -

-

- de soutien à la parentalité -

- -
- - - - - - - - - -

- 1.4 Améliorer la qualité des -

-

- projets pédagogiques des ALSH -

- -
- - - - - - - - - -

- 1.5 Renforcer et améliorer les -

-

- activités de loisirs existantes -

- -
- - - - - - - - - -

- 1.6 Renforcer et améliorer les ateliers   -

-

- visant à  rompre l'isolement lié à la langue, -

-

- la pauvreté, la pression de la consommation -

- -
- - - -
- - - - - - -

- 2) Consolider nos moyens d'action : -

-

- locaux, organisation, communication interne -

- -
- - - - - - - - -

- 2.1 Formaliser notre offre de services -

-

- et les modèles économiques correspondants -

- -
- - - - - - - - - - -

- 2.2 Formaliser le "qui fait quoi" -

-

- en lien avec notre offre de service -

- -
- - - - - - - - - - -

- 2.3. Elaborer un projet immobilier de proximité -

-

- réalisable au  centre ville -

- -
- - - - -
- - - - - - -

- 3) Renforcer nos -

-

- partenariats et -

-

- notre notoriété -

- -
- - - - - - - - -

- 3.1 Organiser pour chaque segment de notre offre -

-

- l'identification et la rencontre des partenaires concernés -

- -
- - - - - - - - - - -

- 3.2 Formaliser et contractualiser les partenariats -

-

- émergeants autour d'actions communes -

- -
- - - - - - - - - - - - - - -

- 3.4 définir et faire vivre un plan de communication -

-

- à partir de notre segmentation de l'offre -

- -
- - - - -
-
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + 1) Adapter et améliorer + +

+

+ + notre offre de services + +

+

+ + selon l'évolution des besoins + + +

+ + +
+ + + + + + + + + + + + + + + + + + +

+ 1.1. .Renforcer et structurer +

+

+ le service "accueil et orientation" +

+ + +
+ + + + + + + + + + +

+ 1.2. Adapter l'offre Halte-Garderie +

+

+ aux besoins des familles +

+ + +
+ + + + + + + + + + +

+ 1.3. Renforcer et structurer les services +

+

+ de soutien à la parentalité +

+ + +
+ + + + + + + + + + +

+ 1.4 Améliorer la qualité des +

+

+ projets pédagogiques des ALSH +

+ + +
+ + + + + + + + + + +

+ 1.5 Renforcer et améliorer les +

+

+ activités de loisirs existantes +

+ + +
+ + + + + + + + + + +

+ 1.6 Renforcer et améliorer les ateliers   +

+

+ visant à  rompre l'isolement lié à la langue, +

+

+ la pauvreté, la pression de la consommation +

+ + +
+ + + +
+ + + + + + + +

+ 2) Consolider nos moyens d'action : +

+

+ locaux, organisation, communication interne +

+ + +
+ + + + + + + + + +

+ 2.1 Formaliser notre offre de services +

+

+ et les modèles économiques correspondants +

+ + +
+ + + + + + + + + + + +

+ 2.2 Formaliser le "qui fait quoi" +

+

+ en lien avec notre offre de service +

+ + +
+ + + + + + + + + + + +

+ 2.3. Elaborer un projet immobilier de proximité +

+

+ réalisable au  centre ville +

+ + +
+ + + + +
+ + + + + + + +

+ 3) Renforcer nos +

+

+ partenariats et +

+

+ notre notoriété +

+ + +
+ + + + + + + + + +

+ 3.1 Organiser pour chaque segment de notre offre +

+

+ l'identification et la rencontre des partenaires concernés +

+ + +
+ + + + + + + + + + + +

+ 3.2 Formaliser et contractualiser les partenariats +

+

+ émergeants autour d'actions communes +

+ + +
+ + + + + + + + + + + + + + + +

+ 3.4 définir et faire vivre un plan de communication +

+

+ à partir de notre segmentation de l'offre +

+ + +
+ + + + +
+
+
diff --git a/wise-webapp/src/test/resources/data/freemind/richtextnode.mmr b/wise-webapp/src/test/resources/data/freemind/richtextnode.mmr index f1cb63d5..b88c81da 100644 --- a/wise-webapp/src/test/resources/data/freemind/richtextnode.mmr +++ b/wise-webapp/src/test/resources/data/freemind/richtextnode.mmr @@ -1,28 +1,28 @@ - + - + - + - + - + - + - + @@ -34,65 +34,65 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/wise-webapp/src/test/resources/data/freemind/richtextnode.wxml b/wise-webapp/src/test/resources/data/freemind/richtextnode.wxml index 2d065ac4..e353d432 100644 --- a/wise-webapp/src/test/resources/data/freemind/richtextnode.wxml +++ b/wise-webapp/src/test/resources/data/freemind/richtextnode.wxml @@ -1,36 +1,36 @@ + fontStyle="Arial;10;#ff3300;bold;;" shape="rounded rectagle"> + bgColor="#ffff33" fontStyle="Arial;8;#0000cc;bold;;" shape="rounded rectagle"> + fontStyle="Arial;8;#006600;bold;;" shape="line"> + fontStyle="Arial;8;;;;" shape="line"> + fontStyle="Arial;8;;;;" shape="line"> + fontStyle="Arial;8;;;;" shape="line"> + bgColor="#99ffff" fontStyle="Arial;8;#0000cc;bold;;" shape="rounded rectagle"> @@ -64,7 +64,7 @@ du plan d'actions]]> + fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -72,8 +72,7 @@ du plan d'actions]]> + bgColor="#ffff00" fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -81,8 +80,7 @@ du plan d'actions]]> + bgColor="#66ff00" fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -90,8 +88,7 @@ du plan d'actions]]> + bgColor="#ffff00" fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -99,8 +96,7 @@ du plan d'actions]]> + bgColor="#ffcc00" fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -108,8 +104,7 @@ du plan d'actions]]> + bgColor="#66ff00" fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -120,12 +115,11 @@ du plan d'actions]]> + fontStyle="Arial;8;#0000cc;bold;;" shape="rounded rectagle"> + bgColor="#ffff00" fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -133,8 +127,7 @@ du plan d'actions]]> + bgColor="#ffcc00" fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -142,8 +135,7 @@ du plan d'actions]]> + bgColor="#66ff00" fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -152,13 +144,13 @@ du plan d'actions]]> + bgColor="#99ffff" fontStyle="Arial;8;#0000cc;bold;;" shape="rounded rectagle"> + fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -167,7 +159,7 @@ du plan d'actions]]> + fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -175,8 +167,7 @@ du plan d'actions]]> + bgColor="#ff6666" fontStyle="Arial;8;#006600;bold;;" shape="line"> @@ -184,7 +175,7 @@ du plan d'actions]]> + fontStyle="Arial;8;#006600;bold;;" shape="line">