Partially supported multilines.

This commit is contained in:
Paulo Veiga
2011-09-02 02:31:03 -03:00
parent e437e0e329
commit d43eb930d9
32 changed files with 804 additions and 353 deletions

View File

@@ -21,25 +21,25 @@ mindplot.commands.AddIconToTopicCommand = new Class({
initialize: function(topicId, iconType) {
$assert(topicId, 'topicId can not be null');
$assert(iconType, 'iconType can not be null');
this._objectsIds = topicId;
this._topicsIds = topicId;
this._iconType = iconType;
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
var updated = function() {
var iconImg = topic.addIcon(this._iconType, commandContext._designer);
this._iconModel = iconImg.getModel();
topic.updateNode();
topic._adjustShapes();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
var updated = function() {
topic.removeIcon(this._iconModel);
topic.updateNode();
topic._adjustShapes();
}.bind(this);
updated.delay(0);
}

View File

@@ -20,20 +20,20 @@ mindplot.commands.AddLinkToTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId, url) {
$assert(topicId, 'topicId can not be null');
this._objectsIds = topicId;
this._topicsIds = topicId;
this._url = url;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
var updated = function() {
topic.addLink(this._url, commandContext._designer);
topic.updateNode();
topic._adjustShapes();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
var updated = function() {
topic.removeLink();
}.bind(this);

View File

@@ -20,20 +20,20 @@ mindplot.commands.AddNoteToTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId, text) {
$assert(topicId, 'topicId can not be null');
this._objectsIds = topicId;
this._topicsIds = topicId;
this._text = text;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
var updated = function() {
topic.addNote(this._text);
topic.updateNode();
topic._adjustShapes();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
var updated = function() {
topic.removeNote();
}.bind(this);

View File

@@ -20,7 +20,7 @@ mindplot.commands.DeleteCommand = new Class({
Extends:mindplot.Command,
initialize: function(objectIds) {
$assert(objectIds, "objectIds must be defined");
this._objectsIds = objectIds;
this._topicsIds = objectIds;
this._deletedTopicModels = [];
this._parentTopicIds = [];
this._deletedRelationships = [];
@@ -28,7 +28,7 @@ mindplot.commands.DeleteCommand = new Class({
},
execute: function(commandContext) {
var topics = commandContext.findTopics(this._objectsIds.nodes);
var topics = commandContext.findTopics(this._topicsIds.nodes);
if (topics.length > 0) {
topics.forEach(
function(topic, index) {
@@ -58,7 +58,7 @@ mindplot.commands.DeleteCommand = new Class({
}.bind(this)
);
}
var lines = commandContext.findRelationships(this._objectsIds.relationship);
var lines = commandContext.findRelationships(this._topicsIds.relationship);
if (lines.length > 0) {
lines.forEach(function(line, index) {
if (line.isInWorkspace()) {
@@ -70,7 +70,7 @@ mindplot.commands.DeleteCommand = new Class({
},
undoExecute: function(commandContext) {
var topics = commandContext.findTopics(this._objectsIds);
var topics = commandContext.findTopics(this._topicsIds);
var parent = commandContext.findTopics(this._parentTopicIds);
this._deletedTopicModels.forEach(

View File

@@ -21,7 +21,7 @@ mindplot.commands.DragTopicCommand = new Class({
initialize: function(topicIds, position, order, parentTopic) {
$assert(topicIds, "topicIds must be defined");
this._objectsIds = topicIds;
this._topicsIds = topicIds;
if ($defined(parentTopic))
this._parentId = parentTopic.getId();
@@ -31,7 +31,7 @@ mindplot.commands.DragTopicCommand = new Class({
},
execute: function(commandContext) {
var topic = commandContext.findTopics([this._objectsIds])[0];
var topic = commandContext.findTopics([this._topicsIds])[0];
// Save old position ...
var origParentTopic = topic.getOutgoingConnectedTopic();

View File

@@ -23,14 +23,14 @@ mindplot.commands.GenericFunctionCommand = new Class({
$assert(topicsIds, "topicsIds must be defined");
this._value = value;
this._objectsIds = topicsIds;
this._topicsIds = topicsIds;
this._commandFunc = commandFunc;
this._oldValues = [];
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext) {
if (!this.applied) {
var topics = commandContext.findTopics(this._objectsIds);
var topics = commandContext.findTopics(this._topicsIds);
topics.forEach(function(topic) {
var oldValue = this._commandFunc(topic, this._value);
this._oldValues.push(oldValue);
@@ -43,7 +43,7 @@ mindplot.commands.GenericFunctionCommand = new Class({
},
undoExecute: function(commandContext) {
if (this.applied) {
var topics = commandContext.findTopics(this._objectsIds);
var topics = commandContext.findTopics(this._topicsIds);
topics.forEach(function(topic, index) {
this._commandFunc(topic, this._oldValues[index]);

View File

@@ -22,26 +22,26 @@ mindplot.commands.RemoveIconFromTopicCommand = new Class({
{
$assert(topicIds, 'topicIds can not be null');
$assert(iconModel, 'iconModel can not be null');
this._objectsIds = topicIds;
this._topicsIds = topicIds;
this._iconModel = iconModel;
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
var updated = function() {
topic.removeIcon(this._iconModel);
topic.updateNode();
topic._adjustShapes();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
var updated = function() {
var iconType = this._iconModel.getIconType();
var iconImg = topic.addIcon(iconType, commandContext._designer);
this._iconModel = iconImg.getModel();
topic.updateNode();
topic._adjustShapes();
}.bind(this);
updated.delay(0);
}

View File

@@ -20,10 +20,10 @@ mindplot.commands.RemoveLinkFromTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId) {
$assert(topicId, 'topicId can not be null');
this._objectsIds = topicId;
this._topicsIds = topicId;
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
this._url = topic._link.getUrl();
var updated = function() {
topic.removeLink();
@@ -31,10 +31,10 @@ mindplot.commands.RemoveLinkFromTopicCommand = new Class({
updated.delay(0);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
var updated = function() {
topic.addLink(this._url, commandContext._designer);
topic.updateNode();
topic._adjustShapes();
}.bind(this);
updated.delay(0);
}

View File

@@ -21,11 +21,11 @@ mindplot.commands.RemoveNoteFromTopicCommand = new Class({
initialize: function(topicId)
{
$assert(topicId, 'topicId can not be null');
this._objectsIds = topicId;
this._topicsIds = topicId;
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
this._text = topic._note.getText();
var updated = function() {
topic.removeNote();
@@ -34,10 +34,10 @@ mindplot.commands.RemoveNoteFromTopicCommand = new Class({
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._objectsIds)[0];
var topic = commandContext.findTopics(this._topicsIds)[0];
var updated = function() {
topic.addNote(this._text,commandContext._designer);
topic.updateNode();
topic._adjustShapes();
}.bind(this);
updated.delay(0);
}