From 107e559364de1a1b4f92281ebfa5c18367540377 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 21 Mar 2011 17:38:05 -0300 Subject: [PATCH] - Mode dynamic way to declare new icons. --- mindplot/src/main/javascript/ImageIcon.js | 243 +----------------- .../com/wisemapping/model/IconFamily.java | 45 ++-- .../com/wisemapping/model/MindmapIcon.java | 17 +- .../com/wisemapping/model/MindmapIcons.java | 50 ++-- ...se.png => arrowc_rotate_anticlockwise.png} | Bin ...ckwise.png => arrowc_rotate_clockwise.png} | Bin ...row_turn_left.png => arrowc_turn_left.png} | Bin ...w_turn_right.png => arrowc_turn_right.png} | Bin .../{lightbulb_off.png => bulb_light_off.png} | Bin .../{lightbulb.png => bulb_light_on.png} | Bin .../icons/{connect.png => conn_connect.png} | Bin .../{disconnect.png => conn_disconnect.png} | Bin .../icons/{face_angel.png => funy_angel.png} | Bin .../{face_devilish.png => funy_devilish.png} | Bin .../{face_glasses.png => funy_glasses.png} | Bin .../icons/{face_grin.png => funy_grin.png} | Bin .../icons/{face_kiss.png => funy_kiss.png} | Bin .../{face_monkey.png => funy_monkey.png} | Bin .../icons/{coins.png => money_coins.png} | Bin .../icons/{money.png => money_money.png} | Bin .../webapp/icons/{ruby.png => money_ruby.png} | Bin .../webapp/icons/{add.png => onoff_add.png} | Bin .../icons/{clock.png => onoff_clock.png} | Bin .../{clock_red.png => onoff_clock_red.png} | Bin .../icons/{delete.png => onoff_delete.png} | Bin .../{thumb_down.png => thumb_thumb_down.png} | Bin .../{thumb_up.png => thumb_thumb_up.png} | Bin .../icons/{cross.png => tick_cross.png} | Bin .../webapp/icons/{tick.png => tick_tick.png} | Bin wise-webapp/src/main/webapp/js/editor.js | 2 +- .../com/wisemapping/test/model/IconsTest.java | 39 ++- 31 files changed, 95 insertions(+), 301 deletions(-) rename wise-webapp/src/main/webapp/icons/{arrow_rotate_anticlockwise.png => arrowc_rotate_anticlockwise.png} (100%) rename wise-webapp/src/main/webapp/icons/{arrow_rotate_clockwise.png => arrowc_rotate_clockwise.png} (100%) rename wise-webapp/src/main/webapp/icons/{arrow_turn_left.png => arrowc_turn_left.png} (100%) rename wise-webapp/src/main/webapp/icons/{arrow_turn_right.png => arrowc_turn_right.png} (100%) rename wise-webapp/src/main/webapp/icons/{lightbulb_off.png => bulb_light_off.png} (100%) rename wise-webapp/src/main/webapp/icons/{lightbulb.png => bulb_light_on.png} (100%) rename wise-webapp/src/main/webapp/icons/{connect.png => conn_connect.png} (100%) rename wise-webapp/src/main/webapp/icons/{disconnect.png => conn_disconnect.png} (100%) rename wise-webapp/src/main/webapp/icons/{face_angel.png => funy_angel.png} (100%) rename wise-webapp/src/main/webapp/icons/{face_devilish.png => funy_devilish.png} (100%) rename wise-webapp/src/main/webapp/icons/{face_glasses.png => funy_glasses.png} (100%) rename wise-webapp/src/main/webapp/icons/{face_grin.png => funy_grin.png} (100%) rename wise-webapp/src/main/webapp/icons/{face_kiss.png => funy_kiss.png} (100%) rename wise-webapp/src/main/webapp/icons/{face_monkey.png => funy_monkey.png} (100%) rename wise-webapp/src/main/webapp/icons/{coins.png => money_coins.png} (100%) rename wise-webapp/src/main/webapp/icons/{money.png => money_money.png} (100%) rename wise-webapp/src/main/webapp/icons/{ruby.png => money_ruby.png} (100%) rename wise-webapp/src/main/webapp/icons/{add.png => onoff_add.png} (100%) rename wise-webapp/src/main/webapp/icons/{clock.png => onoff_clock.png} (100%) rename wise-webapp/src/main/webapp/icons/{clock_red.png => onoff_clock_red.png} (100%) rename wise-webapp/src/main/webapp/icons/{delete.png => onoff_delete.png} (100%) rename wise-webapp/src/main/webapp/icons/{thumb_down.png => thumb_thumb_down.png} (100%) rename wise-webapp/src/main/webapp/icons/{thumb_up.png => thumb_thumb_up.png} (100%) rename wise-webapp/src/main/webapp/icons/{cross.png => tick_cross.png} (100%) rename wise-webapp/src/main/webapp/icons/{tick.png => tick_tick.png} (100%) diff --git a/mindplot/src/main/javascript/ImageIcon.js b/mindplot/src/main/javascript/ImageIcon.js index c1984e4d..4bac3275 100644 --- a/mindplot/src/main/javascript/ImageIcon.js +++ b/mindplot/src/main/javascript/ImageIcon.js @@ -43,7 +43,6 @@ mindplot.ImageIcon = function(iconModel, topic, designer) { { removeImage.addEvent('click', function(event) { - // @Todo: actionRunner should not be exposed ... var actionRunner = designer._actionRunner; var command = new mindplot.commands.RemoveIconFromTopicCommand(this._topic.getId(), iconModel); actionRunner.execute(command); @@ -88,8 +87,8 @@ mindplot.ImageIcon.prototype.initialize = function() { }; -mindplot.ImageIcon.prototype._getImageUrl = function(id) { - return mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[id]; +mindplot.ImageIcon.prototype._getImageUrl = function(iconId) { + return "../icons/"+iconId+".png"; }; mindplot.ImageIcon.prototype.getModel = function() { @@ -97,15 +96,15 @@ mindplot.ImageIcon.prototype.getModel = function() { }; -mindplot.ImageIcon.prototype._getNextFamilyIconId = function(id) { +mindplot.ImageIcon.prototype._getNextFamilyIconId = function(iconId) { - var familyIcons = this._getFamilyIcons(id); + var familyIcons = this._getFamilyIcons(iconId); core.assert(familyIcons != null, "Family Icon not found!"); var result = null; for (var i = 0; i < familyIcons.length && result == null; i++) { - if (familyIcons[i] == id) { + if (familyIcons[i] == iconId) { var nextIconId; //Is last one? if (i == (familyIcons.length - 1)) { @@ -120,16 +119,18 @@ mindplot.ImageIcon.prototype._getNextFamilyIconId = function(id) { return result; }; -mindplot.ImageIcon.prototype._getFamilyIcons = function(id) { - core.assert(id != null, "id must not be null"); - core.assert(id.indexOf("_") != -1, "Invalid icon id (it must contain '_')"); +mindplot.ImageIcon.prototype._getFamilyIcons = function(iconId) { + core.assert(iconId != null, "id must not be null"); + core.assert(iconId.indexOf("_") != -1, "Invalid icon id (it must contain '_')"); + var result = null; for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i++) { var family = mindplot.ImageIcon.prototype.ICON_FAMILIES[i]; - var familyPrefix = id.substr(0, id.indexOf("_")); - if (family[0].match(familyPrefix) != null) { - result = family; + var iconFamilyId = iconId.substr(0, iconId.indexOf("_")); + + if (family.id == iconFamilyId) { + result = family.icons; break; } } @@ -146,223 +147,7 @@ mindplot.ImageIcon.prototype.getUiId = function() return this._uiId; }; -mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX = 'flag_'; -mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX = 'bullet_'; -mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX = 'tag_'; -mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX = 'face_'; -mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX = 'facefuny_'; -mindplot.ImageIcon.ICON_FAMILIY_ARROW_PREFIX = 'arrow_'; -mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX = 'arrowc_'; -mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX = 'chart_'; -mindplot.ImageIcon.ICON_FAMILIY_ONOFF_PREFIX = 'onoff_'; -mindplot.ImageIcon.ICON_FAMILIY_THUMB_PREFIX = 'thumb_'; -mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX = 'money_'; -mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX = 'number_'; -mindplot.ImageIcon.ICON_FAMILIY_TICK_PREFIX = 'tick_'; -mindplot.ImageIcon.ICON_FAMILIY_CONNECT_PREFIX = 'conn_'; -mindplot.ImageIcon.ICON_FAMILIY_BULB_PREFIX = 'bulb_' -mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX = 'task_'; - -mindplot.ImageIcon.ICON_TYPE_ARROW_UP = mindplot.ImageIcon.ICON_FAMILIY_ARROW_PREFIX + 'up'; -mindplot.ImageIcon.ICON_TYPE_ARROW_DOWN = mindplot.ImageIcon.ICON_FAMILIY_ARROW_PREFIX + 'down'; -mindplot.ImageIcon.ICON_TYPE_ARROW_LEFT = mindplot.ImageIcon.ICON_FAMILIY_ARROW_PREFIX + 'left'; -mindplot.ImageIcon.ICON_TYPE_ARROW_RIGHT = mindplot.ImageIcon.ICON_FAMILIY_ARROW_PREFIX + 'right'; - -mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_LEFT = mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX + 'turn_left'; -mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_RIGHT = mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX + 'turn_right'; -mindplot.ImageIcon.ICON_TYPE_ARROWC_UNDO = mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX + 'undo'; -mindplot.ImageIcon.ICON_TYPE_ARROWC_ANTICLOCKWISE = mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX + 'rotate_anticlockwise'; -mindplot.ImageIcon.ICON_TYPE_ARROWC_CLOCKWISE = mindplot.ImageIcon.ICON_FAMILIY_ARROWC_PREFIX + 'rotate_clockwise'; - -mindplot.ImageIcon.ICON_TYPE_FACE_PLAIN = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'plain'; -mindplot.ImageIcon.ICON_TYPE_FACE_SAD = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'sad'; -mindplot.ImageIcon.ICON_TYPE_FACE_SMILE_BIG = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'smilebig'; -mindplot.ImageIcon.ICON_TYPE_FACE_SMILE = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'smile'; -mindplot.ImageIcon.ICON_TYPE_FACE_SURPRISE = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'surprise'; -mindplot.ImageIcon.ICON_TYPE_FACE_WINK = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'wink'; -mindplot.ImageIcon.ICON_TYPE_FACE_CRYING = mindplot.ImageIcon.ICON_FAMILIY_FACE_PREFIX + 'crying'; - -mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_ANGEL = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'angel'; -mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_DEVIL = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'devilish'; -mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_GLASSES = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'glasses'; -mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_GRIN = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'grin'; -mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_KISS = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'kiss'; -mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_MONKEY = mindplot.ImageIcon.ICON_FAMILIY_FACE_FUNY_PREFIX + 'monkey'; - -mindplot.ImageIcon.ICON_TYPE_CHART_BAR = mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX + 'bar'; -mindplot.ImageIcon.ICON_TYPE_CHART_LINE = mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX + 'line'; -mindplot.ImageIcon.ICON_TYPE_CHART_CURVE = mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX + 'curve'; -mindplot.ImageIcon.ICON_TYPE_CHART_PIE = mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX + 'pie'; -mindplot.ImageIcon.ICON_TYPE_CHART_ORGANISATION = mindplot.ImageIcon.ICON_FAMILIY_CHART_PREFIX + 'organisation'; - -mindplot.ImageIcon.ICON_TYPE_FLAG_BLUE = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'blue'; -mindplot.ImageIcon.ICON_TYPE_FLAG_GREEN = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'green'; -mindplot.ImageIcon.ICON_TYPE_FLAG_ORANGE = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'orange'; -mindplot.ImageIcon.ICON_TYPE_FLAG_PINK = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'pink'; -mindplot.ImageIcon.ICON_TYPE_FLAG_PURPLE = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'purple'; -mindplot.ImageIcon.ICON_TYPE_FLAG_YELLOW = mindplot.ImageIcon.ICON_FAMILIY_FLAG_PREFIX + 'yellow'; - -mindplot.ImageIcon.ICON_TYPE_BULLET_BLACK = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'black'; -mindplot.ImageIcon.ICON_TYPE_BULLET_BLUE = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'blue'; -mindplot.ImageIcon.ICON_TYPE_BULLET_GREEN = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'green'; -mindplot.ImageIcon.ICON_TYPE_BULLET_ORANGE = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'orange'; -mindplot.ImageIcon.ICON_TYPE_BULLET_RED = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'red'; -mindplot.ImageIcon.ICON_TYPE_BULLET_PINK = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'pink'; -mindplot.ImageIcon.ICON_TYPE_BULLET_PURPLE = mindplot.ImageIcon.ICON_FAMILIY_BULLET_PREFIX + 'purple'; - -mindplot.ImageIcon.ICON_TYPE_TAG_BLUE = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'blue'; -mindplot.ImageIcon.ICON_TYPE_TAG_GREEN = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'green'; -mindplot.ImageIcon.ICON_TYPE_TAG_ORANGE = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'orange'; -mindplot.ImageIcon.ICON_TYPE_TAG_RED = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'red'; -mindplot.ImageIcon.ICON_TYPE_TAG_PINK = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'pink'; -mindplot.ImageIcon.ICON_TYPE_TAG_YELLOW = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'yellow'; -mindplot.ImageIcon.ICON_TYPE_TAG_PURPLE = mindplot.ImageIcon.ICON_FAMILIY_TAG_PREFIX + 'purple'; - -mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_UP = mindplot.ImageIcon.ICON_FAMILIY_THUMB_PREFIX + 'thumb_up'; -mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_DOWN = mindplot.ImageIcon.ICON_FAMILIY_THUMB_PREFIX + 'thumb_down'; - -mindplot.ImageIcon.ICON_TYPE_TICK_ON = mindplot.ImageIcon.ICON_FAMILIY_TICK_PREFIX + 'tick'; -mindplot.ImageIcon.ICON_TYPE_TICK_OFF = mindplot.ImageIcon.ICON_FAMILIY_TICK_PREFIX + 'cross'; - -mindplot.ImageIcon.ICON_TYPE_BULB_ON = mindplot.ImageIcon.ICON_FAMILIY_BULB_PREFIX + 'light_on'; -mindplot.ImageIcon.ICON_TYPE_BULB_OFF = mindplot.ImageIcon.ICON_FAMILIY_BULB_PREFIX + 'light_off'; - -mindplot.ImageIcon.ICON_TYPE_CONNECT_ON = mindplot.ImageIcon.ICON_FAMILIY_CONNECT_PREFIX + 'connect'; -mindplot.ImageIcon.ICON_TYPE_CONNECT_OFF = mindplot.ImageIcon.ICON_FAMILIY_CONNECT_PREFIX + 'disconnect'; - -mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK = mindplot.ImageIcon.ICON_FAMILIY_ONOFF_PREFIX + 'clock'; -mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK_RED = mindplot.ImageIcon.ICON_FAMILIY_ONOFF_PREFIX + 'clock_red'; -mindplot.ImageIcon.ICON_TYPE_ONOFF_ADD = mindplot.ImageIcon.ICON_FAMILIY_ONOFF_PREFIX + 'add'; -mindplot.ImageIcon.ICON_TYPE_ONOFF_DELETE = mindplot.ImageIcon.ICON_FAMILIY_ONOFF_PREFIX + 'delete'; - -mindplot.ImageIcon.ICON_TYPE_MONEY_MONEY = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'money'; -mindplot.ImageIcon.ICON_TYPE_MONEY_DOLLAR = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'dollar'; -mindplot.ImageIcon.ICON_TYPE_MONEY_EURO = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'euro'; -mindplot.ImageIcon.ICON_TYPE_MONEY_POUND = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'pound'; -mindplot.ImageIcon.ICON_TYPE_MONEY_YEN = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'yen'; -mindplot.ImageIcon.ICON_TYPE_MONEY_COINS = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'coins'; -mindplot.ImageIcon.ICON_TYPE_MONEY_RUBY = mindplot.ImageIcon.ICON_FAMILIY_MONEY_PREFIX + 'ruby'; - -mindplot.ImageIcon.ICON_TYPE_NUMBER_ONE = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'one'; -mindplot.ImageIcon.ICON_TYPE_NUMBER_TWO = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'two'; -mindplot.ImageIcon.ICON_TYPE_NUMBER_THREE = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'three'; -mindplot.ImageIcon.ICON_TYPE_NUMBER_FOUR = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'four'; -mindplot.ImageIcon.ICON_TYPE_NUMBER_FIVE = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'five'; -mindplot.ImageIcon.ICON_TYPE_NUMBER_SIX = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'six'; -mindplot.ImageIcon.ICON_TYPE_NUMBER_SEVEN = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'seven'; -mindplot.ImageIcon.ICON_TYPE_NUMBER_EIGHT = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'eight'; -mindplot.ImageIcon.ICON_TYPE_NUMBER_NINE = mindplot.ImageIcon.ICON_FAMILIY_NUMBER_PREFIX + 'nine'; - -mindplot.ImageIcon.ICON_TYPE_TASK_ONE = mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX + 'one'; -mindplot.ImageIcon.ICON_TYPE_TASK_TWO = mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX + 'two'; -mindplot.ImageIcon.ICON_TYPE_TASK_THREE = mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX + 'three'; -mindplot.ImageIcon.ICON_TYPE_TASK_FOUR = mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX + 'four'; -mindplot.ImageIcon.ICON_TYPE_TASK_FIVE = mindplot.ImageIcon.ICON_FAMILIY_TASK_PREFIX + 'five'; +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": "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"]},{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]},{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]},] -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP = new Object(); -//FLAG -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_BLUE] = "../icons/flag_blue.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_GREEN] = "../icons/flag_green.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_ORANGE] = "../icons/flag_orange.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_PINK] = "../icons/flag_pink.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_PURPLE] = "../icons/flag_purple.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FLAG_YELLOW] = "../icons/flag_yellow.png"; -//BULLET -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_BLACK] = "../icons/bullet_black.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_BLUE] = "../icons/bullet_blue.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_GREEN] = "../icons/bullet_blue.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_ORANGE] = "../icons/bullet_green.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_RED] = "../icons/bullet_orange.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_PINK] = "../icons/bullet_pink.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULLET_PURPLE] = "../icons/bullet_purple.png"; -//TAGS -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_BLUE] = "../icons/tag_blue.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_GREEN] = "../icons/tag_green.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_ORANGE] = "../icons/tag_orange.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_RED] = "../icons/tag_red.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_PINK] = "../icons/tag_pink.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_YELLOW] = "../icons/tag_yellow.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TAG_PURPLE] = "../icons/tag_purple.png"; -//FACES -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_ANGEL] = "../icons/face-_angel.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_DEVIL] = "../icons/face_devilish.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_GLASSES] = "../icons/face_glasses.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_KISS] = "../icons/face_kiss.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_MONKEY] = "../icons/face_monkey.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_PLAIN] = "../icons/face_plain.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_CRYING] = "../icons/face_crying.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_SAD] = "../icons/face_sad.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_SMILE] = "../icons/face_smile.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_SURPRISE] = "../icons/face_surprise.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_FACE_WINK] = "../icons/face_wink.png"; - -//ARROWS -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROW_UP] = "../icons/arrow_up.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROW_DOWN] = "../icons/arrow_down.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROW_LEFT] = "../icons/arrow_left.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROW_RIGHT] = "../icons/arrow_right.png"; - -// ARROWS COMPLEX. -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_LEFT] = "../icons/arrow_turn_left.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_RIGHT] = "../icons/arrow_turn_right.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROWC_UNDO] = "../icons/arrow_undo.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROWC_ANTICLOCKWISE] = "../icons/arrow_rotate_anticlockwise.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ARROWC_CLOCKWISE] = "../icons/arrow_rotate_clockwise.png"; - -//CHARTS -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CHART_BAR] = "../icons/chart_bar.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CHART_LINE] = "../icons/chart_line.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CHART_CURVE] = "../icons/chart_curve.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CHART_PIE] = "../icons/chart_pie.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CHART_ORGANISATION] = "../icons/chart_organisation.png"; - -// THUMB -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_UP] = "../icons/thumb_up.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_DOWN] = "../icons/thumb_down.png"; - -// ON OFF -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TICK_ON] = "../icons/tick.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_TICK_OFF] = "../icons/cross.png"; - -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULB_ON] = "../icons/lightbulb.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_BULB_OFF] = "../icons/lightbulb_off.png"; - -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CONNECT_ON] = "../icons/connect.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_CONNECT_OFF] = "../icons/disconnect.png"; - -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK] = "../icons/clock.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK_RED] = "../icons/clock_red.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_ADD] = "../icons/add.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_ONOFF_DELETE] = "../icons/delete.png"; -//MONEY -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_MONEY] = "../icons/money.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_DOLLAR] = "../icons/money_dollar.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_EURO] = "../icons/money_euro.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_POUND] = "../icons/money_pound.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_YEN] = "../icons/money_yen.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_COINS] = "../icons/coins.png"; -mindplot.ImageIcon.prototype.ICON_IMAGE_MAP[mindplot.ImageIcon.ICON_TYPE_MONEY_RUBY] = "../icons/ruby.png"; - - -//FAMILIES -mindplot.ImageIcon.prototype.ICON_FLAG_FAMILY = [mindplot.ImageIcon.ICON_TYPE_FLAG_BLUE, mindplot.ImageIcon.ICON_TYPE_FLAG_GREEN,mindplot.ImageIcon.ICON_TYPE_FLAG_ORANGE,mindplot.ImageIcon.ICON_TYPE_FLAG_PINK, mindplot.ImageIcon.ICON_TYPE_FLAG_PURPLE, mindplot.ImageIcon.ICON_TYPE_FLAG_YELLOW]; -mindplot.ImageIcon.prototype.ICON_TAG_FAMILY = [mindplot.ImageIcon.ICON_TYPE_TAG_BLUE, mindplot.ImageIcon.ICON_TYPE_TAG_GREEN,mindplot.ImageIcon.ICON_TYPE_TAG_ORANGE,mindplot.ImageIcon.ICON_TYPE_TAG_PINK, mindplot.ImageIcon.ICON_TYPE_TAG_PURPLE, mindplot.ImageIcon.ICON_TYPE_TAG_YELLOW]; -mindplot.ImageIcon.prototype.ICON_BULLET_FAMILY = [mindplot.ImageIcon.ICON_TYPE_BULLET_BLACK, mindplot.ImageIcon.ICON_TYPE_BULLET_BLUE, mindplot.ImageIcon.ICON_TYPE_BULLET_GREEN,mindplot.ImageIcon.ICON_TYPE_BULLET_ORANGE,mindplot.ImageIcon.ICON_TYPE_BULLET_RED, mindplot.ImageIcon.ICON_TYPE_BULLET_PINK, mindplot.ImageIcon.ICON_TYPE_BULLET_PURPLE]; -mindplot.ImageIcon.prototype.ICON_FUNY_FACE_FAMILY = [mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_ANGEL, mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_DEVIL, mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_GLASSES, mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_KISS, mindplot.ImageIcon.ICON_TYPE_FACE_FUNY_MONKEY]; -mindplot.ImageIcon.prototype.ICON_FACE_FAMILY = [mindplot.ImageIcon.ICON_TYPE_FACE_PLAIN, mindplot.ImageIcon.ICON_TYPE_FACE_SAD, mindplot.ImageIcon.ICON_TYPE_FACE_CRYING, mindplot.ImageIcon.ICON_TYPE_FACE_SMILE, mindplot.ImageIcon.ICON_TYPE_FACE_SURPRISE, mindplot.ImageIcon.ICON_TYPE_FACE_WINK]; -mindplot.ImageIcon.prototype.ICON_ARROW_FAMILY = [mindplot.ImageIcon.ICON_TYPE_ARROW_UP, mindplot.ImageIcon.ICON_TYPE_ARROW_DOWN, mindplot.ImageIcon.ICON_TYPE_ARROW_LEFT, mindplot.ImageIcon.ICON_TYPE_ARROW_RIGHT]; -mindplot.ImageIcon.prototype.ICON_COMPLEX_ARROW_FAMILY = [mindplot.ImageIcon.ICON_TYPE_ARROWC_UNDO, mindplot.ImageIcon.ICON_TYPE_ARROWC_ANTICLOCKWISE, mindplot.ImageIcon.ICON_TYPE_ARROWC_CLOCKWISE,mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_LEFT, mindplot.ImageIcon.ICON_TYPE_ARROWC_TURN_RIGHT]; -mindplot.ImageIcon.prototype.ICON_CHART_FAMILY = [mindplot.ImageIcon.ICON_TYPE_CHART_BAR, mindplot.ImageIcon.ICON_TYPE_CHART_LINE, mindplot.ImageIcon.ICON_TYPE_CHART_CURVE, mindplot.ImageIcon.ICON_TYPE_CHART_PIE, mindplot.ImageIcon.ICON_TYPE_CHART_ORGANISATION]; -mindplot.ImageIcon.prototype.ICON_TICK_FAMILY = [ mindplot.ImageIcon.ICON_TYPE_TICK_ON, mindplot.ImageIcon.ICON_TYPE_TICK_OFF]; - -mindplot.ImageIcon.prototype.ICON_CONNECT_FAMILY = [ mindplot.ImageIcon.ICON_TYPE_CONNECT_ON, mindplot.ImageIcon.ICON_TYPE_CONNECT_OFF]; -mindplot.ImageIcon.prototype.ICON_BULB_FAMILY = [ mindplot.ImageIcon.ICON_TYPE_BULB_ON, mindplot.ImageIcon.ICON_TYPE_BULB_OFF]; -mindplot.ImageIcon.prototype.ICON_ONOFF_FAMILY = [ mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK, mindplot.ImageIcon.ICON_TYPE_ONOFF_CLOCK_RED, mindplot.ImageIcon.ICON_TYPE_ONOFF_ADD, mindplot.ImageIcon.ICON_TYPE_ONOFF_DELETE]; - -mindplot.ImageIcon.prototype.ICON_THUMB_FAMILY = [mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_UP, mindplot.ImageIcon.ICON_TYPE_ONOFF_THUMB_DOWN]; -mindplot.ImageIcon.prototype.ICON_MONEY_FAMILY = [mindplot.ImageIcon.ICON_TYPE_MONEY_MONEY,mindplot.ImageIcon.ICON_TYPE_MONEY_DOLLAR,mindplot.ImageIcon.ICON_TYPE_MONEY_EURO,mindplot.ImageIcon.ICON_TYPE_MONEY_POUND,mindplot.ImageIcon.ICON_TYPE_MONEY_YEN,mindplot.ImageIcon.ICON_TYPE_MONEY_COINS,mindplot.ImageIcon.ICON_TYPE_MONEY_RUBY]; - - -mindplot.ImageIcon.prototype.ICON_FAMILIES = [mindplot.ImageIcon.prototype.ICON_FACE_FAMILY, mindplot.ImageIcon.prototype.ICON_FUNY_FACE_FAMILY,mindplot.ImageIcon.prototype.ICON_ARROW_FAMILY,mindplot.ImageIcon.prototype.ICON_COMPLEX_ARROW_FAMILY, mindplot.ImageIcon.prototype.ICON_CONNECT_FAMILY,mindplot.ImageIcon.prototype.ICON_BULB_FAMILY,mindplot.ImageIcon.prototype.ICON_THUMB_FAMILY, mindplot.ImageIcon.prototype.ICON_TICK_FAMILY,mindplot.ImageIcon.prototype.ICON_ONOFF_FAMILY, mindplot.ImageIcon.prototype.ICON_MONEY_FAMILY, mindplot.ImageIcon.prototype.ICON_CHART_FAMILY, mindplot.ImageIcon.prototype.ICON_FLAG_FAMILY, mindplot.ImageIcon.prototype.ICON_BULLET_FAMILY, mindplot.ImageIcon.prototype.ICON_TAG_FAMILY]; \ No newline at end of file diff --git a/wise-webapp/src/main/java/com/wisemapping/model/IconFamily.java b/wise-webapp/src/main/java/com/wisemapping/model/IconFamily.java index 84b88ced..7ddc9d2c 100755 --- a/wise-webapp/src/main/java/com/wisemapping/model/IconFamily.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/IconFamily.java @@ -19,35 +19,20 @@ package com.wisemapping.model; public enum IconFamily { - FLAG("FLAG","flag_"), - BULLET("BULLET","bullet_"), - TAG("TAG","tag_"), - NUMBER("NUMBER","number_"), - SMILEY("FACE","face_"), - ARROW("ARROW","arrow_"), - ARROWC("ARROWC","arrowc_"), - CONN("CONN","conn_"), - BULB("BULB","bulb_"), - THUMB("THUMB","thumb_"), - TICK("TICK","tick_"), - ONOFF("ONOFF","onoff_"), - MONEY("MONEY","money_"), - CHART("CHART","chart_"), - TASK("TASK","task_"); + FLAG(), + BULLET(), + TAG(), + // NUMBER("NUMBER","number_"), + FACE(), + FUNY(), + ARROW(), + ARROWC(), + CONN(), + BULB(), + THUMB(), + TICK(), + ONOFF(), + MONEY(), + CHART(); - private String prefix; - private String name; - - IconFamily(String name, String prefix) { - this.name = name; - this.prefix = prefix; - } - - public String getPrefix() { - return prefix; - } - - public String getName() { - return name; - } } diff --git a/wise-webapp/src/main/java/com/wisemapping/model/MindmapIcon.java b/wise-webapp/src/main/java/com/wisemapping/model/MindmapIcon.java index 33af8099..2145a1ab 100755 --- a/wise-webapp/src/main/java/com/wisemapping/model/MindmapIcon.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/MindmapIcon.java @@ -18,29 +18,24 @@ package com.wisemapping.model; -public class MindmapIcon -{ +public class MindmapIcon { private String name; private IconFamily family; - MindmapIcon(IconFamily family, String name) - { + MindmapIcon(IconFamily family, String name) { this.name = name; this.family = family; } - public String getName() - { + public String getName() { return name; } - public IconFamily getFamily() - { + public IconFamily getFamily() { return family; } - public String getId() - { - return family.getPrefix() + name; + public String getId() { + return family.name().toLowerCase() + "_" + name; } } diff --git a/wise-webapp/src/main/java/com/wisemapping/model/MindmapIcons.java b/wise-webapp/src/main/java/com/wisemapping/model/MindmapIcons.java index 5a729524..c9fab588 100755 --- a/wise-webapp/src/main/java/com/wisemapping/model/MindmapIcons.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/MindmapIcons.java @@ -29,12 +29,12 @@ public class MindmapIcons { private static Map> iconsByFamily; - 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 FACE_PLAIN = new MindmapIcon(IconFamily.FACE, "plain"); + public static final MindmapIcon FACE_SAD = new MindmapIcon(IconFamily.FACE, "sad"); + public static final MindmapIcon FACE_CRYING = new MindmapIcon(IconFamily.FACE, "crying"); + public static final MindmapIcon FACE_SMILE = new MindmapIcon(IconFamily.FACE, "smile"); + public static final MindmapIcon FACE_SURPRISE = new MindmapIcon(IconFamily.FACE, "surprise"); + public static final MindmapIcon FACE_WINK = new MindmapIcon(IconFamily.FACE, "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"); @@ -44,13 +44,13 @@ public class MindmapIcons { public static final MindmapIcon ARROW_LEFT = new MindmapIcon(IconFamily.ARROW, "left"); public static final MindmapIcon ARROW_RIGHT = new MindmapIcon(IconFamily.ARROW, "right"); - public static final MindmapIcon TASK_ONE = new MindmapIcon(IconFamily.TASK, "one"); - public static final MindmapIcon TASK_TWO = new MindmapIcon(IconFamily.TASK, "two"); - public static final MindmapIcon TASK_THREE = new MindmapIcon(IconFamily.TASK, "three"); - public static final MindmapIcon TASK_FOUR = new MindmapIcon(IconFamily.TASK, "four"); - public static final MindmapIcon TASK_FIVE = new MindmapIcon(IconFamily.TASK, "five"); +// public static final MindmapIcon TASK_ONE = new MindmapIcon(IconFamily.TASK, "one"); +// public static final MindmapIcon TASK_TWO = new MindmapIcon(IconFamily.TASK, "two"); +// public static final MindmapIcon TASK_THREE = new MindmapIcon(IconFamily.TASK, "three"); +// public static final MindmapIcon TASK_FOUR = new MindmapIcon(IconFamily.TASK, "four"); +// public static final MindmapIcon TASK_FIVE = new MindmapIcon(IconFamily.TASK, "five"); - public static final MindmapIcon ARROWC_UNDO = new MindmapIcon(IconFamily.ARROWC, "undo"); + // public static final MindmapIcon ARROWC_UNDO = new MindmapIcon(IconFamily.ARROWC, "undo"); public static final MindmapIcon ARROWC_ANTICLOCK_WISE = new MindmapIcon(IconFamily.ARROWC, "rotate_anticlockwise"); public static final MindmapIcon ARROWC_CLOCK_WISE = new MindmapIcon(IconFamily.ARROWC, "rotate_clockwise"); public static final MindmapIcon ARROWC_LEFT = new MindmapIcon(IconFamily.ARROWC, "turn_left"); @@ -80,15 +80,23 @@ public class MindmapIcons { public static final MindmapIcon TAG_PINK = new MindmapIcon(IconFamily.TAG, "pink"); public static final MindmapIcon TAG_YELLOW = new MindmapIcon(IconFamily.TAG, "yellow"); - public static final MindmapIcon NUMBER_ONE = new MindmapIcon(IconFamily.NUMBER, "one"); - public static final MindmapIcon NUMBER_TWO = new MindmapIcon(IconFamily.NUMBER, "two"); - public static final MindmapIcon NUMBER_THREE = new MindmapIcon(IconFamily.NUMBER, "three"); - public static final MindmapIcon NUMBER_FOUR = new MindmapIcon(IconFamily.NUMBER, "four"); - public static final MindmapIcon NUMBER_FIVE = new MindmapIcon(IconFamily.NUMBER, "five"); - public static final MindmapIcon NUMBER_SIX = new MindmapIcon(IconFamily.NUMBER, "six"); - public static final MindmapIcon NUMBER_SEVEN = new MindmapIcon(IconFamily.NUMBER, "seven"); - public static final MindmapIcon NUMBER_EIGHT = new MindmapIcon(IconFamily.NUMBER, "eight"); - public static final MindmapIcon NUMBER_NINE = new MindmapIcon(IconFamily.NUMBER, "nine"); +// public static final MindmapIcon NUMBER_ONE = new MindmapIcon(IconFamily.NUMBER, "one"); +// public static final MindmapIcon NUMBER_TWO = new MindmapIcon(IconFamily.NUMBER, "two"); +// public static final MindmapIcon NUMBER_THREE = new MindmapIcon(IconFamily.NUMBER, "three"); +// public static final MindmapIcon NUMBER_FOUR = new MindmapIcon(IconFamily.NUMBER, "four"); +// public static final MindmapIcon NUMBER_FIVE = new MindmapIcon(IconFamily.NUMBER, "five"); +// public static final MindmapIcon NUMBER_SIX = new MindmapIcon(IconFamily.NUMBER, "six"); +// public static final MindmapIcon NUMBER_SEVEN = new MindmapIcon(IconFamily.NUMBER, "seven"); +// public static final MindmapIcon NUMBER_EIGHT = new MindmapIcon(IconFamily.NUMBER, "eight"); +// public static final MindmapIcon NUMBER_NINE = new MindmapIcon(IconFamily.NUMBER, "nine"); + + + public static final MindmapIcon FUNNY_ANGEL = new MindmapIcon(IconFamily.FUNY, "angel"); + public static final MindmapIcon FUNNY_DEVILISH = new MindmapIcon(IconFamily.FUNY, "devilish"); + public static final MindmapIcon FUNNY_GLASSES = new MindmapIcon(IconFamily.FUNY, "glasses"); + public static final MindmapIcon FUNNY_GRIN = new MindmapIcon(IconFamily.FUNY, "grin"); + public static final MindmapIcon FUNNY_KISS = new MindmapIcon(IconFamily.FUNY, "kiss"); + public static final MindmapIcon FUNNY_MONKEY = new MindmapIcon(IconFamily.FUNY, "monkey"); public static final MindmapIcon FLAG_BLUE = new MindmapIcon(IconFamily.FLAG, "blue"); public static final MindmapIcon FLAG_GREEN = new MindmapIcon(IconFamily.FLAG, "green"); diff --git a/wise-webapp/src/main/webapp/icons/arrow_rotate_anticlockwise.png b/wise-webapp/src/main/webapp/icons/arrowc_rotate_anticlockwise.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/arrow_rotate_anticlockwise.png rename to wise-webapp/src/main/webapp/icons/arrowc_rotate_anticlockwise.png diff --git a/wise-webapp/src/main/webapp/icons/arrow_rotate_clockwise.png b/wise-webapp/src/main/webapp/icons/arrowc_rotate_clockwise.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/arrow_rotate_clockwise.png rename to wise-webapp/src/main/webapp/icons/arrowc_rotate_clockwise.png diff --git a/wise-webapp/src/main/webapp/icons/arrow_turn_left.png b/wise-webapp/src/main/webapp/icons/arrowc_turn_left.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/arrow_turn_left.png rename to wise-webapp/src/main/webapp/icons/arrowc_turn_left.png diff --git a/wise-webapp/src/main/webapp/icons/arrow_turn_right.png b/wise-webapp/src/main/webapp/icons/arrowc_turn_right.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/arrow_turn_right.png rename to wise-webapp/src/main/webapp/icons/arrowc_turn_right.png diff --git a/wise-webapp/src/main/webapp/icons/lightbulb_off.png b/wise-webapp/src/main/webapp/icons/bulb_light_off.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/lightbulb_off.png rename to wise-webapp/src/main/webapp/icons/bulb_light_off.png diff --git a/wise-webapp/src/main/webapp/icons/lightbulb.png b/wise-webapp/src/main/webapp/icons/bulb_light_on.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/lightbulb.png rename to wise-webapp/src/main/webapp/icons/bulb_light_on.png diff --git a/wise-webapp/src/main/webapp/icons/connect.png b/wise-webapp/src/main/webapp/icons/conn_connect.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/connect.png rename to wise-webapp/src/main/webapp/icons/conn_connect.png diff --git a/wise-webapp/src/main/webapp/icons/disconnect.png b/wise-webapp/src/main/webapp/icons/conn_disconnect.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/disconnect.png rename to wise-webapp/src/main/webapp/icons/conn_disconnect.png diff --git a/wise-webapp/src/main/webapp/icons/face_angel.png b/wise-webapp/src/main/webapp/icons/funy_angel.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/face_angel.png rename to wise-webapp/src/main/webapp/icons/funy_angel.png diff --git a/wise-webapp/src/main/webapp/icons/face_devilish.png b/wise-webapp/src/main/webapp/icons/funy_devilish.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/face_devilish.png rename to wise-webapp/src/main/webapp/icons/funy_devilish.png diff --git a/wise-webapp/src/main/webapp/icons/face_glasses.png b/wise-webapp/src/main/webapp/icons/funy_glasses.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/face_glasses.png rename to wise-webapp/src/main/webapp/icons/funy_glasses.png diff --git a/wise-webapp/src/main/webapp/icons/face_grin.png b/wise-webapp/src/main/webapp/icons/funy_grin.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/face_grin.png rename to wise-webapp/src/main/webapp/icons/funy_grin.png diff --git a/wise-webapp/src/main/webapp/icons/face_kiss.png b/wise-webapp/src/main/webapp/icons/funy_kiss.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/face_kiss.png rename to wise-webapp/src/main/webapp/icons/funy_kiss.png diff --git a/wise-webapp/src/main/webapp/icons/face_monkey.png b/wise-webapp/src/main/webapp/icons/funy_monkey.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/face_monkey.png rename to wise-webapp/src/main/webapp/icons/funy_monkey.png diff --git a/wise-webapp/src/main/webapp/icons/coins.png b/wise-webapp/src/main/webapp/icons/money_coins.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/coins.png rename to wise-webapp/src/main/webapp/icons/money_coins.png diff --git a/wise-webapp/src/main/webapp/icons/money.png b/wise-webapp/src/main/webapp/icons/money_money.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/money.png rename to wise-webapp/src/main/webapp/icons/money_money.png diff --git a/wise-webapp/src/main/webapp/icons/ruby.png b/wise-webapp/src/main/webapp/icons/money_ruby.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/ruby.png rename to wise-webapp/src/main/webapp/icons/money_ruby.png diff --git a/wise-webapp/src/main/webapp/icons/add.png b/wise-webapp/src/main/webapp/icons/onoff_add.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/add.png rename to wise-webapp/src/main/webapp/icons/onoff_add.png diff --git a/wise-webapp/src/main/webapp/icons/clock.png b/wise-webapp/src/main/webapp/icons/onoff_clock.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/clock.png rename to wise-webapp/src/main/webapp/icons/onoff_clock.png diff --git a/wise-webapp/src/main/webapp/icons/clock_red.png b/wise-webapp/src/main/webapp/icons/onoff_clock_red.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/clock_red.png rename to wise-webapp/src/main/webapp/icons/onoff_clock_red.png diff --git a/wise-webapp/src/main/webapp/icons/delete.png b/wise-webapp/src/main/webapp/icons/onoff_delete.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/delete.png rename to wise-webapp/src/main/webapp/icons/onoff_delete.png diff --git a/wise-webapp/src/main/webapp/icons/thumb_down.png b/wise-webapp/src/main/webapp/icons/thumb_thumb_down.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/thumb_down.png rename to wise-webapp/src/main/webapp/icons/thumb_thumb_down.png diff --git a/wise-webapp/src/main/webapp/icons/thumb_up.png b/wise-webapp/src/main/webapp/icons/thumb_thumb_up.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/thumb_up.png rename to wise-webapp/src/main/webapp/icons/thumb_thumb_up.png diff --git a/wise-webapp/src/main/webapp/icons/cross.png b/wise-webapp/src/main/webapp/icons/tick_cross.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/cross.png rename to wise-webapp/src/main/webapp/icons/tick_cross.png diff --git a/wise-webapp/src/main/webapp/icons/tick.png b/wise-webapp/src/main/webapp/icons/tick_tick.png similarity index 100% rename from wise-webapp/src/main/webapp/icons/tick.png rename to wise-webapp/src/main/webapp/icons/tick_tick.png diff --git a/wise-webapp/src/main/webapp/js/editor.js b/wise-webapp/src/main/webapp/js/editor.js index b77f3060..ada95ab4 100644 --- a/wise-webapp/src/main/webapp/js/editor.js +++ b/wise-webapp/src/main/webapp/js/editor.js @@ -461,7 +461,7 @@ function buildIconChooser() { var count = 0; for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i = i + 1) { - var familyIcons = mindplot.ImageIcon.prototype.ICON_FAMILIES[i]; + var familyIcons = mindplot.ImageIcon.prototype.ICON_FAMILIES[i].icons; for (var j = 0; j < familyIcons.length; j = j + 1) { // Separate icons by line ... diff --git a/wise-webapp/src/test/java/com/wisemapping/test/model/IconsTest.java b/wise-webapp/src/test/java/com/wisemapping/test/model/IconsTest.java index 4bb5f547..b2fcfcaa 100644 --- a/wise-webapp/src/test/java/com/wisemapping/test/model/IconsTest.java +++ b/wise-webapp/src/test/java/com/wisemapping/test/model/IconsTest.java @@ -12,6 +12,8 @@ import java.util.List; @Test public class IconsTest { + final private static String CURRENT_JSON_ICONS = "[{\"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\": \"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\"]},{\"id\": \"money\", \"icons\" : [\"money_money\",\"money_dollar\",\"money_euro\",\"money_pound\",\"money_yen\",\"money_coins\",\"money_ruby\"]},{\"id\": \"chart\", \"icons\" : [\"chart_bar\",\"chart_line\",\"chart_curve\",\"chart_pie\",\"chart_organisation\"]},]"; + @Test void checkImagesByFamily() throws IllegalAccessException { List iconByFamily = MindmapIcons.getIconByFamily(IconFamily.BULLET); @@ -27,21 +29,40 @@ public class IconsTest { final List iconByFamily = MindmapIcons.getIconByFamily(family); for (MindmapIcon mindmapIcon : iconByFamily) { final String pngName = mindmapIcon.getId() + ".png"; - File file = new File("src/main/webapp/icons/", pngName); - if (!file.exists()) { - System.err.println("File not found:" + pngName); - } -// else { -// System.err.println("Found:" + pngName); -// } - + final File file = new File("src/main/webapp/icons/", pngName); + Assert.assertTrue(file.exists(), "Could not be found:" + file.getAbsolutePath()); } } + } + @Test + void jsonGenerationRepresentation() { + + IconFamily[] values = IconFamily.values(); + final StringBuilder result = new StringBuilder("["); + + for (IconFamily family : values) { + result.append("{"); + result.append("\"id\": \"" + family.name().toLowerCase() + "\""); + result.append(", \"icons\" : ["); + + final List iconByFamily = MindmapIcons.getIconByFamily(family); + for (int i = 0; i < iconByFamily.size(); i++) { + if (i != 0) { + result.append(","); + } + MindmapIcon mindmapIcon = iconByFamily.get(i); + result.append("\"" + mindmapIcon.getId() + "\""); + } + + result.append("]},"); + } + result.append("]"); + System.out.println(result.toString()); + Assert.assertEquals(result.toString(), CURRENT_JSON_ICONS, "Some change has been introduced in the icons library. Please, check the IconIcons.js and update the variable.mindplot.ImageIcon.prototype.ICON_FAMILIES"); } - }