refactoring layout - fixing bugs

This commit is contained in:
Pablo Luna 2011-03-17 16:28:19 +00:00
parent 741ddef314
commit 55f9352c59
4 changed files with 31 additions and 3 deletions

View File

@ -20,8 +20,7 @@ mindplot.MainTopic = function(model)
{ {
core.assert(model, "Model can not be null"); core.assert(model, "Model can not be null");
this.setModel(model); this.setModel(model);
var topicBoard = new mindplot.MainTopicBoard(this); mindplot.MainTopic.superClass.initialize.call(this);
mindplot.MainTopic.superClass.initialize.call(this, topicBoard);
}; };
objects.extend(mindplot.MainTopic, mindplot.Topic); objects.extend(mindplot.MainTopic, mindplot.Topic);

View File

@ -455,6 +455,25 @@ mindplot.MindmapDesigner.prototype._nodeModelToNodeGraph = function(nodeModel, i
var children = nodeModel.getChildren().slice(); var children = nodeModel.getChildren().slice();
// Sort children by order to solve adding order in for OriginalLayoutManager...
if (this._layoutManager.getType() == mindplot.layoutManagers.OriginalLayoutManager.NAME && nodeGraph.getTopicType()!=mindplot.NodeModel.CENTRAL_TOPIC_TYPE && children.length > 0)
{
var oldChildren = children;
children = [];
for (var i = 0; i < oldChildren.length; i++)
{
var child = oldChildren[i];
var order = child.getOrder();
if (order != null)
{
children[order] = child;
} else
{
children.push(child);
}
}
}
for (var i = 0; i < children.length; i++) for (var i = 0; i < children.length; i++)
{ {
var child = children[i]; var child = children[i];

View File

@ -34,8 +34,13 @@ mindplot.layoutManagers.BaseLayoutManager = new Class({
}, },
getDesigner:function(){ getDesigner:function(){
return this._designer; return this._designer;
},
getType:function(){
return mindplot.layoutManagers.BaseLayoutManager.NAME;
} }
}); });
mindplot.layoutManagers.BaseLayoutManager.NAME ="BaseLayoutManager";
mindplot.layoutManagers.BaseLayoutManager.implement(new Events); mindplot.layoutManagers.BaseLayoutManager.implement(new Events);
mindplot.layoutManagers.BaseLayoutManager.implement(new Options); mindplot.layoutManagers.BaseLayoutManager.implement(new Options);

View File

@ -138,5 +138,10 @@ mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayo
_isCentralTopic:function(node){ _isCentralTopic:function(node){
var type = node.getModel().getType(); var type = node.getModel().getType();
return type == mindplot.NodeModel.CENTRAL_TOPIC_TYPE; return type == mindplot.NodeModel.CENTRAL_TOPIC_TYPE;
},
getType:function(){
return mindplot.layoutManagers.OriginalLayoutManager.NAME;
} }
}); });
mindplot.layoutManagers.OriginalLayoutManager.NAME ="OriginalLayoutManager";