- 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){
this._pendingFunctions.forEach(function(item){
var result = item.fn.attempt(item.args, item.bind);
core.assert(result!=false, "execution failed");
$assert(result!=false, "execution failed");
});
this._pendingFunctions=[];
}

View File

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

View File

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

View File

@ -18,7 +18,7 @@
mindplot.Board = new Class({
initialize : function(defaultHeight, referencePoint) {
core.assert(referencePoint, "referencePoint can not be null");
$assert(referencePoint, "referencePoint can not be null");
this._defaultWidth = defaultHeight;
this._entries = new mindplot.BidirectionalArray();
this._referencePoint = referencePoint;
@ -32,7 +32,7 @@ mindplot.Board = new Class({
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);
$assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order);
entry.removeTopic();
board.update(entry);
},
@ -66,9 +66,9 @@ mindplot.BidirectionalArray = new Class({
},
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)) {
core.assert(index >= 0, 'Illegal absIndex value');
$assert(index >= 0, 'Illegal absIndex value');
index = index * sign;
}
@ -82,14 +82,14 @@ mindplot.BidirectionalArray = new Class({
},
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;
array[Math.abs(index)] = elem;
},
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;
},

View File

@ -19,7 +19,7 @@
mindplot.BoardEntry = new Class({
initialize:function(lowerLimit, upperLimit, order) {
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._lowerLimit = lowerLimit;
@ -42,8 +42,8 @@ mindplot.BoardEntry = new Class({
},
setUpperLimit : function(value) {
core.assert($defined(value), "upper limit can not be null");
core.assert(!isNaN(value), "illegal value");
$assert($defined(value), "upper limit can not be null");
$assert(!isNaN(value), "illegal value");
this._upperLimit = value;
},
@ -56,8 +56,8 @@ mindplot.BoardEntry = new Class({
},
setLowerLimit : function(value) {
core.assert($defined(value), "upper limit can not be null");
core.assert(!isNaN(value), "illegal value");
$assert($defined(value), "upper limit can not be null");
$assert(!isNaN(value), "illegal value");
this._lowerLimit = value;
},
@ -76,7 +76,7 @@ mindplot.BoardEntry = new Class({
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();
this.setTopic(null);
topic.setOrder(null);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -112,7 +112,7 @@ mindplot.DragManager.prototype._buildMouseUpListener = function(workspace, node,
var screen = workspace.getScreenManager();
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.
var hasBeenDragged = dragNode._isInTheWorkspace;

View File

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

View File

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

View File

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

View File

@ -214,7 +214,7 @@ mindplot.FixedDistanceBoard = new Class({
removeTopic : function(topic) {
var order = topic.getOrder();
var entry = this.lookupEntryByOrder(order);
core.assert(!entry.isAvailable(), "Illegal state");
$assert(!entry.isAvailable(), "Illegal state");
entry.setTopic(null);
topic.setOrder(null);
@ -245,7 +245,7 @@ mindplot.FixedDistanceBoard = new Class({
},
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 result = null;

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@
mindplot.MainTopic = function(model)
{
core.assert(model, "Model can not be null");
$assert(model, "Model can not be null");
this.setModel(model);
mindplot.MainTopic.superClass.initialize.call(this);
};
@ -188,7 +188,7 @@ mindplot.MainTopic.prototype.setPosition = function(point, fireEvent)
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 size = this.getSize();
@ -217,7 +217,7 @@ mindplot.MainTopic.prototype.workoutIncomingConnectionPoint = function(sourcePos
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 size = this.getSize();

View File

@ -44,8 +44,8 @@ mindplot.MainTopicBoard = new Class({
},
positionateDragTopic : function(dragTopic) {
core.assert(dragTopic != null, 'dragTopic can not be null');
core.assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance');
$assert(dragTopic != null, 'dragTopic can not be null');
$assert(dragTopic.isDragTopic, 'dragTopic must be DragTopic instance');
// This node is a main topic node. Position
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.
*/
_workoutXBorderDistance : function(topic) {
core.assert(topic, 'topic can not be null');
$assert(topic, 'topic can not be null');
var board = this._getBoard();
return board.workoutXBorderDistance(topic);
},
addBranch : function(topic) {
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...
var board = this._getBoard();

View File

@ -52,12 +52,12 @@ mindplot.Mindmap = new Class({
},
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) {
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);
} 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);
@ -74,7 +74,7 @@ mindplot.Mindmap = new Class({
connect : function(parent, child) {
// Child already has a parent ?
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...
parent._appendChild(child);
@ -85,8 +85,8 @@ mindplot.Mindmap = new Class({
disconnect : function(child) {
var parent = child.getParent();
core.assert(child, 'Child can not be null.');
core.assert(parent, 'Child model seems to be already connected');
$assert(child, 'Child can not be null.');
$assert(parent, 'Child model seems to be already connected');
parent._removeChild(child);
@ -109,19 +109,19 @@ mindplot.Mindmap = new Class({
},
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);
},
_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);
return result;
},
createRelationship : function(fromNode, toNode) {
core.assert(fromNode, 'from node cannot be null');
core.assert(toNode, 'to node cannot be null');
$assert(fromNode, 'from node cannot be null');
$assert(toNode, 'to node cannot be null');
return new mindplot.RelationshipModel(fromNode, toNode);
},

View File

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

View File

@ -47,7 +47,7 @@ mindplot.NodeGraph.prototype._set2DElement = function(elem2d)
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;
};
@ -92,10 +92,10 @@ mindplot.NodeGraph.prototype.setSize = function(size)
mindplot.NodeGraph.create = function(nodeModel)
{
core.assert(nodeModel, 'Model can not be null');
$assert(nodeModel, 'Model can not be null');
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;
if (type == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
@ -115,13 +115,13 @@ mindplot.NodeGraph.create = function(nodeModel)
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;
};
mindplot.NodeGraph.prototype.setModel = function(model)
{
core.assert(model, 'Model can not be null');
$assert(model, 'Model can not be null');
this._model = model;
};
@ -167,7 +167,7 @@ mindplot.NodeGraph.prototype.createDragNode = 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()

View File

@ -18,8 +18,8 @@
mindplot.NodeModel = new Class({
initialize:function(type, mindmap, id) {
core.assert(type, 'Node type can not be null');
core.assert(mindmap, 'mindmap can not be null');
$assert(type, 'Node type can not be null');
$assert(mindmap, 'mindmap can not be null');
this._order = null;
this._type = type;
@ -122,47 +122,47 @@ mindplot.NodeModel = new Class({
},
createLink : function(url) {
core.assert(url, 'Link URL must be specified.');
$assert(url, 'Link URL must be specified.');
return new mindplot.LinkModel(url, this);
},
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);
},
_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);
},
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);
},
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);
},
_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);
},
createIcon : function(iconType) {
core.assert(iconType, 'IconType must be specified.');
$assert(iconType, 'IconType must be specified.');
return new mindplot.IconModel(iconType, this);
},
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);
},
_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);
},
@ -171,20 +171,20 @@ mindplot.NodeModel = new Class({
},
_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);
child._parent = this;
},
_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);
child._parent = null;
},
setPosition : function(x, y) {
core.assert($defined(x), "x coordinate must be defined");
core.assert($defined(y), "y coordinate must be defined");
$assert($defined(x), "x coordinate must be defined");
$assert($defined(y), "y coordinate must be defined");
if (!$defined(this._position)) {
this._position = new core.Point();
@ -198,8 +198,8 @@ mindplot.NodeModel = new Class({
},
setFinalPosition : function(x, y) {
core.assert($defined(x), "x coordinate must be defined");
core.assert($defined(y), "y coordinate must be defined");
$assert($defined(x), "x coordinate must be defined");
$assert($defined(y), "y coordinate must be defined");
if (!$defined(this._finalPosition)) {
this._finalPosition = new core.Point();
@ -246,14 +246,14 @@ mindplot.NodeModel = new Class({
},
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;
},
canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) {
core.assert(sourceModel != this, 'The same node can not be parent and child if itself.');
core.assert(sourcePosition, 'childPosition can not be null.');
core.assert($defined(targetTopicHeight), 'childrenWidth can not be null.');
$assert(sourceModel != this, 'The same node can not be parent and child if itself.');
$assert(sourcePosition, 'childPosition 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.
var targetModel = this;

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ mindplot.ScreenManager = function(width, height, divElement)
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;
};

View File

@ -223,7 +223,7 @@ mindplot.Topic.prototype.buildShape = function(attributes, type)
}
else
{
core.assert(false, "Unsupported figure type:" + type);
$assert(false, "Unsupported figure type:" + type);
}
result.setPosition(0, 0);
@ -1100,7 +1100,7 @@ mindplot.Topic.prototype.invariant = function()
// Check consitency...
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)
{
core.assert(size, "size can not be null");
core.assert($defined(size.width), "size seem not to be a valid element");
$assert(size, "size can not be null");
$assert($defined(size.width), "size seem not to be a valid element");
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) {
core.assert(false, "this method must be overided");
$assert(false, "this method must be overided");
};
mindplot.Topic.prototype.disconnect = function(workspace)
@ -1188,7 +1188,7 @@ mindplot.Topic.prototype.disconnect = function(workspace)
var outgoingLine = this.getOutgoingLine();
if ($defined(outgoingLine))
{
core.assert(workspace, 'workspace can not be null');
$assert(workspace, 'workspace can not be null');
this._outgoingLine = null;
@ -1245,10 +1245,10 @@ mindplot.Topic.prototype.setOrder = function(value)
mindplot.Topic.prototype.connectTo = function(targetTopic, workspace, isVisible)
{
core.assert(!this._outgoingLine, 'Could not connect an already connected node');
core.assert(targetTopic != this, 'Cilcular connection are not allowed');
core.assert(targetTopic, 'Parent Graph can not be null');
core.assert(workspace, 'Workspace can not be null');
$assert(!this._outgoingLine, 'Could not connect an already connected node');
$assert(targetTopic != this, 'Cilcular connection are not allowed');
$assert(targetTopic, 'Parent Graph can not be null');
$assert(workspace, 'Workspace can not be null');
// Connect Graphical Nodes ...
targetTopic._appendChild(this);

View File

@ -27,7 +27,7 @@ mindplot.TopicBoard = new Class({
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);
$assert(!entry.isAvailable(), 'Entry must not be available in order to be removed.Entry Order:' + order);
entry.removeTopic();
board.update(entry);
},

View File

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

View File

@ -19,7 +19,7 @@
mindplot.Workspace = new Class({
initialize: function(profile, screenManager, zoom) {
// 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._screenManager = screenManager;
this._screenWidth = profile.width;

View File

@ -21,7 +21,7 @@ mindplot.XMLMindmapSerializer_Beta = function()
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();
@ -179,11 +179,11 @@ mindplot.XMLMindmapSerializer_Beta.prototype._noteToXML = function(document, not
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;
// 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 ...
var mindmap = new mindplot.Mindmap();
@ -281,7 +281,7 @@ mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem
var child = children[i];
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") {
var childTopic = this._deserializeNode(child, mindmap);
childTopic.connectTo(topic);

View File

@ -23,7 +23,7 @@ mindplot.XMLMindmapSerializer_Pela = function()
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();
@ -222,11 +222,11 @@ mindplot.XMLMindmapSerializer_Pela.prototype._relationshipToXML = function(docum
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;
// 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();
// Start the loading process ...
@ -350,7 +350,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
var child = children[i];
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") {
var childTopic = this._deserializeNode(child, mindmap);
childTopic.connectTo(topic);

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ mindplot.commands.AddRelationshipCommand = new Class(
Extends:mindplot.Command,
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._mindmap = mindmap;
this._id = mindplot.Command._nextUUID();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,17 +9,17 @@ mindplot.layoutManagers.boards.freeMindBoards.Board = mindplot.layoutManagers.bo
this._positionTables = this._createTables();
},
_createTables:function(){
core.assert(false, "no Board implementation found!")
$assert(false, "no Board implementation found!")
},
_getTableForNode:function(node, position){
core.assert(false, "no Board implementation found!")
$assert(false, "no Board implementation found!")
},
removeTopicFromBoard:function(node, modifiedTopics){
var pos;
if($defined(node._originalPosition))
pos = node._originalPosition;
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);
},
addBranch:function(node,modifiedTopics){

View File

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

View File

@ -31,8 +31,7 @@ var IconPanel = new Class({
initialize:function(options) {
this.setOptions(options);
if($defined(this.options.button))
{
if ($defined(this.options.button)) {
this.init();
}
},
@ -46,47 +45,69 @@ var IconPanel = new Class({
var coord = this.options.button.getCoordinates();
var top = this.options.button.getTop() + coord.height + 2;
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({
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.addEvent('click', function(event) {
this.close();
}.bind(this));
panel.setStyle('opacity', 0);
panel.inject($(document.body));
this.registerOpenPanel();
},
open:function() {
if(this.options.state=='close')
{
if(!$defined(this.options.panel))
{
if (this.options.state == 'close') {
if (!$defined(this.options.panel)) {
this.init();
}
var panel = this.options.panel;
panel.setStyles({border: '1px solid #636163', opacity:100});
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();
}.bind(this)});
}.bind(this));
fx.start({'height':[0,this.options.height], 'width':[this.options.initialWidth, this.options.width]});
this.options.state = 'open';
}
},
close:function() {
if(this.options.state=='open')
{
var fx = this.options.panel.effects({duration:500, onComplete:function(){
if (this.options.state == 'open') {
// 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.registerOpenPanel();
}.bind(this)});
fx.start({'height':[this.options.height,0], 'width':[this.options.width, this.options.initialWidth]});
}.bind(this));
this.options.state = 'close';
}
},