- Partially fix relationship to central topic.

- Fix add icon to the central topic
This commit is contained in:
Paulo Veiga 2011-11-30 00:50:46 -03:00
parent bc87d0f311
commit e520d9baba
4 changed files with 14 additions and 13 deletions

View File

@ -590,6 +590,7 @@ mindplot.Designer = new Class({
var validateFunc = function(topic) {
return !(topic.getType() == mindplot.model.INodeModel.CENTRAL_TOPIC_TYPE && shape == mindplot.model.INodeModel.SHAPE_TYPE_LINE)
};
var validateError = 'Central Topic shape can not be changed to line figure.';
var topicsIds = this.getModel().filterTopicsIds(validateFunc, validateError);
if (topicsIds.length > 0) {

View File

@ -19,7 +19,7 @@
mindplot.commands.AddIconToTopicCommand = new Class({
Extends:mindplot.Command,
initialize: function(topicId, iconType) {
$assert(topicId, 'topicId can not be null');
$assert($defined(topicId), 'topicId can not be null');
$assert(iconType, 'iconType can not be null');
this._objectsIds = topicId;
this._iconType = iconType;

View File

@ -95,11 +95,11 @@ mindplot.model.Mindmap = new Class({
return new mindplot.model.NodeModel(type, this, id);
},
createRelationship : function(fromNode, toNode) {
$assert(fromNode, 'from node cannot be null');
$assert(toNode, 'to node cannot be null');
createRelationship : function(sourceNodeId, targetNodeId) {
$assert($defined(sourceNodeId), 'from node cannot be null');
$assert($defined(targetNodeId), 'to node cannot be null');
return new mindplot.model.RelationshipModel(fromNode, toNode);
return new mindplot.model.RelationshipModel(sourceNodeId, targetNodeId);
},
addRelationship : function(relationship) {

View File

@ -16,13 +16,13 @@
* limitations under the License.
*/
mindplot.model.RelationshipModel = new Class({
initialize:function(fromNode, toNode) {
$assert(fromNode, 'from node type can not be null');
$assert(toNode, 'to node type can not be null');
initialize:function(sourceTopicId, targetTopicId) {
$assert($defined(sourceTopicId), 'from node type can not be null');
$assert($defined(targetTopicId), 'to node type can not be null');
this._id = mindplot.model.RelationshipModel._nextUUID();
this._fromNode = fromNode;
this._toNode = toNode;
this._sourceTargetId = sourceTopicId;
this._targetTopicId = targetTopicId;
this._lineType = mindplot.ConnectionLine.SIMPLE_CURVED;
this._srcCtrlPoint = null;
this._destCtrlPoint = null;
@ -31,11 +31,11 @@ mindplot.model.RelationshipModel = new Class({
},
getFromNode : function() {
return this._fromNode;
return this._sourceTargetId;
},
getToNode : function() {
return this._toNode;
return this._targetTopicId;
},
getId : function() {
@ -83,7 +83,7 @@ mindplot.model.RelationshipModel = new Class({
},
clone : function(model) {
var result = new mindplot.model.RelationshipModel(this._fromNode, this._toNode);
var result = new mindplot.model.RelationshipModel(this._sourceTargetId, this._targetTopicId);
result._id = this._id;
result._lineType = this._lineType;
result._srcCtrlPoint = this._srcCtrlPoint;