- Add new assert syntax.

- Fix Icons size issues.
This commit is contained in:
Paulo Veiga 2011-07-27 14:33:02 -03:00
parent 0b67b42045
commit d06275f524
51 changed files with 231 additions and 210 deletions

View File

@ -33,7 +33,7 @@ core.Executor = new Class({
if(!isLoading){ if(!isLoading){
this._pendingFunctions.forEach(function(item){ this._pendingFunctions.forEach(function(item){
var result = item.fn.attempt(item.args, item.bind); var result = item.fn.attempt(item.args, item.bind);
core.assert(result!=false, "execution failed"); $assert(result!=false, "execution failed");
}); });
this._pendingFunctions=[]; this._pendingFunctions=[];
} }

View File

@ -18,8 +18,8 @@
core.Monitor = function(fadeElement, logContentElem) core.Monitor = function(fadeElement, logContentElem)
{ {
core.assert(fadeElement, "fadeElement can not be null"); $assert(fadeElement, "fadeElement can not be null");
core.assert(logContentElem, "logContentElem can not be null"); $assert(logContentElem, "logContentElem can not be null");
this.pendingMessages = []; this.pendingMessages = [];
this.inProgress = false; this.inProgress = false;

View File

@ -58,7 +58,7 @@ objects.extend = function(subClass, baseClass) {
subClass.superClass = baseClass.prototype; subClass.superClass = baseClass.prototype;
}; };
core.assert = function(assert, message) { $assert = function(assert, message) {
if (!assert) { if (!assert) {
var stack; var stack;
try { try {

View File

@ -18,7 +18,7 @@
mindplot.Board = new Class({ mindplot.Board = new Class({
initialize : function(defaultHeight, referencePoint) { initialize : function(defaultHeight, referencePoint) {
core.assert(referencePoint, "referencePoint can not be null"); $assert(referencePoint, "referencePoint can not be null");
this._defaultWidth = defaultHeight; this._defaultWidth = defaultHeight;
this._entries = new mindplot.BidirectionalArray(); this._entries = new mindplot.BidirectionalArray();
this._referencePoint = referencePoint; this._referencePoint = referencePoint;
@ -32,7 +32,7 @@ mindplot.Board = new Class({
var board = this._getBoard(position); var board = this._getBoard(position);
var entry = board.lookupEntryByOrder(order); var entry = board.lookupEntryByOrder(order);
core.assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order); $assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order);
entry.removeTopic(); entry.removeTopic();
board.update(entry); board.update(entry);
}, },
@ -66,9 +66,9 @@ mindplot.BidirectionalArray = new Class({
}, },
get :function(index, sign) { get :function(index, sign) {
core.assert($defined(index), 'Illegal argument, index must be passed.'); $assert($defined(index), 'Illegal argument, index must be passed.');
if ($defined(sign)) { if ($defined(sign)) {
core.assert(index >= 0, 'Illegal absIndex value'); $assert(index >= 0, 'Illegal absIndex value');
index = index * sign; index = index * sign;
} }
@ -82,14 +82,14 @@ mindplot.BidirectionalArray = new Class({
}, },
set : function(index, elem) { set : function(index, elem) {
core.assert($defined(index), 'Illegal index value'); $assert($defined(index), 'Illegal index value');
var array = (index >= 0) ? this._rightElem : this._leftElem; var array = (index >= 0) ? this._rightElem : this._leftElem;
array[Math.abs(index)] = elem; array[Math.abs(index)] = elem;
}, },
length : function(index) { length : function(index) {
core.assert($defined(index), 'Illegal index value'); $assert($defined(index), 'Illegal index value');
return (index >= 0) ? this._rightElem.length : this._leftElem.length; return (index >= 0) ? this._rightElem.length : this._leftElem.length;
}, },

View File

@ -19,7 +19,7 @@
mindplot.BoardEntry = new Class({ mindplot.BoardEntry = new Class({
initialize:function(lowerLimit, upperLimit, order) { initialize:function(lowerLimit, upperLimit, order) {
if ($defined(lowerLimit) && $defined(upperLimit)) { if ($defined(lowerLimit) && $defined(upperLimit)) {
core.assert(lowerLimit < upperLimit, 'lowerLimit can not be greater that upperLimit'); $assert(lowerLimit < upperLimit, 'lowerLimit can not be greater that upperLimit');
} }
this._upperLimit = upperLimit; this._upperLimit = upperLimit;
this._lowerLimit = lowerLimit; this._lowerLimit = lowerLimit;
@ -42,8 +42,8 @@ mindplot.BoardEntry = new Class({
}, },
setUpperLimit : function(value) { setUpperLimit : function(value) {
core.assert($defined(value), "upper limit can not be null"); $assert($defined(value), "upper limit can not be null");
core.assert(!isNaN(value), "illegal value"); $assert(!isNaN(value), "illegal value");
this._upperLimit = value; this._upperLimit = value;
}, },
@ -56,8 +56,8 @@ mindplot.BoardEntry = new Class({
}, },
setLowerLimit : function(value) { setLowerLimit : function(value) {
core.assert($defined(value), "upper limit can not be null"); $assert($defined(value), "upper limit can not be null");
core.assert(!isNaN(value), "illegal value"); $assert(!isNaN(value), "illegal value");
this._lowerLimit = value; this._lowerLimit = value;
}, },
@ -76,7 +76,7 @@ mindplot.BoardEntry = new Class({
removeTopic : function() { removeTopic : function() {
core.assert(!this.isAvailable(), "Entry doesn't have a topic."); $assert(!this.isAvailable(), "Entry doesn't have a topic.");
var topic = this.getTopic(); var topic = this.getTopic();
this.setTopic(null); this.setTopic(null);
topic.setOrder(null); topic.setOrder(null);

View File

@ -18,7 +18,7 @@
mindplot.CentralTopic = function(model) mindplot.CentralTopic = function(model)
{ {
core.assert(model, "Model can not be null"); $assert(model, "Model can not be null");
this.setModel(model); this.setModel(model);
mindplot.CentralTopic.superClass.initialize.call(this); mindplot.CentralTopic.superClass.initialize.call(this);
this.__onLoad = true; this.__onLoad = true;

View File

@ -31,8 +31,8 @@ mindplot.CentralTopicBoard = new Class({
}, },
positionateDragTopic : function(dragTopic) { positionateDragTopic : function(dragTopic) {
core.assert(dragTopic != null, 'dragTopic can not be null'); $assert(dragTopic != null, 'dragTopic can not be null');
core.assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance'); $assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance');
// This node is a main topic node. Position // This node is a main topic node. Position
var dragPos = dragTopic.getPosition(); var dragPos = dragTopic.getPosition();

View File

@ -18,9 +18,9 @@
mindplot.ConnectionLine = new Class({ mindplot.ConnectionLine = new Class({
initialize:function(sourceNode, targetNode, lineType) { initialize:function(sourceNode, targetNode, lineType) {
core.assert(targetNode, 'parentNode node can not be null'); $assert(targetNode, 'parentNode node can not be null');
core.assert(sourceNode, 'childNode node can not be null'); $assert(sourceNode, 'childNode node can not be null');
core.assert(sourceNode != targetNode, 'Cilcular connection'); $assert(sourceNode != targetNode, 'Cilcular connection');
this._targetTopic = targetNode; this._targetTopic = targetNode;
this._sourceTopic = sourceNode; this._sourceTopic = sourceNode;

View File

@ -24,7 +24,7 @@ mindplot.DesignerActionRunner = new Class({
}, },
execute:function(command) { execute:function(command) {
core.assert(command, "command can not be null"); $assert(command, "command can not be null");
// Execute action ... // Execute action ...
command.execute(this._context); command.execute(this._context);
@ -86,7 +86,7 @@ mindplot.CommandContext = new Class({
this._designer._removeNode(topic); this._designer._removeNode(topic);
}, },
createTopic:function(model, isVisible) { createTopic:function(model, isVisible) {
core.assert(model, "model can not be null"); $assert(model, "model can not be null");
var topic = this._designer._nodeModelToNodeGraph(model, isVisible); var topic = this._designer._nodeModelToNodeGraph(model, isVisible);
return topic; return topic;
@ -103,7 +103,7 @@ mindplot.CommandContext = new Class({
topic.disconnect(this._designer._workspace); topic.disconnect(this._designer._workspace);
}, },
createRelationship:function(model) { createRelationship:function(model) {
core.assert(model, "model cannot be null"); $assert(model, "model cannot be null");
var relationship = this._designer.createRelationship(model); var relationship = this._designer.createRelationship(model);
return relationship; return relationship;
}, },

View File

@ -24,7 +24,7 @@ mindplot.DesignerUndoManager = new Class({
}, },
enqueue:function(command) { enqueue:function(command) {
core.assert(command, "Command can not be null"); $assert(command, "Command can not be null");
var length = this._undoQueue.length; var length = this._undoQueue.length;
if (command.discartDuplicated && length > 0) { if (command.discartDuplicated && length > 0) {
// Skip duplicated events ... // Skip duplicated events ...

View File

@ -112,7 +112,7 @@ mindplot.DragManager.prototype._buildMouseUpListener = function(workspace, node,
var screen = workspace.getScreenManager(); var screen = workspace.getScreenManager();
var result = function(event) { var result = function(event) {
core.assert(dragNode.isDragTopic, 'dragNode must be an DragTopic'); $assert(dragNode.isDragTopic, 'dragNode must be an DragTopic');
// Remove drag node from the workspace. // Remove drag node from the workspace.
var hasBeenDragged = dragNode._isInTheWorkspace; var hasBeenDragged = dragNode._isInTheWorkspace;

View File

@ -53,7 +53,7 @@ mindplot.DragPivot = new Class({
_redraw : function(pivotPosition) { _redraw : function(pivotPosition) {
// Update line position. // Update line position.
core.assert(this.getTargetTopic(), 'Illegal invocation. Target node can not be null'); $assert(this.getTargetTopic(), 'Illegal invocation. Target node can not be null');
var pivotRect = this._getPivotRect(); var pivotRect = this._getPivotRect();
var currentPivotPosition = pivotRect.getPosition(); var currentPivotPosition = pivotRect.getPosition();
@ -187,9 +187,9 @@ mindplot.DragPivot = new Class({
}, },
connectTo : function(targetTopic) { connectTo : function(targetTopic) {
core.assert(!this._outgoingLine, 'Could not connect an already connected node'); $assert(!this._outgoingLine, 'Could not connect an already connected node');
core.assert(targetTopic != this, 'Cilcular connection are not allowed'); $assert(targetTopic != this, 'Cilcular connection are not allowed');
core.assert(targetTopic, 'parent can not be null'); $assert(targetTopic, 'parent can not be null');
this._targetTopic = targetTopic; this._targetTopic = targetTopic;
if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) { if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) {
@ -217,8 +217,8 @@ mindplot.DragPivot = new Class({
}, },
disconnect : function(workspace) { disconnect : function(workspace) {
core.assert(workspace, 'workspace can not be null.'); $assert(workspace, 'workspace can not be null.');
core.assert(this._targetTopic, 'There are not connected topic.'); $assert(this._targetTopic, 'There are not connected topic.');
this.setVisibility(false); this.setVisibility(false);
this._targetTopic = null; this._targetTopic = null;

View File

@ -18,8 +18,8 @@
mindplot.DragTopic = function(dragShape, draggedNode) mindplot.DragTopic = function(dragShape, draggedNode)
{ {
core.assert($defined(dragShape), 'Rect can not be null.'); $assert($defined(dragShape), 'Rect can not be null.');
core.assert($defined(draggedNode), 'draggedNode can not be null.'); $assert($defined(draggedNode), 'draggedNode can not be null.');
this._elem2d = dragShape; this._elem2d = dragShape;
this._order = null; this._order = null;
@ -68,7 +68,7 @@ mindplot.DragTopic.prototype.disconnect = function(workspace)
mindplot.DragTopic.prototype.canBeConnectedTo = function(targetTopic) mindplot.DragTopic.prototype.canBeConnectedTo = function(targetTopic)
{ {
core.assert($defined(targetTopic), 'parent can not be null'); $assert($defined(targetTopic), 'parent can not be null');
var result = true; var result = true;
if (!targetTopic.areChildrenShrinked() && !targetTopic.isCollapsed()) if (!targetTopic.areChildrenShrinked() && !targetTopic.isCollapsed())
@ -96,7 +96,7 @@ mindplot.DragTopic.prototype.canBeConnectedTo = function(targetTopic)
mindplot.DragTopic.prototype.connectTo = function(parent) mindplot.DragTopic.prototype.connectTo = function(parent)
{ {
core.assert(parent, 'Parent connection node can not be null.'); $assert(parent, 'Parent connection node can not be null.');
var dragPivot = this._getDragPivot(); var dragPivot = this._getDragPivot();
dragPivot.connectTo(parent); dragPivot.connectTo(parent);
@ -156,7 +156,7 @@ mindplot.DragTopic.prototype.isDragTopic = function()
mindplot.DragTopic.prototype.updateDraggedTopic = function(workspace) mindplot.DragTopic.prototype.updateDraggedTopic = function(workspace)
{ {
core.assert(workspace, 'workspace can not be null'); $assert(workspace, 'workspace can not be null');
var dragPivot = this._getDragPivot(); var dragPivot = this._getDragPivot();
var draggedTopic = this.getDraggedTopic(); var draggedTopic = this.getDraggedTopic();
@ -212,7 +212,7 @@ mindplot.DragTopic.prototype.updateDraggedTopic = function(workspace)
mindplot.DragTopic.prototype.setBoardPosition = function(point) mindplot.DragTopic.prototype.setBoardPosition = function(point)
{ {
core.assert(point, 'point can not be null'); $assert(point, 'point can not be null');
var dragPivot = this._getDragPivot(); var dragPivot = this._getDragPivot();
dragPivot.setPosition(point); dragPivot.setPosition(point);
}; };
@ -220,7 +220,7 @@ mindplot.DragTopic.prototype.setBoardPosition = function(point)
mindplot.DragTopic.prototype.getBoardPosition = function(point) mindplot.DragTopic.prototype.getBoardPosition = function(point)
{ {
core.assert(point, 'point can not be null'); $assert(point, 'point can not be null');
var dragPivot = this._getDragPivot(); var dragPivot = this._getDragPivot();
return dragPivot.getPosition(); return dragPivot.getPosition();
}; };

View File

@ -18,7 +18,7 @@
mindplot.DragTopicPositioner = new Class({ mindplot.DragTopicPositioner = new Class({
initialize:function(layoutManager) { initialize:function(layoutManager) {
core.assert(layoutManager, 'layoutManager can not be null'); $assert(layoutManager, 'layoutManager can not be null');
this._layoutManager = layoutManager; this._layoutManager = layoutManager;
this._topics = layoutManager.getDesigner()._getTopics(); this._topics = layoutManager.getDesigner()._getTopics();
this._workspace = layoutManager.getDesigner().getWorkSpace(); this._workspace = layoutManager.getDesigner().getWorkSpace();

View File

@ -214,7 +214,7 @@ mindplot.FixedDistanceBoard = new Class({
removeTopic : function(topic) { removeTopic : function(topic) {
var order = topic.getOrder(); var order = topic.getOrder();
var entry = this.lookupEntryByOrder(order); var entry = this.lookupEntryByOrder(order);
core.assert(!entry.isAvailable(), "Illegal state"); $assert(!entry.isAvailable(), "Illegal state");
entry.setTopic(null); entry.setTopic(null);
topic.setOrder(null); topic.setOrder(null);
@ -245,7 +245,7 @@ mindplot.FixedDistanceBoard = new Class({
}, },
lookupEntryByPosition : function(pos) { lookupEntryByPosition : function(pos) {
core.assert($defined(pos), 'position can not be null'); $assert($defined(pos), 'position can not be null');
var entries = this._entries; var entries = this._entries;
var result = null; var result = null;

View File

@ -18,8 +18,8 @@
mindplot.IconModel = function(iconType, topic) mindplot.IconModel = function(iconType, topic)
{ {
core.assert(iconType, 'Icon id can not be null'); $assert(iconType, 'Icon id can not be null');
core.assert(topic, 'topic can not be null'); $assert(topic, 'topic can not be null');
this._iconType = iconType; this._iconType = iconType;
this._id = mindplot.IconModel._nextUUID(); this._id = mindplot.IconModel._nextUUID();
this._topic = topic; this._topic = topic;

View File

@ -18,9 +18,9 @@
mindplot.ImageIcon = function(iconModel, topic, designer) { mindplot.ImageIcon = function(iconModel, topic, designer) {
core.assert(iconModel, 'iconModel can not be null'); $assert(iconModel, 'iconModel can not be null');
core.assert(topic, 'topic can not be null'); $assert(topic, 'topic can not be null');
core.assert(designer, 'designer can not be null'); $assert(designer, 'designer can not be null');
this._topic = topic; this._topic = topic;
this._iconModel = iconModel; this._iconModel = iconModel;
this._designer = designer; this._designer = designer;
@ -99,7 +99,7 @@ mindplot.ImageIcon.prototype.getModel = function() {
mindplot.ImageIcon.prototype._getNextFamilyIconId = function(iconId) { mindplot.ImageIcon.prototype._getNextFamilyIconId = function(iconId) {
var familyIcons = this._getFamilyIcons(iconId); var familyIcons = this._getFamilyIcons(iconId);
core.assert(familyIcons != null, "Family Icon not found!"); $assert(familyIcons != null, "Family Icon not found!");
var result = null; var result = null;
for (var i = 0; i < familyIcons.length && result == null; i++) for (var i = 0; i < familyIcons.length && result == null; i++)
@ -120,8 +120,8 @@ mindplot.ImageIcon.prototype._getNextFamilyIconId = function(iconId) {
}; };
mindplot.ImageIcon.prototype._getFamilyIcons = function(iconId) { mindplot.ImageIcon.prototype._getFamilyIcons = function(iconId) {
core.assert(iconId != null, "id must not be null"); $assert(iconId != null, "id must not be null");
core.assert(iconId.indexOf("_") != -1, "Invalid icon id (it must contain '_')"); $assert(iconId.indexOf("_") != -1, "Invalid icon id (it must contain '_')");
var result = null; var result = null;
for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i++) for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i++)

View File

@ -18,8 +18,8 @@
mindplot.LinkModel = function(url, topic) mindplot.LinkModel = function(url, topic)
{ {
core.assert(url, 'link url can not be null'); $assert(url, 'link url can not be null');
core.assert(topic, 'mindmap can not be null'); $assert(topic, 'mindmap can not be null');
this._url = url; this._url = url;
this._topic = topic; this._topic = topic;
}; };

View File

@ -18,7 +18,7 @@
mindplot.MainTopic = function(model) mindplot.MainTopic = function(model)
{ {
core.assert(model, "Model can not be null"); $assert(model, "Model can not be null");
this.setModel(model); this.setModel(model);
mindplot.MainTopic.superClass.initialize.call(this); mindplot.MainTopic.superClass.initialize.call(this);
}; };
@ -188,7 +188,7 @@ mindplot.MainTopic.prototype.setPosition = function(point, fireEvent)
mindplot.MainTopic.prototype.workoutIncomingConnectionPoint = function(sourcePosition) mindplot.MainTopic.prototype.workoutIncomingConnectionPoint = function(sourcePosition)
{ {
core.assert(sourcePosition, 'sourcePoint can not be null'); $assert(sourcePosition, 'sourcePoint can not be null');
var pos = this.getPosition(); var pos = this.getPosition();
var size = this.getSize(); var size = this.getSize();
@ -217,7 +217,7 @@ mindplot.MainTopic.prototype.workoutIncomingConnectionPoint = function(sourcePos
mindplot.MainTopic.prototype.workoutOutgoingConnectionPoint = function(targetPosition) mindplot.MainTopic.prototype.workoutOutgoingConnectionPoint = function(targetPosition)
{ {
core.assert(targetPosition, 'targetPoint can not be null'); $assert(targetPosition, 'targetPoint can not be null');
var pos = this.getPosition(); var pos = this.getPosition();
var size = this.getSize(); var size = this.getSize();

View File

@ -44,8 +44,8 @@ mindplot.MainTopicBoard = new Class({
}, },
positionateDragTopic : function(dragTopic) { positionateDragTopic : function(dragTopic) {
core.assert(dragTopic != null, 'dragTopic can not be null'); $assert(dragTopic != null, 'dragTopic can not be null');
core.assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance'); $assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance');
// This node is a main topic node. Position // This node is a main topic node. Position
var dragPos = dragTopic.getPosition(); var dragPos = dragTopic.getPosition();
@ -82,14 +82,14 @@ mindplot.MainTopicBoard = new Class({
* This x distance doesn't take into account the size of the shape. * This x distance doesn't take into account the size of the shape.
*/ */
_workoutXBorderDistance : function(topic) { _workoutXBorderDistance : function(topic) {
core.assert(topic, 'topic can not be null'); $assert(topic, 'topic can not be null');
var board = this._getBoard(); var board = this._getBoard();
return board.workoutXBorderDistance(topic); return board.workoutXBorderDistance(topic);
}, },
addBranch : function(topic) { addBranch : function(topic) {
var order = topic.getOrder(); var order = topic.getOrder();
core.assert($defined(order), "Order must be defined"); $assert($defined(order), "Order must be defined");
// If the entry is not available, I must swap the the entries... // If the entry is not available, I must swap the the entries...
var board = this._getBoard(); var board = this._getBoard();

View File

@ -52,12 +52,12 @@ mindplot.Mindmap = new Class({
}, },
addBranch : function(nodeModel) { addBranch : function(nodeModel) {
core.assert(nodeModel && nodeModel.isNodeModel(), 'Add node must be invoked with model objects'); $assert(nodeModel && nodeModel.isNodeModel(), 'Add node must be invoked with model objects');
if (this._branches.length == 0) { if (this._branches.length == 0) {
core.assert(nodeModel.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE, "First element must be the central topic"); $assert(nodeModel.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE, "First element must be the central topic");
nodeModel.setPosition(0, 0); nodeModel.setPosition(0, 0);
} else { } else {
core.assert(nodeModel.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE, "Mindmaps only have one cental topic"); $assert(nodeModel.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE, "Mindmaps only have one cental topic");
} }
this._branches.push(nodeModel); this._branches.push(nodeModel);
@ -74,7 +74,7 @@ mindplot.Mindmap = new Class({
connect : function(parent, child) { connect : function(parent, child) {
// Child already has a parent ? // Child already has a parent ?
var branches = this.getBranches(); var branches = this.getBranches();
core.assert(!child.getParent(), 'Child model seems to be already connected'); $assert(!child.getParent(), 'Child model seems to be already connected');
// Connect node... // Connect node...
parent._appendChild(child); parent._appendChild(child);
@ -85,8 +85,8 @@ mindplot.Mindmap = new Class({
disconnect : function(child) { disconnect : function(child) {
var parent = child.getParent(); var parent = child.getParent();
core.assert(child, 'Child can not be null.'); $assert(child, 'Child can not be null.');
core.assert(parent, 'Child model seems to be already connected'); $assert(parent, 'Child model seems to be already connected');
parent._removeChild(child); parent._removeChild(child);
@ -109,19 +109,19 @@ mindplot.Mindmap = new Class({
}, },
createNode : function(type, id) { createNode : function(type, id) {
core.assert(type, "node type can not be null"); $assert(type, "node type can not be null");
return this._createNode(type, id); return this._createNode(type, id);
}, },
_createNode : function(type, id) { _createNode : function(type, id) {
core.assert(type, 'Node type must be specified.'); $assert(type, 'Node type must be specified.');
var result = new mindplot.NodeModel(type, this, id); var result = new mindplot.NodeModel(type, this, id);
return result; return result;
}, },
createRelationship : function(fromNode, toNode) { createRelationship : function(fromNode, toNode) {
core.assert(fromNode, 'from node cannot be null'); $assert(fromNode, 'from node cannot be null');
core.assert(toNode, 'to node cannot be null'); $assert(toNode, 'to node cannot be null');
return new mindplot.RelationshipModel(fromNode, toNode); return new mindplot.RelationshipModel(fromNode, toNode);
}, },

View File

@ -18,7 +18,7 @@
mindplot.MindmapDesigner = function(profile, divElement) mindplot.MindmapDesigner = function(profile, divElement)
{ {
core.assert($defined(profile.zoom), "zoom must be defined"); $assert($defined(profile.zoom), "zoom must be defined");
// Undo manager ... // Undo manager ...
this._actionRunner = new mindplot.DesignerActionRunner(this); this._actionRunner = new mindplot.DesignerActionRunner(this);
@ -163,7 +163,7 @@ mindplot.MindmapDesigner.prototype._buildNodeGraph = function(model)
break; break;
} }
} }
core.assert(targetTopic, "Could not find a topic to connect"); $assert(targetTopic, "Could not find a topic to connect");
topic.connectTo(targetTopic, workspace); topic.connectTo(targetTopic, workspace);
} }
@ -375,8 +375,8 @@ mindplot.MindmapDesigner.prototype.save = function(onSavedHandler, saveHistory)
mindplot.MindmapDesigner.prototype.loadFromXML = function(mapId, xmlContent) mindplot.MindmapDesigner.prototype.loadFromXML = function(mapId, xmlContent)
{ {
core.assert(xmlContent, 'mindmapId can not be null'); $assert(xmlContent, 'mindmapId can not be null');
core.assert(xmlContent, 'xmlContent can not be null'); $assert(xmlContent, 'xmlContent can not be null');
// Explorer Hack with local files ... // Explorer Hack with local files ...
var domDocument = core.Utils.createDocumentFromText(xmlContent); var domDocument = core.Utils.createDocumentFromText(xmlContent);
@ -396,7 +396,7 @@ mindplot.MindmapDesigner.prototype.loadFromXML = function(mapId, xmlContent)
mindplot.MindmapDesigner.prototype.load = function(mapId) mindplot.MindmapDesigner.prototype.load = function(mapId)
{ {
core.assert(mapId, 'mapName can not be null'); $assert(mapId, 'mapName can not be null');
// Build load function ... // Build load function ...
var persistantManager = mindplot.PersistanceManager; var persistantManager = mindplot.PersistanceManager;
@ -464,7 +464,7 @@ mindplot.MindmapDesigner.prototype.redo = function()
mindplot.MindmapDesigner.prototype._nodeModelToNodeGraph = function(nodeModel, isVisible) mindplot.MindmapDesigner.prototype._nodeModelToNodeGraph = function(nodeModel, isVisible)
{ {
core.assert(nodeModel, "Node model can not be null"); $assert(nodeModel, "Node model can not be null");
var nodeGraph = this._buildNodeGraph(nodeModel); var nodeGraph = this._buildNodeGraph(nodeModel);
if($defined(isVisible)) if($defined(isVisible))
@ -487,7 +487,7 @@ mindplot.MindmapDesigner.prototype._nodeModelToNodeGraph = function(nodeModel, i
}; };
mindplot.MindmapDesigner.prototype._relationshipModelToRelationship = function(model) { mindplot.MindmapDesigner.prototype._relationshipModelToRelationship = function(model) {
core.assert(model, "Node model can not be null"); $assert(model, "Node model can not be null");
var relationship = this._buildRelationship(model); var relationship = this._buildRelationship(model);
var sourceTopic = relationship.getSourceTopic(); var sourceTopic = relationship.getSourceTopic();
sourceTopic.addRelationship(relationship); sourceTopic.addRelationship(relationship);

View File

@ -47,7 +47,7 @@ mindplot.NodeGraph.prototype._set2DElement = function(elem2d)
mindplot.NodeGraph.prototype.get2DElement = function() mindplot.NodeGraph.prototype.get2DElement = function()
{ {
core.assert(this._elem2d, 'NodeGraph has not been initialized propertly'); $assert(this._elem2d, 'NodeGraph has not been initialized propertly');
return this._elem2d; return this._elem2d;
}; };
@ -92,10 +92,10 @@ mindplot.NodeGraph.prototype.setSize = function(size)
mindplot.NodeGraph.create = function(nodeModel) mindplot.NodeGraph.create = function(nodeModel)
{ {
core.assert(nodeModel, 'Model can not be null'); $assert(nodeModel, 'Model can not be null');
var type = nodeModel.getType(); var type = nodeModel.getType();
core.assert(type, 'Node model type can not be null'); $assert(type, 'Node model type can not be null');
var result; var result;
if (type == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) if (type == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
@ -115,13 +115,13 @@ mindplot.NodeGraph.create = function(nodeModel)
mindplot.NodeGraph.prototype.getModel = function() mindplot.NodeGraph.prototype.getModel = function()
{ {
core.assert(this._model, 'Model has not been initialized yet'); $assert(this._model, 'Model has not been initialized yet');
return this._model; return this._model;
}; };
mindplot.NodeGraph.prototype.setModel = function(model) mindplot.NodeGraph.prototype.setModel = function(model)
{ {
core.assert(model, 'Model can not be null'); $assert(model, 'Model can not be null');
this._model = model; this._model = model;
}; };
@ -167,7 +167,7 @@ mindplot.NodeGraph.prototype.createDragNode = function()
mindplot.NodeGraph.prototype._buildDragShape = function() mindplot.NodeGraph.prototype._buildDragShape = function()
{ {
core.assert(false, '_buildDragShape must be implemented by all nodes.'); $assert(false, '_buildDragShape must be implemented by all nodes.');
}; };
mindplot.NodeGraph.prototype.getPosition = function() mindplot.NodeGraph.prototype.getPosition = function()

View File

@ -18,8 +18,8 @@
mindplot.NodeModel = new Class({ mindplot.NodeModel = new Class({
initialize:function(type, mindmap, id) { initialize:function(type, mindmap, id) {
core.assert(type, 'Node type can not be null'); $assert(type, 'Node type can not be null');
core.assert(mindmap, 'mindmap can not be null'); $assert(mindmap, 'mindmap can not be null');
this._order = null; this._order = null;
this._type = type; this._type = type;
@ -122,47 +122,47 @@ mindplot.NodeModel = new Class({
}, },
createLink : function(url) { createLink : function(url) {
core.assert(url, 'Link URL must be specified.'); $assert(url, 'Link URL must be specified.');
return new mindplot.LinkModel(url, this); return new mindplot.LinkModel(url, this);
}, },
addLink : function(link) { addLink : function(link) {
core.assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links'); $assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links');
this._links.push(link); this._links.push(link);
}, },
_removeLink : function(link) { _removeLink : function(link) {
core.assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links'); $assert(link && link.isLinkModel(), 'Only LinkModel can be appended to Mindmap object as links');
this._links.erase(link); this._links.erase(link);
}, },
createNote : function(text) { createNote : function(text) {
core.assert(text != null, 'note text must be specified.'); $assert(text != null, 'note text must be specified.');
return new mindplot.NoteModel(text, this); return new mindplot.NoteModel(text, this);
}, },
addNote : function(note) { addNote : function(note) {
core.assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links'); $assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links');
this._notes.push(note); this._notes.push(note);
}, },
_removeNote : function(note) { _removeNote : function(note) {
core.assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links'); $assert(note && note.isNoteModel(), 'Only NoteModel can be appended to Mindmap object as links');
this._notes.erase(note); this._notes.erase(note);
}, },
createIcon : function(iconType) { createIcon : function(iconType) {
core.assert(iconType, 'IconType must be specified.'); $assert(iconType, 'IconType must be specified.');
return new mindplot.IconModel(iconType, this); return new mindplot.IconModel(iconType, this);
}, },
addIcon : function(icon) { addIcon : function(icon) {
core.assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons'); $assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
this._icons.push(icon); this._icons.push(icon);
}, },
_removeIcon : function(icon) { _removeIcon : function(icon) {
core.assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons'); $assert(icon && icon.isIconModel(), 'Only IconModel can be appended to Mindmap object as icons');
this._icons.erase(icon); this._icons.erase(icon);
}, },
@ -171,20 +171,20 @@ mindplot.NodeModel = new Class({
}, },
_appendChild : function(child) { _appendChild : function(child) {
core.assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object'); $assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object');
this._children.push(child); this._children.push(child);
child._parent = this; child._parent = this;
}, },
_removeChild : function(child) { _removeChild : function(child) {
core.assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object.'); $assert(child && child.isNodeModel(), 'Only NodeModel can be appended to Mindmap object.');
this._children.erase(child); this._children.erase(child);
child._parent = null; child._parent = null;
}, },
setPosition : function(x, y) { setPosition : function(x, y) {
core.assert($defined(x), "x coordinate must be defined"); $assert($defined(x), "x coordinate must be defined");
core.assert($defined(y), "y coordinate must be defined"); $assert($defined(y), "y coordinate must be defined");
if (!$defined(this._position)) { if (!$defined(this._position)) {
this._position = new core.Point(); this._position = new core.Point();
@ -198,8 +198,8 @@ mindplot.NodeModel = new Class({
}, },
setFinalPosition : function(x, y) { setFinalPosition : function(x, y) {
core.assert($defined(x), "x coordinate must be defined"); $assert($defined(x), "x coordinate must be defined");
core.assert($defined(y), "y coordinate must be defined"); $assert($defined(y), "y coordinate must be defined");
if (!$defined(this._finalPosition)) { if (!$defined(this._finalPosition)) {
this._finalPosition = new core.Point(); this._finalPosition = new core.Point();
@ -246,14 +246,14 @@ mindplot.NodeModel = new Class({
}, },
setParent : function(parent) { setParent : function(parent) {
core.assert(parent != this, 'The same node can not be parent and child if itself.'); $assert(parent != this, 'The same node can not be parent and child if itself.');
this._parent = parent; this._parent = parent;
}, },
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) { canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) {
core.assert(sourceModel != this, 'The same node can not be parent and child if itself.'); $assert(sourceModel != this, 'The same node can not be parent and child if itself.');
core.assert(sourcePosition, 'childPosition can not be null.'); $assert(sourcePosition, 'childPosition can not be null.');
core.assert($defined(targetTopicHeight), 'childrenWidth can not be null.'); $assert($defined(targetTopicHeight), 'childrenWidth can not be null.');
// Only can be connected if the node is in the left or rigth. // Only can be connected if the node is in the left or rigth.
var targetModel = this; var targetModel = this;

View File

@ -18,8 +18,8 @@
mindplot.NoteModel = new Class({ mindplot.NoteModel = new Class({
initialize : function(text, topic) { initialize : function(text, topic) {
core.assert(text != null, 'note text can not be null'); $assert(text != null, 'note text can not be null');
core.assert(topic, 'mindmap can not be null'); $assert(topic, 'mindmap can not be null');
this._text = text; this._text = text;
this._topic = topic; this._topic = topic;
}, },

View File

@ -20,8 +20,8 @@ mindplot.PersistanceManager = {};
mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHandler,saveHistory) mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHandler,saveHistory)
{ {
core.assert(mindmap, "mindmap can not be null"); $assert(mindmap, "mindmap can not be null");
core.assert(editorProperties, "editorProperties can not be null"); $assert(editorProperties, "editorProperties can not be null");
var mapId = mindmap.getId(); var mapId = mindmap.getId();
@ -60,7 +60,7 @@ mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHa
mindplot.PersistanceManager.load = function(mapId) mindplot.PersistanceManager.load = function(mapId)
{ {
core.assert(mapId, "mapId can not be null"); $assert(mapId, "mapId can not be null");
var result = {r:null}; var result = {r:null};
window.MapEditorService.loadMap(mapId, { window.MapEditorService.loadMap(mapId, {

View File

@ -17,8 +17,8 @@
*/ */
mindplot.RelationshipModel = function(fromNode, toNode) mindplot.RelationshipModel = function(fromNode, toNode)
{ {
core.assert(fromNode, 'from node type can not be null'); $assert(fromNode, 'from node type can not be null');
core.assert(toNode, 'to node type can not be null'); $assert(toNode, 'to node type can not be null');
this._id = mindplot.RelationshipModel._nextUUID(); this._id = mindplot.RelationshipModel._nextUUID();
this._fromNode = fromNode; this._fromNode = fromNode;

View File

@ -24,7 +24,7 @@ mindplot.ScreenManager = function(width, height, divElement)
mindplot.ScreenManager.prototype.setScale = function(scale) mindplot.ScreenManager.prototype.setScale = function(scale)
{ {
core.assert($defined(scale), 'Screen scale can not be null'); $assert($defined(scale), 'Screen scale can not be null');
this._workspaceScale = scale; this._workspaceScale = scale;
}; };

View File

@ -223,7 +223,7 @@ mindplot.Topic.prototype.buildShape = function(attributes, type)
} }
else else
{ {
core.assert(false, "Unsupported figure type:" + type); $assert(false, "Unsupported figure type:" + type);
} }
result.setPosition(0, 0); result.setPosition(0, 0);
@ -1100,7 +1100,7 @@ mindplot.Topic.prototype.invariant = function()
// Check consitency... // Check consitency...
if ((isConnected && !line) || (!isConnected && line)) if ((isConnected && !line) || (!isConnected && line))
{ {
// core.assert(false,'Illegal state exception.'); // $assert(false,'Illegal state exception.');
} }
}; };
@ -1151,8 +1151,8 @@ mindplot.Topic.prototype.removeEventListener = function(type, listener)
mindplot.Topic.prototype._setSize = function(size) mindplot.Topic.prototype._setSize = function(size)
{ {
core.assert(size, "size can not be null"); $assert(size, "size can not be null");
core.assert($defined(size.width), "size seem not to be a valid element"); $assert($defined(size.width), "size seem not to be a valid element");
mindplot.Topic.superClass.setSize.call(this, size); mindplot.Topic.superClass.setSize.call(this, size);
@ -1180,7 +1180,7 @@ mindplot.Topic.prototype.setSize = function(size, force, updatePosition)
}; };
mindplot.Topic.prototype._updatePositionOnChangeSize = function(oldSize, newSize, updatePosition) { mindplot.Topic.prototype._updatePositionOnChangeSize = function(oldSize, newSize, updatePosition) {
core.assert(false, "this method must be overided"); $assert(false, "this method must be overided");
}; };
mindplot.Topic.prototype.disconnect = function(workspace) mindplot.Topic.prototype.disconnect = function(workspace)
@ -1188,7 +1188,7 @@ mindplot.Topic.prototype.disconnect = function(workspace)
var outgoingLine = this.getOutgoingLine(); var outgoingLine = this.getOutgoingLine();
if ($defined(outgoingLine)) if ($defined(outgoingLine))
{ {
core.assert(workspace, 'workspace can not be null'); $assert(workspace, 'workspace can not be null');
this._outgoingLine = null; this._outgoingLine = null;
@ -1245,10 +1245,10 @@ mindplot.Topic.prototype.setOrder = function(value)
mindplot.Topic.prototype.connectTo = function(targetTopic, workspace, isVisible) mindplot.Topic.prototype.connectTo = function(targetTopic, workspace, isVisible)
{ {
core.assert(!this._outgoingLine, 'Could not connect an already connected node'); $assert(!this._outgoingLine, 'Could not connect an already connected node');
core.assert(targetTopic != this, 'Cilcular connection are not allowed'); $assert(targetTopic != this, 'Cilcular connection are not allowed');
core.assert(targetTopic, 'Parent Graph can not be null'); $assert(targetTopic, 'Parent Graph can not be null');
core.assert(workspace, 'Workspace can not be null'); $assert(workspace, 'Workspace can not be null');
// Connect Graphical Nodes ... // Connect Graphical Nodes ...
targetTopic._appendChild(this); targetTopic._appendChild(this);

View File

@ -27,7 +27,7 @@ mindplot.TopicBoard = new Class({
var board = this._getBoard(position); var board = this._getBoard(position);
var entry = board.lookupEntryByOrder(order); var entry = board.lookupEntryByOrder(order);
core.assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order); $assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order);
entry.removeTopic(); entry.removeTopic();
board.update(entry); board.update(entry);
}, },

View File

@ -103,7 +103,7 @@ mindplot.VariableDistanceBoard = new Class({
}, },
lookupEntryByPosition:function(pos) { lookupEntryByPosition:function(pos) {
core.assert($defined(pos), 'position can not be null'); $assert($defined(pos), 'position can not be null');
var entries = this._entries; var entries = this._entries;
var zeroEntry = entries.get(0); var zeroEntry = entries.get(0);
if (zeroEntry.isCoordinateIn(pos.y)) { if (zeroEntry.isCoordinateIn(pos.y)) {
@ -156,7 +156,7 @@ mindplot.VariableDistanceBoard = new Class({
}, },
update:function(entry) { update:function(entry) {
core.assert(entry, 'Entry can not be null'); $assert(entry, 'Entry can not be null');
var order = entry.getOrder(); var order = entry.getOrder();
var index = this._orderToIndex(order); var index = this._orderToIndex(order);

View File

@ -19,7 +19,7 @@
mindplot.Workspace = new Class({ mindplot.Workspace = new Class({
initialize: function(profile, screenManager, zoom) { initialize: function(profile, screenManager, zoom) {
// Create a suitable container ... // Create a suitable container ...
core.assert(screenManager, 'Div container can not be null'); $assert(screenManager, 'Div container can not be null');
this._zoom = zoom; this._zoom = zoom;
this._screenManager = screenManager; this._screenManager = screenManager;
this._screenWidth = profile.width; this._screenWidth = profile.width;

View File

@ -21,7 +21,7 @@ mindplot.XMLMindmapSerializer_Beta = function()
mindplot.XMLMindmapSerializer_Beta.prototype.toXML = function(mindmap) mindplot.XMLMindmapSerializer_Beta.prototype.toXML = function(mindmap)
{ {
core.assert(mindmap, "Can not save a null mindmap"); $assert(mindmap, "Can not save a null mindmap");
var document = core.Utils.createDocument(); var document = core.Utils.createDocument();
@ -179,11 +179,11 @@ mindplot.XMLMindmapSerializer_Beta.prototype._noteToXML = function(document, not
mindplot.XMLMindmapSerializer_Beta.prototype.loadFromDom = function(dom) mindplot.XMLMindmapSerializer_Beta.prototype.loadFromDom = function(dom)
{ {
core.assert(dom, "Dom can not be null"); $assert(dom, "Dom can not be null");
var rootElem = dom.documentElement; var rootElem = dom.documentElement;
// Is a wisemap?. // Is a wisemap?.
core.assert(rootElem.tagName == mindplot.XMLMindmapSerializer_Beta.MAP_ROOT_NODE, "This seem not to be a map document."); $assert(rootElem.tagName == mindplot.XMLMindmapSerializer_Beta.MAP_ROOT_NODE, "This seem not to be a map document.");
// Start the loading process ... // Start the loading process ...
var mindmap = new mindplot.Mindmap(); var mindmap = new mindplot.Mindmap();
@ -281,7 +281,7 @@ mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem
var child = children[i]; var child = children[i];
if (child.nodeType == 1) if (child.nodeType == 1)
{ {
core.assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note", 'Illegal node type:' + child.tagName); $assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note", 'Illegal node type:' + child.tagName);
if (child.tagName == "topic") { if (child.tagName == "topic") {
var childTopic = this._deserializeNode(child, mindmap); var childTopic = this._deserializeNode(child, mindmap);
childTopic.connectTo(topic); childTopic.connectTo(topic);

View File

@ -23,7 +23,7 @@ mindplot.XMLMindmapSerializer_Pela = function()
mindplot.XMLMindmapSerializer_Pela.prototype.toXML = function(mindmap) mindplot.XMLMindmapSerializer_Pela.prototype.toXML = function(mindmap)
{ {
core.assert(mindmap, "Can not save a null mindmap"); $assert(mindmap, "Can not save a null mindmap");
var document = core.Utils.createDocument(); var document = core.Utils.createDocument();
@ -222,11 +222,11 @@ mindplot.XMLMindmapSerializer_Pela.prototype._relationshipToXML = function(docum
mindplot.XMLMindmapSerializer_Pela.prototype.loadFromDom = function(dom) mindplot.XMLMindmapSerializer_Pela.prototype.loadFromDom = function(dom)
{ {
core.assert(dom, "Dom can not be null"); $assert(dom, "Dom can not be null");
var rootElem = dom.documentElement; var rootElem = dom.documentElement;
// Is a wisemap?. // Is a wisemap?.
core.assert(rootElem.tagName == mindplot.XMLMindmapSerializer_Pela.MAP_ROOT_NODE, "This seem not to be a map document."); $assert(rootElem.tagName == mindplot.XMLMindmapSerializer_Pela.MAP_ROOT_NODE, "This seem not to be a map document.");
this._idsMap = new Hash(); this._idsMap = new Hash();
// Start the loading process ... // Start the loading process ...
@ -350,7 +350,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
var child = children[i]; var child = children[i];
if (child.nodeType == 1) if (child.nodeType == 1)
{ {
core.assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note", 'Illegal node type:' + child.tagName); $assert(child.tagName == "topic" || child.tagName == "icon" || child.tagName == "link" || child.tagName == "note", 'Illegal node type:' + child.tagName);
if (child.tagName == "topic") { if (child.tagName == "topic") {
var childTopic = this._deserializeNode(child, mindmap); var childTopic = this._deserializeNode(child, mindmap);
childTopic.connectTo(topic); childTopic.connectTo(topic);

View File

@ -21,8 +21,8 @@ mindplot.commands.AddIconToTopicCommand = new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId, iconType) initialize: function(topicId, iconType)
{ {
core.assert(topicId, 'topicId can not be null'); $assert(topicId, 'topicId can not be null');
core.assert(iconType, 'iconType can not be null'); $assert(iconType, 'iconType can not be null');
this._selectedObjectsIds = topicId; this._selectedObjectsIds = topicId;
this._iconType = iconType; this._iconType = iconType;
}, },

View File

@ -21,7 +21,7 @@ mindplot.commands.AddLinkToTopicCommand =new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId,url) initialize: function(topicId,url)
{ {
core.assert(topicId, 'topicId can not be null'); $assert(topicId, 'topicId can not be null');
this._selectedObjectsIds = topicId; this._selectedObjectsIds = topicId;
this._url = url; this._url = url;
this._id = mindplot.Command._nextUUID(); this._id = mindplot.Command._nextUUID();

View File

@ -21,7 +21,7 @@ mindplot.commands.AddNoteToTopicCommand = new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId,text) initialize: function(topicId,text)
{ {
core.assert(topicId, 'topicId can not be null'); $assert(topicId, 'topicId can not be null');
this._selectedObjectsIds = topicId; this._selectedObjectsIds = topicId;
this._text = text; this._text = text;
this._id = mindplot.Command._nextUUID(); this._id = mindplot.Command._nextUUID();

View File

@ -20,7 +20,7 @@ mindplot.commands.AddRelationshipCommand = new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(model, mindmap) initialize: function(model, mindmap)
{ {
core.assert(model, 'Relationship model can not be null'); $assert(model, 'Relationship model can not be null');
this._model = model; this._model = model;
this._mindmap = mindmap; this._mindmap = mindmap;
this._id = mindplot.Command._nextUUID(); this._id = mindplot.Command._nextUUID();

View File

@ -21,7 +21,7 @@ mindplot.commands.AddTopicCommand = new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(model, parentTopicId, animated) initialize: function(model, parentTopicId, animated)
{ {
core.assert(model, 'Model can not be null'); $assert(model, 'Model can not be null');
this._model = model; this._model = model;
this._parentId = parentTopicId; this._parentId = parentTopicId;
this._id = mindplot.Command._nextUUID(); this._id = mindplot.Command._nextUUID();

View File

@ -21,9 +21,9 @@ mindplot.commands.ChangeIconFromTopicCommand = new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId, iconId, iconType) initialize: function(topicId, iconId, iconType)
{ {
core.assert(topicId, 'topicId can not be null'); $assert(topicId, 'topicId can not be null');
core.assert(iconId, 'iconId can not be null'); $assert(iconId, 'iconId can not be null');
core.assert(iconType, 'iconType can not be null'); $assert(iconType, 'iconType can not be null');
this._selectedObjectsIds = topicId; this._selectedObjectsIds = topicId;
this._iconModel = iconId; this._iconModel = iconId;
this._iconType = iconType; this._iconType = iconType;

View File

@ -21,7 +21,7 @@ mindplot.commands.DeleteTopicCommand = new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicsIds) initialize: function(topicsIds)
{ {
core.assert(topicsIds, "topicsIds must be defined"); $assert(topicsIds, "topicsIds must be defined");
this._selectedObjectsIds = topicsIds; this._selectedObjectsIds = topicsIds;
this._deletedTopicModels = []; this._deletedTopicModels = [];
this._parentTopicIds = []; this._parentTopicIds = [];

View File

@ -21,7 +21,7 @@ mindplot.commands.DragTopicCommand = new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId) initialize: function(topicId)
{ {
core.assert(topicId, "topicId must be defined"); $assert(topicId, "topicId must be defined");
this._selectedObjectsIds = topicId; this._selectedObjectsIds = topicId;
this._parentTopic = null; this._parentTopic = null;
this._position = null; this._position = null;
@ -64,7 +64,7 @@ mindplot.commands.DragTopicCommand = new Class(
} else } else
{ {
core.assert("Illegal commnad state exception."); $assert("Illegal commnad state exception.");
} }
this._order = origOrder; this._order = origOrder;
this._position = origPosition; this._position = origPosition;

View File

@ -21,8 +21,8 @@ mindplot.commands.GenericFunctionCommand =new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(commandFunc,value,topicsIds) initialize: function(commandFunc,value,topicsIds)
{ {
core.assert(commandFunc, "commandFunc must be defined"); $assert(commandFunc, "commandFunc must be defined");
core.assert(topicsIds, "topicsIds must be defined"); $assert(topicsIds, "topicsIds must be defined");
this._value = value; this._value = value;
this._selectedObjectsIds = topicsIds; this._selectedObjectsIds = topicsIds;
this._commandFunc = commandFunc; this._commandFunc = commandFunc;

View File

@ -20,7 +20,7 @@ mindplot.commands.MoveControlPointCommand = new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(ctrlPointController, point) initialize: function(ctrlPointController, point)
{ {
core.assert(ctrlPointController, 'line can not be null'); $assert(ctrlPointController, 'line can not be null');
this._ctrlPointControler = ctrlPointController; this._ctrlPointControler = ctrlPointController;
this._line = ctrlPointController._line; this._line = ctrlPointController._line;
var model = this._line.getModel(); var model = this._line.getModel();

View File

@ -21,8 +21,8 @@ mindplot.commands.RemoveIconFromTopicCommand = new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId, iconModel) initialize: function(topicId, iconModel)
{ {
core.assert(topicId, 'topicId can not be null'); $assert(topicId, 'topicId can not be null');
core.assert(iconModel, 'iconId can not be null'); $assert(iconModel, 'iconId can not be null');
this._selectedObjectsIds = topicId; this._selectedObjectsIds = topicId;
this._iconModel = iconModel; this._iconModel = iconModel;
}, },

View File

@ -21,7 +21,7 @@ mindplot.commands.RemoveLinkFromTopicCommand =new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId) initialize: function(topicId)
{ {
core.assert(topicId, 'topicId can not be null'); $assert(topicId, 'topicId can not be null');
this._selectedObjectsIds = topicId; this._selectedObjectsIds = topicId;
}, },
execute: function(commandContext) execute: function(commandContext)

View File

@ -21,7 +21,7 @@ mindplot.commands.RemoveNoteFromTopicCommand = new Class(
Extends:mindplot.Command, Extends:mindplot.Command,
initialize: function(topicId) initialize: function(topicId)
{ {
core.assert(topicId, 'topicId can not be null'); $assert(topicId, 'topicId can not be null');
this._selectedObjectsIds = topicId; this._selectedObjectsIds = topicId;
}, },
execute: function(commandContext) execute: function(commandContext)

View File

@ -14,16 +14,16 @@ mindplot.layoutManagers.boards.Board = new Class({
return mindplot.layoutManagers.boards.Board.NAME; return mindplot.layoutManagers.boards.Board.NAME;
}, },
removeTopicFromBoard:function(node, modifiedTopics){ removeTopicFromBoard:function(node, modifiedTopics){
core.assert(false, "no Board implementation found!"); $assert(false, "no Board implementation found!");
}, },
addBranch:function(node, modifiedTopics){ addBranch:function(node, modifiedTopics){
core.assert(false, "no Board implementation found!"); $assert(false, "no Board implementation found!");
}, },
updateChildrenPosition:function(node, modifiedTopics){ updateChildrenPosition:function(node, modifiedTopics){
core.assert(false, "no Board implementation found!"); $assert(false, "no Board implementation found!");
}, },
setNodeMarginTop:function(node, delta){ setNodeMarginTop:function(node, delta){
core.assert(false, "no Board implementation found!"); $assert(false, "no Board implementation found!");
}, },
getNode:function(){ getNode:function(){
return this._node; return this._node;

View File

@ -9,17 +9,17 @@ mindplot.layoutManagers.boards.freeMindBoards.Board = mindplot.layoutManagers.bo
this._positionTables = this._createTables(); this._positionTables = this._createTables();
}, },
_createTables:function(){ _createTables:function(){
core.assert(false, "no Board implementation found!") $assert(false, "no Board implementation found!")
}, },
_getTableForNode:function(node, position){ _getTableForNode:function(node, position){
core.assert(false, "no Board implementation found!") $assert(false, "no Board implementation found!")
}, },
removeTopicFromBoard:function(node, modifiedTopics){ removeTopicFromBoard:function(node, modifiedTopics){
var pos; var pos;
if($defined(node._originalPosition)) if($defined(node._originalPosition))
pos = node._originalPosition; pos = node._originalPosition;
var result = this.findNodeEntryIndex(node, pos); var result = this.findNodeEntryIndex(node, pos);
core.assert(result.index<result.table.length,"node not found. Could not remove"); $assert(result.index<result.table.length,"node not found. Could not remove");
this._removeEntry(node, result.table, result.index, modifiedTopics); this._removeEntry(node, result.table, result.index, modifiedTopics);
}, },
addBranch:function(node,modifiedTopics){ addBranch:function(node,modifiedTopics){

View File

@ -20,8 +20,8 @@ mindplot.util.Shape =
{ {
isAtRight: function(sourcePoint, targetPoint) isAtRight: function(sourcePoint, targetPoint)
{ {
core.assert(sourcePoint, "Source can not be null"); $assert(sourcePoint, "Source can not be null");
core.assert(targetPoint, "Target can not be null"); $assert(targetPoint, "Target can not be null");
return sourcePoint.x < targetPoint.x; return sourcePoint.x < targetPoint.x;
}, },
workoutDistance: function(sourceNode, targetNode) workoutDistance: function(sourceNode, targetNode)
@ -37,9 +37,9 @@ mindplot.util.Shape =
}, },
calculateRectConnectionPoint: function(rectCenterPoint, rectSize, isAtRight) calculateRectConnectionPoint: function(rectCenterPoint, rectSize, isAtRight)
{ {
core.assert(rectCenterPoint, 'rectCenterPoint can not be null'); $assert(rectCenterPoint, 'rectCenterPoint can not be null');
core.assert(rectSize, 'rectSize can not be null'); $assert(rectSize, 'rectSize can not be null');
core.assert($defined(isAtRight), 'isRight can not be null'); $assert($defined(isAtRight), 'isRight can not be null');
// Node is placed at the right ? // Node is placed at the right ?
var result = new core.Point(); var result = new core.Point();

View File

@ -1,20 +1,20 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
var IconPanel = new Class({ var IconPanel = new Class({
Implements:[Options,Events], Implements:[Options,Events],
@ -29,78 +29,99 @@ var IconPanel = new Class({
state:'close' state:'close'
}, },
initialize:function(options){ initialize:function(options) {
this.setOptions(options); this.setOptions(options);
if($defined(this.options.button)) if ($defined(this.options.button)) {
{
this.init(); this.init();
} }
}, },
setButton:function(button){ setButton:function(button) {
this.options.button=button; this.options.button = button;
}, },
init:function(){ init:function() {
var panel = new Element('div'); var panel = new Element('div');
var coord = this.options.button.getCoordinates(); var coord = this.options.button.getCoordinates();
var top = this.options.button.getTop() + coord.height+2; var top = this.options.button.getTop() + coord.height + 2;
var left = this.options.button.getLeft(); var left = this.options.button.getLeft();
panel.setStyles({width:this.options.initialWidth, height:0,position:'absolute', top:top, left:left, background:'#e5e5e5', border:'1px solid #BBB4D6', zIndex:20, overflow:'hidden'}); panel.setStyles({
this.options.panel=panel; width:this.options.initialWidth,
height:0,position:'absolute',
top:top,
left:left,
background:'#e5e5e5',
border:'1px solid #BBB4D6',
zIndex:20,
overflow:'hidden'}
);
this.options.panel = panel;
this.options.content.inject(panel); this.options.content.inject(panel);
this.options.content.addEvent('click', function(event) { this.options.content.addEvent('click', function(event) {
this.close(); this.close();
}.bind(this)); }.bind(this));
panel.setStyle('opacity',0);
panel.setStyle('opacity', 0);
panel.inject($(document.body)); panel.inject($(document.body));
this.registerOpenPanel(); this.registerOpenPanel();
}, },
open:function(){ open:function() {
if(this.options.state=='close') if (this.options.state == 'close') {
{ if (!$defined(this.options.panel)) {
if(!$defined(this.options.panel))
{
this.init(); this.init();
} }
var panel = this.options.panel; var panel = this.options.panel;
panel.setStyles({border: '1px solid #636163', opacity:100}); panel.setStyles({border: '1px solid #636163', opacity:100});
this.fireEvent('onStart'); this.fireEvent('onStart');
var fx = panel.effects({duration:500, onComplete:function(){ // Resize dialog to show a cool effect ;)
panel.set('morph', {duration: 'long', transition: 'bounce:out'});
panel.morph({
height:[0,this.options.height],
width:[this.options.initialWidth, this.options.width]
});
panel.addEvent('complete', function() {
this.registerClosePanel(); this.registerClosePanel();
}.bind(this)}); }.bind(this));
fx.start({'height':[0,this.options.height], 'width':[this.options.initialWidth, this.options.width]}); this.options.state = 'open';
this.options.state='open';
} }
}, },
close:function(){ close:function() {
if(this.options.state=='open') if (this.options.state == 'open') {
{
var fx = this.options.panel.effects({duration:500, onComplete:function(){ // Magic, disappear effect ;)
var panel = this.options.panel;
panel.set('morph', {duration: 'long', transition: 'bounce:in'});
panel.morph({
height:[this.options.height,0],
width:[this.options.width, this.options.initialWidth]
});
panel.addEvent('complete', function() {
this.options.panel.setStyles({border: '1px solid transparent', opacity:0}); this.options.panel.setStyles({border: '1px solid transparent', opacity:0});
this.registerOpenPanel(); this.registerOpenPanel();
}.bind(this)}); }.bind(this));
fx.start({'height':[this.options.height,0], 'width':[this.options.width, this.options.initialWidth]});
this.options.state = 'close'; this.options.state = 'close';
} }
}, },
registerOpenPanel:function(){ registerOpenPanel:function() {
this.options.button.removeEvents('click'); this.options.button.removeEvents('click');
this.options.button.addEvent('click',function(event){ this.options.button.addEvent('click', function(event) {
this.open(); this.open();
}.bindWithEvent(this)); }.bindWithEvent(this));
}, },
registerClosePanel:function(){ registerClosePanel:function() {
this.options.button.removeEvents('click'); this.options.button.removeEvents('click');
this.options.button.addEvent('click', function(event){ this.options.button.addEvent('click', function(event) {
this.close(); this.close();
}.bindWithEvent(this)); }.bindWithEvent(this));
} }