Adding model update, model migrator, curved line support, relationship lines, remove of web-services classes
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
mindplot.commands.AddRelationshipCommand = mindplot.Command.extend(
|
||||
{
|
||||
initialize: function(model, mindmap)
|
||||
{
|
||||
core.assert(model, 'Relationship model can not be null');
|
||||
this._model = model;
|
||||
this._mindmap = mindmap;
|
||||
this._id = mindplot.Command._nextUUID();
|
||||
},
|
||||
execute: function(commandContext)
|
||||
{
|
||||
var relationship = commandContext.createRelationship(this._model);
|
||||
},
|
||||
undoExecute: function(commandContext)
|
||||
{
|
||||
var relationship = commandContext.removeRelationship(this._model);
|
||||
this._mindmap.removeRelationship(this._model);
|
||||
}
|
||||
});
|
@@ -25,6 +25,7 @@ mindplot.commands.DeleteTopicCommand = mindplot.Command.extend(
|
||||
this._topicId = topicsIds;
|
||||
this._deletedTopicModels = [];
|
||||
this._parentTopicIds = [];
|
||||
this._deletedRelationships = [];
|
||||
this._id = mindplot.Command._nextUUID();
|
||||
},
|
||||
execute: function(commandContext)
|
||||
@@ -34,6 +35,15 @@ mindplot.commands.DeleteTopicCommand = mindplot.Command.extend(
|
||||
function(topic, index)
|
||||
{
|
||||
var model = topic.getModel().clone();
|
||||
|
||||
//delete relationships
|
||||
var relationships = topic.getRelationships();
|
||||
while(relationships.length>0){
|
||||
var relationship = relationships[0];
|
||||
this._deletedRelationships.push(relationship.getModel().clone());
|
||||
commandContext.removeRelationship(relationship.getModel());
|
||||
}
|
||||
|
||||
this._deletedTopicModels.push(model);
|
||||
|
||||
// Is connected?.
|
||||
@@ -49,7 +59,7 @@ mindplot.commands.DeleteTopicCommand = mindplot.Command.extend(
|
||||
commandContext.deleteTopic(topic);
|
||||
|
||||
}.bind(this)
|
||||
)
|
||||
);
|
||||
},
|
||||
undoExecute: function(commandContext)
|
||||
{
|
||||
@@ -70,9 +80,14 @@ mindplot.commands.DeleteTopicCommand = mindplot.Command.extend(
|
||||
}
|
||||
|
||||
}.bind(this)
|
||||
)
|
||||
);
|
||||
this._deletedRelationships.forEach(
|
||||
function(relationship, index){
|
||||
commandContext.createRelationship(relationship);
|
||||
}.bind(this));
|
||||
|
||||
this._deletedTopicModels = [];
|
||||
this._parentTopicIds = [];
|
||||
this._deletedRelationships = [];
|
||||
}
|
||||
});
|
@@ -0,0 +1,59 @@
|
||||
mindplot.commands.MoveControlPointCommand = mindplot.Command.extend(
|
||||
{
|
||||
initialize: function(ctrlPointControler, point)
|
||||
{
|
||||
core.assert(ctrlPointControler, 'line can not be null');
|
||||
this._ctrlPointControler = ctrlPointControler;
|
||||
this._id = mindplot.Command._nextUUID();
|
||||
this._wasCustom=false;
|
||||
this._point = point;
|
||||
this._controlPoint = null;
|
||||
},
|
||||
execute: function(commandContext)
|
||||
{
|
||||
var line = this._ctrlPointControler._line;
|
||||
var ctrlPoints = line.getLine().getControlPoints();
|
||||
var model = line.getModel();
|
||||
var point = null;
|
||||
switch (this._point){
|
||||
case 0:
|
||||
if(core.Utils.isDefined(model.getSrcCtrlPoint())){
|
||||
this._controlPoint= model.getSrcCtrlPoint().clone();
|
||||
}
|
||||
model.setSrcCtrlPoint(ctrlPoints[0].clone());
|
||||
this._wasCustom = line.getLine().isSrcControlPointCustom();
|
||||
line.getLine().setIsSrcControlPointCustom(true);
|
||||
break;
|
||||
case 1:
|
||||
if(core.Utils.isDefined(model.getDestCtrlPoint())){
|
||||
this._controlPoint = model.getDestCtrlPoint().clone();
|
||||
}
|
||||
model.setDestCtrlPoint(ctrlPoints[1].clone());
|
||||
this._wasCustom = line.getLine().isDestControlPointCustom();
|
||||
line.getLine().setIsDestControlPointCustom(true);
|
||||
break;
|
||||
}
|
||||
},
|
||||
undoExecute: function(commandContext)
|
||||
{
|
||||
var line = this._ctrlPointControler._line;
|
||||
var model = line.getModel();
|
||||
switch (this._point){
|
||||
case 0:
|
||||
if(core.Utils.isDefined(this._controlPoint)){
|
||||
model.setSrcCtrlPoint(this._controlPoint.clone());
|
||||
line.getLine().setSrcControlPoint(this._controlPoint.clone());
|
||||
line.getLine().setIsSrcControlPointCustom(this._wasCustom);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(core.Utils.isDefined(this._controlPoint)){
|
||||
model.setDestCtrlPoint(this._controlPoint.clone());
|
||||
line.getLine().setDestControlPoint(this._controlPoint.clone());
|
||||
line.getLine().setIsDestControlPointCustom(this._wasCustom);
|
||||
}
|
||||
break;
|
||||
}
|
||||
this._ctrlPointControler.setLine(line);
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user