Start migration to Mootools 1.3.1

This commit is contained in:
Paulo Veiga
2011-07-26 15:07:53 -03:00
parent 8eb84ce7b3
commit 41c1f47227
55 changed files with 13636 additions and 10601 deletions

View File

@@ -1,66 +1,62 @@
/*
* 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.
*/
* 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.ActionIcon = function(topic, url) {
mindplot.Icon.call(this, url);
this._node = topic;
};
mindplot.ActionIcon = new Class({
Extends:mindplot.Icon,
initialize: function(topic, url) {
mindplot.Icon.call(this, url);
this._node = topic;
},
getNode:function() {
return this._node;
},
objects.extend(mindplot.ActionIcon, mindplot.Icon);
setPosition:function(x, y) {
var size = this.getSize();
this.getImage().setPosition(x - size.width / 2, y - size.height / 2);
},
mindplot.ActionIcon.prototype.initialize = function() {
addEventListener:function(event, fn) {
this.getImage().addEventListener(event, fn);
},
};
addToGroup:function(group) {
group.appendChild(this.getImage());
},
mindplot.ActionIcon.prototype.getNode = function(){
return this._node;
};
setVisibility:function(visible) {
this.getImage().setVisibility(visible);
},
mindplot.ActionIcon.prototype.setPosition = function(x,y){
var size = this.getSize();
this.getImage().setPosition(x-size.width/2, y-size.height/2);
};
isVisible:function() {
return this.getImage().isVisible();
},
mindplot.ActionIcon.prototype.addEventListener = function(event, fn){
this.getImage().addEventListener(event, fn);
};
setCursor:function(cursor) {
return this.getImage().setCursor(cursor);
},
mindplot.ActionIcon.prototype.addToGroup = function(group){
group.appendChild(this.getImage());
};
moveToBack:function(cursor) {
return this.getImage().moveToBack(cursor);
},
mindplot.ActionIcon.prototype.setVisibility = function(visible){
this.getImage().setVisibility(visible);
};
mindplot.ActionIcon.prototype.isVisible = function(){
return this.getImage().isVisible();
};
mindplot.ActionIcon.prototype.setCursor = function(cursor){
return this.getImage().setCursor(cursor);
};
mindplot.ActionIcon.prototype.moveToBack = function(cursor){
return this.getImage().moveToBack(cursor);
};
mindplot.ActionIcon.prototype.moveToFront = function(cursor){
return this.getImage().moveToFront(cursor);
};
moveToFront:function(cursor) {
return this.getImage().moveToFront(cursor);
}
});

View File

@@ -0,0 +1,51 @@
/*
* 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.BaseCommandDispatcher = new Class({
initialize: function() {
},
addIconToTopic: function() {
throw "method must be implemented.";
},
addLinkToTopic: function() {
throw "method must be implemented.";
},
addNoteToTopic: function() {
throw "method must be implemented.";
},addRelationship: function() {
throw "method must be implemented.";
},addTopic: function() {
throw "method must be implemented.";
},changeIcon: function() {
throw "method must be implemented.";
},deleteTopic: function() {
throw "method must be implemented.";
},dragTopic: function() {
throw "method must be implemented.";
},moveControllPoint: function() {
throw "method must be implemented.";
} ,removeIconFromTopic: function() {
throw "method must be implemented.";
},removeLinkFromTopic: function() {
throw "method must be implemented.";
},removeNodeFromTopic: function() {
throw "method must be implemented.";
}
});

View File

@@ -1,103 +1,111 @@
/*
* 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.
*/
* 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.Board = function(defaultHeight, referencePoint)
{
this.initialize(defaultHeight, referencePoint);
};
mindplot.Board = new Class({
initialize : function(defaultHeight, referencePoint) {
core.assert(referencePoint, "referencePoint can not be null");
this._defaultWidth = defaultHeight;
this._entries = new mindplot.BidirectionalArray();
this._referencePoint = referencePoint;
},
mindplot.Board.prototype.initialize = function(defaultHeight, referencePoint)
{
core.assert(referencePoint, "referencePoint can not be null");
this._defaultWidth = defaultHeight;
this._entries = new mindplot.BidirectionalArray();
this._referencePoint = referencePoint;
};
getReferencePoint : function() {
return this._referencePoint;
},
mindplot.Board.prototype.getReferencePoint = function()
{
return this._referencePoint;
};
_removeEntryByOrder : function(order, position) {
var board = this._getBoard(position);
var entry = board.lookupEntryByOrder(order);
core.assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order);
entry.removeTopic();
board.update(entry);
},
removeTopicFromBoard : function(topic) {
var position = topic.getPosition();
var order = topic.getOrder();
this._removeEntryByOrder(order, position);
topic.setOrder(null);
},
positionateDragTopic :function(dragTopic) {
throw "this method must be overrided";
},
getHeight: function() {
var board = this._getBoard();
return board.getHeight();
}
});
/**
* ---------------------------------------
*/
mindplot.BidirectionalArray = function()
{
mindplot.BidirectionalArray = function() {
this._leftElem = [];
this._rightElem = [];
};
mindplot.BidirectionalArray.prototype.get = function(index, sign)
{
mindplot.BidirectionalArray.prototype.get = function(index, sign) {
core.assert(core.Utils.isDefined(index), 'Illegal argument, index must be passed.');
if (core.Utils.isDefined(sign))
{
if (core.Utils.isDefined(sign)) {
core.assert(index >= 0, 'Illegal absIndex value');
index = index * sign;
}
var result = null;
if (index >= 0 && index < this._rightElem.length)
{
if (index >= 0 && index < this._rightElem.length) {
result = this._rightElem[index];
} else if (index < 0 && Math.abs(index) < this._leftElem.length)
{
} else if (index < 0 && Math.abs(index) < this._leftElem.length) {
result = this._leftElem[Math.abs(index)];
}
return result;
};
mindplot.BidirectionalArray.prototype.set = function(index, elem)
{
mindplot.BidirectionalArray.prototype.set = function(index, elem) {
core.assert(core.Utils.isDefined(index), 'Illegal index value');
var array = (index >= 0) ? this._rightElem : this._leftElem;
array[Math.abs(index)] = elem;
};
mindplot.BidirectionalArray.prototype.length = function(index)
{
mindplot.BidirectionalArray.prototype.length = function(index) {
core.assert(core.Utils.isDefined(index), 'Illegal index value');
return (index >= 0) ? this._rightElem.length : this._leftElem.length;
};
mindplot.BidirectionalArray.prototype.upperLength = function()
{
mindplot.BidirectionalArray.prototype.upperLength = function() {
return this.length(1);
};
mindplot.BidirectionalArray.prototype.lowerLength = function()
{
mindplot.BidirectionalArray.prototype.lowerLength = function() {
return this.length(-1);
};
mindplot.BidirectionalArray.prototype.inspect = function()
{
mindplot.BidirectionalArray.prototype.inspect = function() {
var result = '{';
var lenght = this._leftElem.length;
for (var i = 0; i < lenght; i++)
{
for (var i = 0; i < lenght; i++) {
var entry = this._leftElem[lenght - i - 1];
if (entry != null)
{
if (i != 0)
{
if (entry != null) {
if (i != 0) {
result += ', ';
}
result += entry.inspect();
@@ -105,13 +113,10 @@ mindplot.BidirectionalArray.prototype.inspect = function()
}
lenght = this._rightElem.length;
for (var i = 0; i < lenght; i++)
{
for (var i = 0; i < lenght; i++) {
var entry = this._rightElem[i];
if (entry != null)
{
if (i != 0)
{
if (entry != null) {
if (i != 0) {
result += ', ';
}
result += entry.inspect();

View File

@@ -1,122 +1,106 @@
/*
* 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.
*/
* 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.CentralTopicBoard = function(centralTopic, layoutManager)
{
var point = new core.Point(0, 0);
this._layoutManager = layoutManager;
this._rightBoard = new mindplot.VariableDistanceBoard(50, point);
this._leftBoard = new mindplot.VariableDistanceBoard(50, point);
this._centralTopic = centralTopic;
};
mindplot.CentralTopicBoard = new Class({
Extends: mindplot.Board,
initialize:function(centralTopic, layoutManager) {
var point = new core.Point(0, 0);
this._layoutManager = layoutManager;
this._rightBoard = new mindplot.VariableDistanceBoard(50, point);
this._leftBoard = new mindplot.VariableDistanceBoard(50, point);
this._centralTopic = centralTopic;
},
objects.extend(mindplot.CentralTopicBoard, mindplot.Board);
_getBoard : function(position) {
return (position.x >= 0) ? this._rightBoard : this._leftBoard;
},
mindplot.CentralTopicBoard.prototype._getBoard = function(position)
{
return (position.x >= 0) ? this._rightBoard : this._leftBoard;
};
positionateDragTopic : function(dragTopic) {
core.assert(dragTopic != null, 'dragTopic can not be null');
core.assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance');
mindplot.CentralTopicBoard.prototype._updateHeight = function()
{
// This node is a main topic node. Position
var dragPos = dragTopic.getPosition();
var board = this._getBoard(dragPos);
};
// Look for entry ...
var entry = board.lookupEntryByPosition(dragPos);
mindplot.CentralTopicBoard.prototype.positionateDragTopic = function(dragTopic)
{
core.assert(dragTopic != null, 'dragTopic can not be null');
core.assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance');
// Calculate 'y' position base on the entry ...
var yCoord;
if (!entry.isAvailable() && entry.getTopic() != dragTopic.getDraggedTopic()) {
yCoord = entry.getLowerLimit();
} else {
yCoord = entry.workoutEntryYCenter();
}
// This node is a main topic node. Position
var dragPos = dragTopic.getPosition();
var board = this._getBoard(dragPos);
// Look for entry ...
var entry = board.lookupEntryByPosition(dragPos);
// MainTopic can not be positioned over the drag topic ...
var centralTopic = this._centralTopic;
var centralTopicSize = centralTopic.getSize();
var halfWidth = (centralTopicSize.width / 2);
if (Math.abs(dragPos.x) < halfWidth + 60) {
var distance = halfWidth + 60;
dragPos.x = (dragPos.x > 0) ? distance : -distance;
}
// Calculate 'y' position base on the entry ...
var yCoord;
if (!entry.isAvailable() && entry.getTopic() != dragTopic.getDraggedTopic())
{
yCoord = entry.getLowerLimit();
} else
{
yCoord = entry.workoutEntryYCenter();
// Update board position.
var pivotPos = new core.Point(dragPos.x, yCoord);
dragTopic.setBoardPosition(pivotPos);
},
addBranch : function(topic) {
// Update topic position ...
var position = topic.getPosition();
var order = topic.getOrder();
var board = this._getBoard(position);
var entry = null;
if (order != null) {
entry = board.lookupEntryByOrder(order);
} else {
entry = board.lookupEntryByPosition(position);
}
// If the entry is not available, I must swap the the entries...
if (!entry.isAvailable()) {
board.freeEntry(entry);
}
// Add it to the board ...
entry.setTopic(topic);
board.update(entry);
},
updateChildrenPosition : function(topic, xOffset, modifiedTopics) {
var board = this._rightBoard;
var oldReferencePosition = board.getReferencePoint();
var newReferencePosition = new core.Point(oldReferencePosition.x + xOffset, oldReferencePosition.y);
board.updateReferencePoint(newReferencePosition);
board = this._leftBoard;
oldReferencePosition = board.getReferencePoint();
newReferencePosition = new core.Point(oldReferencePosition.x - xOffset, oldReferencePosition.y);
board.updateReferencePoint(newReferencePosition);
},
repositionate : function() {
//@todo: implement ..
}
// MainTopic can not be positioned over the drag topic ...
var centralTopic = this._centralTopic;
var centralTopicSize = centralTopic.getSize();
var halfWidth = (centralTopicSize.width / 2);
if (Math.abs(dragPos.x) < halfWidth + 60)
{
var distance = halfWidth + 60;
dragPos.x = (dragPos.x > 0)? distance:-distance;
}
// Update board position.
var pivotPos = new core.Point(dragPos.x, yCoord);
dragTopic.setBoardPosition(pivotPos);
};
mindplot.CentralTopicBoard.prototype.addBranch = function(topic)
{
// Update topic position ...
var position = topic.getPosition();
var order = topic.getOrder();
var board = this._getBoard(position);
var entry = null;
if (order != null)
{
entry = board.lookupEntryByOrder(order);
} else
{
entry = board.lookupEntryByPosition(position);
}
// If the entry is not available, I must swap the the entries...
if (!entry.isAvailable())
{
board.freeEntry(entry);
}
// Add it to the board ...
entry.setTopic(topic);
board.update(entry);
};
mindplot.CentralTopicBoard.prototype.updateChildrenPosition = function(topic, xOffset, modifiedTopics)
{
var board = this._rightBoard;
var oldReferencePosition = board.getReferencePoint();
var newReferencePosition = new core.Point(oldReferencePosition.x + xOffset, oldReferencePosition.y);
board.updateReferencePoint(newReferencePosition);
board = this._leftBoard;
oldReferencePosition = board.getReferencePoint();
newReferencePosition = new core.Point(oldReferencePosition.x - xOffset, oldReferencePosition.y);
board.updateReferencePoint(newReferencePosition);
};
mindplot.CentralTopicBoard.prototype.repositionate = function()
{
//@todo: implement ..
};
});

View File

@@ -250,7 +250,7 @@ mindplot.FixedDistanceBoard.prototype.removeTopic = function(topic)
entry.setTopic(null);
topic.setOrder(null);
this._entries.remove(entry);
this._entries.erase(entry);
// Repositionate all elements ...
this.repositionate();

View File

@@ -132,7 +132,7 @@ mindplot.IconGroup.prototype.findIconFromModel=function(iconModel){
mindplot.IconGroup.prototype._removeIcon = function(icon) {
var nativeImage = icon.getImage();
this.options.icons.remove(icon);
this.options.icons.erase(icon);
var iconSize = nativeImage.getSize();
var size = this.options.nativeElem.getSize();
var position = nativeImage.getPosition();

View File

@@ -1,142 +1,130 @@
/*
* 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.
*/
* 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.MainTopicBoard = function(topic, layoutManager)
{
this._layoutManager = layoutManager;
this._topic = topic;
this._board = null;
this._height = 0;
};
mindplot.MainTopicBoard = new Class({
Extends:mindplot.Board,
initialize:function(topic, layoutManager) {
this._layoutManager = layoutManager;
this._topic = topic;
this._board = null;
this._height = 0;
},
objects.extend(mindplot.MainTopicBoard, mindplot.Board);
_getBoard: function() {
if (!core.Utils.isDefined(this._board)) {
var topic = this._topic;
this._board = new mindplot.FixedDistanceBoard(mindplot.MainTopicBoard.DEFAULT_MAIN_TOPIC_HEIGHT, topic, this._layoutManager);
}
return this._board;
},
updateReferencePoint : function(position) {
this._board.updateReferencePoint(position);
},
updateChildrenPosition : function(topic) {
var board = this._getBoard();
board.updateReferencePoint();
},
positionateDragTopic : function(dragTopic) {
core.assert(dragTopic != null, 'dragTopic can not be null');
core.assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance');
// This node is a main topic node. Position
var dragPos = dragTopic.getPosition();
var board = this._getBoard();
// Look for entry ...
var entry = board.lookupEntryByPosition(dragPos);
// Calculate 'y' position base on the entry ...
var yCoord;
if (!entry.isAvailable() && entry.getTopic() != dragTopic.getDraggedTopic()) {
yCoord = entry.getLowerLimit();
} else {
yCoord = entry.workoutEntryYCenter();
}
// Update board position.
var targetTopic = dragTopic.getConnectedToTopic();
var xCoord = this._workoutXBorderDistance(targetTopic);
// Add the size of the pivot to the distance ...
var halfPivotWidth = mindplot.DragTopic.PIVOT_SIZE.width / 2;
xCoord = xCoord + ((dragPos.x > 0) ? halfPivotWidth : -halfPivotWidth);
var pivotPos = new core.Point(xCoord, yCoord);
dragTopic.setBoardPosition(pivotPos);
var order = entry.getOrder();
dragTopic.setOrder(order);
}
,
/**
* This x distance doesn't take into account the size of the shape.
*/
_workoutXBorderDistance : function(topic) {
core.assert(topic, 'topic can not be null');
var board = this._getBoard();
return board.workoutXBorderDistance(topic);
},
addBranch : function(topic) {
var order = topic.getOrder();
core.assert(core.Utils.isDefined(order), "Order must be defined");
// If the entry is not available, I must swap the the entries...
var board = this._getBoard();
var entry = board.lookupEntryByOrder(order);
if (!entry.isAvailable()) {
board.freeEntry(entry);
}
// Add the topic to the board ...
board.addTopic(order, topic);
// Repositionate all the parent topics ...
var currentTopic = this._topic;
if (currentTopic.getOutgoingConnectedTopic()) {
var parentTopic = currentTopic.getOutgoingConnectedTopic();
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeRepositionateEvent, [parentTopic]);
}
},
repositionate : function() {
var board = this._getBoard();
board.repositionate();
},
removeTopicFromBoard : function(topic) {
var board = this._getBoard();
board.removeTopic(topic);
// Repositionate all the parent topics ...
var parentTopic = this._topic;
if (parentTopic.getOutgoingConnectedTopic()) {
var connectedTopic = parentTopic.getOutgoingConnectedTopic();
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeRepositionateEvent, [connectedTopic]);
}
}
});
mindplot.MainTopicBoard.DEFAULT_MAIN_TOPIC_HEIGHT = 18;
mindplot.MainTopicBoard.prototype._getBoard = function()
{
if (!core.Utils.isDefined(this._board))
{
var topic = this._topic;
this._board = new mindplot.FixedDistanceBoard(mindplot.MainTopicBoard.DEFAULT_MAIN_TOPIC_HEIGHT, topic, this._layoutManager);
}
return this._board;
};
mindplot.MainTopicBoard.prototype.updateReferencePoint = function(position)
{
this._board.updateReferencePoint(position);
};
mindplot.MainTopicBoard.prototype.updateChildrenPosition = function(topic)
{
var board = this._getBoard();
board.updateReferencePoint();
};
mindplot.MainTopicBoard.prototype.positionateDragTopic = function(dragTopic)
{
core.assert(dragTopic != null, 'dragTopic can not be null');
core.assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance');
// This node is a main topic node. Position
var dragPos = dragTopic.getPosition();
var board = this._getBoard();
// Look for entry ...
var entry = board.lookupEntryByPosition(dragPos);
// Calculate 'y' position base on the entry ...
var yCoord;
if (!entry.isAvailable() && entry.getTopic() != dragTopic.getDraggedTopic())
{
yCoord = entry.getLowerLimit();
} else
{
yCoord = entry.workoutEntryYCenter();
}
// Update board position.
var targetTopic = dragTopic.getConnectedToTopic();
var xCoord = this._workoutXBorderDistance(targetTopic);
// Add the size of the pivot to the distance ...
var halfPivotWidth = mindplot.DragTopic.PIVOT_SIZE.width / 2;
xCoord = xCoord + ((dragPos.x > 0) ? halfPivotWidth : -halfPivotWidth);
var pivotPos = new core.Point(xCoord, yCoord);
dragTopic.setBoardPosition(pivotPos);
var order = entry.getOrder();
dragTopic.setOrder(order);
};
/**
* This x distance does't take into account the size of the shape.
*/
mindplot.MainTopicBoard.prototype._workoutXBorderDistance = function(topic)
{
core.assert(topic, 'topic can not be null');
var board = this._getBoard();
return board.workoutXBorderDistance(topic);
};
mindplot.MainTopicBoard.prototype.addBranch = function(topic)
{
var order = topic.getOrder();
core.assert(core.Utils.isDefined(order), "Order must be defined");
// If the entry is not available, I must swap the the entries...
var board = this._getBoard();
var entry = board.lookupEntryByOrder(order);
if (!entry.isAvailable())
{
board.freeEntry(entry);
}
// Add the topic to the board ...
board.addTopic(order, topic);
// Repositionate all the parent topics ...
var currentTopic = this._topic;
if (currentTopic.getOutgoingConnectedTopic())
{
var parentTopic = currentTopic.getOutgoingConnectedTopic();
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeRepositionateEvent,[parentTopic]);
}
};
mindplot.MainTopicBoard.prototype.repositionate = function()
{
var board = this._getBoard();
board.repositionate();
};
mindplot.MainTopicBoard.prototype.removeTopicFromBoard = function(topic)
{
var board = this._getBoard();
board.removeTopic(topic);
// Repositionate all the parent topics ...
var parentTopic = this._topic;
if (parentTopic.getOutgoingConnectedTopic())
{
var connectedTopic = parentTopic.getOutgoingConnectedTopic();
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeRepositionateEvent,[connectedTopic]);
}
};

View File

@@ -94,7 +94,7 @@ mindplot.Mindmap.prototype.connect = function(parent, child)
parent._appendChild(child);
// Remove from the branch ...
branches.remove(child);
branches.erase(child);
};
mindplot.Mindmap.prototype.disconnect = function(child)
@@ -151,7 +151,7 @@ mindplot.Mindmap.prototype.addRelationship = function(relationship) {
};
mindplot.Mindmap.prototype.removeRelationship = function(relationship) {
this._relationships.remove(relationship);
this._relationships.erase(relationship);
};
mindplot.Mindmap.prototype.inspect = function()

View File

@@ -41,8 +41,9 @@ mindplot.MindmapDesigner = function(profile, divElement)
// Init layout managers ...
this._topics = [];
var layoutManagerClass = mindplot.layoutManagers.LayoutManagerFactory.getManagerByName(mindplot.EditorOptions.LayoutManager);
this._layoutManager = new layoutManagerClass(this);
// var layoutManagerClass = mindplot.layoutManagers.LayoutManagerFactory.getManagerByName(mindplot.EditorOptions.LayoutManager);
// this._layoutManager = new layoutManagerClass(this);
this._layoutManager = new mindplot.layoutManagers.OriginalLayoutManager(this);
// Register handlers..
this._registerEvents();
@@ -591,7 +592,7 @@ mindplot.MindmapDesigner.prototype._removeNode = function(node)
}
this._workspace.removeChild(node);
this._topics.remove(node);
this._topics.erase(node);
// Delete this node from the model...
var model = node.getModel();

View File

@@ -147,7 +147,7 @@ mindplot.NodeModel.prototype.addLink = function(link)
mindplot.NodeModel.prototype._removeLink = function(link)
{
core.assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links');
this._links.remove(link);
this._links.erase(link);
};
mindplot.NodeModel.prototype.createNote = function(text)
@@ -165,7 +165,7 @@ mindplot.NodeModel.prototype.addNote = function(note)
mindplot.NodeModel.prototype._removeNote = function(note)
{
core.assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links');
this._notes.remove(note);
this._notes.erase(note);
};
mindplot.NodeModel.prototype.createIcon = function(iconType)
@@ -183,7 +183,7 @@ mindplot.NodeModel.prototype.addIcon = function(icon)
mindplot.NodeModel.prototype._removeIcon = function(icon)
{
core.assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
this._icons.remove(icon);
this._icons.erase(icon);
};
mindplot.NodeModel.prototype.removeLastIcon = function()
@@ -201,7 +201,7 @@ mindplot.NodeModel.prototype._appendChild = function(child)
mindplot.NodeModel.prototype._removeChild = function(child)
{
core.assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object.');
this._children.remove(child);
this._children.erase(child);
child._parent = null;
};
@@ -497,7 +497,7 @@ mindplot.NodeModel.prototype.deleteNode = function()
// It's an isolated node. It must be a hole branch ...
var branches = mindmap.getBranches();
branches.remove(this);
branches.erase(this);
};

View File

@@ -29,7 +29,7 @@ mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHa
var xmlMap = serializer.toXML(mindmap);
var xmlMapStr = core.Utils.innerXML(xmlMap);
var pref = Json.toString(editorProperties);
var pref = JSON.toString(editorProperties);
window.MapEditorService.saveMap(mapId, xmlMapStr, pref,saveHistory,
{
callback:function(response) {

View File

@@ -24,17 +24,13 @@ mindplot.RichTextEditor = mindplot.TextEditor.extend({
//Create editor ui
this._size = {width:440, height:200};
this._myOverlay = new Element('div').setStyles({position:"absolute", display: "none", zIndex: "8", top: "50%", left:"50%", marginLeft:"-200px", marginTop:"-90px", width:"400px", height:"180px"});
var inputContainer = new Element('div').setStyles({border:"none", overflow:"auto"}).injectInside(this._myOverlay);
this.inputText = new Element('textarea').setProperties({tabindex:'-1', id:"inputText2", value:""}).setStyles({width:"398px", height:"175px", border:"none", background:"transparent"}).injectInside(inputContainer);
/*var spanContainer = new Element('div').setStyle('visibility', "hidden").injectInside(this._myOverlay);
this._spanText = new Element('span').setProperties({id: "spanText2", tabindex:"-1"}).setStyle('white-space', "nowrap").setStyle('nowrap', 'nowrap').injectInside(spanContainer);
*/this._myOverlay.injectInside(this._screenManager.getContainer());
var inputContainer = new Element('div').setStyles({border:"none", overflow:"auto"}).inject(this._myOverlay);
this.inputText = new Element('textarea').setProperties({tabindex:'-1', id:"inputText2", value:""}).setStyles({width:"398px", height:"175px", border:"none", background:"transparent"}).inject(inputContainer);
this._myOverlay.inject(this._screenManager.getContainer());
this._editorNode = new web2d.Rect(0.3,mindplot.Topic.OUTER_SHAPE_ATTRIBUTES);
this._editorNode.setSize(50,20);
this._editorNode.setVisibility(false);
this._designer.getWorkSpace().appendChild(this._editorNode);
// $(this.inputText).setStyle('display','block');
this._addListeners();
},
_addListeners:function(){

View File

@@ -1,135 +1,117 @@
/*
* 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.
*/
* 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.ShirinkConnector = function(topic)
{
var elipse = new web2d.Elipse(mindplot.Topic.prototype.INNER_RECT_ATTRIBUTES);
this._elipse = elipse;
elipse.setFill('#f7f7f7');
mindplot.ShirinkConnector = new Class({
initialize: function(topic) {
elipse.setSize(mindplot.Topic.CONNECTOR_WIDTH, mindplot.Topic.CONNECTOR_WIDTH);
var shrinkConnector = this;
elipse.addEventListener('click', function(event)
{
var elipse = new web2d.Elipse(mindplot.Topic.prototype.INNER_RECT_ATTRIBUTES);
this._elipse = elipse;
elipse.setFill('#f7f7f7');
elipse.setSize(mindplot.Topic.CONNECTOR_WIDTH, mindplot.Topic.CONNECTOR_WIDTH);
elipse.addEventListener('click', function(event) {
var model = topic.getModel();
var isShrink = !model.areChildrenShrinked();
var actionRunner = mindplot.DesignerActionRunner.getInstance();
var topicId = topic.getId();
var commandFunc = function(topic, isShrink) {
topic.setChildrenShrinked(isShrink);
return !isShrink;
};
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, isShrink, [topicId]);
actionRunner.execute(command);
var e = new Event(event).stop();
e.preventDefault();
});
elipse.addEventListener('mousedown', function(event) {
// Avoid node creation ...
var e = new Event(event).stop();
e.preventDefault();
});
elipse.addEventListener('dblclick', function(event) {
// Avoid node creation ...
event = new Event(event).stop();
event.preventDefault();
});
elipse.addEventListener('mouseover', function(event) {
this.setFill('#009900');
});
elipse.addEventListener('mouseout', function(event) {
var color = topic.getBackgroundColor();
this.setFill(color);
});
elipse.setCursor('default');
this._fillColor = '#f7f7f7';
var model = topic.getModel();
var isShrink = !model.areChildrenShrinked();
this.changeRender(model.areChildrenShrinked());
var actionRunner = mindplot.DesignerActionRunner.getInstance();
var topicId = topic.getId();
},
changeRender: function(isShrink) {
var elipse = this._elipse;
if (isShrink) {
elipse.setStroke('2', 'solid');
} else {
elipse.setStroke('1', 'solid');
}
},
var commandFunc = function(topic, isShrink)
{
topic.setChildrenShrinked(isShrink);
return !isShrink;
};
setVisibility: function(value) {
this._elipse.setVisibility(value);
},
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, isShrink, [topicId]);
actionRunner.execute(command);
setOpacity: function(opacity) {
this._elipse.setOpacity(opacity);
},
var event = new Event(event).stop();
event.preventDefault();
setFill: function(color) {
this._fillColor = color;
this._elipse.setFill(color);
},
});
setAttribute: function(name, value) {
this._elipse.setAttribute(name, value);
},
elipse.addEventListener('mousedown', function(event)
{
// Avoid node creation ...
var event = new Event(event).stop();
event.preventDefault();
});
addToWorkspace: function(group) {
group.appendChild(this._elipse);
},
elipse.addEventListener('dblclick', function(event)
{
// Avoid node creation ...
event = new Event(event).stop();
event.preventDefault();
});
setPosition: function(x, y) {
this._elipse.setPosition(x, y);
},
elipse.addEventListener('mouseover', function(event)
{
this.setFill('#009900');
});
moveToBack: function() {
this._elipse.moveToBack();
},
elipse.addEventListener('mouseout', function(event)
{
var color = topic.getBackgroundColor();
this.setFill(color);
});
elipse.setCursor('default');
this._fillColor = '#f7f7f7';
var model = topic.getModel();
this.changeRender(model.areChildrenShrinked());
};
mindplot.ShirinkConnector.prototype.changeRender = function(isShrink)
{
var elipse = this._elipse;
if (isShrink)
{
elipse.setStroke('2', 'solid');
} else
{
elipse.setStroke('1', 'solid');
moveToFront: function() {
this._elipse.moveToFront();
}
}
mindplot.ShirinkConnector.prototype.setVisibility = function(value)
{
this._elipse.setVisibility(value);
}
mindplot.ShirinkConnector.prototype.setOpacity = function(opacity)
{
this._elipse.setOpacity(opacity);
}
mindplot.ShirinkConnector.prototype.setFill = function(color)
{
this._fillColor = color;
this._elipse.setFill(color);
}
mindplot.ShirinkConnector.prototype.setAttribute = function(name, value)
{
this._elipse.setAttribute(name, value);
}
mindplot.ShirinkConnector.prototype.addToWorkspace = function(group)
{
group.appendChild(this._elipse);
}
mindplot.ShirinkConnector.prototype.setPosition = function(x, y)
{
this._elipse.setPosition(x, y);
}
mindplot.ShirinkConnector.prototype.moveToBack = function()
{
this._elipse.moveToBack();
}
mindplot.ShirinkConnector.prototype.moveToFront = function()
{
this._elipse.moveToFront();
}
});

View File

@@ -0,0 +1,53 @@
/*
* 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.SingleCommandDispatcher = new Class({
Extends:mindplot.BaseCommandDispatcher,
initialize: function()
{
},
addIconToTopic: function() {
throw "method must be implemented.";
},
addLinkToTopic: function() {
throw "method must be implemented.";
},
addNoteToTopic: function() {
throw "method must be implemented.";
},addRelationship: function() {
throw "method must be implemented.";
},addTopic: function() {
throw "method must be implemented.";
},changeIcon: function() {
throw "method must be implemented.";
},deleteTopic: function() {
throw "method must be implemented.";
},dragTopic: function() {
throw "method must be implemented.";
},moveControllPoint: function() {
throw "method must be implemented.";
} ,removeIconFromTopic: function() {
throw "method must be implemented.";
},removeLinkFromTopic: function() {
throw "method must be implemented.";
},removeNodeFromTopic: function() {
throw "method must be implemented.";
}
});

View File

@@ -34,11 +34,11 @@ mindplot.TextEditor = new Class({
_createUI:function(){
this._size = {width:500, height:100};
this._myOverlay = new Element('div').setStyles({position:"absolute", display: "none", zIndex: "8", top: 0, left:0, width:"500px", height:"100px"});
var inputContainer = new Element('div').setStyles({border:"none", overflow:"auto"}).injectInside(this._myOverlay);
this.inputText = new Element('input').setProperties({type:"text", tabindex:'-1', id:"inputText", value:""}).setStyles({border:"none", background:"transparent"}).injectInside(inputContainer);
var spanContainer = new Element('div').setStyle('visibility', "hidden").injectInside(this._myOverlay);
this._spanText = new Element('span').setProperties({id: "spanText", tabindex:"-1"}).setStyle('white-space', "nowrap").setStyle('nowrap', 'nowrap').injectInside(spanContainer);
this._myOverlay.injectInside(this._container);
var inputContainer = new Element('div').setStyles({border:"none", overflow:"auto"}).inject(this._myOverlay);
this.inputText = new Element('input').setProperties({type:"text", tabindex:'-1', id:"inputText", value:""}).setStyles({border:"none", background:"transparent"}).inject(inputContainer);
var spanContainer = new Element('div').setStyle('visibility', "hidden").inject(this._myOverlay);
this._spanText = new Element('span').setProperties({id: "spanText", tabindex:"-1"}).setStyle('white-space', "nowrap").setStyle('nowrap', 'nowrap').inject(spanContainer);
this._myOverlay.inject(this._container);
},
_addListeners:function(){
var elem = this;
@@ -101,7 +101,7 @@ mindplot.TextEditor = new Class({
setTimeout("$('ffoxWorkarroundInput').focus();", 0);
};
this.fx = new Fx.Style(this.inputText, 'opacity', { duration: 10});
this.fx = new Fx.Morph(this.inputText, 'opacity', { duration: 10});
this.fx.addEvent('onComplete', onComplete.bind(this));
},
lostFocusEvent : function ()

View File

@@ -104,7 +104,7 @@ mindplot.Tip.prototype.forceClose=function(){
this.options.panel.effect('opacity',{duration:100, onComplete:function(){
this._open=false;
$(this.options.panel).setStyles({left:0,top:0});
$(this.options.container).remove();
$(this.options.container).dispose();
}.bind(this)}).start(100,0);
};
@@ -120,7 +120,7 @@ mindplot.Tip.prototype.init=function(event,source){
var screenWidth = containerCoords.width;
var screenHeight = containerCoords.height;
$(this.options.panel).remove();
$(this.options.panel).dispose();
this.buildTip();
$(this.options.container).inject(this.options.panel);
this.moveTopic(offset, $(opts.panel).getCoordinates().height);

View File

@@ -431,7 +431,7 @@ mindplot.Topic.prototype.addRelationship = function(relationship){
};
mindplot.Topic.prototype.removeRelationship = function(relationship){
this._relationships.remove(relationship);
this._relationships.erase(relationship);
};
mindplot.Topic.prototype.getRelationships = function(){
@@ -1303,7 +1303,7 @@ mindplot.Topic.prototype._appendChild = function(child)
mindplot.Topic.prototype._removeChild = function(child)
{
var children = this._getChildren();
children.remove(child);
children.erase(child);
};
mindplot.Topic.prototype._getChildren = function()

View File

@@ -1,52 +1,53 @@
/*
* 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.
*/
* 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.Board = function()
{
this._height = null;
};
//@Todo: Por que lo cambiaste a Board ?
mindplot.TopicBoard = new Class({
mindplot.Board.prototype._removeEntryByOrder = function(order, position)
{
var board = this._getBoard(position);
var entry = board.lookupEntryByOrder(order);
initialize: function() {
this._height = null;
},
core.assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order);
entry.removeTopic();
board.update(entry);
};
_removeEntryByOrder : function(order, position) {
var board = this._getBoard(position);
var entry = board.lookupEntryByOrder(order);
mindplot.Board.prototype.removeTopicFromBoard = function(topic)
{
var position = topic.getPosition();
var order = topic.getOrder();
core.assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order);
entry.removeTopic();
board.update(entry);
},
this._removeEntryByOrder(order, position);
topic.setOrder(null);
};
removeTopicFromBoard : function(topic) {
var position = topic.getPosition();
var order = topic.getOrder();
mindplot.Board.prototype.positionateDragTopic = function(dragTopic)
{
throw "this method must be overrided";
};
this._removeEntryByOrder(order, position);
topic.setOrder(null);
},
positionateDragTopic :function(dragTopic) {
throw "this method must be overrided";
},
getHeight: function() {
var board = this._getBoard();
return board.getHeight();
}
}
);
mindplot.Board.prototype.getHeight = function()
{
var board = this._getBoard();
return board.getHeight();
};

View File

@@ -1,295 +1,213 @@
/*
* 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.
*/
* 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.VariableDistanceBoard = function(defaultHeight, referencePoint)
{
mindplot.VariableDistanceBoard.superClass.initialize.call(this, defaultHeight, referencePoint);
mindplot.VariableDistanceBoard = new Class({
Extends: mindplot.Board,
initialize: function(defaultHeight, referencePoint) {
this.parent(defaultHeight, referencePoint);
var zeroEntryCoordinate = referencePoint.y;
var entry = this.createBoardEntry(zeroEntryCoordinate - (defaultHeight / 2), zeroEntryCoordinate + (defaultHeight / 2), 0);
this._entries.set(0, entry);
},
var zeroEntryCoordinate = referencePoint.y;
var entry = this.createBoardEntry(zeroEntryCoordinate - (defaultHeight / 2), zeroEntryCoordinate + (defaultHeight / 2), 0);
this._entries.set(0, entry);
};
lookupEntryByOrder:function(order) {
var entries = this._entries;
var index = this._orderToIndex(order);
var result = entries.get(index);
if (!core.Utils.isDefined(result)) {
// I've not found a entry. I have to create a new one.
var i = 1;
var zeroEntry = entries.get(0);
var distance = zeroEntry.getWidth() / 2;
var indexSign = Math.sign(index);
var absIndex = Math.abs(index);
while (i < absIndex) {
// Move to the next entry ...
var entry = entries.get(i, indexSign);
if (entry != null) {
distance += entry.getWidth();
} else {
distance += this._defaultWidth;
}
i++;
}
objects.extend(mindplot.VariableDistanceBoard, mindplot.Board);
// Calculate limits ...
var upperLimit = -1;
var lowerLimit = -1;
var offset = zeroEntry.workoutEntryYCenter();
if (index >= 0) {
lowerLimit = offset + distance;
upperLimit = lowerLimit + this._defaultWidth;
} else {
upperLimit = offset - distance;
lowerLimit = upperLimit - this._defaultWidth;
}
mindplot.VariableDistanceBoard.prototype.lookupEntryByOrder = function(order)
{
var entries = this._entries;
var index = this._orderToIndex(order);
result = this.createBoardEntry(lowerLimit, upperLimit, order);
}
return result;
},
var result = entries.get(index);
if (!core.Utils.isDefined(result))
{
// I've not found a entry. I have to create a new one.
var i = 1;
var zeroEntry = entries.get(0);
var distance = zeroEntry.getWidth() / 2;
var indexSign = Math.sign(index);
var absIndex = Math.abs(index);
while (i < absIndex)
{
// Move to the next entry ...
var width;
var entry = entries.get(i, indexSign);
if (entry != null)
{
distance += entry.getWidth();
} else
{
distance += this._defaultWidth;
createBoardEntry:function(lowerLimit, upperLimit, order) {
return new mindplot.BoardEntry(lowerLimit, upperLimit, order);
},
updateReferencePoint:function(position) {
var entries = this._entries;
var referencePoint = this._referencePoint;
// Update zero entry current position.
this._referencePoint = position.clone();
var yOffset = position.y - referencePoint.y;
var i = -entries.lowerLength();
for (; i <= entries.length(1); i++) {
var entry = entries.get(i);
if (entry != null) {
var upperLimit = entry.getUpperLimit() + yOffset;
var lowerLimit = entry.getLowerLimit() + yOffset;
entry.setUpperLimit(upperLimit);
entry.setLowerLimit(lowerLimit);
// Update topic position ...
if (!entry.isAvailable()) {
var topic = entry.getTopic();
var topicPosition = topic.getPosition();
topicPosition.y = topicPosition.y + yOffset;
// MainTopicToCentral must be positioned based on the referencePoint.
var xOffset = position.x - referencePoint.x;
topicPosition.x = topicPosition.x + xOffset;
topic.setPosition(topicPosition);
}
}
}
},
lookupEntryByPosition:function(pos) {
core.assert(core.Utils.isDefined(pos), 'position can not be null');
var entries = this._entries;
var zeroEntry = entries.get(0);
if (zeroEntry.isCoordinateIn(pos.y)) {
return zeroEntry;
}
i++;
}
// Caculate limits ...
var upperLimit = -1;
var lowerLimit = -1;
var offset = zeroEntry.workoutEntryYCenter();
if (index >= 0)
{
lowerLimit = offset + distance;
upperLimit = lowerLimit + this._defaultWidth;
} else
{
upperLimit = offset - distance;
lowerLimit = upperLimit - this._defaultWidth;
}
result = this.createBoardEntry(lowerLimit, upperLimit, order);
}
return result;
};
mindplot.VariableDistanceBoard.prototype.createBoardEntry = function(lowerLimit, upperLimit, order)
{
return new mindplot.BoardEntry(lowerLimit, upperLimit, order);
};
mindplot.VariableDistanceBoard.prototype.updateReferencePoint = function(position)
{
var entries = this._entries;
var referencePoint = this._referencePoint;
// Update zero entry current position.
this._referencePoint = position.clone();
var yOffset = position.y - referencePoint.y;
var i = -entries.lowerLength();
for (; i <= entries.length(1); i++)
{
var entry = entries.get(i);
if (entry != null)
{
var upperLimit = entry.getUpperLimit() + yOffset;
var lowerLimit = entry.getLowerLimit() + yOffset;
entry.setUpperLimit(upperLimit);
entry.setLowerLimit(lowerLimit);
// Update topic position ...
if (!entry.isAvailable())
{
var topic = entry.getTopic();
var topicPosition = topic.getPosition();
topicPosition.y = topicPosition.y + yOffset;
// MainTopicToCentral must be positioned based on the referencePoint.
var xOffset = position.x - referencePoint.x;
topicPosition.x = topicPosition.x + xOffset;
topic.setPosition(topicPosition);
}
}
}
};
mindplot.VariableDistanceBoard.prototype.lookupEntryByPosition = function(pos)
{
core.assert(core.Utils.isDefined(pos), 'position can not be null');
var entries = this._entries;
var zeroEntry = entries.get(0);
if (zeroEntry.isCoordinateIn(pos.y))
{
return zeroEntry;
}
// Is Upper or lower ?
var sign = -1;
if (pos.y >= zeroEntry.getUpperLimit())
{
sign = 1;
}
var i = 1;
var tempEntry = this.createBoardEntry();
var currentEntry = zeroEntry;
while (true)
{
// Move to the next entry ...
var index = i * sign;
var entry = entries.get(index);
if (core.Utils.isDefined(entry))
{
currentEntry = entry;
} else
{
// Calculate boundaries...
var lowerLimit, upperLimit;
if (sign > 0)
{
lowerLimit = currentEntry.getUpperLimit();
upperLimit = lowerLimit + this._defaultWidth;
}
else
{
upperLimit = currentEntry.getLowerLimit();
lowerLimit = upperLimit - this._defaultWidth;
// Is Upper or lower ?
var sign = -1;
if (pos.y >= zeroEntry.getUpperLimit()) {
sign = 1;
}
// Update current entry.
currentEntry = tempEntry;
currentEntry.setLowerLimit(lowerLimit);
currentEntry.setUpperLimit(upperLimit);
var i = 1;
var tempEntry = this.createBoardEntry();
var currentEntry = zeroEntry;
while (true) {
// Move to the next entry ...
var index = i * sign;
var entry = entries.get(index);
if (core.Utils.isDefined(entry)) {
currentEntry = entry;
} else {
// Calculate boundaries...
var lowerLimit, upperLimit;
if (sign > 0) {
lowerLimit = currentEntry.getUpperLimit();
upperLimit = lowerLimit + this._defaultWidth;
}
else {
upperLimit = currentEntry.getLowerLimit();
lowerLimit = upperLimit - this._defaultWidth;
}
var order = this._indexToOrder(index);
currentEntry.setOrder(order);
}
// Update current entry.
currentEntry = tempEntry;
currentEntry.setLowerLimit(lowerLimit);
currentEntry.setUpperLimit(upperLimit);
// Have I found the item?
if (currentEntry.isCoordinateIn(pos.y))
{
break;
}
i++;
}
return currentEntry;
};
var order = this._indexToOrder(index);
currentEntry.setOrder(order);
}
mindplot.VariableDistanceBoard.prototype.update = function(entry)
{
core.assert(entry, 'Entry can not be null');
var order = entry.getOrder();
var index = this._orderToIndex(order);
this._entries.set(index, entry);
};
mindplot.VariableDistanceBoard.prototype.getLastNoAvailalbleEntry = function()
{
var entries = this._entries;
var lowerLength = entries.lowerLength();
var upperLength = entries.upperLength();
var result = null;
var i = -lowerLength;
while (i <= upperLength)
{
var entry = entries.get(i);
if (entry && !entry.isAvailable())
{
result = entry;
break;
}
i++;
}
return result;
};
mindplot.VariableDistanceBoard.prototype.getFirstNoAvailableEntry = function()
{
var entries = this._entries;
var lowerLength = -entries.lowerLength();
var upperLength = entries.upperLength();
var result = null;
var i = upperLength;
while (i >= lowerLength)
{
var entry = entries.get(i);
if (entry && !entry.isAvailable())
{
result = entry;
break;
}
i--;
}
return result;
};
mindplot.VariableDistanceBoard.prototype.freeEntry = function(entry)
{
var order = entry.getOrder();
var entries = this._entries;
var index = this._orderToIndex(order);
var indexSign = Math.sign(index);
var lenght = entries.length(index);
var currentTopic = entry.getTopic();
var i = Math.abs(index) + 1;
while (currentTopic)
{
var e = entries.get(i, indexSign);
if (core.Utils.isDefined(currentTopic) && !core.Utils.isDefined(e))
{
var entryOrder = this._indexToOrder(i * indexSign);
e = this.lookupEntryByOrder(entryOrder);
}
// Move the topic to the next entry ...
var topic = null;
if (core.Utils.isDefined(e))
{
topic = e.getTopic();
if (core.Utils.isDefined(currentTopic))
{
e.setTopic(currentTopic);
// Have I found the item?
if (currentEntry.isCoordinateIn(pos.y)) {
break;
}
i++;
}
this.update(e);
return currentEntry;
},
update:function(entry) {
core.assert(entry, 'Entry can not be null');
var order = entry.getOrder();
var index = this._orderToIndex(order);
this._entries.set(index, entry);
},
freeEntry:function(entry) {
var order = entry.getOrder();
var entries = this._entries;
var index = this._orderToIndex(order);
var indexSign = Math.sign(index);
var currentTopic = entry.getTopic();
var i = Math.abs(index) + 1;
while (currentTopic) {
var e = entries.get(i, indexSign);
if (core.Utils.isDefined(currentTopic) && !core.Utils.isDefined(e)) {
var entryOrder = this._indexToOrder(i * indexSign);
e = this.lookupEntryByOrder(entryOrder);
}
// Move the topic to the next entry ...
var topic = null;
if (core.Utils.isDefined(e)) {
topic = e.getTopic();
if (core.Utils.isDefined(currentTopic)) {
e.setTopic(currentTopic);
}
this.update(e);
}
currentTopic = topic;
i++;
}
// Clear the entry topic ...
entry.setTopic(null);
},
_orderToIndex:function(order) {
var index = Math.round(order / 2);
return ((order % 2) == 0) ? index : -index;
},
_indexToOrder:function(index) {
var order = Math.abs(index) * 2;
return (index >= 0) ? order : order - 1;
},
inspect:function() {
return this._entries.inspect();
}
currentTopic = topic;
i++;
}
// Clear the entry topic ...
entry.setTopic(null);
};
mindplot.VariableDistanceBoard.prototype._orderToIndex = function(order)
{
var index = Math.round(order / 2);
return ((order % 2) == 0) ? index : -index;
};
mindplot.VariableDistanceBoard.prototype._indexToOrder = function(index)
{
var order = Math.abs(index) * 2;
return (index >= 0)? order: order - 1;
};
mindplot.VariableDistanceBoard.prototype.inspect = function()
{
return this._entries.inspect();
};
});

View File

@@ -1,189 +1,165 @@
/*
* 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.
*/
* 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.Workspace = function(profile, screenManager, zoom)
{
// Create a suitable container ...
core.assert(screenManager, 'Div container can not be null');
this._zoom = zoom;
this._screenManager = screenManager;
this._screenWidth = profile.width;
this._screenHeight = profile.height;
mindplot.Workspace = new Class({
initialize: function(profile, screenManager, zoom) {
// Create a suitable container ...
core.assert(screenManager, 'Div container can not be null');
this._zoom = zoom;
this._screenManager = screenManager;
this._screenWidth = profile.width;
this._screenHeight = profile.height;
// Initalize web2d workspace.
var workspace = this._createWorkspace(profile);
this._workspace = workspace;
// Initalize web2d workspace.
var workspace = this._createWorkspace(profile);
this._workspace = workspace;
var screenContainer = screenManager.getContainer();
// Fix the height of the container ....
screenContainer.style.height = this._screenHeight + "px";
var screenContainer = screenManager.getContainer();
// Fix the height of the container ....
screenContainer.style.height = this._screenHeight + "px";
// Append to the workspace...
workspace.addItAsChildTo(screenContainer);
this.setZoom(zoom, true);
// Append to the workspace...
workspace.addItAsChildTo(screenContainer);
this.setZoom(zoom, true);
// Register drag events ...
this._registerDragEvents();
// Register drag events ...
this._registerDragEvents();
this._eventsEnabled = true;
this._eventsEnabled = true;
};
},
mindplot.Workspace.prototype._updateScreenManager = function()
{
var zoom = this._zoom;
this._screenManager.setScale(zoom);
_updateScreenManager: function() {
var zoom = this._zoom;
this._screenManager.setScale(zoom);
var coordOriginX = -((this._screenWidth * this._zoom) / 2);
var coordOriginY = -((this._screenHeight * this._zoom) / 2);
this._screenManager.setOffset(coordOriginX, coordOriginY);
};
var coordOriginX = -((this._screenWidth * this._zoom) / 2);
var coordOriginY = -((this._screenHeight * this._zoom) / 2);
this._screenManager.setOffset(coordOriginX, coordOriginY);
},
mindplot.Workspace.prototype._createWorkspace = function(profile)
{
// Initialize workspace ...
var coordOriginX = -(this._screenWidth / 2);
var coordOriginY = -(this._screenHeight / 2);
_createWorkspace: function(profile) {
// Initialize workspace ...
var coordOriginX = -(this._screenWidth / 2);
var coordOriginY = -(this._screenHeight / 2);
var workspaceProfile = {
width: this._screenWidth + "px",
height: this._screenHeight + "px",
coordSizeWidth:this._screenWidth,
coordSizeHeight:this._screenHeight,
coordOriginX:coordOriginX,
coordOriginY:coordOriginY,
fillColor:'transparent',
strokeWidth:0};
var workspaceProfile = {
width: this._screenWidth + "px",
height: this._screenHeight + "px",
coordSizeWidth:this._screenWidth,
coordSizeHeight:this._screenHeight,
coordOriginX:coordOriginX,
coordOriginY:coordOriginY,
fillColor:'transparent',
strokeWidth:0
};
web2d.peer.Toolkit.init();
return new web2d.Workspace(workspaceProfile);
},
web2d.peer.Toolkit.init();
return new web2d.Workspace(workspaceProfile);
};
appendChild: function(shape) {
if (core.Utils.isDefined(shape.addToWorkspace)) {
shape.addToWorkspace(this);
} else {
this._workspace.appendChild(shape);
}
},
mindplot.Workspace.prototype.appendChild = function(shape)
{
if (core.Utils.isDefined(shape.addToWorkspace))
{
shape.addToWorkspace(this);
} else
{
this._workspace.appendChild(shape);
}
};
removeChild: function(shape) {
// Element is a node, not a web2d element?
if (core.Utils.isDefined(shape.removeFromWorkspace)) {
shape.removeFromWorkspace(this);
} else {
this._workspace.removeChild(shape);
}
},
mindplot.Workspace.prototype.removeChild = function(shape)
{
// Element is a node, not a web2d element?
if (core.Utils.isDefined(shape.removeFromWorkspace))
{
shape.removeFromWorkspace(this);
} else
{
this._workspace.removeChild(shape);
}
};
addEventListener: function(type, listener) {
this._workspace.addEventListener(type, listener);
},
mindplot.Workspace.prototype.addEventListener = function(type, listener)
{
this._workspace.addEventListener(type, listener);
};
removeEventListener: function(type, listener) {
this._workspace.removeEventListener(type, listener);
},
mindplot.Workspace.prototype.removeEventListener = function(type, listener)
{
this._workspace.removeEventListener(type, listener);
};
getSize: function() {
return this._workspace.getCoordSize();
},
mindplot.Workspace.prototype.getSize = function()
{
return this._workspace.getCoordSize();
};
setZoom: function(zoom, center) {
this._zoom = zoom;
var workspace = this._workspace;
mindplot.Workspace.prototype.setZoom = function(zoom, center)
{
this._zoom = zoom;
var workspace = this._workspace;
// Update coord scale...
var coordWidth = zoom * this._screenWidth;
var coordHeight = zoom * this._screenHeight;
workspace.setCoordSize(coordWidth, coordHeight);
// Update coord scale...
var coordWidth = zoom * this._screenWidth;
var coordHeight = zoom * this._screenHeight;
workspace.setCoordSize(coordWidth, coordHeight);
// Center topic....
var coordOriginX;
var coordOriginY;
if (center) {
coordOriginX = -(coordWidth / 2);
coordOriginY = -(coordHeight / 2);
} else {
var coordOrigin = workspace.getCoordOrigin();
coordOriginX = coordOrigin.x;
coordOriginY = coordOrigin.y;
}
// Center topic....
var coordOriginX;
var coordOriginY;
if (center)
{
coordOriginX = -(coordWidth / 2);
coordOriginY = -(coordHeight / 2);
} else
{
var coordOrigin = workspace.getCoordOrigin();
coordOriginX = coordOrigin.x;
coordOriginY = coordOrigin.y;
}
workspace.setCoordOrigin(coordOriginX, coordOriginY);
workspace.setCoordOrigin(coordOriginX, coordOriginY);
// Update screen.
this._screenManager.setOffset(coordOriginX, coordOriginY);
this._screenManager.setScale(zoom);
},
// Update screen.
this._screenManager.setOffset(coordOriginX, coordOriginY);
this._screenManager.setScale(zoom);
};
getScreenManager: function() {
return this._screenManager;
},
mindplot.Workspace.prototype.getScreenManager = function()
{
return this._screenManager;
};
enableWorkspaceEvents: function(value) {
this._eventsEnabled = value;
},
isWorkspaceEventsEnabled: function() {
return this._eventsEnabled;
},
mindplot.Workspace.prototype.enableWorkspaceEvents = function(value)
{
this._eventsEnabled = value;
};
mindplot.Workspace.prototype.isWorkspaceEventsEnabled = function()
{
return this._eventsEnabled;
};
mindplot.Workspace.prototype.dumpNativeChart = function()
{
var workspace = this._workspace;
return workspace.dumpNativeChart();
};
mindplot.Workspace.prototype._registerDragEvents = function()
{
var workspace = this._workspace;
var screenManager = this._screenManager;
this._dragging = true;
var mWorkspace = this;
var mouseDownListener = function(event)
{
if (!core.Utils.isDefined(workspace.mouseMoveListener))
dumpNativeChart: function() {
var workspace = this._workspace;
return workspace.dumpNativeChart();
},
_registerDragEvents: function() {
var workspace = this._workspace;
var screenManager = this._screenManager;
this._dragging = true;
var mWorkspace = this;
var mouseDownListener = function(event)
{
if (mWorkspace.isWorkspaceEventsEnabled())
{
mWorkspace.enableWorkspaceEvents(false);
if (!core.Utils.isDefined(workspace.mouseMoveListener)) {
if (mWorkspace.isWorkspaceEventsEnabled()) {
mWorkspace.enableWorkspaceEvents(false);
var mouseDownPosition = screenManager.getWorkspaceMousePosition(event);
var originalCoordOrigin = workspace.getCoordOrigin();
var mouseDownPosition = screenManager.getWorkspaceMousePosition(event);
var originalCoordOrigin = workspace.getCoordOrigin();
workspace.mouseMoveListener = function(event)
{
workspace.mouseMoveListener = function(event) {
var currentMousePosition = screenManager.getWorkspaceMousePosition(event);
@@ -196,40 +172,37 @@ mindplot.Workspace.prototype._registerDragEvents = function()
workspace.setCoordOrigin(coordOriginX, coordOriginY);
// Change cursor.
if (core.UserAgent.isMozillaFamily())
{
if (core.UserAgent.isMozillaFamily()) {
window.document.body.style.cursor = "-moz-grabbing";
} else
{
} else {
window.document.body.style.cursor = "move";
}
event.preventDefault();
}.bindWithEvent(this);
screenManager.addEventListener('mousemove', workspace.mouseMoveListener);
event.preventDefault();
}.bindWithEvent(this);
screenManager.addEventListener('mousemove', workspace.mouseMoveListener);
// Register mouse up listeners ...
workspace.mouseUpListener = function(event)
{
// Register mouse up listeners ...
workspace.mouseUpListener = function(event) {
screenManager.removeEventListener('mousemove', workspace.mouseMoveListener);
screenManager.removeEventListener('mouseup', workspace.mouseUpListener);
workspace.mouseUpListener = null;
workspace.mouseMoveListener = null;
window.document.body.style.cursor = 'default';
screenManager.removeEventListener('mousemove', workspace.mouseMoveListener);
screenManager.removeEventListener('mouseup', workspace.mouseUpListener);
workspace.mouseUpListener = null;
workspace.mouseMoveListener = null;
window.document.body.style.cursor = 'default';
// Update screen manager offset.
var coordOrigin = workspace.getCoordOrigin();
screenManager.setOffset(coordOrigin.x, coordOrigin.y);
mWorkspace.enableWorkspaceEvents(true);
};
screenManager.addEventListener('mouseup', workspace.mouseUpListener);
// Update screen manager offset.
var coordOrigin = workspace.getCoordOrigin();
screenManager.setOffset(coordOrigin.x, coordOrigin.y);
mWorkspace.enableWorkspaceEvents(true);
},
screenManager.addEventListener('mouseup', workspace.mouseUpListener);
}
} else {
workspace.mouseUpListener();
}
} else
{
workspace.mouseUpListener();
}
};
};
screenManager.addEventListener('mousedown', mouseDownListener);
}
});
screenManager.addEventListener('mousedown', mouseDownListener);
};

View File

@@ -267,7 +267,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
id=parseInt(id);
}
if(this._idsMap.hasKey(id)){
if(this._idsMap.has(id)){
id=null;
}else{
this._idsMap.set(id,domElem);

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.AddIconToTopicCommand = mindplot.Command.extend(
mindplot.commands.AddIconToTopicCommand = new Class(
{
Extends:mindplot.Command,
initialize: function(topicId, iconType)
{
core.assert(topicId, 'topicId can not be null');

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.AddLinkToTopicCommand = mindplot.Command.extend(
mindplot.commands.AddLinkToTopicCommand =new Class(
{
Extends:mindplot.Command,
initialize: function(topicId,url)
{
core.assert(topicId, 'topicId can not be null');

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.AddNoteToTopicCommand = mindplot.Command.extend(
mindplot.commands.AddNoteToTopicCommand = new Class(
{
Extends:mindplot.Command,
initialize: function(topicId,text)
{
core.assert(topicId, 'topicId can not be null');

View File

@@ -15,8 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mindplot.commands.AddRelationshipCommand = mindplot.Command.extend(
mindplot.commands.AddRelationshipCommand = new Class(
{
Extends:mindplot.Command,
initialize: function(model, mindmap)
{
core.assert(model, 'Relationship model can not be null');

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.AddTopicCommand = mindplot.Command.extend(
mindplot.commands.AddTopicCommand = new Class(
{
Extends:mindplot.Command,
initialize: function(model, parentTopicId, animated)
{
core.assert(model, 'Model can not be null');

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.ChangeIconFromTopicCommand = mindplot.Command.extend(
mindplot.commands.ChangeIconFromTopicCommand = new Class(
{
Extends:mindplot.Command,
initialize: function(topicId, iconId, iconType)
{
core.assert(topicId, 'topicId can not be null');

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.DeleteTopicCommand = mindplot.Command.extend(
mindplot.commands.DeleteTopicCommand = new Class(
{
Extends:mindplot.Command,
initialize: function(topicsIds)
{
core.assert(topicsIds, "topicsIds must be defined");

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.DragTopicCommand = mindplot.Command.extend(
mindplot.commands.DragTopicCommand = new Class(
{
Extends:mindplot.Command,
initialize: function(topicId)
{
core.assert(topicId, "topicId must be defined");

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.GenericFunctionCommand = mindplot.Command.extend(
mindplot.commands.GenericFunctionCommand =new Class(
{
Extends:mindplot.Command,
initialize: function(commandFunc,value,topicsIds)
{
core.assert(commandFunc, "commandFunc must be defined");

View File

@@ -15,8 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mindplot.commands.MoveControlPointCommand = mindplot.Command.extend(
mindplot.commands.MoveControlPointCommand = new Class(
{
Extends:mindplot.Command,
initialize: function(ctrlPointController, point)
{
core.assert(ctrlPointController, 'line can not be null');

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.RemoveIconFromTopicCommand = mindplot.Command.extend(
mindplot.commands.RemoveIconFromTopicCommand = new Class(
{
Extends:mindplot.Command,
initialize: function(topicId, iconModel)
{
core.assert(topicId, 'topicId can not be null');

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.RemoveLinkFromTopicCommand = mindplot.Command.extend(
mindplot.commands.RemoveLinkFromTopicCommand =new Class(
{
Extends:mindplot.Command,
initialize: function(topicId)
{
core.assert(topicId, 'topicId can not be null');

View File

@@ -16,8 +16,9 @@
* limitations under the License.
*/
mindplot.commands.RemoveNoteFromTopicCommand = mindplot.Command.extend(
mindplot.commands.RemoveNoteFromTopicCommand = new Class(
{
Extends:mindplot.Command,
initialize: function(topicId)
{
core.assert(topicId, 'topicId can not be null');

View File

@@ -157,7 +157,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
node.setPosition(pos.clone(), false);
if(core.Utils.isDefined(this._modifiedTopics.set)){
var key = node.getId();
if(this._modifiedTopics.hasKey(key)){
if(this._modifiedTopics.has(key)){
nodePos = this._modifiedTopics.get(key).originalPos;
}
this._modifiedTopics.set(key,{originalPos:nodePos, newPos:pos});
@@ -186,7 +186,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
child.setPosition(childPos, false);
if(core.Utils.isDefined(modifiedTopics.set)){
var key = node.getId();
if(modifiedTopics.hasKey(key)){
if(modifiedTopics.has(key)){
oldPos = this._modifiedTopics.get(key).originalPos;
}
this._modifiedTopics.set(key,{originalPos:oldPos, newPos:childPos});
@@ -384,7 +384,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
}
if(core.Utils.isDefined(this._modifiedTopics.set)){
var key = node.getId();
if(this._modifiedTopics.hasKey(key)){
if(this._modifiedTopics.has(key)){
nodePos = this._modifiedTopics.get(key).originalPos;
}
this._modifiedTopics.set(key,{originalPos:nodePos, newPos:pos});
@@ -678,7 +678,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
},
_addToModifiedList:function(modifiedTopics, key, originalpos, newPos){
if(core.Utils.isDefined(modifiedTopics.set)){
if(modifiedTopics.hasKey(key)){
if(modifiedTopics.has(key)){
originalpos = modifiedTopics.get(key).originalPos;
}
modifiedTopics.set(key,{originalPos:originalpos, newPos:newPos});

View File

@@ -1,8 +1,27 @@
mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayoutManager.extend({
/*
* 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.layoutManagers.OriginalLayoutManager = new Class({
Extends:mindplot.layoutManagers.BaseLayoutManager,
options:{
},
initialize:function(designer, options){
initialize:function(designer, options) {
this.parent(designer, options);
this._dragTopicPositioner = new mindplot.DragTopicPositioner(this);
// Init dragger manager.
@@ -12,83 +31,72 @@ mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayo
// Add shapes to speed up the loading process ...
mindplot.DragTopic.initialize(workSpace);
},
prepareNode:function(node, children){
prepareNode:function(node, children) {
// Sort children by order to solve adding order in for OriginalLayoutManager...
var nodesByOrder = new Hash();
var maxOrder =0;
var maxOrder = 0;
var result = [];
if (children.length > 0)
{
for (var i = 0; i < children.length; i++)
{
if (children.length > 0) {
for (var i = 0; i < children.length; i++) {
var child = children[i];
var order = child.getOrder();
if (!core.Utils.isDefined(order))
{
if (!core.Utils.isDefined(order)) {
order = ++maxOrder;
child.setOrder(order);
}
if(nodesByOrder.hasKey(order)){
if(Math.sign(child.getPosition().x) == Math.sign(nodesByOrder.get(order).getPosition().x)){
if (nodesByOrder.has(order)) {
if (Math.sign(child.getPosition().x) == Math.sign(nodesByOrder.get(order).getPosition().x)) {
//duplicated order. Change order to next available.
order = ++maxOrder;
child.setOrder(order);
}
}else{
} else {
nodesByOrder.set(order, child);
if(order>maxOrder)
maxOrder=order;
if (order > maxOrder)
maxOrder = order;
}
result[order] = child;
}
}
nodesByOrder=null;
return node.getTopicType()!=mindplot.NodeModel.CENTRAL_TOPIC_TYPE?result:children;
nodesByOrder = null;
return node.getTopicType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE ? result : children;
},
_nodeResizeEvent:function(node){
_nodeResizeEvent:function(node) {
},
_nodeRepositionateEvent:function(node){
_nodeRepositionateEvent:function(node) {
this.getTopicBoardForTopic(node).repositionate();
},
getDragTopicPositioner : function()
{
getDragTopicPositioner : function() {
return this._dragTopicPositioner;
},
_buildDragManager: function(workspace)
{
_buildDragManager: function(workspace) {
// Init dragger manager.
var dragger = new mindplot.DragManager(workspace);
var topics = this.getDesigner()._getTopics();
var dragTopicPositioner = this.getDragTopicPositioner();
dragger.addEventListener('startdragging', function(event, node)
{
dragger.addEventListener('startdragging', function(event, node) {
// Enable all mouse events.
for (var i = 0; i < topics.length; i++)
{
for (var i = 0; i < topics.length; i++) {
topics[i].setMouseEventsEnabled(false);
}
});
dragger.addEventListener('dragging', function(event, dragTopic)
{
dragger.addEventListener('dragging', function(event, dragTopic) {
// Update the state and connections of the topic ...
dragTopicPositioner.positionateDragTopic(dragTopic);
});
dragger.addEventListener('enddragging', function(event, dragTopic)
{
dragger.addEventListener('enddragging', function(event, dragTopic) {
// Enable all mouse events.
for (var i = 0; i < topics.length; i++)
{
for (var i = 0; i < topics.length; i++) {
topics[i].setMouseEventsEnabled(true);
}
// Topic must be positioned in the real board postion.
if (dragTopic._isInTheWorkspace)
{
if (dragTopic._isInTheWorkspace) {
var draggedTopic = dragTopic.getDraggedTopic();
// Hide topic during draw ...
@@ -99,8 +107,7 @@ mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayo
// Make all node visible ...
draggedTopic.setVisibility(true);
if (parentNode != null)
{
if (parentNode != null) {
parentNode.setBranchVisibility(true);
}
}
@@ -108,18 +115,15 @@ mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayo
return dragger;
},
registerListenersOnNode : function(topic)
{
registerListenersOnNode : function(topic) {
// Register node listeners ...
var designer = this.getDesigner();
topic.addEventListener('onfocus', function(event)
{
topic.addEventListener('onfocus', function(event) {
designer.onObjectFocusEvent.attempt([topic, event], designer);
});
// Add drag behaviour ...
if (topic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
{
if (topic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
// Central Topic doesn't support to be dragged
var dragger = this._dragger;
@@ -127,21 +131,20 @@ mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayo
}
// Register editor events ...
if (!core.Utils.isDefined(this.getDesigner()._viewMode)|| (core.Utils.isDefined(this.getDesigner()._viewMode) && !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);
}
},
_createMainTopicBoard:function(node){
_createMainTopicBoard:function(node) {
return new mindplot.MainTopicBoard(node, this);
},
_createCentralTopicBoard:function(node){
return new mindplot.CentralTopicBoard(node,this);
_createCentralTopicBoard:function(node) {
return new mindplot.CentralTopicBoard(node, this);
},
getClassName:function(){
getClassName:function() {
return mindplot.layoutManagers.OriginalLayoutManager.NAME;
}
});
mindplot.layoutManagers.OriginalLayoutManager.NAME ="OriginalLayoutManager";
mindplot.layoutManagers.OriginalLayoutManager.NAME = "OriginalLayoutManager";

View File

@@ -185,7 +185,7 @@ mindplot.layoutManagers.boards.freeMindBoards.Board = mindplot.layoutManagers.bo
this._layoutManager._updateChildrenBoards(entry.getNode(), delta, modifiedTopics);
if(core.Utils.isDefined(modifiedTopics.set)){
var key = entry.getId();
if(modifiedTopics.hasKey(key)){
if(modifiedTopics.has(key)){
pos = modifiedTopics.get(key).originalPos;
}
modifiedTopics.set(key,{originalPos:pos, newPos:newPos});