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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -51,7 +51,7 @@ mindplot.DragTopicPositioner.prototype._checkDragTopicConnection = function(drag
// Must be disconnected from their current connection ?.
var mainTopicToMainTopicConnection = this._lookUpForMainTopicToMainTopicConnection(dragTopic);
var currentConnection = dragTopic.getConnectedToTopic();
if (currentConnection)
if (core.Utils.isDefined(currentConnection))
{
// MainTopic->MainTopicConnection.
if (currentConnection.getType()==mindplot.NodeModel.MAIN_TOPIC_TYPE)
@ -67,7 +67,7 @@ mindplot.DragTopicPositioner.prototype._checkDragTopicConnection = function(drag
var dragXPosition = dragTopic.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.
dragTopic.disconnect(this._workspace);
@ -83,7 +83,7 @@ mindplot.DragTopicPositioner.prototype._checkDragTopicConnection = function(drag
if (!dragTopic.isConnected())
{
var centalTopic = topics[0];
if (mainTopicToMainTopicConnection)
if (core.Utils.isDefined(mainTopicToMainTopicConnection))
{
dragTopic.connectTo(mainTopicToMainTopicConnection);
} 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() {
this.options.nativeElem.addEventListener('click', function(event) {
// Avoid node creation ...
if (event.stopPropagation)
if (core.Utils.isDefined(event.stopPropagation))
{
event.stopPropagation(true);
} else
@ -168,7 +168,7 @@ mindplot.IconGroup.prototype.registerListeners = function() {
this.options.nativeElem.addEventListener('dblclick', function(event)
{
// Avoid node creation ...
if (event.stopPropagation)
if (core.Utils.isDefined(event.stopPropagation))
{
event.stopPropagation(true);
} else

View File

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

View File

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

View File

@ -72,7 +72,7 @@ mindplot.LinkIcon = function(urlModel, topic, designer) {
attribution.inject(element);
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 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);

View File

@ -120,7 +120,7 @@ mindplot.MainTopic.prototype.updateTopicShape = function(targetTopic, workspace)
var shapeType = model.getShapeType();
if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
{
if (!shapeType)
if (!core.Utils.isDefined(shapeType))
{
// Get the real shape type ...
shapeType = this.getShapeType();
@ -139,7 +139,7 @@ mindplot.MainTopic.prototype.disconnect = function(workspace)
var model = this.getModel();
var shapeType = model.getShapeType();
if (!shapeType)
if (!core.Utils.isDefined(shapeType))
{
// Change figure ...
shapeType = this.getShapeType();
@ -208,6 +208,9 @@ mindplot.MainTopic.prototype.workoutIncomingConnectionPoint = function(sourcePos
{
result.x = result.x - offset;
}
result.x = Math.ceil(result.x);
result.y = Math.ceil(result.y);
return result;
};
@ -256,6 +259,8 @@ mindplot.MainTopic.prototype.workoutOutgoingConnectionPoint = function(targetPos
{
result = mindplot.util.Shape.calculateRectConnectionPoint(pos, size, isAtRight, true);
}
result.x = Math.ceil(result.x);
result.y = Math.ceil(result.y);
return result;
};
@ -272,7 +277,7 @@ mindplot.MainTopic.prototype._defaultText = function()
{
var targetTopic = this.getOutgoingConnectedTopic();
var result = "";
if (targetTopic)
if (core.Utils.isDefined(targetTopic))
{
if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE)
{
@ -292,7 +297,7 @@ mindplot.MainTopic.prototype._defaultFontStyle = function()
{
var targetTopic = this.getOutgoingConnectedTopic();
var result;
if (targetTopic)
if (core.Utils.isDefined(targetTopic))
{
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()
{
if (!this._board)
if (!core.Utils.isDefined(this._board))
{
var topic = this._topic;
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 screenManager = workspace.getScreenManager();
if (!this._viewMode)
if (!core.Utils.isDefined(this._viewMode) || (core.Utils.isDefined(this._viewMode) && !this._viewMode))
{
// Initialize workspace event listeners.
// Create nodes on double click...
@ -278,7 +278,8 @@ mindplot.MindmapDesigner.prototype.addRelationShip2SelectedNode = function(event
var screen = this._workspace.getScreenManager();
var pos = screen.getWorkspaceMousePosition(event);
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();
this._relationship = new web2d.CurvedLine();
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.setTo(pos.x, pos.y);
this._workspace.appendChild(this._relationship);
this._creatingRelationship=true;
this._relationshipMouseMoveFunction = this._relationshipMouseMove.bindWithEvent(this);
this._relationshipMouseClickFunction = this._relationshipMouseClick.bindWithEvent(this, selectedTopics[0]);
this._workspace.getScreenManager().addEventListener('mousemove',this._relationshipMouseMoveFunction);
@ -315,6 +317,7 @@ mindplot.MindmapDesigner.prototype._relationshipMouseClick = function (event, fr
this._relationship = null;
this._workspace.getScreenManager().removeEventListener('mousemove',this._relationshipMouseMoveFunction);
this._workspace.getScreenManager().removeEventListener('click',this._relationshipMouseClickFunction);
this._creatingRelationship=false;
event.preventDefault();
event.stop();
return false;
@ -336,7 +339,7 @@ mindplot.MindmapDesigner.prototype.needsSave = function()
mindplot.MindmapDesigner.prototype.autoSaveEnabled = function(value)
{
if (value)
if (core.Utils.isDefined(value) && value)
{
var autosave = function() {
@ -587,7 +590,7 @@ mindplot.MindmapDesigner.prototype._removeNode = function(node)
var model = node.getModel();
model.deleteNode();
if (parent)
if (core.Utils.isDefined(parent))
{
this._goToNode(parent);
}
@ -708,7 +711,7 @@ mindplot.MindmapDesigner.prototype._getValidSelectedObjectsIds = function(valida
for (var i = 0; i < selectedNodes.length; i++)
{
var selectedNode = selectedNodes[i];
if (validate)
if (core.Utils.isDefined(validate))
{
isValid = validate(selectedNode);
}
@ -725,7 +728,7 @@ mindplot.MindmapDesigner.prototype._getValidSelectedObjectsIds = function(valida
for( var j = 0; j< selectedRelationshipLines.length; j++){
var selectedLine = selectedRelationshipLines[j];
isValid = true;
if(validate){
if(core.Utils.isDefined(validate)){
isValid = validate(selectedLine);
}
@ -1035,9 +1038,9 @@ mindplot.MindmapDesigner.prototype.keyEventHandler = function(event)
if (evt.keyCode == 8)
{
if (event)
if (core.Utils.isDefined(event))
{
if (event.preventDefault) {
if (core.Utils.isDefined(event.preventDefault)) {
event.preventDefault();
} else {
event.returnValue = false;

View File

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

View File

@ -39,7 +39,7 @@ mindplot.Note = function(textModel, topic, designer) {
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 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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ mindplot.VariableDistanceBoard.prototype.lookupEntryByOrder = function(order)
var index = this._orderToIndex(order);
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.
var i = 1;
@ -145,7 +145,7 @@ mindplot.VariableDistanceBoard.prototype.lookupEntryByPosition = function(pos)
// Move to the next entry ...
var index = i * sign;
var entry = entries.get(index);
if (entry)
if (core.Utils.isDefined(entry))
{
currentEntry = entry;
} else
@ -252,7 +252,7 @@ mindplot.VariableDistanceBoard.prototype.freeEntry = function(entry)
while (currentTopic)
{
var e = entries.get(i, indexSign);
if (currentTopic && !e)
if (core.Utils.isDefined(currentTopic) && !core.Utils.isDefined(e))
{
var entryOrder = this._indexToOrder(i * indexSign);
e = this.lookupEntryByOrder(entryOrder);
@ -260,10 +260,10 @@ mindplot.VariableDistanceBoard.prototype.freeEntry = function(entry)
// Move the topic to the next entry ...
var topic = null;
if (e)
if (core.Utils.isDefined(e))
{
topic = e.getTopic();
if (currentTopic)
if (core.Utils.isDefined(currentTopic))
{
e.setTopic(currentTopic);
}

View File

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

View File

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

View File

@ -30,12 +30,12 @@ mindplot.XMLMindmapSerializer_Pela.prototype.toXML = function(mindmap)
// Store map attributes ...
var mapElem = document.createElement("map");
var name = mindmap.getId();
if (name)
if (core.Utils.isDefined(name))
{
mapElem.setAttribute('name', name);
}
var version = mindmap.getVersion();
if (version)
if (core.Utils.isDefined(version))
{
mapElem.setAttribute('version', version);
}
@ -88,12 +88,12 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
}
var text = topic.getText();
if (text) {
if (core.Utils.isDefined(text)) {
parentTopic.setAttribute('text', text);
}
var shape = topic.getShapeType();
if (shape) {
if (core.Utils.isDefined(shape)) {
parentTopic.setAttribute('shape', shape);
}
@ -123,18 +123,19 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
var fontStyle = topic.getFontStyle();
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);
}
var bgColor = topic.getBackgroundColor();
if (bgColor) {
if (core.Utils.isDefined(bgColor)) {
parentTopic.setAttribute('bgColor', bgColor);
}
var brColor = topic.getBorderColor();
if (brColor) {
if (core.Utils.isDefined(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;
// Load attributes...
var id = domElem.getAttribute('id');
if(id) {
if(core.Utils.isDefined(id)) {
id=parseInt(id);
}
@ -274,28 +275,28 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
var topic = mindmap.createNode(type, id);
var text = domElem.getAttribute('text');
if (text) {
if (core.Utils.isDefined(text)) {
topic.setText(text);
}
var order = domElem.getAttribute('order');
if (order) {
if (core.Utils.isDefined(order)) {
topic.setOrder(parseInt(order));
}
var shape = domElem.getAttribute('shape');
if (shape) {
if (core.Utils.isDefined(shape)) {
topic.setShapeType(shape);
}
var isShrink = domElem.getAttribute('shrink');
if(isShrink)
if(core.Utils.isDefined(isShrink))
{
topic.setChildrenShrinked(isShrink);
}
var fontStyle = domElem.getAttribute('fontStyle');
if (fontStyle) {
if (core.Utils.isDefined(fontStyle)) {
var font = fontStyle.split(';');
if (font[0])
@ -325,17 +326,17 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
}
var bgColor = domElem.getAttribute('bgColor');
if (bgColor) {
if (core.Utils.isDefined(bgColor)) {
topic.setBackgroundColor(bgColor);
}
var borderColor = domElem.getAttribute('brColor');
if (borderColor) {
if (core.Utils.isDefined(borderColor)) {
topic.setBorderColor(borderColor);
}
var position = domElem.getAttribute('position');
if (position) {
if (core.Utils.isDefined(position)) {
var pos = position.split(',');
topic.setPosition(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);
// Connect to topic ...
if (this._parentId)
if (core.Utils.isDefined(this._parentId))
{
var parentTopic = commandContext.findTopics(this._parentId)[0];
commandContext.connect(topic, parentTopic, !this._animated);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ web2d.Element.prototype._initialize = function(attributes)
{
var funcName = this._attributeNameToFuncName(key, 'set');
var funcArgs = batchExecute[funcName];
if (!funcArgs)
if (!core.Utils.isDefined(funcArgs))
{
funcArgs = [];
}
@ -63,7 +63,7 @@ web2d.Element.prototype._initialize = function(attributes)
for (var key in batchExecute)
{
var func = this[key];
if (!func)
if (!core.Utils.isDefined(func))
{
throw "Could not find function: " + key;
}
@ -223,7 +223,7 @@ web2d.Element.prototype._propertyNameToSignature =
web2d.Element.prototype._attributeNameToFuncName = function(attributeKey, prefix)
{
var signature = this._propertyNameToSignature[attributeKey];
if (!signature)
if (!core.Utils.isDefined(signature))
{
throw "Unsupported attribute: " + attributeKey;
}
@ -292,13 +292,13 @@ web2d.Element.prototype.getAttribute = function(key)
var getterResult = getter.apply(this, []);
var attibuteName = signature[2];
if (!attibuteName)
if (!core.Utils.isDefined(attibuteName))
{
throw "Could not find attribute mapping for:" + key;
}
var result = getterResult[attibuteName];
if (!result)
if (!core.Utils.isDefined(result))
{
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)
{
if (!listener)
if (!core.Utils.isDefined(listener))
{
throw "Listener can not be null.";
}
@ -44,7 +44,7 @@ web2d.EventDispatcher.prototype.addListener = function(type, listener)
web2d.EventDispatcher.prototype.removeListener = function(type, listener)
{
if (!listener)
if (!core.Utils.isDefined(listener))
{
throw "Listener can not be null.";
}

View File

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

View File

@ -56,7 +56,7 @@ web2d.Workspace.prototype._disableTextSelection = function()
contaier.onselectstart = new Function("return false");
//if the browser is NS6
if (window.sidebar)
if (core.Utils.isDefined(window.sidebar))
{
contaier.onmousedown = disabletext;
contaier.onclick = reEnable;
@ -73,7 +73,7 @@ web2d.Workspace.prototype.getType = function()
*/
web2d.Workspace.prototype.appendChild = function(element)
{
if (!element)
if (!core.Utils.isDefined(element))
{
throw "Child element can not be null";
}
@ -96,7 +96,7 @@ web2d.Workspace.prototype.appendChild = function(element)
*/
web2d.Workspace.prototype.addItAsChildTo = function(element)
{
if (!element)
if (!core.Utils.isDefined(element))
{
throw "Workspace div container can not be null";
}
@ -232,7 +232,7 @@ web2d.Workspace.prototype.getCoordSize = function()
*/
web2d.Workspace.prototype.removeChild = function(element)
{
if (!element)
if (!core.Utils.isDefined(element))
{
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()
{
var result = this._children;
if (!result)
if (!core.Utils.isDefined(result))
{
result = [];
this._children = result;
@ -270,7 +270,7 @@ web2d.peer.svg.ElementPeer.prototype.updateStrokeStyle = function()
web2d.peer.svg.ElementPeer.prototype.attachChangeEventListener = function(type, listener)
{
var listeners = this.getChangeEventListeners(type);
if (!listener)
if (!core.Utils.isDefined(listener))
{
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)
{
var listeners = this._changeListeners[type];
if (!listeners)
if (!core.Utils.isDefined(listeners))
{
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);
var min = width < height?width:height;
if (this._arc)
if (core.Utils.isDefined(this._arc))
{
// Transform percentages to SVG format.
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);
var child = this._native.firstChild;
if (child)
if (core.Utils.isDefined(child))
{
this._native.removeChild(child);
}
@ -63,7 +63,7 @@ web2d.peer.svg.TextPeer.prototype.setPosition = function(x, y)
{
this._position = {x:x, y:y};
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();
var size = parseInt(height);
this._native.setAttribute('y', y+size*3/4);

View File

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

View File

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