mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
- Fix errors on actions over central topic.
This commit is contained in:
parent
e520d9baba
commit
dfc3bbdbe6
@ -21,18 +21,18 @@ mindplot.commands.AddIconToTopicCommand = new Class({
|
|||||||
initialize: function(topicId, iconType) {
|
initialize: function(topicId, iconType) {
|
||||||
$assert($defined(topicId), 'topicId can not be null');
|
$assert($defined(topicId), 'topicId can not be null');
|
||||||
$assert(iconType, 'iconType can not be null');
|
$assert(iconType, 'iconType can not be null');
|
||||||
this._objectsIds = topicId;
|
this._topicsIds = topicId;
|
||||||
this._iconType = iconType;
|
this._iconType = iconType;
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
var iconImg = topic.addIcon(this._iconType, commandContext._designer);
|
var iconImg = topic.addIcon(this._iconType, commandContext._designer);
|
||||||
this._iconModel = iconImg.getModel();
|
this._iconModel = iconImg.getModel();
|
||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
topic.removeIcon(this._iconModel);
|
topic.removeIcon(this._iconModel);
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -20,13 +20,13 @@ mindplot.commands.ChangeLinkToTopicCommand = new Class({
|
|||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicId, url) {
|
initialize: function(topicId, url) {
|
||||||
$assert(topicId, 'topicId can not be null');
|
$assert(topicId, 'topicId can not be null');
|
||||||
this._objectsIds = topicId;
|
this._topicsIds = topicId;
|
||||||
this._url = url;
|
this._url = url;
|
||||||
this._id = mindplot.Command._nextUUID();
|
this._id = mindplot.Command._nextUUID();
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
if (topic.hasLink()) {
|
if (topic.hasLink()) {
|
||||||
var model = topic.getModel();
|
var model = topic.getModel();
|
||||||
var link = model.getLinks()[0];
|
var link = model.getLinks()[0];
|
||||||
@ -37,7 +37,7 @@ mindplot.commands.ChangeLinkToTopicCommand = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
if (this._oldtext) {
|
if (this._oldtext) {
|
||||||
topic.removeLink();
|
topic.removeLink();
|
||||||
topic.addLink(this._oldUrl);
|
topic.addLink(this._oldUrl);
|
||||||
|
@ -20,14 +20,14 @@ mindplot.commands.ChangeNoteToTopicCommand = new Class({
|
|||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicId, text) {
|
initialize: function(topicId, text) {
|
||||||
$assert(topicId, 'topicId can not be null');
|
$assert(topicId, 'topicId can not be null');
|
||||||
this._objectsIds = topicId;
|
this._topicsIds = topicId;
|
||||||
this._text = text;
|
this._text = text;
|
||||||
this._oldtext = null;
|
this._oldtext = null;
|
||||||
this._id = mindplot.Command._nextUUID();
|
this._id = mindplot.Command._nextUUID();
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
if (topic.hasNote()) {
|
if (topic.hasNote()) {
|
||||||
var model = topic.getModel();
|
var model = topic.getModel();
|
||||||
var notes = model.getNotes()[0];
|
var notes = model.getNotes()[0];
|
||||||
@ -38,7 +38,7 @@ mindplot.commands.ChangeNoteToTopicCommand = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
if (this._oldtext) {
|
if (this._oldtext) {
|
||||||
topic.removeNote();
|
topic.removeNote();
|
||||||
topic.addNote(this._oldtext);
|
topic.addNote(this._oldtext);
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
mindplot.commands.DeleteCommand = new Class({
|
mindplot.commands.DeleteCommand = new Class({
|
||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicIds, relIds) {
|
initialize: function(topicIds, relIds) {
|
||||||
|
$assert($defined(topicIds), 'topicIds can not be null');
|
||||||
|
|
||||||
this._relIds = relIds;
|
this._relIds = relIds;
|
||||||
this._topicIds = topicIds;
|
this._topicIds = topicIds;
|
||||||
this._deletedTopicModels = [];
|
this._deletedTopicModels = [];
|
||||||
|
@ -21,7 +21,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
|||||||
initialize: function(topicIds, position, order, parentTopic) {
|
initialize: function(topicIds, position, order, parentTopic) {
|
||||||
$assert(topicIds, "topicIds must be defined");
|
$assert(topicIds, "topicIds must be defined");
|
||||||
|
|
||||||
this._objectsIds = topicIds;
|
this._topicsIds = topicIds;
|
||||||
if ($defined(parentTopic))
|
if ($defined(parentTopic))
|
||||||
this._parentId = parentTopic.getId();
|
this._parentId = parentTopic.getId();
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ mindplot.commands.DragTopicCommand = new Class({
|
|||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
|
|
||||||
var topic = commandContext.findTopics([this._objectsIds])[0];
|
var topic = commandContext.findTopics([this._topicsIds])[0];
|
||||||
|
|
||||||
// Save old position ...
|
// Save old position ...
|
||||||
var origParentTopic = topic.getOutgoingConnectedTopic();
|
var origParentTopic = topic.getOutgoingConnectedTopic();
|
||||||
|
@ -23,14 +23,14 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
|||||||
$assert(topicsIds, "topicsIds must be defined");
|
$assert(topicsIds, "topicsIds must be defined");
|
||||||
|
|
||||||
this._value = value;
|
this._value = value;
|
||||||
this._objectsIds = topicsIds;
|
this._topicsIds = topicsIds;
|
||||||
this._commandFunc = commandFunc;
|
this._commandFunc = commandFunc;
|
||||||
this._oldValues = [];
|
this._oldValues = [];
|
||||||
this._id = mindplot.Command._nextUUID();
|
this._id = mindplot.Command._nextUUID();
|
||||||
},
|
},
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
if (!this.applied) {
|
if (!this.applied) {
|
||||||
var topics = commandContext.findTopics(this._objectsIds);
|
var topics = commandContext.findTopics(this._topicsIds);
|
||||||
topics.forEach(function(topic) {
|
topics.forEach(function(topic) {
|
||||||
var oldValue = this._commandFunc(topic, this._value);
|
var oldValue = this._commandFunc(topic, this._value);
|
||||||
this._oldValues.push(oldValue);
|
this._oldValues.push(oldValue);
|
||||||
@ -43,7 +43,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
|||||||
},
|
},
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
if (this.applied) {
|
if (this.applied) {
|
||||||
var topics = commandContext.findTopics(this._objectsIds);
|
var topics = commandContext.findTopics(this._topicsIds);
|
||||||
topics.forEach(function(topic, index) {
|
topics.forEach(function(topic, index) {
|
||||||
this._commandFunc(topic, this._oldValues[index]);
|
this._commandFunc(topic, this._oldValues[index]);
|
||||||
|
|
||||||
|
@ -19,19 +19,19 @@
|
|||||||
mindplot.commands.RemoveIconFromTopicCommand = new Class({
|
mindplot.commands.RemoveIconFromTopicCommand = new Class({
|
||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicIds, iconModel) {
|
initialize: function(topicIds, iconModel) {
|
||||||
$assert(topicIds, 'topicIds can not be null');
|
$assert($defined(topicIds), 'topicIds can not be null');
|
||||||
$assert(iconModel, 'iconModel can not be null');
|
$assert(iconModel, 'iconModel can not be null');
|
||||||
this._objectsIds = topicIds;
|
this._topicsIds = topicIds;
|
||||||
this._iconModel = iconModel;
|
this._iconModel = iconModel;
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
topic.removeIcon(this._iconModel);
|
topic.removeIcon(this._iconModel);
|
||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
var iconType = this._iconModel.getIconType();
|
var iconType = this._iconModel.getIconType();
|
||||||
var iconImg = topic.addIcon(iconType, commandContext._designer);
|
var iconImg = topic.addIcon(iconType, commandContext._designer);
|
||||||
this._iconModel = iconImg.getModel();
|
this._iconModel = iconImg.getModel();
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
mindplot.commands.RemoveLinkFromTopicCommand = new Class({
|
mindplot.commands.RemoveLinkFromTopicCommand = new Class({
|
||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicId) {
|
initialize: function(topicId) {
|
||||||
$assert(topicId, 'topicId can not be null');
|
$assert($defined(topicId), 'topicId can not be null');
|
||||||
this._objectsIds = topicId;
|
this._topicsIds = topicId;
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
var model = topic.getModel();
|
var model = topic.getModel();
|
||||||
var links = model.getLinks()[0];
|
var links = model.getLinks()[0];
|
||||||
this._text = links.getUrl();
|
this._text = links.getUrl();
|
||||||
@ -32,7 +32,7 @@ mindplot.commands.RemoveLinkFromTopicCommand = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
topic.addLink(this._url, commandContext._designer);
|
topic.addLink(this._url, commandContext._designer);
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -19,18 +19,18 @@
|
|||||||
mindplot.commands.RemoveNoteFromTopicCommand = new Class({
|
mindplot.commands.RemoveNoteFromTopicCommand = new Class({
|
||||||
Extends:mindplot.Command,
|
Extends:mindplot.Command,
|
||||||
initialize: function(topicId) {
|
initialize: function(topicId) {
|
||||||
$assert(topicId, 'topicId can not be null');
|
$assert($defined(topicId), 'topicId can not be null');
|
||||||
this._objectsIds = topicId;
|
this._topicsIds = topicId;
|
||||||
},
|
},
|
||||||
execute: function(commandContext) {
|
execute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
var model = topic.getModel();
|
var model = topic.getModel();
|
||||||
var notes = model.getNotes()[0];
|
var notes = model.getNotes()[0];
|
||||||
this._text = notes.getText();
|
this._text = notes.getText();
|
||||||
topic.removeNote();
|
topic.removeNote();
|
||||||
},
|
},
|
||||||
undoExecute: function(commandContext) {
|
undoExecute: function(commandContext) {
|
||||||
var topic = commandContext.findTopics(this._objectsIds)[0];
|
var topic = commandContext.findTopics(this._topicsIds)[0];
|
||||||
topic.addNote(this._text, commandContext._designer);
|
topic.addNote(this._text, commandContext._designer);
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user