fixing bugs

This commit is contained in:
Pablo Luna
2011-04-16 21:41:06 +01:00
parent 60ab4c7f5d
commit f73737ed0b
49 changed files with 214 additions and 186 deletions

View File

@@ -39,7 +39,7 @@ mindplot.layoutManagers.BaseLayoutManager = new Class({
getTopicBoardForTopic:function(node){
var id = node.getId();
var result = this._boards[id];
if(!result){
if(!core.Utils.isDefined(result)){
result = this._addNode(node);
}
return result;

View File

@@ -6,7 +6,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
this.parent(designer, options);
},
_nodeConnectEvent:function(targetNode, node){
if(node.relationship){
if(core.Utils.isDefined(node.relationship)){
this._movingNode(targetNode, node);
}
else if(!this._isCentralTopic(node)){
@@ -14,7 +14,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
}
},
_nodeDisconnectEvent:function(targetNode, node){
if(node.relationship){
if(core.Utils.isDefined(node.relationship)){
}
else{
this.parent(targetNode, node);
@@ -64,7 +64,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
}
// Register editor events ...
if (!this.getDesigner()._viewMode)
if (!core.Utils.isDefined(this.getDesigner()._viewMode)|| (core.Utils.isDefined(this.getDesigner()._viewMode) && !this.getDesigner()._viewMode))
{
this.getDesigner()._editor.listenEventOnNode(topic, 'dblclick', true);
}
@@ -155,7 +155,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
parentBoard._removeEntry(node, entryObj.table, entryObj.index, this._modifiedTopics);
this._changeChildrenSide(node, pos, this._modifiedTopics);
node.setPosition(pos.clone(), false);
if(this._modifiedTopics.set){
if(core.Utils.isDefined(this._modifiedTopics.set)){
var key = node.getId();
if(this._modifiedTopics.hasKey(key)){
nodePos = this._modifiedTopics.get(key).originalPos;
@@ -184,7 +184,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
childPos.y = newPos.y +(childPos.y - refPos.y);
this._changeChildrenSide(child, childPos, modifiedTopics);
child.setPosition(childPos, false);
if(modifiedTopics.set){
if(core.Utils.isDefined(modifiedTopics.set)){
var key = node.getId();
if(modifiedTopics.hasKey(key)){
oldPos = this._modifiedTopics.get(key).originalPos;
@@ -335,7 +335,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
}
this._updateTopicsForReconnect(topic, mindplot.layoutManagers.FreeMindLayoutManager.RECONNECT_NODES_OPACITY);
var line = topic.getOutgoingLine();
if(line){
if(core.Utils.isDefined(line)){
line.setVisibility(false);
}
this._createIndicatorShapes();
@@ -382,7 +382,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
// parentBoard._updateTable(entryObj.index, entryObj.table, this._modifiedTopics, true);
}
if(this._modifiedTopics.set){
if(core.Utils.isDefined(this._modifiedTopics.set)){
var key = node.getId();
if(this._modifiedTopics.hasKey(key)){
nodePos = this._modifiedTopics.get(key).originalPos;
@@ -449,7 +449,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
if(this._createShape == null){
//cancel everything.
var line = node.getOutgoingLine();
if(line){
if(core.Utils.isDefined(line)){
line.setVisibility(true);
}
core.Utils.animatePosition(this._modifiedTopics, null, this.getDesigner());
@@ -677,7 +677,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeMouseOutEvent,[node ]);
},
_addToModifiedList:function(modifiedTopics, key, originalpos, newPos){
if(modifiedTopics.set){
if(core.Utils.isDefined(modifiedTopics.set)){
if(modifiedTopics.hasKey(key)){
originalpos = modifiedTopics.get(key).originalPos;
}

View File

@@ -5,7 +5,7 @@ mindplot.layoutManagers.LayoutManagerFactory.managers = {
};
mindplot.layoutManagers.LayoutManagerFactory.getManagerByName = function(name){
var manager = mindplot.layoutManagers.LayoutManagerFactory.managers[name+"Manager"];
if(manager){
if(core.Utils.isDefined(manager)){
return manager;
}
else{

View File

@@ -127,7 +127,7 @@ mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayo
}
// Register editor events ...
if (!this.getDesigner()._viewMode)
if (!core.Utils.isDefined(this.getDesigner()._viewMode)|| (core.Utils.isDefined(this.getDesigner()._viewMode) && !this.getDesigner()._viewMode))
{
this.getDesigner()._editor.listenEventOnNode(topic, 'dblclick', true);
}

View File

@@ -16,7 +16,7 @@ mindplot.layoutManagers.boards.freeMindBoards.Board = mindplot.layoutManagers.bo
},
removeTopicFromBoard:function(node, modifiedTopics){
var pos;
if(node._originalPosition)
if(core.Utils.isDefined(node._originalPosition))
pos = node._originalPosition;
var result = this.findNodeEntryIndex(node, pos);
core.assert(result.index<result.table.length,"node not found. Could not remove");
@@ -30,7 +30,7 @@ mindplot.layoutManagers.boards.freeMindBoards.Board = mindplot.layoutManagers.bo
// if creating a sibling or child
if(!this._layoutManager._isMovingNode && this._layoutManager.getDesigner().getSelectedNodes().length>0){
var selectedNode = this._layoutManager.getDesigner().getSelectedNodes()[0];
if(!pos){
if(!core.Utils.isDefined(pos)){
if(selectedNode.getParent()!= null && node.getParent().getId() == selectedNode.getParent().getId()){
//creating a sibling - Lets put the new node below the selected node.
var parentBoard = this._layoutManager.getTopicBoardForTopic(selectedNode.getParent());
@@ -60,7 +60,7 @@ mindplot.layoutManagers.boards.freeMindBoards.Board = mindplot.layoutManagers.bo
}
}
this._addEntry(entry, result.table, result.index);
if(pos){
if(core.Utils.isDefined(pos)){
if(result.index>0){
var prevEntry =result.table[result.index-1];
entry.setMarginTop(pos.y-(prevEntry.getPosition() + prevEntry.getTotalMarginBottom()));
@@ -183,7 +183,7 @@ mindplot.layoutManagers.boards.freeMindBoards.Board = mindplot.layoutManagers.bo
var newPos = new core.Point(pos.x-(delta.x==null?0:delta.x), pos.y-delta.y);
entry.setPosition(newPos.x, newPos.y);
this._layoutManager._updateChildrenBoards(entry.getNode(), delta, modifiedTopics);
if(modifiedTopics.set){
if(core.Utils.isDefined(modifiedTopics.set)){
var key = entry.getId();
if(modifiedTopics.hasKey(key)){
pos = modifiedTopics.get(key).originalPos;

View File

@@ -15,7 +15,7 @@ mindplot.layoutManagers.boards.freeMindBoards.CentralTopicBoard = mindplot.layou
{
position = altPosition;
}
if(!position){
if(!core.Utils.isDefined(position)){
if(Math.sign(node.getParent().getPosition().x) == -1){
i=1;
}

View File

@@ -3,12 +3,12 @@ mindplot.layoutManagers.boards.freeMindBoards.Entry = new Class({
this._node = node;
this._DEFAULT_X_GAP = 30;
var pos = node.getModel().getFinalPosition();
if(useFinalPosition && pos){
if(useFinalPosition && core.Utils.isDefined(pos)){
this.setPosition(pos.x, pos.y);
}
else{
pos = node.getPosition();
if(!pos){
if(!core.Utils.isDefined(pos)){
var parent = node.getParent();
pos = parent.getPosition().clone();
var pwidth = parent.getSize().width;