fixing bugs

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

View File

@ -92,8 +92,8 @@ core.Utils.getMousePosition = function(event)
var xcoord = -1; var xcoord = -1;
var ycoord = -1; var ycoord = -1;
if (!event) { if (!core.Utils.isDefined(event)) {
if (window.event) { if (core.Utils.isDefined(window.event)) {
//Internet Explorer //Internet Explorer
event = window.event; event = window.event;
} else { } else {
@ -143,7 +143,7 @@ core.Utils.workOutDivElementPosition = function(divElement)
{ {
var curleft = 0; var curleft = 0;
var curtop = 0; var curtop = 0;
if (divElement.offsetParent) { if (core.Utils.isDefined(divElement.offsetParent)) {
curleft = divElement.offsetLeft; curleft = divElement.offsetLeft;
curtop = divElement.offsetTop; curtop = divElement.offsetTop;
while (divElement = divElement.offsetParent) { while (divElement = divElement.offsetParent) {
@ -158,13 +158,13 @@ core.Utils.workOutDivElementPosition = function(divElement)
core.Utils.innerXML = function(/*Node*/node) { core.Utils.innerXML = function(/*Node*/node) {
// summary: // summary:
// Implementation of MS's innerXML function. // Implementation of MS's innerXML function.
if (node.innerXML) { if (core.Utils.isDefined(node.innerXML)) {
return node.innerXML; return node.innerXML;
// string // string
} else if (node.xml) { } else if (core.Utils.isDefined(node.xml)) {
return node.xml; return node.xml;
// string // string
} else if (typeof XMLSerializer != "undefined") { } else if (core.Utils.isDefined(XMLSerializer)) {
return (new XMLSerializer()).serializeToString(node); return (new XMLSerializer()).serializeToString(node);
// string // string
} }
@ -175,7 +175,7 @@ core.Utils.createDocument = function() {
// cross-browser implementation of creating an XML document object. // cross-browser implementation of creating an XML document object.
var doc = null; var doc = null;
var _document = window.document; var _document = window.document;
if (window.ActiveXObject) { if (core.Utils.isDefined(window.ActiveXObject)) {
var prefixes = [ "MSXML2", "Microsoft", "MSXML", "MSXML3" ]; var prefixes = [ "MSXML2", "Microsoft", "MSXML", "MSXML3" ];
for (var i = 0; i < prefixes.length; i++) { for (var i = 0; i < prefixes.length; i++) {
try { try {
@ -184,7 +184,7 @@ core.Utils.createDocument = function() {
} }
; ;
if (doc) { if (core.Utils.isDefined(doc)) {
break; break;
} }
} }
@ -201,17 +201,17 @@ core.Utils.createDocumentFromText = function(/*string*/str, /*string?*/mimetype)
// summary: // summary:
// attempts to create a Document object based on optional mime-type, // attempts to create a Document object based on optional mime-type,
// using str as the contents of the document // using str as the contents of the document
if (!mimetype) { if (!core.Utils.isDefined(mimetype)) {
mimetype = "text/xml"; mimetype = "text/xml";
} }
if (window.DOMParser) if (core.Utils.isDefined(window.DOMParser))
{ {
var parser = new DOMParser(); var parser = new DOMParser();
return parser.parseFromString(str, mimetype); return parser.parseFromString(str, mimetype);
// DOMDocument // DOMDocument
} else if (window.ActiveXObject) { } else if (core.Utils.isDefined(window.ActiveXObject)) {
var domDoc = core.Utils.createDocument(); var domDoc = core.Utils.createDocument();
if (domDoc) { if (core.Utils.isDefined(domDoc)) {
domDoc.async = false; domDoc.async = false;
domDoc.loadXML(str); domDoc.loadXML(str);
return domDoc; return domDoc;
@ -269,7 +269,7 @@ core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos){
var x2 = tarPos.x + Math.sqrt(l*l/(1+(m*m)))*fix*-1; var x2 = tarPos.x + Math.sqrt(l*l/(1+(m*m)))*fix*-1;
var y2= m*(x2-tarPos.x)+tarPos.y; var y2= m*(x2-tarPos.x)+tarPos.y;
return [new core.Point(-srcPos.x + x1,-srcPos.y + y1),new core.Point(-tarPos.x + x2,-tarPos.y + y2)]; return [new core.Point(srcPos.x - x1,srcPos.y - y1),new core.Point(tarPos.x - x2,tarPos.y - y2)];
}; };
core.Utils.setVisibilityAnimated = function(elems, isVisible, doneFn){ core.Utils.setVisibilityAnimated = function(elems, isVisible, doneFn){
@ -285,8 +285,10 @@ core.Utils.animateVisibility = function (elems, isVisible, doneFn){
var _opacity = (isVisible?0:1); var _opacity = (isVisible?0:1);
if(isVisible){ if(isVisible){
elems.forEach(function(child, index){ elems.forEach(function(child, index){
child.setOpacity(_opacity); if(core.Utils.isDefined(child)){
child.setVisibility(isVisible); child.setOpacity(_opacity);
child.setVisibility(isVisible);
}
}); });
} }
var fadeEffect = function(index) var fadeEffect = function(index)
@ -296,8 +298,9 @@ core.Utils.animateVisibility = function (elems, isVisible, doneFn){
$clear(_fadeEffect); $clear(_fadeEffect);
_fadeEffect = null; _fadeEffect = null;
elems.forEach(function(child, index){ elems.forEach(function(child, index){
if(core.Utils.isDefined(child)){
child.setVisibility(isVisible); child.setVisibility(isVisible);
}
}); });
if(core.Utils.isDefined(doneFn)) if(core.Utils.isDefined(doneFn))
@ -310,7 +313,9 @@ core.Utils.animateVisibility = function (elems, isVisible, doneFn){
} }
_opacity-=(1/step)*fix; _opacity-=(1/step)*fix;
elems.forEach(function(child, index){ elems.forEach(function(child, index){
child.setOpacity(_opacity); if(core.Utils.isDefined(child)){
child.setOpacity(_opacity);
}
}); });
} }

View File

@ -22,7 +22,7 @@ wLogger.setLevel(Log4js.Level.ALL);
//wLogger.addAppender(new Log4js.BrowserConsoleAppender()); //wLogger.addAppender(new Log4js.BrowserConsoleAppender());
// Is logger service available ? // Is logger service available ?
if (window.LoggerService) if (core.Utils.isDefined(window.LoggerService))
{ {
Log4js.WiseServerAppender = function() Log4js.WiseServerAppender = function()
{ {

View File

@ -18,7 +18,7 @@
mindplot.BoardEntry = function(lowerLimit, upperLimit, order) mindplot.BoardEntry = function(lowerLimit, upperLimit, order)
{ {
if (lowerLimit && upperLimit) if (core.Utils.isDefined(lowerLimit) && core.Utils.isDefined(upperLimit))
{ {
core.assert(lowerLimit < upperLimit, 'lowerLimit can not be greater that upperLimit'); core.assert(lowerLimit < upperLimit, 'lowerLimit can not be greater that upperLimit');
} }
@ -102,20 +102,20 @@ mindplot.BoardEntry.prototype.update = function()
mindplot.BoardEntry.prototype.setTopic = function(topic, updatePosition) mindplot.BoardEntry.prototype.setTopic = function(topic, updatePosition)
{ {
if (!core.Utils.isDefined(updatePosition)) if (!core.Utils.isDefined(updatePosition) || (core.Utils.isDefined(updatePosition) && !updatePosition))
{ {
updatePosition = true; updatePosition = true;
} }
this._topic = topic; this._topic = topic;
if (topic) if (core.Utils.isDefined(topic))
{ {
// Fixed positioning. Only for main topic ... // Fixed positioning. Only for main topic ...
var position = null; var position = null;
var topicPosition = topic.getPosition(); var topicPosition = topic.getPosition();
// Must update position base on the border limits? // Must update position base on the border limits?
if (this._xPos) if (core.Utils.isDefined(this._xPos))
{ {
position = new core.Point(); position = new core.Point();

View File

@ -148,7 +148,7 @@ mindplot.BubbleTip.prototype.moveTopic=function(offset, panelHeight, panelWidth,
mindplot.BubbleTip.getInstance = function(divContainer) mindplot.BubbleTip.getInstance = function(divContainer)
{ {
var result = mindplot.BubbleTip.instance; var result = mindplot.BubbleTip.instance;
if(!result) if(!core.Utils.isDefined(result))
{ {
mindplot.BubbleTip.instance = new mindplot.BubbleTip(divContainer); mindplot.BubbleTip.instance = new mindplot.BubbleTip(divContainer);
result = mindplot.BubbleTip.instance; result = mindplot.BubbleTip.instance;

View File

@ -38,7 +38,7 @@ mindplot.Command = new Class(
mindplot.Command._nextUUID = function() mindplot.Command._nextUUID = function()
{ {
if (!mindplot.Command._uuid) if (!core.Utils.isDefined(mindplot.Command._uuid))
{ {
mindplot.Command._uuid = 1; mindplot.Command._uuid = 1;
} }

View File

@ -50,7 +50,7 @@ mindplot.ControlPoint.prototype.setLine= function(line) {
}; };
mindplot.ControlPoint.prototype.redraw = function(){ mindplot.ControlPoint.prototype.redraw = function(){
if(this._line) if(core.Utils.isDefined(this._line))
this._createControlPoint(); this._createControlPoint();
}; };

View File

@ -97,7 +97,7 @@ mindplot.DragManager.prototype._buildMouseMoveListener = function(workspace, dra
// Call mouse move listeners ... // Call mouse move listeners ...
var dragListener = dragManager._listeners['dragging']; var dragListener = dragManager._listeners['dragging'];
if (dragListener) if (core.Utils.isDefined(dragListener))
{ {
dragListener(event, dragNode); dragListener(event, dragNode);
} }

View File

@ -152,7 +152,7 @@ mindplot.DragPivot.prototype.setVisibility = function(value)
var connectRect = this._connectRect; var connectRect = this._connectRect;
connectRect.setVisibility(value); connectRect.setVisibility(value);
if (this._line) if (core.Utils.isDefined(this._line))
{ {
this._line.setVisibility(value); this._line.setVisibility(value);
} }
@ -193,12 +193,12 @@ mindplot.DragPivot.prototype.removeFromWorkspace = function(workspace)
var connectToRect = this._connectRect; var connectToRect = this._connectRect;
workspace.removeChild(connectToRect); workspace.removeChild(connectToRect);
if (this._straightLine) if (core.Utils.isDefined(this._straightLine))
{ {
workspace.removeChild(this._straightLine); workspace.removeChild(this._straightLine);
} }
if (this._curvedLine) if (core.Utils.isDefined(this._curvedLine))
{ {
workspace.removeChild(this._curvedLine); workspace.removeChild(this._curvedLine);
} }
@ -225,13 +225,13 @@ mindplot.DragPivot.prototype.connectTo = function(targetTopic)
// Connected to Rect ... // Connected to Rect ...
var connectRect = this._connectRect; var connectRect = this._connectRect;
var targetSize = targetTopic.getSize(); var targetSize = targetTopic.getSize();
var width = targetSize.width + 6; var width = targetSize.width;
var height = targetSize.height + 6; var height = targetSize.height;
connectRect.setSize(width, height); connectRect.setSize(width, height);
var targetPosition = targetTopic.getPosition(); var targetPosition = targetTopic.getPosition();
var cx = Math.round(targetPosition.x - (width / 2)); var cx = Math.ceil(targetPosition.x - (width / 2));
var cy = Math.round(targetPosition.y - (height / 2)); var cy = Math.ceil(targetPosition.y - (height / 2));
connectRect.setPosition(cx, cy); connectRect.setPosition(cx, cy);
// Change elements position ... // Change elements position ...

View File

@ -47,8 +47,8 @@ mindplot.DragTopic.prototype.setPosition = function(x, y)
var draggedNode = this._draggedNode; var draggedNode = this._draggedNode;
var size = draggedNode.getSize(); var size = draggedNode.getSize();
var cx = x - (size.width / 2); var cx = Math.ceil(x - (size.width / 2));
var cy = y - (size.height / 2); var cy = Math.ceil(y - (size.height / 2));
// Update visual position. // Update visual position.
this._elem2d.setPosition(cx, cy); this._elem2d.setPosition(cx, cy);
@ -135,7 +135,7 @@ mindplot.DragTopic.prototype._getDragPivot = function()
mindplot.DragTopic.__getDragPivot = function() mindplot.DragTopic.__getDragPivot = function()
{ {
var result = mindplot.DragTopic._dragPivot; var result = mindplot.DragTopic._dragPivot;
if (!result) if (!core.Utils.isDefined(result))
{ {
result = new mindplot.DragPivot(); result = new mindplot.DragPivot();
mindplot.DragTopic._dragPivot = result; mindplot.DragTopic._dragPivot = result;

View File

@ -51,7 +51,7 @@ mindplot.DragTopicPositioner.prototype._checkDragTopicConnection = function(drag
// Must be disconnected from their current connection ?. // Must be disconnected from their current connection ?.
var mainTopicToMainTopicConnection = this._lookUpForMainTopicToMainTopicConnection(dragTopic); var mainTopicToMainTopicConnection = this._lookUpForMainTopicToMainTopicConnection(dragTopic);
var currentConnection = dragTopic.getConnectedToTopic(); var currentConnection = dragTopic.getConnectedToTopic();
if (currentConnection) if (core.Utils.isDefined(currentConnection))
{ {
// MainTopic->MainTopicConnection. // MainTopic->MainTopicConnection.
if (currentConnection.getType()==mindplot.NodeModel.MAIN_TOPIC_TYPE) if (currentConnection.getType()==mindplot.NodeModel.MAIN_TOPIC_TYPE)
@ -67,7 +67,7 @@ mindplot.DragTopicPositioner.prototype._checkDragTopicConnection = function(drag
var dragXPosition = dragTopic.getPosition().x; var dragXPosition = dragTopic.getPosition().x;
var currentXPosition = currentConnection.getPosition().x; var currentXPosition = currentConnection.getPosition().x;
if(mainTopicToMainTopicConnection) if(core.Utils.isDefined(mainTopicToMainTopicConnection))
{ {
// I have to change the current connection to a main topic. // I have to change the current connection to a main topic.
dragTopic.disconnect(this._workspace); dragTopic.disconnect(this._workspace);
@ -83,7 +83,7 @@ mindplot.DragTopicPositioner.prototype._checkDragTopicConnection = function(drag
if (!dragTopic.isConnected()) if (!dragTopic.isConnected())
{ {
var centalTopic = topics[0]; var centalTopic = topics[0];
if (mainTopicToMainTopicConnection) if (core.Utils.isDefined(mainTopicToMainTopicConnection))
{ {
dragTopic.connectTo(mainTopicToMainTopicConnection); dragTopic.connectTo(mainTopicToMainTopicConnection);
} else if (Math.abs(dragTopic.getPosition().x - centalTopic.getPosition().x) <= mindplot.DragTopicPositioner.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE) } else if (Math.abs(dragTopic.getPosition().x - centalTopic.getPosition().x) <= mindplot.DragTopicPositioner.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE)

View File

@ -156,7 +156,7 @@ mindplot.IconGroup.prototype.moveToFront = function() {
mindplot.IconGroup.prototype.registerListeners = function() { mindplot.IconGroup.prototype.registerListeners = function() {
this.options.nativeElem.addEventListener('click', function(event) { this.options.nativeElem.addEventListener('click', function(event) {
// Avoid node creation ... // Avoid node creation ...
if (event.stopPropagation) if (core.Utils.isDefined(event.stopPropagation))
{ {
event.stopPropagation(true); event.stopPropagation(true);
} else } else
@ -168,7 +168,7 @@ mindplot.IconGroup.prototype.registerListeners = function() {
this.options.nativeElem.addEventListener('dblclick', function(event) this.options.nativeElem.addEventListener('dblclick', function(event)
{ {
// Avoid node creation ... // Avoid node creation ...
if (event.stopPropagation) if (core.Utils.isDefined(event.stopPropagation))
{ {
event.stopPropagation(true); event.stopPropagation(true);
} else } else

View File

@ -57,7 +57,7 @@ mindplot.IconModel.prototype.isIconModel = function()
*/ */
mindplot.IconModel._nextUUID = function() mindplot.IconModel._nextUUID = function()
{ {
if (!this._uuid) if (!core.Utils.isDefined(this._uuid))
{ {
this._uuid = 0; this._uuid = 0;
} }

View File

@ -39,7 +39,7 @@ mindplot.ImageIcon = function(iconModel, topic, designer) {
removeImage.src = "../images/bin.png"; removeImage.src = "../images/bin.png";
removeImage.inject(container); removeImage.inject(container);
if (!designer._viewMode) if (!core.Utils.isDefined(designer._viewMode)|| (core.Utils.isDefined(designer._viewMode) && !designer._viewMode))
{ {
removeImage.addEvent('click', function(event) { removeImage.addEvent('click', function(event) {

View File

@ -72,7 +72,7 @@ mindplot.LinkIcon = function(urlModel, topic, designer) {
attribution.inject(element); attribution.inject(element);
element.inject(container); element.inject(container);
if(!designer._viewMode){ if(!core.Utils.isDefined(designer._viewMode)|| (core.Utils.isDefined(designer._viewMode) && !designer._viewMode)){
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'}); var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'});
var editBtn = new Element('input', {type:'button', 'class':'btn-primary', value:'Edit','class':'btn-primary'}).addClass('button').inject(buttonContainer); var editBtn = new Element('input', {type:'button', 'class':'btn-primary', value:'Edit','class':'btn-primary'}).addClass('button').inject(buttonContainer);
var removeBtn = new Element('input', {type:'button', value:'Remove','class':'btn-primary'}).addClass('button').inject(buttonContainer); var removeBtn = new Element('input', {type:'button', value:'Remove','class':'btn-primary'}).addClass('button').inject(buttonContainer);

View File

@ -120,7 +120,7 @@ mindplot.MainTopic.prototype.updateTopicShape = function(targetTopic, workspace)
var shapeType = model.getShapeType(); var shapeType = model.getShapeType();
if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
{ {
if (!shapeType) if (!core.Utils.isDefined(shapeType))
{ {
// Get the real shape type ... // Get the real shape type ...
shapeType = this.getShapeType(); shapeType = this.getShapeType();
@ -139,7 +139,7 @@ mindplot.MainTopic.prototype.disconnect = function(workspace)
var model = this.getModel(); var model = this.getModel();
var shapeType = model.getShapeType(); var shapeType = model.getShapeType();
if (!shapeType) if (!core.Utils.isDefined(shapeType))
{ {
// Change figure ... // Change figure ...
shapeType = this.getShapeType(); shapeType = this.getShapeType();
@ -208,6 +208,9 @@ mindplot.MainTopic.prototype.workoutIncomingConnectionPoint = function(sourcePos
{ {
result.x = result.x - offset; result.x = result.x - offset;
} }
result.x = Math.ceil(result.x);
result.y = Math.ceil(result.y);
return result; return result;
}; };
@ -256,6 +259,8 @@ mindplot.MainTopic.prototype.workoutOutgoingConnectionPoint = function(targetPos
{ {
result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight, true); result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight, true);
} }
result.x = Math.ceil(result.x);
result.y = Math.ceil(result.y);
return result; return result;
}; };
@ -272,7 +277,7 @@ mindplot.MainTopic.prototype._defaultText = function()
{ {
var targetTopic = this.getOutgoingConnectedTopic(); var targetTopic = this.getOutgoingConnectedTopic();
var result = ""; var result = "";
if (targetTopic) if (core.Utils.isDefined(targetTopic))
{ {
if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
{ {
@ -292,7 +297,7 @@ mindplot.MainTopic.prototype._defaultFontStyle = function()
{ {
var targetTopic = this.getOutgoingConnectedTopic(); var targetTopic = this.getOutgoingConnectedTopic();
var result; var result;
if (targetTopic) if (core.Utils.isDefined(targetTopic))
{ {
if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
{ {

View File

@ -30,7 +30,7 @@ mindplot.MainTopicBoard.DEFAULT_MAIN_TOPIC_HEIGHT = 18;
mindplot.MainTopicBoard.prototype._getBoard = function() mindplot.MainTopicBoard.prototype._getBoard = function()
{ {
if (!this._board) if (!core.Utils.isDefined(this._board))
{ {
var topic = this._topic; var topic = this._topic;
this._board = new mindplot.FixedDistanceBoard(mindplot.MainTopicBoard.DEFAULT_MAIN_TOPIC_HEIGHT, topic, this._layoutManager); this._board = new mindplot.FixedDistanceBoard(mindplot.MainTopicBoard.DEFAULT_MAIN_TOPIC_HEIGHT, topic, this._layoutManager);

View File

@ -85,7 +85,7 @@ mindplot.MindmapDesigner.prototype._registerEvents = function()
var workspace = this._workspace; var workspace = this._workspace;
var screenManager = workspace.getScreenManager(); var screenManager = workspace.getScreenManager();
if (!this._viewMode) if (!core.Utils.isDefined(this._viewMode) || (core.Utils.isDefined(this._viewMode) && !this._viewMode))
{ {
// Initialize workspace event listeners. // Initialize workspace event listeners.
// Create nodes on double click... // Create nodes on double click...
@ -278,7 +278,8 @@ mindplot.MindmapDesigner.prototype.addRelationShip2SelectedNode = function(event
var screen = this._workspace.getScreenManager(); var screen = this._workspace.getScreenManager();
var pos = screen.getWorkspaceMousePosition(event); var pos = screen.getWorkspaceMousePosition(event);
var selectedTopics = this.getSelectedNodes(); var selectedTopics = this.getSelectedNodes();
if(selectedTopics.length >0){ if(selectedTopics.length >0 &&
(!core.Utils.isDefined(this._creatingRelationship) || (core.Utils.isDefined(this._creatingRelationship) && !this._creatingRelationship))){
var fromNodePosition = selectedTopics[0].getPosition(); var fromNodePosition = selectedTopics[0].getPosition();
this._relationship = new web2d.CurvedLine(); this._relationship = new web2d.CurvedLine();
this._relationship.setStyle(web2d.CurvedLine.SIMPLE_LINE); this._relationship.setStyle(web2d.CurvedLine.SIMPLE_LINE);
@ -286,6 +287,7 @@ mindplot.MindmapDesigner.prototype.addRelationShip2SelectedNode = function(event
this._relationship.setFrom(fromNodePosition.x, fromNodePosition.y); this._relationship.setFrom(fromNodePosition.x, fromNodePosition.y);
this._relationship.setTo(pos.x, pos.y); this._relationship.setTo(pos.x, pos.y);
this._workspace.appendChild(this._relationship); this._workspace.appendChild(this._relationship);
this._creatingRelationship=true;
this._relationshipMouseMoveFunction = this._relationshipMouseMove.bindWithEvent(this); this._relationshipMouseMoveFunction = this._relationshipMouseMove.bindWithEvent(this);
this._relationshipMouseClickFunction = this._relationshipMouseClick.bindWithEvent(this, selectedTopics[0]); this._relationshipMouseClickFunction = this._relationshipMouseClick.bindWithEvent(this, selectedTopics[0]);
this._workspace.getScreenManager().addEventListener('mousemove',this._relationshipMouseMoveFunction); this._workspace.getScreenManager().addEventListener('mousemove',this._relationshipMouseMoveFunction);
@ -315,6 +317,7 @@ mindplot.MindmapDesigner.prototype._relationshipMouseClick = function (event, fr
this._relationship = null; this._relationship = null;
this._workspace.getScreenManager().removeEventListener('mousemove',this._relationshipMouseMoveFunction); this._workspace.getScreenManager().removeEventListener('mousemove',this._relationshipMouseMoveFunction);
this._workspace.getScreenManager().removeEventListener('click',this._relationshipMouseClickFunction); this._workspace.getScreenManager().removeEventListener('click',this._relationshipMouseClickFunction);
this._creatingRelationship=false;
event.preventDefault(); event.preventDefault();
event.stop(); event.stop();
return false; return false;
@ -336,7 +339,7 @@ mindplot.MindmapDesigner.prototype.needsSave = function()
mindplot.MindmapDesigner.prototype.autoSaveEnabled = function(value) mindplot.MindmapDesigner.prototype.autoSaveEnabled = function(value)
{ {
if (value) if (core.Utils.isDefined(value) && value)
{ {
var autosave = function() { var autosave = function() {
@ -587,7 +590,7 @@ mindplot.MindmapDesigner.prototype._removeNode = function(node)
var model = node.getModel(); var model = node.getModel();
model.deleteNode(); model.deleteNode();
if (parent) if (core.Utils.isDefined(parent))
{ {
this._goToNode(parent); this._goToNode(parent);
} }
@ -708,7 +711,7 @@ mindplot.MindmapDesigner.prototype._getValidSelectedObjectsIds = function(valida
for (var i = 0; i < selectedNodes.length; i++) for (var i = 0; i < selectedNodes.length; i++)
{ {
var selectedNode = selectedNodes[i]; var selectedNode = selectedNodes[i];
if (validate) if (core.Utils.isDefined(validate))
{ {
isValid = validate(selectedNode); isValid = validate(selectedNode);
} }
@ -725,7 +728,7 @@ mindplot.MindmapDesigner.prototype._getValidSelectedObjectsIds = function(valida
for( var j = 0; j< selectedRelationshipLines.length; j++){ for( var j = 0; j< selectedRelationshipLines.length; j++){
var selectedLine = selectedRelationshipLines[j]; var selectedLine = selectedRelationshipLines[j];
isValid = true; isValid = true;
if(validate){ if(core.Utils.isDefined(validate)){
isValid = validate(selectedLine); isValid = validate(selectedLine);
} }
@ -1035,9 +1038,9 @@ mindplot.MindmapDesigner.prototype.keyEventHandler = function(event)
if (evt.keyCode == 8) if (evt.keyCode == 8)
{ {
if (event) if (core.Utils.isDefined(event))
{ {
if (event.preventDefault) { if (core.Utils.isDefined(event.preventDefault)) {
event.preventDefault(); event.preventDefault();
} else { } else {
event.returnValue = false; event.returnValue = false;

View File

@ -30,7 +30,7 @@ mindplot.NodeModel = function(type, mindmap, id)
this._size = {width:50,height:20}; this._size = {width:50,height:20};
this._position = null; this._position = null;
if(core.Utils.isDefined(id)){ if(core.Utils.isDefined(id)){
if(!mindplot.NodeModel._uuid || id>mindplot.NodeModel._uuid){ if(!core.Utils.isDefined(mindplot.NodeModel._uuid) || id>mindplot.NodeModel._uuid){
mindplot.NodeModel._uuid = id; mindplot.NodeModel._uuid = id;
} }
this._id = id; this._id = id;
@ -485,7 +485,7 @@ mindplot.NodeModel.prototype.deleteNode = function()
} }
var parent = this._parent; var parent = this._parent;
if (parent) if (core.Utils.isDefined(parent))
{ {
// if it is connected, I must remove it from the parent.. // if it is connected, I must remove it from the parent..
mindmap.disconnect(this); mindmap.disconnect(this);
@ -502,7 +502,7 @@ mindplot.NodeModel.prototype.deleteNode = function()
*/ */
mindplot.NodeModel._nextUUID = function() mindplot.NodeModel._nextUUID = function()
{ {
if (!this._uuid) if (!core.Utils.isDefined(this._uuid))
{ {
this._uuid = 0; this._uuid = 0;
} }

View File

@ -39,7 +39,7 @@ mindplot.Note = function(textModel, topic, designer) {
imgContainer.inject(container); imgContainer.inject(container);
if(!designer._viewMode){ if(!core.Utils.isDefined(designer._viewMode)|| (core.Utils.isDefined(designer._viewMode) && !designer._viewMode)){
var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'}); var buttonContainer = new Element('div').setStyles({paddingTop:5, textAlign:'center'});
var editBtn = new Element('input', {type:'button', value:'Edit','class':'btn-primary'}).addClass('button').inject(buttonContainer); var editBtn = new Element('input', {type:'button', value:'Edit','class':'btn-primary'}).addClass('button').inject(buttonContainer);
var removeBtn = new Element('input', {type:'button', value:'Remove','class':'btn-primary'}).addClass('button').inject(buttonContainer); var removeBtn = new Element('input', {type:'button', value:'Remove','class':'btn-primary'}).addClass('button').inject(buttonContainer);

View File

@ -41,7 +41,7 @@ mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHa
} else } else
{ {
// Execute on success handler ... // Execute on success handler ...
if (onSavedHandler) if (core.Utils.isDefined(onSavedHandler))
{ {
onSavedHandler(); onSavedHandler();
} }

View File

@ -18,6 +18,8 @@
mindplot.RelationshipLine = function(sourceNode, targetNode, lineType) mindplot.RelationshipLine = function(sourceNode, targetNode, lineType)
{ {
mindplot.ConnectionLine.call(this,sourceNode, targetNode, lineType); mindplot.ConnectionLine.call(this,sourceNode, targetNode, lineType);
this._line2d.setIsSrcControlPointCustom(false);
this._line2d.setIsDestControlPointCustom(false);
this._isOnfocus = false; this._isOnfocus = false;
this._focusShape = this._createLine(this.getLineType(), mindplot.ConnectionLine.SIMPLE_CURVED); this._focusShape = this._createLine(this.getLineType(), mindplot.ConnectionLine.SIMPLE_CURVED);
this._focusShape.setStroke(2, "solid", "#3f96ff"); this._focusShape.setStroke(2, "solid", "#3f96ff");

View File

@ -100,7 +100,7 @@ mindplot.RelationshipModel.prototype.clone = function(model){
*/ */
mindplot.RelationshipModel._nextUUID = function() mindplot.RelationshipModel._nextUUID = function()
{ {
if (!this._uuid) if (!core.Utils.isDefined(this._uuid))
{ {
this._uuid = 0; this._uuid = 0;
} }

View File

@ -174,7 +174,7 @@ mindplot.TextEditor.prototype.listenEventOnNode = function(topic, eventName, sto
if (stopPropagation) if (stopPropagation)
{ {
if (event.stopPropagation) if (core.Utils.isDefined(event.stopPropagation))
{ {
event.stopPropagation(true); event.stopPropagation(true);
} else } else
@ -390,7 +390,7 @@ mindplot.TextEditor.prototype.lostFocus = function(bothBrowsers)
mindplot.TextEditor.prototype.clickEvent = function(event){ mindplot.TextEditor.prototype.clickEvent = function(event){
if(this._isVisible()){ if(this._isVisible()){
if (event.stopPropagation) if (core.Utils.isDefined(event.stopPropagation))
{ {
event.stopPropagation(true); event.stopPropagation(true);
} else } else
@ -403,7 +403,7 @@ mindplot.TextEditor.prototype.clickEvent = function(event){
mindplot.TextEditor.prototype.mouseDownEvent = function(event){ mindplot.TextEditor.prototype.mouseDownEvent = function(event){
if(this._isVisible()){ if(this._isVisible()){
if (event.stopPropagation) if (core.Utils.isDefined(event.stopPropagation))
{ {
event.stopPropagation(true); event.stopPropagation(true);
} else } else

View File

@ -135,7 +135,7 @@ mindplot.Tip.prototype.moveTopic=function(offset, panelHeight){
mindplot.Tip.getInstance = function(divContainer) mindplot.Tip.getInstance = function(divContainer)
{ {
var result = mindplot.Tip.instance; var result = mindplot.Tip.instance;
if(!result) if(!core.Utils.isDefined(result))
{ {
mindplot.Tip.instance = new mindplot.Tip(divContainer); mindplot.Tip.instance = new mindplot.Tip(divContainer);
result = mindplot.Tip.instance; result = mindplot.Tip.instance;

View File

@ -60,7 +60,7 @@ mindplot.Topic.prototype._setShapeType = function(type, updateModel)
{ {
// Remove inner shape figure ... // Remove inner shape figure ...
var model = this.getModel(); var model = this.getModel();
if (updateModel) if (core.Utils.isDefined(updateModel)&& updateModel)
{ {
model.setShapeType(type); model.setShapeType(type);
} }
@ -79,7 +79,7 @@ mindplot.Topic.prototype._setShapeType = function(type, updateModel)
//this._registerDefaultListenersToElement(innerShape, this); //this._registerDefaultListenersToElement(innerShape, this);
var dispatcher = dispatcherByEventType['mousedown']; var dispatcher = dispatcherByEventType['mousedown'];
if(dispatcher) if(core.Utils.isDefined(dispatcher))
{ {
for(var i = 1; i<dispatcher._listeners.length; i++) for(var i = 1; i<dispatcher._listeners.length; i++)
{ {
@ -103,6 +103,17 @@ mindplot.Topic.prototype._setShapeType = function(type, updateModel)
if($chk(iconGroup)){ if($chk(iconGroup)){
iconGroup.moveToFront(); iconGroup.moveToFront();
} }
//Move connector to front
var connector = this.getShrinkConnector();
if($chk(connector)){
connector.moveToFront();
}
//Move helpers to front
this._helpers.forEach(function(helper){
helper.moveToFront();
});
} }
}; };
@ -111,7 +122,7 @@ mindplot.Topic.prototype.getShapeType = function()
{ {
var model = this.getModel(); var model = this.getModel();
var result = model.getShapeType(); var result = model.getShapeType();
if (!result) if (!core.Utils.isDefined(result))
{ {
result = this._defaultShapeType(); result = this._defaultShapeType();
} }
@ -129,7 +140,7 @@ mindplot.Topic.prototype._removeInnerShape = function()
mindplot.Topic.prototype.INNER_RECT_ATTRIBUTES = {stroke:'0.5 solid'}; mindplot.Topic.prototype.INNER_RECT_ATTRIBUTES = {stroke:'0.5 solid'};
mindplot.Topic.prototype.getInnerShape = function() mindplot.Topic.prototype.getInnerShape = function()
{ {
if (!this._innerShape) if (!core.Utils.isDefined(this._innerShape))
{ {
// Create inner box. // Create inner box.
this._innerShape = this.buildShape(this.INNER_RECT_ATTRIBUTES); this._innerShape = this.buildShape(this.INNER_RECT_ATTRIBUTES);
@ -236,7 +247,7 @@ mindplot.Topic.OUTER_SHAPE_ATTRIBUTES = {fillColor:'#dbe2e6',stroke:'1 solid #77
mindplot.Topic.prototype.getOuterShape = function() mindplot.Topic.prototype.getOuterShape = function()
{ {
if (!this._outerShape) if (!core.Utils.isDefined(this._outerShape))
{ {
var rect = this.buildShape(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES, mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT); var rect = this.buildShape(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES, mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT);
rect.setPosition(-2, -3); rect.setPosition(-2, -3);
@ -249,7 +260,7 @@ mindplot.Topic.prototype.getOuterShape = function()
mindplot.Topic.prototype.getTextShape = function() mindplot.Topic.prototype.getTextShape = function()
{ {
if (!this._text) if (!core.Utils.isDefined(this._text))
{ {
var model = this.getModel(); var model = this.getModel();
this._text = this._buildTextShape(); this._text = this._buildTextShape();
@ -263,7 +274,7 @@ mindplot.Topic.prototype.getTextShape = function()
mindplot.Topic.prototype.getOrBuildIconGroup = function() mindplot.Topic.prototype.getOrBuildIconGroup = function()
{ {
if (!this._icon) if (!core.Utils.isDefined(this._icon))
{ {
this._icon = this._buildIconGroup(); this._icon = this._buildIconGroup();
var group = this.get2DElement(); var group = this.get2DElement();
@ -448,7 +459,7 @@ mindplot.Topic.prototype._buildTextShape = function(disableEventsListeners)
result.addEventListener('mousedown', function(event) result.addEventListener('mousedown', function(event)
{ {
var eventDispatcher = topic.getInnerShape()._dispatcherByEventType['mousedown']; var eventDispatcher = topic.getInnerShape()._dispatcherByEventType['mousedown'];
if (eventDispatcher) if (core.Utils.isDefined(eventDispatcher))
{ {
eventDispatcher.eventListener(event); eventDispatcher.eventListener(event);
} }
@ -503,7 +514,7 @@ mindplot.Topic.prototype.setFontFamily = function(value, updateModel)
{ {
var textShape = this.getTextShape(); var textShape = this.getTextShape();
textShape.setFontFamily(value); textShape.setFontFamily(value);
if (updateModel) if (core.Utils.isDefined(updateModel) && updateModel)
{ {
var model = this.getModel(); var model = this.getModel();
model.setFontFamily(value); model.setFontFamily(value);
@ -525,7 +536,7 @@ mindplot.Topic.prototype.setFontSize = function(value, updateModel)
{ {
var textShape = this.getTextShape(); var textShape = this.getTextShape();
textShape.setSize(value); textShape.setSize(value);
if (updateModel) if (core.Utils.isDefined(updateModel) && updateModel)
{ {
var model = this.getModel(); var model = this.getModel();
model.setFontSize(value); model.setFontSize(value);
@ -548,7 +559,7 @@ mindplot.Topic.prototype.setFontStyle = function(value, updateModel)
{ {
var textShape = this.getTextShape(); var textShape = this.getTextShape();
textShape.setStyle(value); textShape.setStyle(value);
if (updateModel) if (core.Utils.isDefined(updateModel) && updateModel)
{ {
var model = this.getModel(); var model = this.getModel();
model.setFontStyle(value); model.setFontStyle(value);
@ -570,7 +581,7 @@ mindplot.Topic.prototype.setFontWeight = function(value, updateModel)
{ {
var textShape = this.getTextShape(); var textShape = this.getTextShape();
textShape.setWeight(value); textShape.setWeight(value);
if (updateModel) if (core.Utils.isDefined(updateModel) && updateModel)
{ {
var model = this.getModel(); var model = this.getModel();
model.setFontWeight(value); model.setFontWeight(value);
@ -581,7 +592,7 @@ mindplot.Topic.prototype.getFontWeight = function()
{ {
var model = this.getModel(); var model = this.getModel();
var result = model.getFontWeight(); var result = model.getFontWeight();
if (!result) if (!core.Utils.isDefined(result))
{ {
var font = this._defaultFontStyle(); var font = this._defaultFontStyle();
result = font.weight; result = font.weight;
@ -593,7 +604,7 @@ mindplot.Topic.prototype.getFontFamily = function()
{ {
var model = this.getModel(); var model = this.getModel();
var result = model.getFontFamily(); var result = model.getFontFamily();
if (!result) if (!core.Utils.isDefined(result))
{ {
var font = this._defaultFontStyle(); var font = this._defaultFontStyle();
result = font.font; result = font.font;
@ -605,7 +616,7 @@ mindplot.Topic.prototype.getFontColor = function()
{ {
var model = this.getModel(); var model = this.getModel();
var result = model.getFontColor(); var result = model.getFontColor();
if (!result) if (!core.Utils.isDefined(result))
{ {
var font = this._defaultFontStyle(); var font = this._defaultFontStyle();
result = font.color; result = font.color;
@ -617,7 +628,7 @@ mindplot.Topic.prototype.getFontStyle = function()
{ {
var model = this.getModel(); var model = this.getModel();
var result = model.getFontStyle(); var result = model.getFontStyle();
if (!result) if (!core.Utils.isDefined(result))
{ {
var font = this._defaultFontStyle(); var font = this._defaultFontStyle();
result = font.style; result = font.style;
@ -629,7 +640,7 @@ mindplot.Topic.prototype.getFontSize = function()
{ {
var model = this.getModel(); var model = this.getModel();
var result = model.getFontSize(); var result = model.getFontSize();
if (!result) if (!core.Utils.isDefined(result))
{ {
var font = this._defaultFontStyle(); var font = this._defaultFontStyle();
result = font.size; result = font.size;
@ -641,7 +652,7 @@ mindplot.Topic.prototype.setFontColor = function(value, updateModel)
{ {
var textShape = this.getTextShape(); var textShape = this.getTextShape();
textShape.setColor(value); textShape.setColor(value);
if (updateModel) if (core.Utils.isDefined(updateModel) && updateModel)
{ {
var model = this.getModel(); var model = this.getModel();
model.setFontColor(value); model.setFontColor(value);
@ -664,7 +675,7 @@ mindplot.Topic.prototype._setText = function(text, updateModel)
setTimeout(executor(this), 0);*/ setTimeout(executor(this), 0);*/
core.Executor.instance.delay(this.updateNode, 0,this, [updateModel]); core.Executor.instance.delay(this.updateNode, 0,this, [updateModel]);
if (updateModel) if (core.Utils.isDefined(updateModel) && updateModel)
{ {
var model = this.getModel(); var model = this.getModel();
model.setText(text); model.setText(text);
@ -680,7 +691,7 @@ mindplot.Topic.prototype.getText = function()
{ {
var model = this.getModel(); var model = this.getModel();
var result = model.getText(); var result = model.getText();
if (!result) if (!core.Utils.isDefined(result))
{ {
result = this._defaultText(); result = this._defaultText();
} }
@ -699,7 +710,7 @@ mindplot.Topic.prototype._setBackgroundColor = function(color, updateModel)
var connector = this.getShrinkConnector(); var connector = this.getShrinkConnector();
connector.setFill(color); connector.setFill(color);
if (updateModel) if (core.Utils.isDefined(updateModel) && updateModel)
{ {
var model = this.getModel(); var model = this.getModel();
model.setBackgroundColor(color); model.setBackgroundColor(color);
@ -710,7 +721,7 @@ mindplot.Topic.prototype.getBackgroundColor = function()
{ {
var model = this.getModel(); var model = this.getModel();
var result = model.getBackgroundColor(); var result = model.getBackgroundColor();
if (!result) if (!core.Utils.isDefined(result))
{ {
result = this._defaultBackgroundColor(); result = this._defaultBackgroundColor();
} }
@ -731,7 +742,7 @@ mindplot.Topic.prototype._setBorderColor = function(color, updateModel)
connector.setAttribute('strokeColor', color); connector.setAttribute('strokeColor', color);
if (updateModel) if (core.Utils.isDefined(updateModel) && updateModel)
{ {
var model = this.getModel(); var model = this.getModel();
model.setBorderColor(color); model.setBorderColor(color);
@ -742,7 +753,7 @@ mindplot.Topic.prototype.getBorderColor = function()
{ {
var model = this.getModel(); var model = this.getModel();
var result = model.getBorderColor(); var result = model.getBorderColor();
if (!result) if (!core.Utils.isDefined(result))
{ {
result = this._defaultBorderColor(); result = this._defaultBorderColor();
} }
@ -923,7 +934,7 @@ mindplot.Topic.prototype.getIncomingLines = function()
{ {
var node = children[i]; var node = children[i];
var line = node.getOutgoingLine(); var line = node.getOutgoingLine();
if (line) if (core.Utils.isDefined(line))
{ {
result.push(line); result.push(line);
} }
@ -935,7 +946,7 @@ mindplot.Topic.prototype.getOutgoingConnectedTopic = function()
{ {
var result = null; var result = null;
var line = this.getOutgoingLine(); var line = this.getOutgoingLine();
if (line) if (core.Utils.isDefined(line))
{ {
result = line.getTargetTopic(); result = line.getTargetTopic();
} }
@ -947,7 +958,7 @@ mindplot.Topic.prototype._updateConnectionLines = function()
{ {
// Update this to parent line ... // Update this to parent line ...
var outgoingLine = this.getOutgoingLine(); var outgoingLine = this.getOutgoingLine();
if (outgoingLine) if (core.Utils.isDefined(outgoingLine))
{ {
outgoingLine.redraw(); outgoingLine.redraw();
} }
@ -997,7 +1008,7 @@ mindplot.Topic.prototype.moveToBack = function(){
this._relationships[j].moveToBack(); this._relationships[j].moveToBack();
} }
var connector = this.getShrinkConnector(); var connector = this.getShrinkConnector();
if(connector){ if(core.Utils.isDefined(connector)){
connector.moveToBack(); connector.moveToBack();
} }
@ -1010,7 +1021,7 @@ mindplot.Topic.prototype.moveToFront = function(){
this.get2DElement().moveToFront(); this.get2DElement().moveToFront();
var connector = this.getShrinkConnector(); var connector = this.getShrinkConnector();
if(connector){ if(core.Utils.isDefined(connector)){
connector.moveToFront(); connector.moveToFront();
} }
// Update relationship lines // Update relationship lines
@ -1175,7 +1186,7 @@ mindplot.Topic.prototype._updatePositionOnChangeSize = function(oldSize, newSize
mindplot.Topic.prototype.disconnect = function(workspace) mindplot.Topic.prototype.disconnect = function(workspace)
{ {
var outgoingLine = this.getOutgoingLine(); var outgoingLine = this.getOutgoingLine();
if (outgoingLine) if (core.Utils.isDefined(outgoingLine))
{ {
core.assert(workspace, 'workspace can not be null'); core.assert(workspace, 'workspace can not be null');
@ -1298,7 +1309,7 @@ mindplot.Topic.prototype._removeChild = function(child)
mindplot.Topic.prototype._getChildren = function() mindplot.Topic.prototype._getChildren = function()
{ {
var result = this._children; var result = this._children;
if (!result) if (!core.Utils.isDefined(result))
{ {
this._children = []; this._children = [];
result = this._children; result = this._children;
@ -1311,7 +1322,7 @@ mindplot.Topic.prototype.removeFromWorkspace = function(workspace)
var elem2d = this.get2DElement(); var elem2d = this.get2DElement();
workspace.removeChild(elem2d); workspace.removeChild(elem2d);
var line = this.getOutgoingLine(); var line = this.getOutgoingLine();
if (line) if (core.Utils.isDefined(line))
{ {
workspace.removeChild(line); workspace.removeChild(line);
} }
@ -1335,7 +1346,7 @@ mindplot.Topic.prototype.createDragNode = function()
// Is the node already connected ? // Is the node already connected ?
var targetTopic = this.getOutgoingConnectedTopic(); var targetTopic = this.getOutgoingConnectedTopic();
if (targetTopic) if (core.Utils.isDefined(targetTopic))
{ {
dragNode.connectTo(targetTopic); dragNode.connectTo(targetTopic);
} }

View File

@ -34,7 +34,7 @@ mindplot.VariableDistanceBoard.prototype.lookupEntryByOrder = function(order)
var index = this._orderToIndex(order); var index = this._orderToIndex(order);
var result = entries.get(index); var result = entries.get(index);
if (!result) if (!core.Utils.isDefined(result))
{ {
// I've not found a entry. I have to create a new one. // I've not found a entry. I have to create a new one.
var i = 1; var i = 1;
@ -145,7 +145,7 @@ mindplot.VariableDistanceBoard.prototype.lookupEntryByPosition = function(pos)
// Move to the next entry ... // Move to the next entry ...
var index = i * sign; var index = i * sign;
var entry = entries.get(index); var entry = entries.get(index);
if (entry) if (core.Utils.isDefined(entry))
{ {
currentEntry = entry; currentEntry = entry;
} else } else
@ -252,7 +252,7 @@ mindplot.VariableDistanceBoard.prototype.freeEntry = function(entry)
while (currentTopic) while (currentTopic)
{ {
var e = entries.get(i, indexSign); var e = entries.get(i, indexSign);
if (currentTopic && !e) if (core.Utils.isDefined(currentTopic) && !core.Utils.isDefined(e))
{ {
var entryOrder = this._indexToOrder(i * indexSign); var entryOrder = this._indexToOrder(i * indexSign);
e = this.lookupEntryByOrder(entryOrder); e = this.lookupEntryByOrder(entryOrder);
@ -260,10 +260,10 @@ mindplot.VariableDistanceBoard.prototype.freeEntry = function(entry)
// Move the topic to the next entry ... // Move the topic to the next entry ...
var topic = null; var topic = null;
if (e) if (core.Utils.isDefined(e))
{ {
topic = e.getTopic(); topic = e.getTopic();
if (currentTopic) if (core.Utils.isDefined(currentTopic))
{ {
e.setTopic(currentTopic); e.setTopic(currentTopic);
} }

View File

@ -76,7 +76,7 @@ mindplot.Workspace.prototype._createWorkspace = function(profile)
mindplot.Workspace.prototype.appendChild = function(shape) mindplot.Workspace.prototype.appendChild = function(shape)
{ {
if (shape.addToWorkspace) if (core.Utils.isDefined(shape.addToWorkspace))
{ {
shape.addToWorkspace(this); shape.addToWorkspace(this);
} else } else
@ -88,7 +88,7 @@ mindplot.Workspace.prototype.appendChild = function(shape)
mindplot.Workspace.prototype.removeChild = function(shape) mindplot.Workspace.prototype.removeChild = function(shape)
{ {
// Element is a node, not a web2d element? // Element is a node, not a web2d element?
if (shape.removeFromWorkspace) if (core.Utils.isDefined(shape.removeFromWorkspace))
{ {
shape.removeFromWorkspace(this); shape.removeFromWorkspace(this);
} else } else
@ -173,7 +173,7 @@ mindplot.Workspace.prototype._registerDragEvents = function()
var mWorkspace = this; var mWorkspace = this;
var mouseDownListener = function(event) var mouseDownListener = function(event)
{ {
if (!workspace.mouseMoveListener) if (!core.Utils.isDefined(workspace.mouseMoveListener))
{ {
if (mWorkspace.isWorkspaceEventsEnabled()) if (mWorkspace.isWorkspaceEventsEnabled())
{ {

View File

@ -28,7 +28,7 @@ mindplot.XMLMindmapSerializer_Beta.prototype.toXML = function(mindmap)
// Store map attributes ... // Store map attributes ...
var mapElem = document.createElement("map"); var mapElem = document.createElement("map");
var name = mindmap.getId(); var name = mindmap.getId();
if (name) if (core.Utils.isDefined(name))
{ {
mapElem.setAttribute('name', name); mapElem.setAttribute('name', name);
} }
@ -69,12 +69,12 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
} }
var text = topic.getText(); var text = topic.getText();
if (text) { if (core.Utils.isDefined(text)) {
parentTopic.setAttribute('text', text); parentTopic.setAttribute('text', text);
} }
var shape = topic.getShapeType(); var shape = topic.getShapeType();
if (shape) { if (core.Utils.isDefined(shape)) {
parentTopic.setAttribute('shape', shape); parentTopic.setAttribute('shape', shape);
} }
@ -101,18 +101,19 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
var fontStyle = topic.getFontStyle(); var fontStyle = topic.getFontStyle();
font += (fontStyle ? fontStyle : '') + ';'; font += (fontStyle ? fontStyle : '') + ';';
if (fontFamily || fontSize || fontColor || fontWeight || fontStyle) if (core.Utils.isDefined(fontFamily) || core.Utils.isDefined(fontSize) || core.Utils.isDefined(fontColor)
|| core.Utils.isDefined(fontWeight )|| core.Utils.isDefined(fontStyle))
{ {
parentTopic.setAttribute('fontStyle', font); parentTopic.setAttribute('fontStyle', font);
} }
var bgColor = topic.getBackgroundColor(); var bgColor = topic.getBackgroundColor();
if (bgColor) { if (core.Utils.isDefined(bgColor)) {
parentTopic.setAttribute('bgColor', bgColor); parentTopic.setAttribute('bgColor', bgColor);
} }
var brColor = topic.getBorderColor(); var brColor = topic.getBorderColor();
if (brColor) { if (core.Utils.isDefined(brColor)) {
parentTopic.setAttribute('brColor', brColor); parentTopic.setAttribute('brColor', brColor);
} }
@ -207,28 +208,28 @@ mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem
// Load attributes... // Load attributes...
var text = domElem.getAttribute('text'); var text = domElem.getAttribute('text');
if (text) { if (core.Utils.isDefined(text)) {
topic.setText(text); topic.setText(text);
} }
var order = domElem.getAttribute('order'); var order = domElem.getAttribute('order');
if (order) { if (core.Utils.isDefined(order)) {
topic.setOrder(order); topic.setOrder(order);
} }
var shape = domElem.getAttribute('shape'); var shape = domElem.getAttribute('shape');
if (shape) { if (core.Utils.isDefined(shape)) {
topic.setShapeType(shape); topic.setShapeType(shape);
} }
var isShrink = domElem.getAttribute('shrink'); var isShrink = domElem.getAttribute('shrink');
if(isShrink) if(core.Utils.isDefined(isShrink))
{ {
topic.setChildrenShrinked(isShrink); topic.setChildrenShrinked(isShrink);
} }
var fontStyle = domElem.getAttribute('fontStyle'); var fontStyle = domElem.getAttribute('fontStyle');
if (fontStyle) { if (core.Utils.isDefined(fontStyle)) {
var font = fontStyle.split(';'); var font = fontStyle.split(';');
if (font[0]) if (font[0])
@ -258,17 +259,17 @@ mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem
} }
var bgColor = domElem.getAttribute('bgColor'); var bgColor = domElem.getAttribute('bgColor');
if (bgColor) { if (core.Utils.isDefined(bgColor)) {
topic.setBackgroundColor(bgColor); topic.setBackgroundColor(bgColor);
} }
var borderColor = domElem.getAttribute('brColor'); var borderColor = domElem.getAttribute('brColor');
if (borderColor) { if (core.Utils.isDefined(borderColor)) {
topic.setBorderColor(borderColor); topic.setBorderColor(borderColor);
} }
var position = domElem.getAttribute('position'); var position = domElem.getAttribute('position');
if (position) { if (core.Utils.isDefined(position)) {
var pos = position.split(','); var pos = position.split(',');
topic.setPosition(pos[0], pos[1]); topic.setPosition(pos[0], pos[1]);
} }

View File

@ -30,12 +30,12 @@ mindplot.XMLMindmapSerializer_Pela.prototype.toXML = function(mindmap)
// Store map attributes ... // Store map attributes ...
var mapElem = document.createElement("map"); var mapElem = document.createElement("map");
var name = mindmap.getId(); var name = mindmap.getId();
if (name) if (core.Utils.isDefined(name))
{ {
mapElem.setAttribute('name', name); mapElem.setAttribute('name', name);
} }
var version = mindmap.getVersion(); var version = mindmap.getVersion();
if (version) if (core.Utils.isDefined(version))
{ {
mapElem.setAttribute('version', version); mapElem.setAttribute('version', version);
} }
@ -88,12 +88,12 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
} }
var text = topic.getText(); var text = topic.getText();
if (text) { if (core.Utils.isDefined(text)) {
parentTopic.setAttribute('text', text); parentTopic.setAttribute('text', text);
} }
var shape = topic.getShapeType(); var shape = topic.getShapeType();
if (shape) { if (core.Utils.isDefined(shape)) {
parentTopic.setAttribute('shape', shape); parentTopic.setAttribute('shape', shape);
} }
@ -123,18 +123,19 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
var fontStyle = topic.getFontStyle(); var fontStyle = topic.getFontStyle();
font += (fontStyle ? fontStyle : '') + ';'; font += (fontStyle ? fontStyle : '') + ';';
if (fontFamily || fontSize || fontColor || fontWeight || fontStyle) if (core.Utils.isDefined(fontFamily) || core.Utils.isDefined(fontSize) || core.Utils.isDefined(fontColor)
|| core.Utils.isDefined(fontWeight) || core.Utils.isDefined(fontStyle))
{ {
parentTopic.setAttribute('fontStyle', font); parentTopic.setAttribute('fontStyle', font);
} }
var bgColor = topic.getBackgroundColor(); var bgColor = topic.getBackgroundColor();
if (bgColor) { if (core.Utils.isDefined(bgColor)) {
parentTopic.setAttribute('bgColor', bgColor); parentTopic.setAttribute('bgColor', bgColor);
} }
var brColor = topic.getBorderColor(); var brColor = topic.getBorderColor();
if (brColor) { if (core.Utils.isDefined(brColor)) {
parentTopic.setAttribute('brColor', brColor); parentTopic.setAttribute('brColor', brColor);
} }
@ -261,7 +262,7 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
var type = (domElem.getAttribute('central') != null) ? mindplot.NodeModel.CENTRAL_TOPIC_TYPE : mindplot.NodeModel.MAIN_TOPIC_TYPE; var type = (domElem.getAttribute('central') != null) ? mindplot.NodeModel.CENTRAL_TOPIC_TYPE : mindplot.NodeModel.MAIN_TOPIC_TYPE;
// Load attributes... // Load attributes...
var id = domElem.getAttribute('id'); var id = domElem.getAttribute('id');
if(id) { if(core.Utils.isDefined(id)) {
id=parseInt(id); id=parseInt(id);
} }
@ -274,28 +275,28 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
var topic = mindmap.createNode(type, id); var topic = mindmap.createNode(type, id);
var text = domElem.getAttribute('text'); var text = domElem.getAttribute('text');
if (text) { if (core.Utils.isDefined(text)) {
topic.setText(text); topic.setText(text);
} }
var order = domElem.getAttribute('order'); var order = domElem.getAttribute('order');
if (order) { if (core.Utils.isDefined(order)) {
topic.setOrder(parseInt(order)); topic.setOrder(parseInt(order));
} }
var shape = domElem.getAttribute('shape'); var shape = domElem.getAttribute('shape');
if (shape) { if (core.Utils.isDefined(shape)) {
topic.setShapeType(shape); topic.setShapeType(shape);
} }
var isShrink = domElem.getAttribute('shrink'); var isShrink = domElem.getAttribute('shrink');
if(isShrink) if(core.Utils.isDefined(isShrink))
{ {
topic.setChildrenShrinked(isShrink); topic.setChildrenShrinked(isShrink);
} }
var fontStyle = domElem.getAttribute('fontStyle'); var fontStyle = domElem.getAttribute('fontStyle');
if (fontStyle) { if (core.Utils.isDefined(fontStyle)) {
var font = fontStyle.split(';'); var font = fontStyle.split(';');
if (font[0]) if (font[0])
@ -325,17 +326,17 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
} }
var bgColor = domElem.getAttribute('bgColor'); var bgColor = domElem.getAttribute('bgColor');
if (bgColor) { if (core.Utils.isDefined(bgColor)) {
topic.setBackgroundColor(bgColor); topic.setBackgroundColor(bgColor);
} }
var borderColor = domElem.getAttribute('brColor'); var borderColor = domElem.getAttribute('brColor');
if (borderColor) { if (core.Utils.isDefined(borderColor)) {
topic.setBorderColor(borderColor); topic.setBorderColor(borderColor);
} }
var position = domElem.getAttribute('position'); var position = domElem.getAttribute('position');
if (position) { if (core.Utils.isDefined(position)) {
var pos = position.split(','); var pos = position.split(',');
topic.setPosition(pos[0], pos[1]); topic.setPosition(pos[0], pos[1]);
topic.setFinalPosition(pos[0], pos[1]); topic.setFinalPosition(pos[0], pos[1]);

View File

@ -33,7 +33,7 @@ mindplot.commands.AddTopicCommand = mindplot.Command.extend(
var topic = commandContext.createTopic(this._model, !this._animated); var topic = commandContext.createTopic(this._model, !this._animated);
// Connect to topic ... // Connect to topic ...
if (this._parentId) if (core.Utils.isDefined(this._parentId))
{ {
var parentTopic = commandContext.findTopics(this._parentId)[0]; var parentTopic = commandContext.findTopics(this._parentId)[0];
commandContext.connect(topic, parentTopic, !this._animated); commandContext.connect(topic, parentTopic, !this._animated);

View File

@ -46,7 +46,7 @@ mindplot.commands.DragTopicCommand = mindplot.Command.extend(
// } // }
// Disconnect topic .. // Disconnect topic ..
if (origParentTopic) if (core.Utils.isDefined(origParentTopic))
{ {
commandContext.disconnect(topic); commandContext.disconnect(topic);
} }
@ -69,7 +69,7 @@ mindplot.commands.DragTopicCommand = mindplot.Command.extend(
this._position = origPosition; this._position = origPosition;
// Finally, connect topic ... // Finally, connect topic ...
if (this._parentId) if (core.Utils.isDefined(this._parentId))
{ {
var parentTopic = commandContext.findTopics([this._parentId])[0]; var parentTopic = commandContext.findTopics([this._parentId])[0];
commandContext.connect(topic, parentTopic); commandContext.connect(topic, parentTopic);
@ -77,7 +77,7 @@ mindplot.commands.DragTopicCommand = mindplot.Command.extend(
// Backup old parent id ... // Backup old parent id ...
this._parentId = null; this._parentId = null;
if (origParentTopic) if (core.Utils.isDefined(origParentTopic))
{ {
this._parentId = origParentTopic.getId(); this._parentId = origParentTopic.getId();
} }

View File

@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
if(afterMindpotLibraryLoading) if(core.Utils.isDefined(afterMindpotLibraryLoading))
{ {
afterMindpotLibraryLoading(); afterMindpotLibraryLoading();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -68,7 +68,7 @@ mindplot.util.Shape =
var y = sPos.y - tPos.y; var y = sPos.y - tPos.y;
var gradient = 0; var gradient = 0;
if (x) if (core.Utils.isDefined(x))
{ {
gradient = y / x; gradient = y / x;
} }

View File

@ -42,7 +42,7 @@ web2d.Element.prototype._initialize = function(attributes)
{ {
var funcName = this._attributeNameToFuncName(key, 'set'); var funcName = this._attributeNameToFuncName(key, 'set');
var funcArgs = batchExecute[funcName]; var funcArgs = batchExecute[funcName];
if (!funcArgs) if (!core.Utils.isDefined(funcArgs))
{ {
funcArgs = []; funcArgs = [];
} }
@ -63,7 +63,7 @@ web2d.Element.prototype._initialize = function(attributes)
for (var key in batchExecute) for (var key in batchExecute)
{ {
var func = this[key]; var func = this[key];
if (!func) if (!core.Utils.isDefined(func))
{ {
throw "Could not find function: " + key; throw "Could not find function: " + key;
} }
@ -223,7 +223,7 @@ web2d.Element.prototype._propertyNameToSignature =
web2d.Element.prototype._attributeNameToFuncName = function(attributeKey, prefix) web2d.Element.prototype._attributeNameToFuncName = function(attributeKey, prefix)
{ {
var signature = this._propertyNameToSignature[attributeKey]; var signature = this._propertyNameToSignature[attributeKey];
if (!signature) if (!core.Utils.isDefined(signature))
{ {
throw "Unsupported attribute: " + attributeKey; throw "Unsupported attribute: " + attributeKey;
} }
@ -292,13 +292,13 @@ web2d.Element.prototype.getAttribute = function(key)
var getterResult = getter.apply(this, []); var getterResult = getter.apply(this, []);
var attibuteName = signature[2]; var attibuteName = signature[2];
if (!attibuteName) if (!core.Utils.isDefined(attibuteName))
{ {
throw "Could not find attribute mapping for:" + key; throw "Could not find attribute mapping for:" + key;
} }
var result = getterResult[attibuteName]; var result = getterResult[attibuteName];
if (!result) if (!core.Utils.isDefined(result))
{ {
throw "Could not find attribute with name:" + attibuteName; throw "Could not find attribute with name:" + attibuteName;
} }

View File

@ -35,7 +35,7 @@ web2d.EventDispatcher = function(element)
web2d.EventDispatcher.prototype.addListener = function(type, listener) web2d.EventDispatcher.prototype.addListener = function(type, listener)
{ {
if (!listener) if (!core.Utils.isDefined(listener))
{ {
throw "Listener can not be null."; throw "Listener can not be null.";
} }
@ -44,7 +44,7 @@ web2d.EventDispatcher.prototype.addListener = function(type, listener)
web2d.EventDispatcher.prototype.removeListener = function(type, listener) web2d.EventDispatcher.prototype.removeListener = function(type, listener)
{ {
if (!listener) if (!core.Utils.isDefined(listener))
{ {
throw "Listener can not be null."; throw "Listener can not be null.";
} }

View File

@ -37,7 +37,7 @@ objects.extend(web2d.Group, web2d.Element);
*/ */
web2d.Group.prototype.removeChild = function(element) web2d.Group.prototype.removeChild = function(element)
{ {
if (!element) if (!core.Utils.isDefined(element))
{ {
throw "Child element can not be null"; throw "Child element can not be null";
} }
@ -61,7 +61,7 @@ web2d.Group.prototype.removeChild = function(element)
*/ */
web2d.Group.prototype.appendChild = function(element) web2d.Group.prototype.appendChild = function(element)
{ {
if (!element) if (!core.Utils.isDefined(element))
{ {
throw "Child element can not be null"; throw "Child element can not be null";
} }
@ -144,7 +144,7 @@ web2d.Group.prototype.getCoordSize = function()
web2d.Group.prototype.appendDomChild = function(DomElement) web2d.Group.prototype.appendDomChild = function(DomElement)
{ {
if (!DomElement) if (!core.Utils.isDefined(DomElement))
{ {
throw "Child element can not be null"; throw "Child element can not be null";
} }

View File

@ -56,7 +56,7 @@ web2d.Workspace.prototype._disableTextSelection = function()
contaier.onselectstart = new Function("return false"); contaier.onselectstart = new Function("return false");
//if the browser is NS6 //if the browser is NS6
if (window.sidebar) if (core.Utils.isDefined(window.sidebar))
{ {
contaier.onmousedown = disabletext; contaier.onmousedown = disabletext;
contaier.onclick = reEnable; contaier.onclick = reEnable;
@ -73,7 +73,7 @@ web2d.Workspace.prototype.getType = function()
*/ */
web2d.Workspace.prototype.appendChild = function(element) web2d.Workspace.prototype.appendChild = function(element)
{ {
if (!element) if (!core.Utils.isDefined(element))
{ {
throw "Child element can not be null"; throw "Child element can not be null";
} }
@ -96,7 +96,7 @@ web2d.Workspace.prototype.appendChild = function(element)
*/ */
web2d.Workspace.prototype.addItAsChildTo = function(element) web2d.Workspace.prototype.addItAsChildTo = function(element)
{ {
if (!element) if (!core.Utils.isDefined(element))
{ {
throw "Workspace div container can not be null"; throw "Workspace div container can not be null";
} }
@ -232,7 +232,7 @@ web2d.Workspace.prototype.getCoordSize = function()
*/ */
web2d.Workspace.prototype.removeChild = function(element) web2d.Workspace.prototype.removeChild = function(element)
{ {
if (!element) if (!core.Utils.isDefined(element))
{ {
throw "Child element can not be null"; throw "Child element can not be null";
} }

View File

@ -36,7 +36,7 @@ web2d.peer.svg.ElementPeer.prototype.setChildren = function(children)
web2d.peer.svg.ElementPeer.prototype.getChildren = function() web2d.peer.svg.ElementPeer.prototype.getChildren = function()
{ {
var result = this._children; var result = this._children;
if (!result) if (!core.Utils.isDefined(result))
{ {
result = []; result = [];
this._children = result; this._children = result;
@ -270,7 +270,7 @@ web2d.peer.svg.ElementPeer.prototype.updateStrokeStyle = function()
web2d.peer.svg.ElementPeer.prototype.attachChangeEventListener = function(type, listener) web2d.peer.svg.ElementPeer.prototype.attachChangeEventListener = function(type, listener)
{ {
var listeners = this.getChangeEventListeners(type); var listeners = this.getChangeEventListeners(type);
if (!listener) if (!core.Utils.isDefined(listener))
{ {
throw "Listener can not be null"; throw "Listener can not be null";
} }
@ -280,7 +280,7 @@ web2d.peer.svg.ElementPeer.prototype.attachChangeEventListener = function(type,
web2d.peer.svg.ElementPeer.prototype.getChangeEventListeners = function(type) web2d.peer.svg.ElementPeer.prototype.getChangeEventListeners = function(type)
{ {
var listeners = this._changeListeners[type]; var listeners = this._changeListeners[type];
if (!listeners) if (!core.Utils.isDefined(listeners))
{ {
listeners = []; listeners = [];
this._changeListeners[type] = listeners; this._changeListeners[type] = listeners;

View File

@ -53,7 +53,7 @@ web2d.peer.svg.RectPeer.prototype.setSize = function(width, height)
web2d.peer.svg.RectPeer.superClass.setSize.call(this, width, height); web2d.peer.svg.RectPeer.superClass.setSize.call(this, width, height);
var min = width < height?width:height; var min = width < height?width:height;
if (this._arc) if (core.Utils.isDefined(this._arc))
{ {
// Transform percentages to SVG format. // Transform percentages to SVG format.
var arc = (min / 2) * this._arc; var arc = (min / 2) * this._arc;

View File

@ -45,7 +45,7 @@ web2d.peer.svg.TextPeer.prototype.setText = function(text)
{ {
text = core.Utils.escapeInvalidTags(text); text = core.Utils.escapeInvalidTags(text);
var child = this._native.firstChild; var child = this._native.firstChild;
if (child) if (core.Utils.isDefined(child))
{ {
this._native.removeChild(child); this._native.removeChild(child);
} }
@ -63,7 +63,7 @@ web2d.peer.svg.TextPeer.prototype.setPosition = function(x, y)
{ {
this._position = {x:x, y:y}; this._position = {x:x, y:y};
var height = this._font.getSize(); var height = this._font.getSize();
if(this._parent && this._native.getBBox) if(core.Utils.isDefined(this._parent) && core.Utils.isDefined(this._native.getBBox))
height = this.getHeight(); height = this.getHeight();
var size = parseInt(height); var size = parseInt(height);
this._native.setAttribute('y', y+size*3/4); this._native.setAttribute('y', y+size*3/4);

View File

@ -21,7 +21,7 @@ web2d.peer.utils.EventUtils =
broadcastChangeEvent:function (elementPeer, type) broadcastChangeEvent:function (elementPeer, type)
{ {
var listeners = elementPeer.getChangeEventListeners(type); var listeners = elementPeer.getChangeEventListeners(type);
if (listeners) if (core.Utils.isDefined(listeners))
{ {
for (var i = 0; i < listeners.length; i++) for (var i = 0; i < listeners.length; i++)
{ {

View File

@ -388,7 +388,7 @@ public class FreemindImporter
|| freeChild.getPOSITION()==null && isOnLeftSide(wiseParent)) || freeChild.getPOSITION()==null && isOnLeftSide(wiseParent))
fix=BigInteger.valueOf(-1L); fix=BigInteger.valueOf(-1L);
BigInteger firstLevelDistance = BigInteger.valueOf(0L); BigInteger firstLevelDistance = BigInteger.valueOf(0L);
BigInteger defaultXDistance = BigInteger.valueOf(100L); BigInteger defaultXDistance = BigInteger.valueOf(200L);
if(depth==1){ if(depth==1){
firstLevelDistance = BigInteger.valueOf(200L); firstLevelDistance = BigInteger.valueOf(200L);
defaultXDistance = BigInteger.valueOf(0L); defaultXDistance = BigInteger.valueOf(0L);