Fix image mappings issue during export/import to freemind.

This commit is contained in:
Paulo Gustavo Veiga 2011-03-20 22:49:31 -03:00
parent 4ae0258411
commit d5ac7376b3
13 changed files with 518 additions and 405 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
wisemapping.ipr
wisemapping.iws
wisemapping.iml
wise-webapp/wisemapping.log

View File

@ -20,6 +20,7 @@ package com.wisemapping.exporter.freemind;
import com.wisemapping.exporter.ExportException;
import com.wisemapping.exporter.Exporter;
import com.wisemapping.importer.freemind.FreemindIconConverter;
import com.wisemapping.model.MindMap;
import com.wisemapping.util.JAXBUtils;
import com.wisemapping.xml.freemind.*;
@ -174,10 +175,13 @@ public class FreemindExporter
final List<Icon> iconsList = mindmapTopic.getIcon();
for (Icon icon : iconsList) {
final String id = icon.getId();
com.wisemapping.xml.freemind.Icon freemindIcon = new com.wisemapping.xml.freemind.Icon();
final String freemindIconId = FreemindIconMapper.getFreemindIcon(id);
freemindIcon.setBUILTIN(freemindIconId);
freemindNode.getArrowlinkOrCloudOrEdge().add(freemindIcon);
final String freemindIconId = FreemindIconConverter.toFreemindId(id);
if (freemindIconId != null) {
com.wisemapping.xml.freemind.Icon freemindIcon = new com.wisemapping.xml.freemind.Icon();
freemindIcon.setBUILTIN(freemindIconId);
freemindNode.getArrowlinkOrCloudOrEdge().add(freemindIcon);
}
}
}
}

View File

@ -1,86 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.exporter.freemind;
import com.wisemapping.model.MindmapImagesFactory;
import com.wisemapping.model.ImageFamily;
import com.wisemapping.model.MindmapImage;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
public class FreemindIconMapper {
private static Map<String,String> mindmapImageToFreemind = new HashMap<String,String>();
private static final String DEFAULT_ICON = "button_ok";
public FreemindIconMapper()
{
}
public static String getFreemindIcon(String mindmapImageId)
{
String freemindIconId = mindmapImageToFreemind.get(mindmapImageId);
// The image doesn´t exists in freemind select he default image
if (freemindIconId == null)
{
freemindIconId = DEFAULT_ICON;
}
return freemindIconId;
}
static {
List<MindmapImage> images = MindmapImagesFactory.getImagesByFamily(ImageFamily.BULLET);
for (int idx=0; idx < images.size() ; idx++)
{
mindmapImageToFreemind.put(images.get(idx).getId(), "full-"+(idx+1));
}
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.FLAG);
for (MindmapImage mindmapImage : images) {
mindmapImageToFreemind.put(mindmapImage.getId(), "flag");
}
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.BULB);
mindmapImageToFreemind.put(images.get(0).getId(), "idea");
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.TICK);
mindmapImageToFreemind.put(images.get(0).getId(), "button_ok");
mindmapImageToFreemind.put(images.get(1).getId(), "button_cancel");
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.ARROW);
mindmapImageToFreemind.put(images.get(2).getId(), "back");
mindmapImageToFreemind.put(images.get(3).getId(), "forward");
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.FACE);
mindmapImageToFreemind.put(images.get(3).getId(), "ksmiletris");
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.FLAG);
for (MindmapImage mindmapImage : images) {
mindmapImageToFreemind.put(mindmapImage.getId(), "flag");
}
}
}

View File

@ -0,0 +1,99 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.importer.freemind;
import com.wisemapping.model.MindmapIcon;
import com.wisemapping.model.MindmapIcons;
import com.wisemapping.model.IconFamily;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
final public class FreemindIconConverter {
private final static Map<String, MindmapIcon> freeIdToIcon = new HashMap<String, MindmapIcon>();
private final static Map<MindmapIcon, String> iconToFreeId = new HashMap<MindmapIcon, String>();
private static final MindmapIcon DEFAULT_ICON = MindmapIcons.getIconByFamily(IconFamily.BULLET).get(3);
private FreemindIconConverter() {
}
@Nullable
public static String toWiseId(@NotNull String iconId) {
final MindmapIcon result = freeIdToIcon.get(iconId);
return result!=null?result.getId():null;
}
@Nullable
public static String toFreemindId(@NotNull String iconId) {
return iconToFreeId.get(MindmapIcons.findById(iconId));
}
static {
// Load bullets image mapping ...
final List<MindmapIcon> bulletsImages = MindmapIcons.getIconByFamily(IconFamily.BULLET);
for (int i = 0; i < bulletsImages.size(); i++) {
final MindmapIcon icon = bulletsImages.get(i);
iconToFreeId.put(icon, "full-" + i);
}
final List<MindmapIcon> bulbImages = MindmapIcons.getIconByFamily(IconFamily.BULB);
iconToFreeId.put(bulbImages.get(0), "idea");
final List<MindmapIcon> tickImages = MindmapIcons.getIconByFamily(IconFamily.TICK);
iconToFreeId.put(tickImages.get(0), "button_ok");
iconToFreeId.put(tickImages.get(1), "button_cancel");
// Map arrow icons ...
iconToFreeId.put(MindmapIcons.ARROW_UP, "up");
iconToFreeId.put(MindmapIcons.ARROW_DOWN, "down");
iconToFreeId.put(MindmapIcons.ARROW_RIGHT, "back");
iconToFreeId.put(MindmapIcons.ARROW_LEFT, "forward");
// Map smile icons ...
iconToFreeId.put(MindmapIcons.FACE_PLAIN, "smiley-neutral");
iconToFreeId.put(MindmapIcons.FACE_SMILE, "ksmiletris");
iconToFreeId.put(MindmapIcons.FACE_SURPRISE, "smiley-oh");
iconToFreeId.put(MindmapIcons.FACE_SAD, "smiley_bad");
// Maps Flag familly Icons ...
final List<MindmapIcon> flagImages = MindmapIcons.getIconByFamily(IconFamily.FLAG);
for (MindmapIcon flagImage : flagImages) {
iconToFreeId.put(flagImage, "flag-" + flagImage.getName());
}
final Set<MindmapIcon> mindmapIcons = iconToFreeId.keySet();
for (MindmapIcon mindmapIcon : mindmapIcons) {
freeIdToIcon.put(iconToFreeId.get(mindmapIcon), mindmapIcon);
}
}
}

View File

@ -1,84 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.importer.freemind;
import com.wisemapping.model.MindmapImage;
import com.wisemapping.model.MindmapImagesFactory;
import com.wisemapping.model.ImageFamily;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
public class FreemindIconMapper {
private static Map<String,String> freemindToMindmapIcon = new HashMap<String,String>();
private static final MindmapImage DEFAULT_ICON = MindmapImagesFactory.getImagesByFamily(ImageFamily.BULLET).get(3);
public FreemindIconMapper()
{
}
public static String getMindmapIcon(String freemindIconId)
{
String iconId = freemindToMindmapIcon.get(freemindIconId);
// The image doesn´t exists in freemind select he default image
if (iconId == null)
{
iconId = DEFAULT_ICON.getId();
}
return iconId;
}
static {
List<MindmapImage> images = MindmapImagesFactory.getImagesByFamily(ImageFamily.BULLET);
freemindToMindmapIcon.put( "full-1",images.get(0).getId());
freemindToMindmapIcon.put( "full-2",images.get(1).getId());
freemindToMindmapIcon.put( "full-3",images.get(2).getId());
freemindToMindmapIcon.put( "full-4",images.get(3).getId());
freemindToMindmapIcon.put( "full-5",images.get(4).getId());
freemindToMindmapIcon.put( "full-6",images.get(5).getId());
freemindToMindmapIcon.put( "full-7",images.get(6).getId());
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.BULB);
freemindToMindmapIcon.put( "idea",images.get(0).getId());
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.TICK);
freemindToMindmapIcon.put( "button_ok",images.get(0).getId());
freemindToMindmapIcon.put( "button_cancel",images.get(1).getId());
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.ARROW);
freemindToMindmapIcon.put( "back",images.get(2).getId());
freemindToMindmapIcon.put( "forward",images.get(3).getId());
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.FACE);
freemindToMindmapIcon.put( "ksmiletris",images.get(3).getId());
images = MindmapImagesFactory.getImagesByFamily(ImageFamily.FLAG);
final MindmapImage orangeFlag = images.get(2);
freemindToMindmapIcon.put("flag", orangeFlag.getId());
}
}

View File

@ -266,17 +266,22 @@ public class FreemindImporter
currentTopic.setBrColor(edge.getCOLOR());
} else if (freemindNode instanceof Icon) {
final Icon freemindIcon = (Icon) freemindNode;
final com.wisemapping.xml.mindmap.Icon mindmapIcon = new com.wisemapping.xml.mindmap.Icon();
final String mindmapIconId = FreemindIconMapper.getMindmapIcon(freemindIcon.getBUILTIN());
mindmapIcon.setId(mindmapIconId);
currentTopic.getIcon().add(mindmapIcon);
String iconId = freemindIcon.getBUILTIN();
final String wiseIconId = FreemindIconConverter.toWiseId(iconId);
if (wiseIconId != null) {
final com.wisemapping.xml.mindmap.Icon mindmapIcon = new com.wisemapping.xml.mindmap.Icon();
mindmapIcon.setId(wiseIconId);
currentTopic.getIcon().add(mindmapIcon);
}
} else if (freemindNode instanceof Hook) {
final Hook hook = (Hook) freemindNode;
final com.wisemapping.xml.mindmap.Note mindmapNote = new com.wisemapping.xml.mindmap.Note();
String textNote = hook.getText();
if (textNote == null) // It is not a note is a BlinkingNodeHook or AutomaticLayout Hook
{
textNote = textNote != null ? textNote.replaceAll("\n", "%0A") : EMPTY_NOTE;
textNote = EMPTY_NOTE;
mindmapNote.setText(textNote);
currentTopic.setNote(mindmapNote);
}
@ -285,9 +290,9 @@ public class FreemindImporter
final String type = content.getTYPE();
if (type.equals("NODE")) {
final String text = getText(content);
text.replaceAll("\n", "");
text.trim();
String text = getText(content);
text = text.replaceAll("\n", "");
text = text.trim();
currentTopic.setText(text);
} else {
String text = getRichContent(content);

View File

@ -18,12 +18,12 @@
package com.wisemapping.model;
public enum ImageFamily {
public enum IconFamily {
FLAG("FLAG","flag_"),
BULLET("BULLET","bullet_"),
TAG("TAG","tag_"),
NUMBER("NUMBER","number_"),
FACE("FACE","face_"),
SMILEY("FACE","face_"),
FACE_FUNY("FACEFUNY","facefuny_"),
ARROW("ARROW","arrow_"),
ARROWC("ARROWC","arrowc_"),
@ -39,7 +39,7 @@ public enum ImageFamily {
private String prefix;
private String name;
ImageFamily(String name, String prefix) {
IconFamily(String name, String prefix) {
this.name = name;
this.prefix = prefix;
}

View File

@ -18,12 +18,12 @@
package com.wisemapping.model;
public class MindmapImage
public class MindmapIcon
{
private String name;
private ImageFamily family;
private IconFamily family;
public MindmapImage(String name, ImageFamily family)
MindmapIcon(IconFamily family, String name)
{
this.name = name;
this.family = family;
@ -34,7 +34,7 @@ public class MindmapImage
return name;
}
public ImageFamily getFamily()
public IconFamily getFamily()
{
return family;
}

View File

@ -0,0 +1,226 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.model;
import org.jetbrains.annotations.NotNull;
import java.util.*;
public class MindmapIcons {
private static Map<IconFamily, List<MindmapIcon>> images = new HashMap<IconFamily, List<MindmapIcon>>();
public static final MindmapIcon FACE_PLAIN = new MindmapIcon(IconFamily.SMILEY, "plain");
public static final MindmapIcon FACE_SAD = new MindmapIcon(IconFamily.SMILEY, "sad");
public static final MindmapIcon FACE_CRYING = new MindmapIcon(IconFamily.SMILEY, "crying");
public static final MindmapIcon FACE_SMILE = new MindmapIcon(IconFamily.SMILEY, "smile");
public static final MindmapIcon FACE_SURPRISE = new MindmapIcon(IconFamily.SMILEY, "surprise");
public static final MindmapIcon FACE_WINK = new MindmapIcon(IconFamily.SMILEY, "wink");
public static final MindmapIcon THUMB__UP = new MindmapIcon(IconFamily.THUMB, "thumb_up");
public static final MindmapIcon THUMB_DOWN = new MindmapIcon(IconFamily.THUMB, "thumb_down");
public static final MindmapIcon ARROW_UP = new MindmapIcon(IconFamily.ARROW, "up");
public static final MindmapIcon ARROW_DOWN = new MindmapIcon(IconFamily.ARROW, "down");
public static final MindmapIcon ARROW_LEFT = new MindmapIcon(IconFamily.ARROW, "left");
public static final MindmapIcon ARROW_RIGHT = new MindmapIcon(IconFamily.ARROW, "right");
static {
images.put(IconFamily.BULLET, getImagesBullet());
images.put(IconFamily.FLAG, getImagesFlag());
images.put(IconFamily.NUMBER, getImagesNumber());
images.put(IconFamily.TAG, getImagesTag());
images.put(IconFamily.TASK, getImagesTask());
images.put(IconFamily.SMILEY, getImagesFaces());
images.put(IconFamily.BULB, getImagesBulb());
images.put(IconFamily.ARROW, getImagesArrow());
images.put(IconFamily.ARROWC, getImagesArrowC());
images.put(IconFamily.CONN, getImagesConn());
images.put(IconFamily.THUMB, getImagesThumbs());
images.put(IconFamily.TICK, getImagesTick());
images.put(IconFamily.ONOFF, getImagesOnOff());
images.put(IconFamily.MONEY, getImagesMoney());
images.put(IconFamily.CHART, getImagesChart());
}
private static List<MindmapIcon> getImagesFaces() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(FACE_PLAIN);
images.add(FACE_SAD);
images.add(FACE_CRYING);
images.add(FACE_SMILE);
images.add(FACE_SURPRISE);
images.add(FACE_WINK);
return images;
}
private static List<MindmapIcon> getImagesArrow() {
final List<MindmapIcon> result = new ArrayList<MindmapIcon>();
result.add(ARROW_UP);
result.add(ARROW_DOWN);
result.add(ARROW_LEFT);
result.add(ARROW_RIGHT);
return result;
}
private static List<MindmapIcon> getImagesArrowC() {
final List<MindmapIcon> result = new ArrayList<MindmapIcon>();
result.add(new MindmapIcon(IconFamily.ARROWC, "undo"));
result.add(new MindmapIcon(IconFamily.ARROWC, "rotate_anticlockwise"));
result.add(new MindmapIcon(IconFamily.ARROWC, "rotate_clockwise"));
result.add(new MindmapIcon(IconFamily.ARROWC, "turn_left"));
result.add(new MindmapIcon(IconFamily.ARROWC, "turn_right"));
return result;
}
private static List<MindmapIcon> getImagesBulb() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.BULB, "light_on"));
images.add(new MindmapIcon(IconFamily.BULB, "light_off"));
return images;
}
private static List<MindmapIcon> getImagesTick() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.TICK, "tick"));
images.add(new MindmapIcon(IconFamily.TICK, "cross"));
return images;
}
private static List<MindmapIcon> getImagesChart() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.CHART, "bar"));
images.add(new MindmapIcon(IconFamily.CHART, "line"));
images.add(new MindmapIcon(IconFamily.CHART, "curve"));
images.add(new MindmapIcon(IconFamily.CHART, "pie"));
images.add(new MindmapIcon(IconFamily.CHART, "organisation"));
return images;
}
private static List<MindmapIcon> getImagesOnOff() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.ONOFF, "clock"));
images.add(new MindmapIcon(IconFamily.ONOFF, "clock_red"));
images.add(new MindmapIcon(IconFamily.ONOFF, "add"));
images.add(new MindmapIcon(IconFamily.ONOFF, "delete"));
return images;
}
private static List<MindmapIcon> getImagesMoney() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.MONEY, "money"));
images.add(new MindmapIcon(IconFamily.MONEY, "dollar"));
images.add(new MindmapIcon(IconFamily.MONEY, "euro"));
images.add(new MindmapIcon(IconFamily.MONEY, "pound"));
images.add(new MindmapIcon(IconFamily.MONEY, "yen"));
images.add(new MindmapIcon(IconFamily.MONEY, "coins"));
images.add(new MindmapIcon(IconFamily.MONEY, "ruby"));
return images;
}
private static List<MindmapIcon> getImagesThumbs() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(THUMB__UP);
images.add(THUMB_DOWN);
return images;
}
private static List<MindmapIcon> getImagesConn() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.CONN, "connect"));
images.add(new MindmapIcon(IconFamily.CONN, "disconnect"));
return images;
}
private static List<MindmapIcon> getImagesBullet() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.BULLET, "black"));
images.add(new MindmapIcon(IconFamily.BULLET, "blue"));
images.add(new MindmapIcon(IconFamily.BULLET, "green"));
images.add(new MindmapIcon(IconFamily.BULLET, "orange"));
images.add(new MindmapIcon(IconFamily.BULLET, "red"));
images.add(new MindmapIcon(IconFamily.BULLET, "pink"));
images.add(new MindmapIcon(IconFamily.BULLET, "purple"));
return images;
}
private static List<MindmapIcon> getImagesFlag() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.FLAG, "blue"));
images.add(new MindmapIcon(IconFamily.FLAG, "green"));
images.add(new MindmapIcon(IconFamily.FLAG, "orange"));
images.add(new MindmapIcon(IconFamily.FLAG, "pink"));
images.add(new MindmapIcon(IconFamily.FLAG, "purple"));
images.add(new MindmapIcon(IconFamily.FLAG, "yellow"));
return images;
}
private static List<MindmapIcon> getImagesNumber() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.NUMBER, "one"));
images.add(new MindmapIcon(IconFamily.NUMBER, "two"));
images.add(new MindmapIcon(IconFamily.NUMBER, "three"));
images.add(new MindmapIcon(IconFamily.NUMBER, "four"));
images.add(new MindmapIcon(IconFamily.NUMBER, "five"));
images.add(new MindmapIcon(IconFamily.NUMBER, "six"));
images.add(new MindmapIcon(IconFamily.NUMBER, "seven"));
images.add(new MindmapIcon(IconFamily.NUMBER, "eight"));
images.add(new MindmapIcon(IconFamily.NUMBER, "nine"));
return images;
}
private static List<MindmapIcon> getImagesTag() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.TAG, "blue"));
images.add(new MindmapIcon(IconFamily.TAG, "green"));
images.add(new MindmapIcon(IconFamily.TAG, "orange"));
images.add(new MindmapIcon(IconFamily.TAG, "red"));
images.add(new MindmapIcon(IconFamily.TAG, "pink"));
images.add(new MindmapIcon(IconFamily.TAG, "yellow"));
return images;
}
private static List<MindmapIcon> getImagesTask() {
final List<MindmapIcon> images = new ArrayList<MindmapIcon>();
images.add(new MindmapIcon(IconFamily.TASK, "one"));
images.add(new MindmapIcon(IconFamily.TASK, "two"));
images.add(new MindmapIcon(IconFamily.TASK, "three"));
images.add(new MindmapIcon(IconFamily.TASK, "four"));
images.add(new MindmapIcon(IconFamily.TASK, "five"));
return images;
}
public static List<MindmapIcon> getIconByFamily(IconFamily family) {
return images.get(family);
}
public static MindmapIcon findById(final @NotNull String id) {
for (IconFamily imageFamily : images.keySet()) {
final List<MindmapIcon> mindmapIcons = images.get(imageFamily);
for (MindmapIcon mindmapIcon : mindmapIcons) {
if (mindmapIcon.getId().equals(id)) {
return mindmapIcon;
}
}
}
throw new IllegalArgumentException("Image could not be found. Id:" + id);
}
}

View File

@ -1,216 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.model;
import java.util.*;
public class MindmapImagesFactory {
private static Map<ImageFamily,List<MindmapImage>> images = new HashMap<ImageFamily,List<MindmapImage>>();
static {
images.put(ImageFamily.BULLET, getImagesBullet());
images.put(ImageFamily.FLAG,getImagesFlag());
images.put(ImageFamily.NUMBER,getImagesNumber());
images.put(ImageFamily.TAG,getImagesTag());
images.put(ImageFamily.TASK,getImagesTask());
images.put(ImageFamily.FACE,getImagesFaces());
images.put(ImageFamily.BULB,getImagesBulb());
images.put(ImageFamily.ARROW,getImagesArrow());
images.put(ImageFamily.ARROWC,getImagesArrowC());
images.put(ImageFamily.CONN,getImagesConn());
images.put(ImageFamily.THUMB,getImagesThumbs());
images.put(ImageFamily.TICK,getImagesTick());
images.put(ImageFamily.ONOFF,getImagesOnOff());
images.put(ImageFamily.MONEY,getImagesMoney());
images.put(ImageFamily.CHART,getImagesChart());
}
private static List<MindmapImage> getImagesFaces()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("plain",ImageFamily.FACE));
images.add(new MindmapImage("sad",ImageFamily.FACE));
images.add(new MindmapImage("crying",ImageFamily.FACE));
images.add(new MindmapImage("smile",ImageFamily.FACE));
images.add(new MindmapImage("surprise",ImageFamily.FACE));
images.add(new MindmapImage("wink",ImageFamily.FACE));
return images;
}
private static List<MindmapImage> getImagesArrow()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("up",ImageFamily.ARROW));
images.add(new MindmapImage("down",ImageFamily.ARROW));
images.add(new MindmapImage("left",ImageFamily.ARROW));
images.add(new MindmapImage("right",ImageFamily.ARROW));
return images;
}
private static List<MindmapImage> getImagesArrowC()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("undo",ImageFamily.ARROWC));
images.add(new MindmapImage("rotate_anticlockwise",ImageFamily.ARROWC));
images.add(new MindmapImage("rotate_clockwise",ImageFamily.ARROWC));
images.add(new MindmapImage("turn_left",ImageFamily.ARROWC));
images.add(new MindmapImage("turn_right",ImageFamily.ARROWC));
return images;
}
private static List<MindmapImage> getImagesBulb()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("light_on",ImageFamily.BULB));
images.add(new MindmapImage("light_off",ImageFamily.BULB));
return images;
}
private static List<MindmapImage> getImagesTick()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("tick",ImageFamily.TICK));
images.add(new MindmapImage("cross",ImageFamily.TICK));
return images;
}
private static List<MindmapImage> getImagesChart()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("bar",ImageFamily.CHART));
images.add(new MindmapImage("line",ImageFamily.CHART));
images.add(new MindmapImage("curve",ImageFamily.CHART));
images.add(new MindmapImage("pie",ImageFamily.CHART));
images.add(new MindmapImage("organisation",ImageFamily.CHART));
return images;
}
private static List<MindmapImage> getImagesOnOff()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("clock",ImageFamily.ONOFF));
images.add(new MindmapImage("clock_red",ImageFamily.ONOFF));
images.add(new MindmapImage("add",ImageFamily.ONOFF));
images.add(new MindmapImage("delete",ImageFamily.ONOFF));
return images;
}
private static List<MindmapImage> getImagesMoney()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("money",ImageFamily.MONEY));
images.add(new MindmapImage("dollar",ImageFamily.MONEY));
images.add(new MindmapImage("euro",ImageFamily.MONEY));
images.add(new MindmapImage("pound",ImageFamily.MONEY));
images.add(new MindmapImage("yen",ImageFamily.MONEY));
images.add(new MindmapImage("coins",ImageFamily.MONEY));
images.add(new MindmapImage("ruby",ImageFamily.MONEY));
return images;
}
private static List<MindmapImage> getImagesThumbs()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("thumb_up",ImageFamily.THUMB));
images.add(new MindmapImage("thumb_down",ImageFamily.THUMB));
return images;
}
private static List<MindmapImage> getImagesConn()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("connect",ImageFamily.CONN));
images.add(new MindmapImage("disconnect",ImageFamily.CONN));
return images;
}
private static List<MindmapImage> getImagesBullet()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("black",ImageFamily.BULLET));
images.add(new MindmapImage("blue",ImageFamily.BULLET));
images.add(new MindmapImage("green",ImageFamily.BULLET));
images.add(new MindmapImage("orange",ImageFamily.BULLET));
images.add(new MindmapImage("red",ImageFamily.BULLET));
images.add(new MindmapImage("pink",ImageFamily.BULLET));
images.add(new MindmapImage("purple",ImageFamily.BULLET));
return images;
}
private static List<MindmapImage> getImagesFlag()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("blue",ImageFamily.FLAG));
images.add(new MindmapImage("green",ImageFamily.FLAG));
images.add(new MindmapImage("orange",ImageFamily.FLAG));
images.add(new MindmapImage("pink",ImageFamily.FLAG));
images.add(new MindmapImage("purple",ImageFamily.FLAG));
images.add(new MindmapImage("yellow",ImageFamily.FLAG));
return images;
}
private static List<MindmapImage> getImagesNumber()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("one",ImageFamily.NUMBER));
images.add(new MindmapImage("two",ImageFamily.NUMBER));
images.add(new MindmapImage("three",ImageFamily.NUMBER));
images.add(new MindmapImage("four",ImageFamily.NUMBER));
images.add(new MindmapImage("five",ImageFamily.NUMBER));
images.add(new MindmapImage("six",ImageFamily.NUMBER));
images.add(new MindmapImage("seven",ImageFamily.NUMBER));
images.add(new MindmapImage("eight",ImageFamily.NUMBER));
images.add(new MindmapImage("nine",ImageFamily.NUMBER));
return images;
}
private static List<MindmapImage> getImagesTag()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("blue",ImageFamily.TAG));
images.add(new MindmapImage("green",ImageFamily.TAG));
images.add(new MindmapImage("orange",ImageFamily.TAG));
images.add(new MindmapImage("red",ImageFamily.TAG));
images.add(new MindmapImage("pink",ImageFamily.TAG));
images.add(new MindmapImage("yellow",ImageFamily.TAG));
return images;
}
private static List<MindmapImage> getImagesTask()
{
final List<MindmapImage> images = new ArrayList<MindmapImage>();
images.add(new MindmapImage("one",ImageFamily.TASK));
images.add(new MindmapImage("two",ImageFamily.TASK));
images.add(new MindmapImage("three",ImageFamily.TASK));
images.add(new MindmapImage("four",ImageFamily.TASK));
images.add(new MindmapImage("five",ImageFamily.TASK));
return images;
}
public static Collection<List<MindmapImage>> getAllImages()
{
return images.values();
}
public static List<MindmapImage> getImagesByFamily(ImageFamily family)
{
return images.get(family);
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<icons>
<family name="">
<icon id="" img=""/>
</family>
</icons>

View File

@ -0,0 +1,154 @@
<map version="0.9.0">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1299957724614" ID="ID_1257555991" MODIFIED="1300660744042" TEXT="This is the root node">
<node CREATED="1300659938246" ID="ID_1618158073" MODIFIED="1300660937537" POSITION="right" TEXT="Generic">
<node CREATED="1300660056663" ID="ID_961003997" MODIFIED="1300660075006" TEXT="Warning">
<icon BUILTIN="messagebox_warning"/>
</node>
<node CREATED="1300660121313" ID="ID_1919070075" MODIFIED="1300660919414" TEXT="No Ok">
<icon BUILTIN="button_cancel"/>
</node>
<node CREATED="1300660114849" ID="ID_385678791" MODIFIED="1300660118492" TEXT="Ok">
<icon BUILTIN="button_ok"/>
</node>
<node CREATED="1300660105416" ID="ID_536737326" MODIFIED="1300660111692" TEXT="Info">
<icon BUILTIN="info"/>
</node>
<node CREATED="1300660094504" ID="ID_1595034059" MODIFIED="1300660104596" TEXT="No Entry">
<icon BUILTIN="closed"/>
</node>
<node CREATED="1300660080832" ID="ID_519232946" MODIFIED="1300660084598" TEXT="Stop">
<icon BUILTIN="stop-sign"/>
</node>
<node CREATED="1300659964800" ID="ID_36013731" MODIFIED="1300660077693" TEXT="Lamp">
<icon BUILTIN="idea"/>
</node>
<node CREATED="1300660027958" ID="ID_100611334" MODIFIED="1300660038050" TEXT="! Simbol">
<icon BUILTIN="yes"/>
</node>
<node CREATED="1300659989128" ID="ID_513620588" MODIFIED="1300660000320" TEXT="Question Mark">
<icon BUILTIN="help"/>
</node>
</node>
<node CREATED="1300660131953" ID="ID_203319573" MODIFIED="1300660909665" POSITION="left" TEXT="Numbers">
<node CREATED="1300660197527" ID="ID_353096125" MODIFIED="1300660219127" TEXT="1">
<icon BUILTIN="full-1"/>
</node>
<node CREATED="1300660201891" ID="ID_649422103" MODIFIED="1300660220992" TEXT="2">
<icon BUILTIN="full-2"/>
</node>
<node CREATED="1300660203259" ID="ID_1965971423" MODIFIED="1300660222752" TEXT="3">
<icon BUILTIN="full-3"/>
</node>
<node CREATED="1300660204283" ID="ID_65578210" MODIFIED="1300660224600" TEXT="4">
<icon BUILTIN="full-4"/>
</node>
<node CREATED="1300660207579" ID="ID_882889151" MODIFIED="1300660227168" TEXT="5">
<icon BUILTIN="full-5"/>
</node>
<node CREATED="1300660209044" ID="ID_162668441" MODIFIED="1300660244000" TEXT="6">
<icon BUILTIN="full-6"/>
</node>
<node CREATED="1300660210444" ID="ID_150658010" MODIFIED="1300660231496" TEXT="7">
<icon BUILTIN="full-7"/>
</node>
<node CREATED="1300660211755" ID="ID_197256381" MODIFIED="1300660250801" TEXT="8">
<icon BUILTIN="full-8"/>
</node>
<node CREATED="1300660212972" ID="ID_1862446262" MODIFIED="1300660253945" TEXT="9">
<icon BUILTIN="full-9"/>
</node>
<node CREATED="1300660215412" ID="ID_1339894565" MODIFIED="1300660256144" TEXT="0">
<icon BUILTIN="full-0"/>
</node>
</node>
<node CREATED="1300660263713" ID="ID_197980041" MODIFIED="1300660854307" POSITION="right" TEXT="Trafic">
<node CREATED="1300660289578" ID="ID_1342690461" MODIFIED="1300660304466" TEXT="Read">
<icon BUILTIN="stop"/>
</node>
<node CREATED="1300660293382" ID="ID_1249604240" MODIFIED="1300660307154" TEXT="Green">
<icon BUILTIN="go"/>
</node>
<node CREATED="1300660298502" ID="ID_325749572" MODIFIED="1300660309546" TEXT="Yellow">
<icon BUILTIN="prepare"/>
</node>
</node>
<node CREATED="1300660363350" ID="ID_1671979095" MODIFIED="1300660859865" POSITION="left" TEXT="Arrow">
<node CREATED="1300660376350" ID="ID_1037071455" MODIFIED="1300660442346" TEXT="Back">
<icon BUILTIN="back"/>
</node>
<node CREATED="1300660380251" ID="ID_388014179" MODIFIED="1300660444826" TEXT="Forward">
<icon BUILTIN="forward"/>
</node>
<node CREATED="1300660390307" ID="ID_898943058" MODIFIED="1300660458834" TEXT="Up">
<icon BUILTIN="up"/>
</node>
<node CREATED="1300660397595" ID="ID_546551064" MODIFIED="1300660460954" TEXT="Down">
<icon BUILTIN="down"/>
</node>
</node>
<node CREATED="1300660467186" ID="ID_1434576243" MODIFIED="1300660838314" POSITION="right" TEXT="Smiles">
<node CREATED="1300660494515" ID="ID_349071168" MODIFIED="1300660499857" TEXT="Smile">
<icon BUILTIN="ksmiletris"/>
</node>
<node CREATED="1300660505665" ID="ID_1127705003" MODIFIED="1300660509580" TEXT="No Mind">
<icon BUILTIN="smiley-neutral"/>
</node>
<node CREATED="1300660512160" ID="ID_1170321075" MODIFIED="1300660518107" TEXT="Surprise">
<icon BUILTIN="smiley-oh"/>
</node>
<node CREATED="1300660567710" ID="ID_1669610958" MODIFIED="1300660571241" TEXT="Sad">
<icon BUILTIN="smily_bad"/>
</node>
<node CREATED="1300660520745" ID="ID_481380867" MODIFIED="1300660554176" TEXT="Angry">
<icon BUILTIN="smiley-angry"/>
</node>
</node>
<node CREATED="1300660597562" ID="ID_583705804" MODIFIED="1300660902560" POSITION="left" TEXT="People">
<node CREATED="1300660622507" ID="ID_294818765" MODIFIED="1300660662564" TEXT="Family">
<icon BUILTIN="family"/>
</node>
<node CREATED="1300660625399" ID="ID_46082137" MODIFIED="1300660664564" TEXT="Female1">
<icon BUILTIN="female1"/>
</node>
<node CREATED="1300660634480" ID="ID_786003255" MODIFIED="1300660666444" TEXT="Female2">
<icon BUILTIN="female2"/>
</node>
<node CREATED="1300660641600" ID="ID_392270042" MODIFIED="1300660671564" TEXT="Male1">
<icon BUILTIN="male1"/>
</node>
<node CREATED="1300660644944" ID="ID_92348291" MODIFIED="1300660675052" TEXT="Male2">
<icon BUILTIN="male2"/>
</node>
<node CREATED="1300660650968" ID="ID_1227722053" MODIFIED="1300660676884" TEXT="Females">
<icon BUILTIN="fema"/>
</node>
<node CREATED="1300660656568" ID="ID_1783798935" MODIFIED="1300660678876" TEXT="Group">
<icon BUILTIN="group"/>
</node>
</node>
<node CREATED="1300660683137" ID="ID_1619225504" MODIFIED="1300660705976" POSITION="right" TEXT="Flags">
<node CREATED="1300660751347" ID="ID_899824007" MODIFIED="1300660802509" TEXT="Black">
<icon BUILTIN="flag-black"/>
</node>
<node CREATED="1300660762839" ID="ID_1430693413" MODIFIED="1300660805796" TEXT="Blue">
<icon BUILTIN="flag-blue"/>
</node>
<node CREATED="1300660779616" ID="ID_1301775448" MODIFIED="1300660809044" TEXT="Green">
<icon BUILTIN="flag-green"/>
</node>
<node CREATED="1300660785192" ID="ID_252960302" MODIFIED="1300660816997" TEXT="Orange">
<icon BUILTIN="flag-orange"/>
</node>
<node CREATED="1300660789768" ID="ID_511443357" MODIFIED="1300660820453" TEXT="Pink">
<icon BUILTIN="flag-pink"/>
</node>
<node CREATED="1300660795753" ID="ID_1392758100" MODIFIED="1300660824549" TEXT="Red">
<icon BUILTIN="flag"/>
</node>
<node CREATED="1300660797841" ID="ID_1505526545" MODIFIED="1300660827093" TEXT="Yellow">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
</node>
</map>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><map version="0.9.0"><node TEXT="This is the root node" STYLE="elipse" ID="ID_0"><node TEXT="Generic" POSITION="right" ID="ID_1"><node TEXT="Warning" POSITION="right" ID="ID_2"/><node TEXT="No Ok" POSITION="right" ID="ID_3"><icon BUILTIN="button_cancel"/></node><node TEXT="Ok" POSITION="right" ID="ID_4"><icon BUILTIN="button_ok"/></node><node TEXT="Info" POSITION="right" ID="ID_5"/><node TEXT="No Entry" POSITION="right" ID="ID_6"/><node TEXT="Stop" POSITION="right" ID="ID_7"/><node TEXT="Lamp" POSITION="right" ID="ID_8"><icon BUILTIN="idea"/></node><node TEXT="! Simbol" POSITION="right" ID="ID_9"/><node TEXT="Question Mark" POSITION="right" ID="ID_10"/></node><node TEXT="Numbers" POSITION="left" ID="ID_11"><node TEXT="1" POSITION="left" ID="ID_12"><icon BUILTIN="full-1"/></node><node TEXT="2" POSITION="left" ID="ID_13"><icon BUILTIN="full-2"/></node><node TEXT="3" POSITION="left" ID="ID_14"><icon BUILTIN="full-3"/></node><node TEXT="4" POSITION="left" ID="ID_15"><icon BUILTIN="full-4"/></node><node TEXT="5" POSITION="left" ID="ID_16"><icon BUILTIN="full-5"/></node><node TEXT="6" POSITION="left" ID="ID_17"><icon BUILTIN="full-6"/></node><node TEXT="7" POSITION="left" ID="ID_18"/><node TEXT="8" POSITION="left" ID="ID_19"/><node TEXT="9" POSITION="left" ID="ID_20"/><node TEXT="0" POSITION="left" ID="ID_21"><icon BUILTIN="full-0"/></node></node><node TEXT="Trafic" POSITION="right" ID="ID_22"><node TEXT="Read" POSITION="right" ID="ID_23"/><node TEXT="Green" POSITION="right" ID="ID_24"/><node TEXT="Yellow" POSITION="right" ID="ID_25"/></node><node TEXT="Arrow" POSITION="left" ID="ID_26"><node TEXT="Back" POSITION="left" ID="ID_27"><icon BUILTIN="back"/></node><node TEXT="Forward" POSITION="left" ID="ID_28"><icon BUILTIN="forward"/></node><node TEXT="Up" POSITION="left" ID="ID_29"><icon BUILTIN="up"/></node><node TEXT="Down" POSITION="left" ID="ID_30"><icon BUILTIN="down"/></node></node><node TEXT="Smiles" POSITION="right" ID="ID_31"><node TEXT="Smile" POSITION="right" ID="ID_32"><icon BUILTIN="ksmiletris"/></node><node TEXT="No Mind" POSITION="right" ID="ID_33"><icon BUILTIN="smiley-neutral"/></node><node TEXT="Surprise" POSITION="right" ID="ID_34"><icon BUILTIN="smiley-oh"/></node><node TEXT="Sad" POSITION="right" ID="ID_35"/><node TEXT="Angry" POSITION="right" ID="ID_36"/></node><node TEXT="People" POSITION="left" ID="ID_37"><node TEXT="Family" POSITION="left" ID="ID_38"/><node TEXT="Female1" POSITION="left" ID="ID_39"/><node TEXT="Female2" POSITION="left" ID="ID_40"/><node TEXT="Male1" POSITION="left" ID="ID_41"/><node TEXT="Male2" POSITION="left" ID="ID_42"/><node TEXT="Females" POSITION="left" ID="ID_43"/><node TEXT="Group" POSITION="left" ID="ID_44"/></node><node TEXT="Flags" POSITION="right" ID="ID_45"><node TEXT="Black" POSITION="right" ID="ID_46"/><node TEXT="Blue" POSITION="right" ID="ID_47"><icon BUILTIN="flag-blue"/></node><node TEXT="Green" POSITION="right" ID="ID_48"><icon BUILTIN="flag-green"/></node><node TEXT="Orange" POSITION="right" ID="ID_49"><icon BUILTIN="flag-orange"/></node><node TEXT="Pink" POSITION="right" ID="ID_50"><icon BUILTIN="flag-pink"/></node><node TEXT="Red" POSITION="right" ID="ID_51"/><node TEXT="Yellow" POSITION="right" ID="ID_52"><icon BUILTIN="flag-yellow"/></node></node></node></map>