Start working on ActionDispatcher migration.

This commit is contained in:
Paulo Veiga
2011-08-03 17:52:39 -03:00
parent 6a4a0f68fc
commit 63cda0a170
20 changed files with 544 additions and 569 deletions

View File

@@ -26,10 +26,11 @@ mindplot.commands.AddTopicCommand = new Class(
this._id = mindplot.Command._nextUUID();
this._animated = $defined(animated) ? animated : false;
},
execute: function(commandContext) {
// Add a new topic ...
var topic = commandContext.createTopic(this._model, !this._animated);
execute: function(commandContext) {
// Add a new topic ...
var topic = commandContext.createTopic(this._model, !this._animated);
// Connect to topic ...
if ($defined(this._parentId)) {
@@ -49,6 +50,7 @@ mindplot.commands.AddTopicCommand = new Class(
} else
doneFn.attempt();
},
undoExecute: function(commandContext) {
// Finally, delete the topic from the workspace ...
var topicId = this._model.getId();

View File

@@ -1,45 +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.ChangeIconFromTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId, iconId, iconType) {
$assert(topicId, 'topicId can not be null');
$assert(iconId, 'iconId can not be null');
$assert(iconType, 'iconType can not be null');
this._selectedObjectsIds = topicId;
this._iconModel = iconId;
this._iconType = iconType;
},
execute: function(commandContext) {
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
var updated = function() {
topic.removeIcon(this._iconModel);
topic.updateNode();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext) {
var topic = commandContext.findTopics(this._selectedObjectsIds)[0];
var updated = function() {
topic.addIcon(this._iconModel, commandContext._designer);
topic.updateNode();
}.bind(this);
updated.delay(0);
}
});

View File

@@ -18,12 +18,15 @@
mindplot.commands.DragTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId) {
$assert(topicId, "topicId must be defined");
this._selectedObjectsIds = topicId;
this._parentTopic = null;
this._position = null;
this._order = null;
initialize: function(topicIds, position, order, parentTopic) {
$assert(topicIds, "topicIds must be defined");
this._selectedObjectsIds = topicIds;
if ($defined(parentTopic))
this._parentId = parentTopic.getId();
this._position = position;
this._order = order;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext) {
@@ -78,19 +81,9 @@ mindplot.commands.DragTopicCommand = new Class({
undoExecute: function(commandContext) {
this.execute(commandContext);
var selectedRelationships = commandContext.getSelectedRelationshipLines();
selectedRelationships.forEach(function(relationshipLine, index) {
selectedRelationships.forEach(function(relationshipLine) {
relationshipLine.redraw();
});
},
setPosition: function(point) {
this._position = point;
},
setParetTopic: function(topic) {
this._parentId = topic.getId();
},
setOrder: function(order) {
this._order = order
}
});

View File

@@ -18,9 +18,10 @@
mindplot.commands.GenericFunctionCommand = new Class({
Extends:mindplot.Command,
initialize: function(commandFunc, value, topicsIds) {
initialize: function(commandFunc, topicsIds,value) {
$assert(commandFunc, "commandFunc must be defined");
$assert(topicsIds, "topicsIds must be defined");
this._value = value;
this._selectedObjectsIds = topicsIds;
this._commandFunc = commandFunc;

View File

@@ -19,9 +19,10 @@ mindplot.commands.MoveControlPointCommand = new Class({
Extends:mindplot.Command,
initialize: function(ctrlPointController, point) {
$assert(ctrlPointController, 'line can not be null');
$assert(point, 'point can not be null');
this._ctrlPointControler = ctrlPointController;
this._line = ctrlPointController._line;
var model = this._line.getModel();
this._controlPoint = this._ctrlPointControler.getControlPoint(point).clone();
this._oldControlPoint = this._ctrlPointControler.getOriginalCtrlPoint(point).clone();
this._originalEndPoint = this._ctrlPointControler.getOriginalEndPoint(point).clone();