Introduce the convept of Feature to a topic.

This commit is contained in:
Paulo Gustavo Veiga 2012-02-27 18:17:15 -03:00
parent 9e44804314
commit 7ba0e36cb9
26 changed files with 483 additions and 1240 deletions

View File

@ -68,7 +68,6 @@
<filelist dir="${basedir}/src/main/javascript/" files="DesignerKeyboard.js"/> <filelist dir="${basedir}/src/main/javascript/" files="DesignerKeyboard.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="NodeGraph.js"/> <filelist dir="${basedir}/src/main/javascript/" files="NodeGraph.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="Topic.js"/> <filelist dir="${basedir}/src/main/javascript/" files="Topic.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="TextTopic.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="CentralTopic.js"/> <filelist dir="${basedir}/src/main/javascript/" files="CentralTopic.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="MainTopic.js"/> <filelist dir="${basedir}/src/main/javascript/" files="MainTopic.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="DragTopic.js"/> <filelist dir="${basedir}/src/main/javascript/" files="DragTopic.js"/>
@ -82,7 +81,8 @@
<!--<filelist dir="${basedir}/src/main/javascript/" files="RichTextEditor.js"/>--> <!--<filelist dir="${basedir}/src/main/javascript/" files="RichTextEditor.js"/>-->
<filelist dir="${basedir}/src/main/javascript/" files="TextEditorFactory.js"/> <filelist dir="${basedir}/src/main/javascript/" files="TextEditorFactory.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="util/Shape.js"/> <filelist dir="${basedir}/src/main/javascript/" files="util/Shape.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="persistence/ModelCodeName.js"/> <filelist dir="${basedir}/src/main/javascript/"
files="persistence/ModelCodeName.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="persistence/XMLSerializer_Pela.js"/> files="persistence/XMLSerializer_Pela.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
@ -91,7 +91,8 @@
files="persistence/Pela2TangoMigrator.js"/> files="persistence/Pela2TangoMigrator.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="persistence/XMLSerializer_Beta.js"/> files="persistence/XMLSerializer_Beta.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="persistence/Beta2PelaMigrator.js"/> <filelist dir="${basedir}/src/main/javascript/"
files="persistence/Beta2PelaMigrator.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="persistence/XMLSerializerFactory.js"/> files="persistence/XMLSerializerFactory.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/> <filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/>
@ -105,6 +106,7 @@
<filelist dir="${basedir}/src/main/javascript/" files="ActionIcon.js"/> <filelist dir="${basedir}/src/main/javascript/" files="ActionIcon.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="ImageIcon.js"/> <filelist dir="${basedir}/src/main/javascript/" files="ImageIcon.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/FeatureModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/IconModel.js"/> <filelist dir="${basedir}/src/main/javascript/" files="model/IconModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/LinkModel.js"/> <filelist dir="${basedir}/src/main/javascript/" files="model/LinkModel.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="model/NoteModel.js"/> <filelist dir="${basedir}/src/main/javascript/" files="model/NoteModel.js"/>
@ -114,7 +116,7 @@
<filelist dir="${basedir}/src/main/javascript/" files="ControlPoint.js"/> <filelist dir="${basedir}/src/main/javascript/" files="ControlPoint.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="EditorOptions.js"/> <filelist dir="${basedir}/src/main/javascript/" files="EditorOptions.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="RelationshipPivot.js"/> <filelist dir="${basedir}/src/main/javascript/" files="RelationshipPivot.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="TopicFeature.js"/>
<filelist dir="${basedir}/src/main/javascript/commands/" <filelist dir="${basedir}/src/main/javascript/commands/"
files="GenericFunctionCommand.js"/> files="GenericFunctionCommand.js"/>
<filelist dir="${basedir}/src/main/javascript/commands/" files="DeleteCommand.js"/> <filelist dir="${basedir}/src/main/javascript/commands/" files="DeleteCommand.js"/>
@ -123,17 +125,11 @@
<filelist dir="${basedir}/src/main/javascript/commands/" <filelist dir="${basedir}/src/main/javascript/commands/"
files="AddTopicCommand.js"/> files="AddTopicCommand.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="commands/ChangeLinkToTopicCommand.js"/> files="commands/ChangeFeatureToTopicCommand.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="commands/RemoveLinkFromTopicCommand.js"/> files="commands/RemoveFeatureFromTopicCommand.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="commands/AddIconToTopicCommand.js"/> files="commands/AddFeatureToTopicCommand.js"/>
<filelist dir="${basedir}/src/main/javascript/"
files="commands/RemoveIconFromTopicCommand.js"/>
<filelist dir="${basedir}/src/main/javascript/"
files="commands/ChangeNoteToTopicCommand.js"/>
<filelist dir="${basedir}/src/main/javascript/"
files="commands/RemoveNoteFromTopicCommand.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="commands/AddRelationshipCommand.js"/> files="commands/AddRelationshipCommand.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
@ -167,6 +163,7 @@
files="widget/IMenu.js"/> files="widget/IMenu.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="widget/Menu.js"/> files="widget/Menu.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="TopicFeature.js"/>
<filelist dir="${basedir}/src/main/javascript/" <filelist dir="${basedir}/src/main/javascript/"
files="layout/EventBusDispatcher.js"/> files="layout/EventBusDispatcher.js"/>

View File

@ -23,18 +23,6 @@ mindplot.ActionDispatcher = new Class({
$assert(commandContext, "commandContext can not be null"); $assert(commandContext, "commandContext can not be null");
}, },
addIconToTopic: function(topicId, iconType) {
throw "method must be implemented.";
},
changeLinkToTopic: function(topicId, url) {
throw "method must be implemented.";
},
changeNoteToTopic: function(topicId, text) {
throw "method must be implemented.";
},
connectByRelation: function(model, mindmap) { connectByRelation: function(model, mindmap) {
throw "method must be implemented."; throw "method must be implemented.";
}, },
@ -59,18 +47,6 @@ mindplot.ActionDispatcher = new Class({
throw "method must be implemented."; throw "method must be implemented.";
}, },
removeIconFromTopic: function(topicId, iconModel) {
throw "method must be implemented.";
},
removeLinkFromTopic: function(topicId) {
throw "method must be implemented.";
},
removeNoteFromTopic: function(topicId) {
throw "method must be implemented.";
},
changeFontFamilyToTopic: function(topicIds, fontFamily) { changeFontFamilyToTopic: function(topicIds, fontFamily) {
throw "method must be implemented."; throw "method must be implemented.";
}, },
@ -109,9 +85,19 @@ mindplot.ActionDispatcher = new Class({
shrinkBranch : function(topicsIds, collapse) { shrinkBranch : function(topicsIds, collapse) {
throw "method must be implemented."; throw "method must be implemented.";
},
addFeatureToTopic : function(topicId, type, attributes) {
throw "method must be implemented.";
},
changeFeatureToTopic : function(topicId, featureId, attributes) {
throw "method must be implemented.";
},
removeFeatureFromTopic : function(topicId, featureId) {
throw "method must be implemented.";
} }
}); });
mindplot.ActionDispatcher.setInstance = function(dispatcher) { mindplot.ActionDispatcher.setInstance = function(dispatcher) {

View File

@ -22,14 +22,17 @@ mindplot.Command = new Class(
{ {
this._id = mindplot.Command._nextUUID(); this._id = mindplot.Command._nextUUID();
}, },
execute: function(commandContext) execute: function(commandContext)
{ {
throw "execute must be implemented."; throw "execute must be implemented.";
}, },
undoExecute: function(commandContext) undoExecute: function(commandContext)
{ {
throw "undo must be implemented."; throw "undo must be implemented.";
}, },
getId:function() getId:function()
{ {
return this._id; return this._id;

View File

@ -422,7 +422,7 @@ mindplot.Designer = new Class({
$assert(mindmapModel, "mindmapModel can not be null"); $assert(mindmapModel, "mindmapModel can not be null");
this._mindmap = mindmapModel; this._mindmap = mindmapModel;
// try { try {
// Init layout manager ... // Init layout manager ...
var size = {width:25,height:25}; var size = {width:25,height:25};
var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size); var layoutManager = new mindplot.layout.LayoutManager(mindmapModel.getCentralTopic().getId(), size);
@ -446,7 +446,6 @@ mindplot.Designer = new Class({
nodeGraph.setBranchVisibility(true); nodeGraph.setBranchVisibility(true);
} }
var relationships = mindmapModel.getRelationships(); var relationships = mindmapModel.getRelationships();
for (var j = 0; j < relationships.length; j++) { for (var j = 0; j < relationships.length; j++) {
this._relationshipModelToRelationship(relationships[j]); this._relationshipModelToRelationship(relationships[j]);
@ -460,9 +459,9 @@ mindplot.Designer = new Class({
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout); mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);
this.fireEvent('loadSuccess'); this.fireEvent('loadSuccess');
// } catch(e) { } catch(e) {
// this.fireEvent('loadError',e); this.fireEvent('loadError', e);
// } }
}, },
getMindmap : function() { getMindmap : function() {
@ -707,7 +706,7 @@ mindplot.Designer = new Class({
addIconType : function(iconType) { addIconType : function(iconType) {
var topicsIds = this.getModel().filterTopicsIds(); var topicsIds = this.getModel().filterTopicsIds();
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.addIconToTopic(topicsIds[0], iconType); this._actionDispatcher.addFeatureToTopic(topicsIds[0], mindplot.TopicFeature.Icon.id, {id:iconType});
} }
}, },

View File

@ -83,10 +83,10 @@ mindplot.IconGroup = new Class({
_findIconFromModel : function(iconModel) { _findIconFromModel : function(iconModel) {
var result = null; var result = null;
this._icons.each(function(el) { this._icons.each(function(icon) {
var elModel = el.getModel(); var elModel = icon.getModel();
if (result == null && $defined(elModel.isIconModel) && elModel.getId() == iconModel.getId()) { if (elModel.getId() == iconModel.getId()) {
result = el; result = icon;
} }
}, this); }, this);
@ -110,6 +110,13 @@ mindplot.IconGroup = new Class({
this._removeIcon(icon); this._removeIcon(icon);
}, },
removeIconByModel : function(featureModel) {
$assert(featureModel, "featureModel can not be null");
var icon = this._findIconFromModel(featureModel);
this._removeIcon(icon);
},
_removeIcon : function(icon) { _removeIcon : function(icon) {
$assert(icon, "icon can not be null"); $assert(icon, "icon can not be null");

View File

@ -23,7 +23,7 @@ mindplot.ImageIcon = new Class({
$assert(topic, 'topic can not be null'); $assert(topic, 'topic can not be null');
this._topicId = topic.getId(); this._topicId = topic.getId();
this._iconModel = iconModel; this._featureModel = iconModel;
// @Todo: Read only must be a property ... // @Todo: Read only must be a property ...
this._readOnly = designer._readOnly; this._readOnly = designer._readOnly;
@ -57,7 +57,7 @@ mindplot.ImageIcon = new Class({
}, },
getModel : function() { getModel : function() {
return this._iconModel; return this._featureModel;
}, },
_getNextFamilyIconId : function(iconId) { _getNextFamilyIconId : function(iconId) {
@ -98,21 +98,39 @@ mindplot.ImageIcon = new Class({
return result; return result;
}, },
getId : function() {
return this._iconType;
},
getUiId : function() {
return this._uiId;
},
remove : function() { remove : function() {
var actionDispatcher = mindplot.ActionDispatcher.getInstance(); var actionDispatcher = mindplot.ActionDispatcher.getInstance();
actionDispatcher.removeIconFromTopic(this._topicId, this._iconModel); var featureId = this._featureModel.getId();
var topicId = this._topicId;
actionDispatcher.removeFeatureFromTopic(topicId, featureId);
} }
}); });
mindplot.ImageIcon.prototype.ICON_FAMILIES = [{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]},{"id": "funy", "icons" : ["funy_angel","funy_devilish","funy_glasses","funy_grin","funy_kiss","funy_monkey"]},{"id": "conn", "icons" : ["conn_connect","conn_disconnect"]},{"id": "sport", "icons" : ["sport_basketball","sport_football","sport_golf","sport_raquet","sport_shuttlecock","sport_soccer","sport_tennis"]},{"id": "bulb", "icons" : ["bulb_light_on","bulb_light_off"]},{"id": "thumb", "icons" : ["thumb_thumb_up","thumb_thumb_down"]},{"id": "tick", "icons" : ["tick_tick","tick_cross"]},{"id": "onoff", "icons" : ["onoff_clock","onoff_clock_red","onoff_add","onoff_delete","onoff_status_offline","onoff_status_online"]},{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]},{"id": "time", "icons" : ["time_calendar","time_clock","time_hourglass"]},{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]},{"id": "sign", "icons" : ["sign_warning","sign_info","sign_stop","sign_help","sign_cancel"]},{"id": "hard", "icons" : ["hard_cd","hard_computer","hard_controller","hard_driver_disk","hard_ipod","hard_keyboard","hard_mouse","hard_printer"]},{"id": "soft", "icons" : ["soft_bug","soft_cursor","soft_database_table","soft_database","soft_feed","soft_folder_explore","soft_rss","soft_penguin"]},{"id": "arrow", "icons" : ["arrow_up","arrow_down","arrow_left","arrow_right"]},{"id": "arrowc", "icons" : ["arrowc_rotate_anticlockwise","arrowc_rotate_clockwise","arrowc_turn_left","arrowc_turn_right"]},{"id": "people", "icons" : ["people_group","people_male1","people_male2","people_female1","people_female2"]},{"id": "mail", "icons" : ["mail_envelop","mail_mailbox","mail_edit","mail_list"]},{"id": "flag", "icons" : ["flag_blue","flag_green","flag_orange","flag_pink","flag_purple","flag_yellow"]},{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]},{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]},{"id": "object", "icons" : ["object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house","object_cake","object_camera","object_palette","object_rainbow"]},{"id": "weather", "icons" : ["weather_clear-night","weather_clear","weather_few-clouds-night","weather_few-clouds","weather_overcast","weather_severe-alert","weather_showers-scattered","weather_showers","weather_snow","weather_storm"]}]; mindplot.ImageIcon.prototype.ICON_FAMILIES = [
{"id": "face", "icons" : ["face_plain","face_sad","face_crying","face_smile","face_surprise","face_wink"]},
{"id": "funy", "icons" : ["funy_angel","funy_devilish","funy_glasses","funy_grin","funy_kiss","funy_monkey"]},
{"id": "conn", "icons" : ["conn_connect","conn_disconnect"]},
{"id": "sport", "icons" : ["sport_basketball","sport_football","sport_golf","sport_raquet","sport_shuttlecock","sport_soccer","sport_tennis"]},
{"id": "bulb", "icons" : ["bulb_light_on","bulb_light_off"]},
{"id": "thumb", "icons" : ["thumb_thumb_up","thumb_thumb_down"]},
{"id": "tick", "icons" : ["tick_tick","tick_cross"]},
{"id": "onoff", "icons" : ["onoff_clock","onoff_clock_red","onoff_add","onoff_delete","onoff_status_offline","onoff_status_online"]},
{"id": "money", "icons" : ["money_money","money_dollar","money_euro","money_pound","money_yen","money_coins","money_ruby"]},
{"id": "time", "icons" : ["time_calendar","time_clock","time_hourglass"]},
{"id": "chart", "icons" : ["chart_bar","chart_line","chart_curve","chart_pie","chart_organisation"]},
{"id": "sign", "icons" : ["sign_warning","sign_info","sign_stop","sign_help","sign_cancel"]},
{"id": "hard", "icons" : ["hard_cd","hard_computer","hard_controller","hard_driver_disk","hard_ipod","hard_keyboard","hard_mouse","hard_printer"]},
{"id": "soft", "icons" : ["soft_bug","soft_cursor","soft_database_table","soft_database","soft_feed","soft_folder_explore","soft_rss","soft_penguin"]},
{"id": "arrow", "icons" : ["arrow_up","arrow_down","arrow_left","arrow_right"]},
{"id": "arrowc", "icons" : ["arrowc_rotate_anticlockwise","arrowc_rotate_clockwise","arrowc_turn_left","arrowc_turn_right"]},
{"id": "people", "icons" : ["people_group","people_male1","people_male2","people_female1","people_female2"]},
{"id": "mail", "icons" : ["mail_envelop","mail_mailbox","mail_edit","mail_list"]},
{"id": "flag", "icons" : ["flag_blue","flag_green","flag_orange","flag_pink","flag_purple","flag_yellow"]},
{"id": "bullet", "icons" : ["bullet_black","bullet_blue","bullet_green","bullet_orange","bullet_red","bullet_pink","bullet_purple"]},
{"id": "tag", "icons" : ["tag_blue","tag_green","tag_orange","tag_red","tag_pink","tag_yellow"]},
{"id": "object", "icons" : ["object_bell","object_clanbomber","object_key","object_pencil","object_phone","object_magnifier","object_clip","object_music","object_star","object_wizard","object_house","object_cake","object_camera","object_palette","object_rainbow"]},
{"id": "weather", "icons" : ["weather_clear-night","weather_clear","weather_few-clouds-night","weather_few-clouds","weather_overcast","weather_severe-alert","weather_showers-scattered","weather_showers","weather_snow","weather_storm"]}
];

View File

@ -19,7 +19,7 @@
mindplot.ShirinkConnector = new Class({ mindplot.ShirinkConnector = new Class({
initialize: function(topic) { initialize: function(topic) {
var ellipse = new web2d.Elipse(mindplot.TextTopic.prototype.INNER_RECT_ATTRIBUTES); var ellipse = new web2d.Elipse(mindplot.Topic.prototype.INNER_RECT_ATTRIBUTES);
this._ellipse = ellipse; this._ellipse = ellipse;
ellipse.setFill('rgb(62,118,179)'); ellipse.setFill('rgb(62,118,179)');

View File

@ -28,26 +28,12 @@ mindplot.StandaloneActionDispatcher = new Class({
this._actionRunner.hasBeenChanged(); this._actionRunner.hasBeenChanged();
}, },
addIconToTopic: function(topicId, iconType) {
var command = new mindplot.commands.AddIconToTopicCommand(topicId, iconType);
this.execute(command);
},
changeLinkToTopic: function(topicId, url) {
var command = new mindplot.commands.ChangeLinkToTopicCommand(topicId, url);
this.execute(command);
},
addTopic:function(nodeModel, parentTopicId, animated) { addTopic:function(nodeModel, parentTopicId, animated) {
var command = new mindplot.commands.AddTopicCommand(nodeModel, parentTopicId, animated); var command = new mindplot.commands.AddTopicCommand(nodeModel, parentTopicId, animated);
this.execute(command); this.execute(command);
}, },
changeNoteToTopic: function(topicId, text) {
var command = new mindplot.commands.ChangeNoteToTopicCommand(topicId, text);
this.execute(command);
},
connectByRelation: function(model) { connectByRelation: function(model) {
var command = new mindplot.commands.AddRelationshipCommand(model); var command = new mindplot.commands.AddRelationshipCommand(model);
this.execute(command); this.execute(command);
@ -82,20 +68,6 @@ mindplot.StandaloneActionDispatcher = new Class({
this.execute(command); this.execute(command);
}, },
removeIconFromTopic: function(topicId, iconModel) {
var command = new mindplot.commands.RemoveIconFromTopicCommand(topicId, iconModel);
this.execute(command);
},
removeLinkFromTopic: function(topicId) {
var command = new mindplot.commands.RemoveLinkFromTopicCommand(topicId);
this.execute(command);
},
removeNoteFromTopic: function(topicId) {
var command = new mindplot.commands.RemoveNoteFromTopicCommand(topicId);
this.execute(command);
},
changeFontStyleToTopic: function(topicsIds) { changeFontStyleToTopic: function(topicsIds) {
var commandFunc = function(topic) { var commandFunc = function(topic) {
@ -242,6 +214,21 @@ mindplot.StandaloneActionDispatcher = new Class({
this.execute(command, false); this.execute(command, false);
}, },
addFeatureToTopic : function(topicId, featureType, attributes) {
var command = new mindplot.commands.AddFeatureToTopicCommand(topicId, featureType, attributes);
this.execute(command);
},
changeFeatureToTopic : function(topicId, featureId, attributes) {
var command = new mindplot.commands.ChangeFeatureToTopicCommand(topicId, featureId, attributes);
this.execute(command);
},
removeFeatureFromTopic : function(topicId, featureId) {
var command = new mindplot.commands.RemoveFeatureFromTopicCommand(topicId, featureId);
this.execute(command);
},
execute:function(command) { execute:function(command) {
this._actionRunner.execute(command); this._actionRunner.execute(command);
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout); mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout);

View File

@ -1,590 +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.
*/
mindplot.TextTopic = new Class({
Extends:mindplot.Topic,
initialize : function(model, options) {
this._textEditor = new mindplot.MultilineTextEditor(this);
this.parent(model, options);
},
_registerEvents : function() {
this.parent();
this.addEvent('dblclick', function (event) {
this._textEditor.show();
event.stopPropagation(true);
}.bind(this));
this._textEditor.addEvent('input', function(event, text) {
var textShape = this.getTextShape();
// var oldText = textShape.getText();
// this._setText(text, false);
// @Todo: I must resize, no change the position ...
// textShape.setText(oldText);
}.bind(this));
},
setShapeType : function(type) {
this._setShapeType(type, true);
},
_setShapeType : function(type, updateModel) {
// Remove inner shape figure ...
var model = this.getModel();
if ($defined(updateModel) && updateModel) {
model.setShapeType(type);
}
var oldInnerShape = this.getInnerShape();
if (oldInnerShape != null) {
this._removeInnerShape();
// Create a new one ...
var innerShape = this.getInnerShape();
// Update figure size ...
var size = model.getSize();
this.setSize(size, true);
var group = this.get2DElement();
group.appendChild(innerShape);
// Move text to the front ...
var text = this.getTextShape();
text.moveToFront();
//Move iconGroup to front ...
var iconGroup = this.getIconGroup();
if ($defined(iconGroup)) {
iconGroup.moveToFront();
}
//Move connector to front
var connector = this.getShrinkConnector();
if ($defined(connector)) {
connector.moveToFront();
}
}
},
getShapeType : function() {
var model = this.getModel();
var result = model.getShapeType();
if (!$defined(result)) {
result = this._defaultShapeType();
}
return result;
},
getInnerShape : function() {
if (!$defined(this._innerShape)) {
// Create inner box.
this._innerShape = this.buildShape(mindplot.TextTopic.INNER_RECT_ATTRIBUTES);
// Update bgcolor ...
var bgColor = this.getBackgroundColor();
this._setBackgroundColor(bgColor, false);
// Update border color ...
var brColor = this.getBorderColor();
this._setBorderColor(brColor, false);
// Define the pointer ...
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
this._innerShape.setCursor('move');
} else {
this._innerShape.setCursor('default');
}
}
return this._innerShape;
},
buildShape : function(attributes, type) {
var result;
if (!$defined(type)) {
type = this.getShapeType();
}
if (type == mindplot.model.INodeModel.SHAPE_TYPE_RECT) {
result = new web2d.Rect(0, attributes);
}
else if (type == mindplot.model.INodeModel.SHAPE_TYPE_ELIPSE) {
result = new web2d.Rect(0.9, attributes);
}
else if (type == mindplot.model.INodeModel.SHAPE_TYPE_ROUNDED_RECT) {
result = new web2d.Rect(0.3, attributes);
}
else if (type == mindplot.model.INodeModel.SHAPE_TYPE_LINE) {
result = new web2d.Line({strokeColor:"#495879",strokeWidth:1});
result.setSize = function(width, height) {
this.size = {width:width, height:height};
result.setFrom(0, height);
result.setTo(width, height);
// Lines will have the same color of the default connection lines...
var stokeColor = mindplot.ConnectionLine.getStrokeColor();
result.setStroke(1, 'solid', stokeColor);
};
result.getSize = function() {
return this.size;
};
result.setPosition = function() {
};
var setStrokeFunction = result.setStroke;
result.setFill = function() {
};
result.setStroke = function() {
};
}
else {
$assert(false, "Unsupported figure type:" + type);
}
result.setPosition(0, 0);
return result;
},
getOuterShape : function() {
if (!$defined(this._outerShape)) {
var rect = this.buildShape(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES, mindplot.model.INodeModel.SHAPE_TYPE_ROUNDED_RECT);
rect.setPosition(-2, -3);
rect.setOpacity(0);
this._outerShape = rect;
}
return this._outerShape;
},
getTextShape : function() {
if (!$defined(this._text)) {
this._text = this._buildTextShape(false);
// Set Text ...
var text = this.getText();
this._setText(text, false);
}
return this._text;
},
_buildTextShape : function(readOnly) {
var result = new web2d.Text();
var family = this.getFontFamily();
var size = this.getFontSize();
var weight = this.getFontWeight();
var style = this.getFontStyle();
result.setFont(family, size, style, weight);
var color = this.getFontColor();
result.setColor(color);
if (!readOnly) {
// Propagate mouse events ...
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
result.setCursor('move');
} else {
result.setCursor('default');
}
}
return result;
},
_getInnerPadding : function() {
throw "this must be implemented";
},
setFontFamily : function(value, updateModel) {
var textShape = this.getTextShape();
textShape.setFontFamily(value);
if ($defined(updateModel) && updateModel) {
var model = this.getModel();
model.setFontFamily(value);
}
this._adjustShapes(updateModel);
},
setFontSize : function(value, updateModel) {
var textShape = this.getTextShape();
textShape.setSize(value);
if ($defined(updateModel) && updateModel) {
var model = this.getModel();
model.setFontSize(value);
}
this._adjustShapes(updateModel);
},
setFontStyle : function(value, updateModel) {
var textShape = this.getTextShape();
textShape.setStyle(value);
if ($defined(updateModel) && updateModel) {
var model = this.getModel();
model.setFontStyle(value);
}
this._adjustShapes(updateModel);
},
setFontWeight : function(value, updateModel) {
var textShape = this.getTextShape();
textShape.setWeight(value);
if ($defined(updateModel) && updateModel) {
var model = this.getModel();
model.setFontWeight(value);
}
this._adjustShapes();
},
getFontWeight : function() {
var model = this.getModel();
var result = model.getFontWeight();
if (!$defined(result)) {
var font = this._defaultFontStyle();
result = font.weight;
}
return result;
},
getFontFamily : function() {
var model = this.getModel();
var result = model.getFontFamily();
if (!$defined(result)) {
var font = this._defaultFontStyle();
result = font.font;
}
return result;
},
getFontColor : function() {
var model = this.getModel();
var result = model.getFontColor();
if (!$defined(result)) {
var font = this._defaultFontStyle();
result = font.color;
}
return result;
},
getFontStyle : function() {
var model = this.getModel();
var result = model.getFontStyle();
if (!$defined(result)) {
var font = this._defaultFontStyle();
result = font.style;
}
return result;
},
getFontSize : function() {
var model = this.getModel();
var result = model.getFontSize();
if (!$defined(result)) {
var font = this._defaultFontStyle();
result = font.size;
}
return result;
},
setFontColor : function(value, updateModel) {
var textShape = this.getTextShape();
textShape.setColor(value);
if ($defined(updateModel) && updateModel) {
var model = this.getModel();
model.setFontColor(value);
}
},
_setText : function(text, updateModel) {
var textShape = this.getTextShape();
textShape.setText(text == null ? this._defaultText() : text);
if ($defined(updateModel) && updateModel) {
var model = this.getModel();
model.setText(text);
}
},
setText : function(text) {
// Avoid empty nodes ...
if (text.trim().length == 0) {
text = null;
}
this._setText(text, true);
this._adjustShapes();
},
getText : function() {
var model = this.getModel();
var result = model.getText();
if (!$defined(result)) {
result = this._defaultText();
}
return result;
},
setBackgroundColor : function(color) {
this._setBackgroundColor(color, true);
},
_setBackgroundColor : function(color, updateModel) {
var innerShape = this.getInnerShape();
innerShape.setFill(color);
var connector = this.getShrinkConnector();
connector.setFill(color);
if ($defined(updateModel) && updateModel) {
var model = this.getModel();
model.setBackgroundColor(color);
}
},
getBackgroundColor : function() {
var model = this.getModel();
var result = model.getBackgroundColor();
if (!$defined(result)) {
result = this._defaultBackgroundColor();
}
return result;
},
setBorderColor : function(color) {
this._setBorderColor(color, true);
},
_setBorderColor : function(color, updateModel) {
var innerShape = this.getInnerShape();
innerShape.setAttribute('strokeColor', color);
var connector = this.getShrinkConnector();
connector.setAttribute('strokeColor', color);
if ($defined(updateModel) && updateModel) {
var model = this.getModel();
model.setBorderColor(color);
}
},
getBorderColor : function() {
var model = this.getModel();
var result = model.getBorderColor();
if (!$defined(result)) {
result = this._defaultBorderColor();
}
return result;
},
_buildShape : function() {
var groupAttributes = {width: 100, height:100,coordSizeWidth:100,coordSizeHeight:100};
var group = new web2d.Group(groupAttributes);
this._set2DElement(group);
// Shape must be build based on the model width ...
var outerShape = this.getOuterShape();
var innerShape = this.getInnerShape();
var textShape = this.getTextShape();
var shrinkConnector = this.getShrinkConnector();
// Add to the group ...
group.appendChild(outerShape);
group.appendChild(innerShape);
group.appendChild(textShape);
// Update figure size ...
var model = this.getModel();
if (model.getLinks().length != 0 || model.getNotes().length != 0 || model.getIcons().length != 0) {
this.getOrBuildIconGroup();
}
if (this.getType() != mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE) {
shrinkConnector.addToWorkspace(group);
}
// Register listeners ...
this._registerDefaultListenersToElement(group, this);
},
showTextEditor : function(text) {
this._textEditor.show(text);
},
showLinkEditor : function() {
var topicId = this.getId();
var model = this.getModel();
var editorModel = {
getValue : function() {
var links = model.getLinks();
var result;
if (links.length > 0)
result = links[0].getUrl();
return result;
},
setValue : function(value) {
var dispatcher = mindplot.ActionDispatcher.getInstance();
if (!$defined(value)) {
dispatcher.removeLinkFromTopic(topicId);
}
else {
dispatcher.changeLinkToTopic(topicId, value);
}
}
};
this.closeEditors();
var editor = new mindplot.widget.LinkEditor(editorModel);
editor.show();
},
closeEditors : function() {
this._textEditor.close(true);
},
/**
* Point: references the center of the rect shape.!!!
*/
setPosition : function(point) {
$assert(point, "position can not be null");
point.x = Math.ceil(point.x);
point.y = Math.ceil(point.y);
// Update model's position ...
var model = this.getModel();
model.setPosition(point.x, point.y);
// Elements are positioned in the center.
// All topic element must be positioned based on the innerShape.
var size = this.getSize();
var cx = point.x - (size.width / 2);
var cy = point.y - (size.height / 2);
// Update visual position.
this._elem2d.setPosition(cx, cy);
// Update connection lines ...
this._updateConnectionLines();
// Check object state.
this.invariant();
},
getOutgoingConnectedTopic : function() {
var result = null;
var line = this.getOutgoingLine();
if ($defined(line)) {
result = line.getTargetTopic();
}
return result;
},
_setTopicVisibility : function(value) {
this.parent(value);
var textShape = this.getTextShape();
textShape.setVisibility(value);
},
setOpacity : function(opacity) {
this.parent();
var textShape = this.getTextShape();
textShape.setOpacity(opacity);
},
_updatePositionOnChangeSize : function(oldSize, newSize) {
$assert(false, "this method must be overwrited.");
},
createDragNode : function(layoutManager) {
var result = this.parent(layoutManager);
// Is the node already connected ?
var targetTopic = this.getOutgoingConnectedTopic();
if ($defined(targetTopic)) {
result.connectTo(targetTopic);
result.setVisibility(false);
}
// If a drag node is create for it, let's hide the editor.
this._textEditor.close();
return result;
},
_adjustShapes : function() {
if (this._isInWorkspace) {
var textShape = this.getTextShape();
var textWidth = textShape.getWidth();
var textHeight = textShape.getHeight();
textHeight = textHeight != 0 ? textHeight : 20;
var topicPadding = this._getInnerPadding();
// Adjust the icon size to the size of the text ...
var iconGroup = this.getOrBuildIconGroup();
var fontHeight = this.getTextShape().getFontHeight();
iconGroup.setPosition(topicPadding, topicPadding);
iconGroup.seIconSize(fontHeight, fontHeight);
// Add a extra padding between the text and the icons
var iconsWidth = iconGroup.getSize().width;
if (iconsWidth != 0) {
iconsWidth = iconsWidth + (textHeight / 4);
}
var height = textHeight + (topicPadding * 2);
var width = textWidth + iconsWidth + (topicPadding * 2);
this.setSize({width:width,height:height});
// Position node ...
textShape.setPosition(topicPadding + iconsWidth, topicPadding);
}
}
});
mindplot.TextTopic.INNER_RECT_ATTRIBUTES = {stroke:'2 solid'};

View File

@ -260,129 +260,55 @@ mindplot.Topic = new Class({
var padding = this._getInnerPadding(); var padding = this._getInnerPadding();
result.setPosition(padding, padding); result.setPosition(padding, padding);
// Load topic features ...
var model = this.getModel(); var model = this.getModel();
var featuresModel = model.getFeatures();
//Icons for (var i = 0; i < featuresModel.length; i++) {
var icons = model.getIcons(); var featureModel = featuresModel[i];
for (var i = 0; i < icons.length; i++) { var icon = mindplot.TopicFeature.createIcon(this, featureModel);
// Update model identifier ... result.addIcon(icon, featureModel.getType() == "icon"); // @Todo: Remove hack ...
var iconModel = icons[i];
var icon = new mindplot.ImageIcon(this, iconModel);
result.addIcon(icon, true);
}
//Links
var links = model.getLinks();
for (var i = 0; i < links.length; i++) {
this._link = new mindplot.LinkIcon(this, links[i]);
result.addIcon(this._link);
}
//Notes
var notes = model.getNotes();
for (var j = 0; j < notes.length; j++) {
this._note = new mindplot.NoteIcon(this, notes[j]);
result.addIcon(this._note);
} }
return result; return result;
}, },
addLink : function(url) { addFeature : function(type, attributes) {
var iconGroup = this.getOrBuildIconGroup();
var model = this.getModel();
var linkModel = model.createLink(url);
model.addLink(linkModel);
this._link = new mindplot.LinkIcon(this, linkModel);
iconGroup.addIcon(this._link);
this._adjustShapes();
},
addNote : function(text) {
var iconGroup = this.getOrBuildIconGroup();
var model = this.getModel();
var noteModel = model.createNote(text);
model.addNote(noteModel);
this._note = new mindplot.NoteIcon(this, noteModel);
iconGroup.addIcon(this._note);
this._adjustShapes();
},
addIcon : function(iconType) {
var iconGroup = this.getOrBuildIconGroup(); var iconGroup = this.getOrBuildIconGroup();
this.closeEditors(); this.closeEditors();
var model = this.getModel(); var model = this.getModel();
// Update model ... // Update model ...
var iconModel = model.createIcon(iconType); var feature = model.createFeature(type, attributes);
model.addIcon(iconModel); model.addFeature(feature);
var result = mindplot.TopicFeature.createIcon(this, feature);
iconGroup.addIcon(result, type == "icon"); // @Todo: Remove hack ...
var imageIcon = new mindplot.ImageIcon(this, iconModel);
iconGroup.addIcon(imageIcon, true);
this._adjustShapes(); this._adjustShapes();
return imageIcon; return result;
}, },
removeIcon : function(iconModel) { findFeatureById : function(id) {
var model = this.getModel();
return model.findFeatureById(id);
},
removeFeature : function(featureModel) {
$assert(featureModel, "featureModel could not be null");
//Removing the icon from MODEL //Removing the icon from MODEL
var model = this.getModel(); var model = this.getModel();
model.removeIcon(iconModel); model.removeFeature(featureModel);
//Removing the icon from UI //Removing the icon from UI
var iconGroup = this.getIconGroup(); var iconGroup = this.getIconGroup();
if ($defined(iconGroup)) { if ($defined(iconGroup)) {
iconGroup.removeIcon(iconModel); iconGroup.removeIconByModel(featureModel);
} }
this._adjustShapes(); this._adjustShapes();
}, },
removeLink : function() {
// Update model ...
var model = this.getModel();
var links = model.getLinks();
model._removeLink(links[0]);
// Remove UI ...
var iconGroup = this.getIconGroup();
if ($defined(iconGroup)) {
iconGroup.removeIconByUrl(mindplot.LinkIcon.IMAGE_URL);
}
this._link = null;
this._adjustShapes();
},
removeNote : function() {
// Update model ...
var model = this.getModel();
var notes = model.getNotes();
model.removeNote(notes[0]);
// Remove UI ...
var iconGroup = this.getIconGroup();
if ($defined(iconGroup)) {
iconGroup.removeIconByUrl(mindplot.NoteIcon.IMAGE_URL);
}
this._note = null;
this._adjustShapes();
},
hasNote : function() {
return this.getModel().getNotes().length != 0;
},
hasLink : function() {
return this.getModel().getLinks().length != 0;
},
connectByRelation : function(relationship) { connectByRelation : function(relationship) {
this._relationships.push(relationship); this._relationships.push(relationship);
}, },
@ -624,7 +550,7 @@ mindplot.Topic = new Class({
// Update figure size ... // Update figure size ...
var model = this.getModel(); var model = this.getModel();
if (model.getLinks().length != 0 || model.getNotes().length != 0 || model.getIcons().length != 0) { if (model.getFeatures().length != 0) {
this.getOrBuildIconGroup(); this.getOrBuildIconGroup();
} }
@ -728,7 +654,7 @@ mindplot.Topic = new Class({
var model = this.getModel(); var model = this.getModel();
var editorModel = { var editorModel = {
getValue : function() { getValue : function() {
var notes = model.getNotes(); var notes = model.findFeatureByType(mindplot.TopicFeature.Note.id);
var result; var result;
if (notes.length > 0) if (notes.length > 0)
result = notes[0].getText(); result = notes[0].getText();
@ -738,11 +664,18 @@ mindplot.Topic = new Class({
setValue : function(value) { setValue : function(value) {
var dispatcher = mindplot.ActionDispatcher.getInstance(); var dispatcher = mindplot.ActionDispatcher.getInstance();
var notes = model.findFeatureByType(mindplot.TopicFeature.Note.id);
if (!$defined(value)) { if (!$defined(value)) {
dispatcher.removeNoteFromTopic(topicId); var featureId = notes[0].getId();
dispatcher.removeFeatureFromTopic(topicId, featureId);
} }
else { else {
dispatcher.changeNoteToTopic(topicId, value); if (notes.length > 0) {
dispatcher.changeFeatureToTopic(topicId, notes[0].getId(), {text:value});
}
else {
dispatcher.addFeatureToTopic(topicId, mindplot.TopicFeature.Note.id, {text:value});
}
} }
} }
}; };
@ -757,7 +690,7 @@ mindplot.Topic = new Class({
var model = this.getModel(); var model = this.getModel();
var editorModel = { var editorModel = {
getValue : function() { getValue : function() {
var links = model.getLinks(); var links = model.findFeatureByType(mindplot.TopicFeature.Link.id);
var result; var result;
if (links.length > 0) if (links.length > 0)
result = links[0].getUrl(); result = links[0].getUrl();
@ -767,11 +700,18 @@ mindplot.Topic = new Class({
setValue : function(value) { setValue : function(value) {
var dispatcher = mindplot.ActionDispatcher.getInstance(); var dispatcher = mindplot.ActionDispatcher.getInstance();
var links = model.findFeatureByType(mindplot.TopicFeature.Link.id);
if (!$defined(value)) { if (!$defined(value)) {
dispatcher.removeLinkFromTopic(topicId); var featureId = links[0].getId();
dispatcher.removeFeatureFromTopic(topicId, featureId);
} }
else { else {
dispatcher.changeLinkToTopic(topicId, value); if (links.length > 0) {
dispatcher.changeFeatureToTopic(topicId, links[0].getId(), {url:value});
}
else {
dispatcher.addFeatureToTopic(topicId, mindplot.TopicFeature.Link.id, {url:value});
}
} }
} }
}; };
@ -841,7 +781,6 @@ mindplot.Topic = new Class({
return result; return result;
}, },
_updateConnectionLines : function() { _updateConnectionLines : function() {
// Update this to parent line ... // Update this to parent line ...
var outgoingLine = this.getOutgoingLine(); var outgoingLine = this.getOutgoingLine();

View File

@ -0,0 +1,68 @@
/*
* 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.
*/
mindplot.TopicFeature = {
Icon: {
id:mindplot.model.IconModel.FEATURE_TYPE,
model: mindplot.model.IconModel,
icon : mindplot.ImageIcon
},
Link: {
id: mindplot.model.LinkModel.FEATURE_TYPE,
model: mindplot.model.LinkModel,
icon : mindplot.LinkIcon
},
Note: {
id: mindplot.model.NoteModel.FEATURE_TYPE,
model: mindplot.model.NoteModel,
icon : mindplot.NoteIcon
},
isSupported : function(id) {
return mindplot.TopicFeature._featuresMetadataById.some(function(elem) {
return elem.id == id;
});
},
createModel : function(id, topic, attributes) {
$assert(id, 'type can not be null');
$assert(topic, 'topic can not be null');
$assert(attributes, 'attributes can not be null');
var model = mindplot.TopicFeature._featuresMetadataById.filter(function(elem) {
return elem.id == id;
})[0].model;
return new model(topic, attributes);
},
createIcon : function(topic, model) {
$assert(topic, 'topic can not be null');
$assert(model, 'model can not be null');
var icon = mindplot.TopicFeature._featuresMetadataById.filter(function(elem) {
return elem.id == model.getType();
})[0].icon;
return new icon(topic, model);
}
};
mindplot.TopicFeature._featuresMetadataById = [mindplot.TopicFeature.Icon,mindplot.TopicFeature.Link,mindplot.TopicFeature.Note]

View File

@ -16,23 +16,27 @@
* limitations under the License. * limitations under the License.
*/ */
mindplot.commands.AddIconToTopicCommand = new Class({ mindplot.commands.AddFeatureToTopicCommand = new Class({
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId, iconType) { initialize: function(topicId, featureType, attributes) {
$assert($defined(topicId), 'topicId can not be null'); $assert($defined(topicId), 'topicId can not be null');
$assert(iconType, 'iconType can not be null'); $assert(featureType, 'featureType can not be null');
this._topicsIds = topicId; $assert(attributes, 'attributes can not be null');
this._iconType = iconType;
this._topicId = topicId;
this._featureType = featureType;
this._attributes = attributes;
}, },
execute: function(commandContext) { execute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0]; var topic = commandContext.findTopics(this._topicId)[0];
var iconImg = topic.addIcon(this._iconType, commandContext._designer); var icon = topic.addFeature(this._featureType, this._attributes);
this._iconModel = iconImg.getModel(); this._featureModel = icon.getModel();
}, },
undoExecute: function(commandContext) { undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0]; var topic = commandContext.findTopics(this._topicId)[0];
topic.removeIcon(this._iconModel); topic.removeFeature(this._featureModel);
} }
}); });

View File

@ -16,23 +16,28 @@
* limitations under the License. * limitations under the License.
*/ */
mindplot.commands.RemoveLinkFromTopicCommand = new Class({ mindplot.commands.ChangeFeatureToTopicCommand = new Class({
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId) { initialize: function(topicId, featureId, attributes) {
$assert($defined(topicId), 'topicId can not be null'); $assert($defined(topicId), 'topicId can not be null');
this._topicsIds = topicId; $assert($defined(featureId), 'featureId can not be null');
$assert($defined(attributes), 'attributes can not be null');
this._topicId = topicId;
this._featureId = featureId;
this._attributes = attributes;
}, },
execute: function(commandContext) { execute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0]; var topic = commandContext.findTopics(this._topicId)[0];
var model = topic.getModel(); var feature = topic.findFeatureById(this._featureId);
var links = model.getLinks()[0];
this._text = links.getUrl(); var oldAttributes = feature.getAttributes();
topic.removeLink(); feature.setAttributes(this._attributes);
this._attributes = oldAttributes;
}, },
undoExecute: function(commandContext) { undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0]; this.execute(commandContext);
topic.addLink(this._url, commandContext._designer);
} }
}); });

View File

@ -1,48 +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.
*/
mindplot.commands.ChangeLinkToTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId, url) {
$assert($defined(topicId), 'topicId can not be null');
this._topicsIds = topicId;
this._url = url;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
if (topic.hasLink()) {
var model = topic.getModel();
var link = model.getLinks()[0];
this._oldUrl = link.getUrl();
topic.removeLink();
}
topic.addLink(this._url);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
if (this._oldtext) {
topic.removeLink();
topic.addLink(this._oldUrl);
} else {
topic.removeLink();
}
}
});

View File

@ -1,49 +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.
*/
mindplot.commands.ChangeNoteToTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId, text) {
$assert($defined(topicId), 'topicId can not be null');
this._topicsIds = topicId;
this._text = text;
this._oldtext = null;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
if (topic.hasNote()) {
var model = topic.getModel();
var notes = model.getNotes()[0];
this._oldtext = notes.getText();
topic.removeNote();
}
topic.addNote(this._text);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
if (this._oldtext) {
topic.removeNote();
topic.addNote(this._oldtext);
} else {
topic.removeNote();
}
}
});

View File

@ -16,21 +16,30 @@
* limitations under the License. * limitations under the License.
*/ */
mindplot.commands.RemoveNoteFromTopicCommand = new Class({ mindplot.commands.RemoveFeatureFromTopicCommand = new Class({
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId) { initialize: function(topicId, featureId) {
$assert($defined(topicId), 'topicId can not be null'); $assert($defined(topicId), 'topicId can not be null');
this._topicsIds = topicId; $assert(featureId, 'iconModel can not be null');
this._topicId = topicId;
this._featureId = featureId;
this._oldFeature = null;
}, },
execute: function(commandContext) { execute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0]; var topic = commandContext.findTopics(this._topicId)[0];
var model = topic.getModel();
var notes = model.getNotes()[0]; var feature = topic.findFeatureById(this._featureId);
this._text = notes.getText(); topic.removeFeature(feature);
topic.removeNote(); this._oldFeature = feature;
}, },
undoExecute: function(commandContext) { undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0]; var topic = commandContext.findTopics(this._topicId)[0];
topic.addNote(this._text, commandContext._designer);
var feature = this._oldFeature;
topic.addFeature(feature.getType(), feature.getAttributes());
this._oldFeature = null;
} }
}); });

View File

@ -1,39 +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.
*/
mindplot.commands.RemoveIconFromTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicIds, iconModel) {
$assert($defined(topicIds), 'topicIds can not be null');
$assert(iconModel, 'iconModel can not be null');
this._topicsIds = topicIds;
this._iconModel = iconModel;
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
topic.removeIcon(this._iconModel);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._topicsIds)[0];
var iconType = this._iconModel.getIconType();
var iconImg = topic.addIcon(iconType, commandContext._designer);
this._iconModel = iconImg.getModel();
}
});

View File

@ -0,0 +1,76 @@
/*
* 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.
*/
mindplot.model.FeatureModel = new Class({
initialize:function(type, topic) {
$assert(type, 'type can not be null');
$assert(topic, 'topic can not be null');
this._id = mindplot.model.FeatureModel._nextUUID();
this._type = type;
this._topic = topic;
this._attributes = {};
// Create type method ...
this['is' + type.camelCase() + 'Model'] = function() {
return true;
};
},
getAttributes : function() {
return Object.clone(this._attributes);
},
setAttributes : function(attributes) {
for (key in attributes) {
this["set" + key.capitalize()](attributes[key]);
}
},
setAttribute : function(key, value) {
$assert(key, 'key id can not be null');
this._attributes[key] = value;
},
getAttribute : function(key) {
$assert(key, 'key id can not be null');
return this._attributes[key];
},
getTopic : function() {
return this._topic;
},
getId : function() {
return this._id;
},
getType:function() {
return this._type;
}
});
mindplot.model.FeatureModel._nextUUID = function() {
if (!$defined(this._uuid)) {
this._uuid = 0;
}
this._uuid = this._uuid + 1;
return this._uuid;
};

View File

@ -248,58 +248,10 @@ mindplot.model.INodeModel = new Class({
throw "Unsupported operation"; throw "Unsupported operation";
}, },
createLink : function(url) {
throw "Unsupported operation";
},
addLink : function(link) {
throw "Unsupported operation";
},
createNote : function(text) {
throw "Unsupported operation";
},
addNote : function(note) {
throw "Unsupported operation";
},
removeNote : function(note) {
throw "Unsupported operation";
},
createIcon : function(iconType) {
throw "Unsupported operation";
},
addIcon : function(icon) {
throw "Unsupported operation";
},
removeIcon : function(icon) {
throw "Unsupported operation";
},
removeLastIcon : function() {
throw "Unsupported operation";
},
getChildren : function() { getChildren : function() {
throw "Unsupported operation"; throw "Unsupported operation";
}, },
getIcons : function() {
throw "Unsupported operation";
},
getLinks : function() {
throw "Unsupported operation";
},
getNotes : function() {
throw "Unsupported operation";
},
getParent : function() { getParent : function() {
throw "Unsupported operation"; throw "Unsupported operation";
}, },

View File

@ -17,46 +17,19 @@
*/ */
mindplot.model.IconModel = new Class({ mindplot.model.IconModel = new Class({
initialize:function(iconType, topic) { Extends: mindplot.model.FeatureModel,
$assert(iconType, 'Icon id can not be null'); initialize:function(topic, attributes) {
$assert(topic, 'topic can not be null'); this.parent(mindplot.model.IconModel.FEATURE_TYPE, topic);
this.setIconType(attributes.id);
this._iconType = iconType;
this._id = mindplot.model.IconModel._nextUUID();
this._topic = topic;
},
getId : function() {
return this._id;
}, },
getIconType : function() { getIconType : function() {
return this._iconType; return this.getAttribute('id');
}, },
setIconType : function(iconType) { setIconType : function(iconType) {
this._iconType = iconType; $assert(iconType, 'iconType id can not be null');
}, this.setAttribute('id', iconType);
getTopic : function() {
return this._topic;
},
isIconModel : function() {
return true;
}});
/**
* @todo: This method must be implemented.
*/
mindplot.model.IconModel._nextUUID = function() {
if (!$defined(this._uuid)) {
this._uuid = 0;
} }
});
this._uuid = this._uuid + 1; mindplot.model.IconModel.FEATURE_TYPE = "icon";
return this._uuid;
};

View File

@ -17,31 +17,27 @@
*/ */
mindplot.model.LinkModel = new Class({ mindplot.model.LinkModel = new Class({
initialize : function(url, topic) { Extends: mindplot.model.FeatureModel,
$assert(url, 'url can not be null'); initialize : function(topic, attributes) {
$assert(topic, 'mindmap can not be null'); this.parent(mindplot.model.LinkModel.FEATURE_TYPE, topic);
this._topic = topic; this.setUrl(attributes.url);
this.setUrl(url);
}, },
getUrl : function() { getUrl : function() {
return this._url; return this.getAttribute('url');
}, },
setUrl : function(url) { setUrl : function(url) {
$assert(url, 'url can not be null'); $assert(url, 'url can not be null');
this._url = this._fixUrl(url);
this._type = this._url.contains('mailto:') ? 'mail' : 'url'; var fixedUrl = this._fixUrl(url);
this.setAttribute('url', fixedUrl);
var type = fixedUrl.contains('mailto:') ? 'mail' : 'url';
this.setAttribute('type', type);
}, },
getTopic : function() {
return this._topic;
},
isLinkModel : function() {
return true;
}
,
_fixUrl : function(url) { _fixUrl : function(url) {
var result = url; var result = url;
if (!result.contains('http://') && !result.contains('https://') && !result.contains('mailto://')) { if (!result.contains('http://') && !result.contains('https://') && !result.contains('mailto://')) {
@ -50,3 +46,5 @@ mindplot.model.LinkModel = new Class({
return result; return result;
} }
}); });
mindplot.model.LinkModel.FEATURE_TYPE = 'link';

View File

@ -30,9 +30,39 @@ mindplot.model.NodeModel = new Class({
this.setSize(50, 20); this.setSize(50, 20);
this._children = []; this._children = [];
this._icons = []; this._feature = [];
this._links = []; },
this._notes = [];
createFeature: function(type, attributes) {
return mindplot.TopicFeature.createModel(type, this, attributes);
},
addFeature: function(feature) {
$assert(feature, 'feature can not be null');
this._feature.push(feature);
},
getFeatures: function() {
return this._feature;
},
removeFeature: function(feature) {
$assert(feature, 'feature can not be null');
this._feature.erase(feature);
},
findFeatureByType : function(type) {
$assert(type, 'type can not be null');
return this._feature.filter(function(feature) {
return feature.getType() == type;
});
},
findFeatureById : function(id) {
$assert($defined(id), 'id can not be null');
return this._feature.filter(function(feature) {
return feature.getId() == id;
})[0];
}, },
getPropertiesKeys : function() { getPropertiesKeys : function() {
@ -64,67 +94,10 @@ mindplot.model.NodeModel = new Class({
}); });
result._properties = Object.clone(this._properties); result._properties = Object.clone(this._properties);
result._icons = this._icons.clone(); result._feature = this._feature.clone();
result._links = this._links.clone();
result._notes = this._notes.clone();
return result; return result;
}, },
addChildren : function() {
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object');
this._children.push(child);
child._parent = this;
},
createLink : function(url) {
$assert(url, 'Link URL must be specified.');
return new mindplot.model.LinkModel(url, this);
},
addLink : function(link) {
$assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links');
this._links.push(link);
},
_removeLink : function(link) {
$assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links');
this._links.erase(link);
},
createNote : function(text) {
$assert(text != null, 'note text must be specified.');
return new mindplot.model.NoteModel(text, this);
},
addNote : function(note) {
$assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links');
this._notes.push(note);
},
removeNote : function(note) {
$assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links');
this._notes.erase(note);
},
createIcon : function(iconType) {
$assert(iconType, 'IconType must be specified.');
return new mindplot.model.IconModel(iconType, this);
},
addIcon : function(icon) {
$assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
this._icons.push(icon);
},
removeIcon : function(icon) {
$assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
this._icons.erase(icon);
},
removeLastIcon : function() {
this._icons.pop();
},
appendChild : function(child) { appendChild : function(child) {
$assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object'); $assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object');
this._children.push(child); this._children.push(child);
@ -141,18 +114,6 @@ mindplot.model.NodeModel = new Class({
return this._children; return this._children;
}, },
getIcons : function() {
return this._icons;
},
getLinks : function() {
return this._links;
},
getNotes : function() {
return this._notes;
},
getParent : function() { getParent : function() {
return this._parent; return this._parent;
}, },

View File

@ -17,26 +17,20 @@
*/ */
mindplot.model.NoteModel = new Class({ mindplot.model.NoteModel = new Class({
initialize : function(text, topic) { Extends: mindplot.model.FeatureModel,
$assert(text, 'text text can not be null'); initialize : function(topic, attributes) {
$assert(topic, 'topic can not be null'); this.parent(mindplot.model.NoteModel.FEATURE_TYPE, topic);
this._text = text; this.setText(attributes.text);
this._topic = topic;
}, },
getText:function() { getText:function() {
return this._text; return this.getAttribute('text');
}, },
setText : function(text) { setText : function(text) {
this._text = text; $assert(text, 'text can not be null');
}, this.setAttribute('text', text);
getTopic : function() {
return this._topic;
},
isNoteModel : function() {
return true;
} }
}); });
mindplot.model.NoteModel.FEATURE_TYPE = "note";

View File

@ -260,13 +260,13 @@ mindplot.persistence.XMLSerializer_Beta = new Class({
childTopic.connectTo(topic); childTopic.connectTo(topic);
} else if (child.tagName == "icon") { } else if (child.tagName == "icon") {
var icon = this._deserializeIcon(child, topic); var icon = this._deserializeIcon(child, topic);
topic.addIcon(icon); topic.addFeature(icon);
} else if (child.tagName == "link") { } else if (child.tagName == "link") {
var link = this._deserializeLink(child, topic); var link = this._deserializeLink(child, topic);
topic.addLink(link); topic.addFeature(link);
} else if (child.tagName == "note") { } else if (child.tagName == "note") {
var note = this._deserializeNote(child, topic); var note = this._deserializeNote(child, topic);
topic.addNote(note); topic.addFeature(note);
} }
} }
} }
@ -277,15 +277,15 @@ mindplot.persistence.XMLSerializer_Beta = new Class({
_deserializeIcon : function(domElem, topic) { _deserializeIcon : function(domElem, topic) {
var icon = domElem.getAttribute("id"); var icon = domElem.getAttribute("id");
icon = icon.replace("images/", "icons/legacy/"); icon = icon.replace("images/", "icons/legacy/");
return topic.createIcon(icon); return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Icon.id, topic, {id:icon});
}, },
_deserializeLink : function(domElem, topic) { _deserializeLink : function(domElem, topic) {
return topic.createLink(domElem.getAttribute("url")); return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Link.id, topic, {url:domElem.getAttribute("url")});
}, },
_deserializeNote : function(domElem, topic) { _deserializeNote : function(domElem, topic) {
return topic.createNote(domElem.getAttribute("text")); return mindplot.TopicFeature.createModel(mindplot.TopicFeature.Note.id, topic, {text:domElem.getAttribute("url")});
}}); }});
mindplot.persistence.XMLSerializer_Beta.MAP_ROOT_NODE = 'map'; mindplot.persistence.XMLSerializer_Beta.MAP_ROOT_NODE = 'map';

View File

@ -47,8 +47,6 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
// Create Relationships // Create Relationships
var relationships = mindmap.getRelationships(); var relationships = mindmap.getRelationships();
if (relationships.length > 0) { if (relationships.length > 0) {
// var relationshipDom=document.createElement("relationships");
// mapElem.appendChild(relationshipDom);
for (var j = 0; j < relationships.length; j++) { for (var j = 0; j < relationships.length; j++) {
var relationDom = this._relationshipToXML(document, relationships[j]); var relationDom = this._relationshipToXML(document, relationships[j]);
mapElem.appendChild(relationDom); mapElem.appendChild(relationDom);
@ -124,60 +122,38 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
parentTopic.setAttribute('brColor', brColor); parentTopic.setAttribute('brColor', brColor);
} }
//ICONS // Serialize features ...
var icons = topic.getIcons(); var features = topic.getFeatures();
for (var i = 0; i < icons.length; i++) { for (var i = 0; i < features.length; i++) {
var icon = icons[i]; var feature = features[i];
var iconDom = this._iconToXML(document, icon);
parentTopic.appendChild(iconDom);
}
//LINKS var featureType = feature.getType();
var links = topic.getLinks(); var featureDom = document.createElement(featureType);
for (var i = 0; i < links.length; i++) { var attributes = feature.getAttributes();
var link = links[i];
var linkDom = this._linkToXML(document, link);
parentTopic.appendChild(linkDom);
}
var notes = topic.getNotes(); for (var key in attributes) {
for (var i = 0; i < notes.length; i++) { var value = attributes[key];
var note = notes[i]; if (key == 'text') {
var noteDom = this._noteToXML(document, note); var cdata = document.createCDATASection(value);
parentTopic.appendChild(noteDom); featureDom.appendChild(cdata);
} else {
featureDom.setAttribute(key, value);
}
}
parentTopic.appendChild(featureDom);
} }
//CHILDREN TOPICS //CHILDREN TOPICS
var childTopics = topic.getChildren(); var childTopics = topic.getChildren();
for (var i = 0; i < childTopics.length; i++) { for (var j = 0; j < childTopics.length; j++) {
var childTopic = childTopics[i]; var childTopic = childTopics[j];
var childDom = this._topicToXML(document, childTopic); var childDom = this._topicToXML(document, childTopic);
parentTopic.appendChild(childDom); parentTopic.appendChild(childDom);
} }
return parentTopic; return parentTopic;
}, },
_iconToXML : function(document, icon) {
var iconDom = document.createElement("icon");
iconDom.setAttribute('id', icon.getIconType());
return iconDom;
},
_linkToXML : function(document, link) {
var linkDom = document.createElement("link");
linkDom.setAttribute('url', link.getUrl());
return linkDom;
},
_noteToXML : function(document, note) {
var noteDom = document.createElement("note");
var cdata = document.createCDATASection(note.getText());
noteDom.appendChild(cdata);
return noteDom;
},
_noteTextToXML : function(document, elem, text) { _noteTextToXML : function(document, elem, text) {
if (text.indexOf('\n') == -1) { if (text.indexOf('\n') == -1) {
elem.setAttribute('text', text); elem.setAttribute('text', text);
@ -305,17 +281,6 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
if ($defined(borderColor)) { if ($defined(borderColor)) {
topic.setBorderColor(borderColor); topic.setBorderColor(borderColor);
} }
//
// } else {
// var sizeStr = domElem.getAttribute('size');
// $assert(sizeStr, "size can not be null");
// var size = sizeStr.split(',');
// topic.setSize(size[0], size[1]);
//
// var url = domElem.getAttribute('image');
// $assert(url, "url can not be null");
// topic.setImageUrl(url);
// }
var order = domElem.getAttribute('order'); var order = domElem.getAttribute('order');
if ($defined(order)) { if ($defined(order)) {
@ -338,40 +303,40 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
for (var i = 0; i < children.length; i++) { for (var i = 0; i < children.length; i++) {
var child = children[i]; var child = children[i];
if (child.nodeType == Node.ELEMENT_NODE) { if (child.nodeType == Node.ELEMENT_NODE) {
$assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note" || child.tagName == "text", 'Illegal node type:' + child.tagName);
if (child.tagName == "topic") { if (child.tagName == "topic") {
var childTopic = this._deserializeNode(child, mindmap); var childTopic = this._deserializeNode(child, mindmap);
childTopic.connectTo(topic); childTopic.connectTo(topic);
} else if (child.tagName == "icon") { } else if (mindplot.TopicFeature.isSupported(child.tagName)) {
var icon = this._deserializeIcon(child, topic);
topic.addIcon(icon); // Load attributes ...
} else if (child.tagName == "link") { var namedNodeMap = child.attributes;
var link = this._deserializeLink(child, topic); var attributes = {};
topic.addLink(link); for (var j = 0; j < namedNodeMap.length; j++) {
} else if (child.tagName == "note") { var attribute = namedNodeMap.item(j);
var note = this._deserializeNote(child, topic); attributes[attribute.name] = attribute.value;
topic.addNote(note); }
// Has text node ?.
var textAttr = this._deserializeTextAttr(child);
if (textAttr) {
attributes['text'] = textAttr;
}
// Create a new element ....
var featureType = child.tagName;
var feature = mindplot.TopicFeature.createModel(featureType, topic, attributes);
topic.addFeature(feature);
} else if (child.tagName == "text") { } else if (child.tagName == "text") {
var nodeText = this._deserializeNodeText(child); var nodeText = this._deserializeNodeText(child);
topic.setText(nodeText); topic.setText(nodeText);
} }
} }
} }
return topic; return topic;
}, },
_deserializeIcon : function(domElem, topic) { _deserializeTextAttr : function(domElem) {
var icon = domElem.getAttribute("id");
icon = icon.replace("images/", "icons/legacy/");
return topic.createIcon(icon);
},
_deserializeLink : function(domElem, topic) {
return topic.createLink(domElem.getAttribute("url"));
},
_deserializeNote : function(domElem, topic) {
var value = domElem.getAttribute("text"); var value = domElem.getAttribute("text");
if (!$defined(value)) { if (!$defined(value)) {
var children = domElem.childNodes; var children = domElem.childNodes;
@ -382,11 +347,10 @@ mindplot.persistence.XMLSerializer_Pela = new Class({
} }
} }
} }
return topic.createNote(value); return value;
}, },
_deserializeNodeText: function(domElem) { _deserializeNodeText: function(domElem) {
var children = domElem.childNodes; var children = domElem.childNodes;
var value = null; var value = null;
for (var i = 0; i < children.length; i++) { for (var i = 0; i < children.length; i++) {

View File

@ -1,20 +1,49 @@
Actual :<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <map name="welcome" version="tango">
<map version="pela" name="basic"> <topic central="true" text="Welcome To WiseMapping" id="1" fontStyle=";;#dfcfe6;;;" bgColor="#0a0a08">
<topic id="0" central="true" position="0,0" shape="rounded rectagle" text="Fonts"> <topic position="178,-130" order="0" text="Try it Now!" id="11" fontStyle=";;#ffffff;;;" bgColor="#250be3"
<topic id="1" position="200,-50" order="1" shape="line" text="Styles"> brColor="#080559">
<topic id="2" position="400,-25" order="0" fontStyle="Arial;12;;bold;;" shape="line" text="Bold"/> <topic position="272,-156" order="0" text="Double Click" id="12" fontStyle=";;#001be6;;italic;"/>
<topic id="3" position="400,-50" order="1" fontStyle="Arial;12;;;italic;" shape="line" text="Italic"/> <topic position="274,-130" order="1" text=" INS to insert" id="13" fontStyle=";;#001be6;;italic;"/>
<topic position="285,-104" order="2" text="Drag map to move" id="14" fontStyle=";;#001be6;;italic;"/>
</topic> </topic>
<topic id="4" position="-200,-50" order="1" shape="line" text="Sizes"> <topic position="-197,-68" order="1" id="2" fontStyle=";;#104f11;;;" bgColor="#d9b518">
<topic id="5" position="-400,50" order="0" fontStyle="Arial;8;;;;" shape="line" text="Normal----"/> <text><![CDATA[Productivity sss sss]]></text>
<topic id="6" position="-400,25" order="1" fontStyle="Arial;9;;;;" shape="line" text="Normal---"/> <icon id="chart_pie"/>
<topic id="7" position="-400,0" order="2" fontStyle="Arial;10;;;;" shape="line" text="Normal--"/> <note><![CDATA[hola]]></note>
<topic id="8" position="-400,-25" order="3" fontStyle="Arial;11;;;;" shape="line" text="Normal-"/> <topic position="-325,-94" order="0" text="Share your ideas" id="3">
<topic id="9" position="-400,-50" order="4" shape="line" text="Normal"/> <icon id="bulb_light_on"/>
<topic id="10" position="-400,-75" order="5" fontStyle="Arial;13;;;;" shape="line" text="Nomal+"/> </topic>
<topic id="11" position="-400,-100" order="6" fontStyle="Arial;14;;;;" shape="line" text="Normal++"/> <topic position="-314,-68" order="1" text="Brainstorming" id="4"/>
<topic id="12" position="-400,-125" order="7" fontStyle="Arial;15;;;;" shape="line" text="Normal+++"/> <topic position="-298,-42" order="2" text="Visual " id="5"/>
<topic id="13" position="-400,-150" order="8" fontStyle="Arial;16;;;;" shape="line" text="Normal++++"/>
</topic> </topic>
<topic position="185,-39" order="2" text="Mind Mapping" id="6" fontStyle=";;#602378;;;" bgColor="#edabff">
<topic position="303,-78" order="0" text="Share with Collegues" id="7"/>
<topic position="275,-52" order="1" text="Online" id="8"/>
<topic position="299,-26" order="2" text="Anyplace, Anytime" id="9"/>
<topic position="277,0" order="3" text="Free!!!" id="10"/>
</topic>
<topic position="-183,23" order="3" text="Web 2.0 Tool" id="22" fontStyle=";;#0c1d6b;;;" bgColor="#add1f7">
<topic position="-281,-16" order="0" text="Collaborate" id="23"/>
<topic position="-302,10" order="1" text="No plugin required" id="24">
<icon id="conn_disconnect"/>
</topic>
<topic position="-271,36" order="2" text="Share" id="25"/>
<topic position="-282,62" order="3" text="Easy to use" id="26"/>
</topic>
<topic position="171,91" order="4" text="Features" id="15">
<topic position="266,26" order="0" text="Links to Sites" id="16" fontStyle=";6;;;;">
<link url="http://www.digg.com" type="url"/>
</topic>
<topic position="245,52" order="1" text="Fonts" id="17"/>
<topic position="255,78" order="2" text="Topic Color" id="18"/>
<topic position="260,104" order="3" text="Topic Shapes" shape="line" id="19"/>
<topic position="252,130" order="4" text="Icons" id="20">
<icon id="object_rainbow"/>
</topic>
<topic position="272,156" order="5" text="History Changes" id="21">
<icon id="arrowc_turn_left"/>
</topic>
</topic>
<topic position="-176,91" order="5" id="27"/>
</topic> </topic>
</map> </map>