diff --git a/core-js/src/main/javascript/Utils.js b/core-js/src/main/javascript/Utils.js index f45c9224..3419b631 100644 --- a/core-js/src/main/javascript/Utils.js +++ b/core-js/src/main/javascript/Utils.js @@ -1,34 +1,41 @@ /* -* Copyright [2011] [wisemapping] -* -* Licensed under WiseMapping Public License, Version 1.0 (the "License"). -* It is basically the Apache License, Version 2.0 (the "License") plus the -* "powered by wisemapping" text requirement on every single page; -* you may not use this file except in compliance with the License. -* You may obtain a copy of the license at -* -* http://www.wisemapping.org/license -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. + * Copyright [2011] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ core.Utils = { - isDefined: function(val) - { - return val !== null && val !== undefined && typeof val !="undefined"; - }, - escapeInvalidTags: function (text) - { + escapeInvalidTags: function (text) { //todo:Pablo. scape invalid tags in a text return text; } }; +/* + Function: $defined + Returns true if the passed in value/object is defined, that means is not null or undefined. + + Arguments: + obj - object to inspect + */ +function $defined(obj) { + return (obj != undefined); +} +; + /** * http://kevlindev.com/tutorials/javascript/inheritance/index.htm * A function used to extend one class with another @@ -51,16 +58,12 @@ objects.extend = function(subClass, baseClass) { subClass.superClass = baseClass.prototype; }; -core.assert = function(assert, message) -{ - if (!assert) - { +core.assert = function(assert, message) { + if (!assert) { var stack; - try - { + try { null.eval(); - } catch(e) - { + } catch(e) { stack = e; } wLogger.error(message + "," + stack); @@ -70,8 +73,7 @@ core.assert = function(assert, message) }; -Math.sign = function(value) -{ +Math.sign = function(value) { return (value >= 0) ? 1 : -1; }; @@ -87,13 +89,12 @@ function $import(src) { /** * Retrieve the mouse position. */ -core.Utils.getMousePosition = function(event) -{ +core.Utils.getMousePosition = function(event) { var xcoord = -1; var ycoord = -1; - if (!core.Utils.isDefined(event)) { - if (core.Utils.isDefined(window.event)) { + if (!$defined(event)) { + if ($defined(window.event)) { //Internet Explorer event = window.event; } else { @@ -101,7 +102,7 @@ core.Utils.getMousePosition = function(event) throw "Could not obtain mouse position"; } } - if(core.Utils.isDefined(event.$extended)){ + if ($defined(event.$extended)) { event = event.event; } if (typeof( event.pageX ) == 'number') { @@ -114,8 +115,8 @@ core.Utils.getMousePosition = function(event) xcoord = event.clientX; ycoord = event.clientY; var badOldBrowser = ( window.navigator.userAgent.indexOf('Opera') + 1 ) || - ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) || - ( navigator.vendor == 'KDE' ); + ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) || + ( navigator.vendor == 'KDE' ); if (!badOldBrowser) { if (document.body && ( document.body.scrollLeft || document.body.scrollTop )) { //IE 4, 5 & 6 (in non-standards compliant mode) @@ -139,11 +140,10 @@ core.Utils.getMousePosition = function(event) /** * Calculate the position of the passed element. */ -core.Utils.workOutDivElementPosition = function(divElement) -{ +core.Utils.workOutDivElementPosition = function(divElement) { var curleft = 0; var curtop = 0; - if (core.Utils.isDefined(divElement.offsetParent)) { + if ($defined(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 (core.Utils.isDefined(node.innerXML)) { + if ($defined(node.innerXML)) { return node.innerXML; // string - } else if (core.Utils.isDefined(node.xml)) { + } else if ($defined(node.xml)) { return node.xml; // string - } else if (core.Utils.isDefined(XMLSerializer)) { + } else if ($defined(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 (core.Utils.isDefined(window.ActiveXObject)) { + if ($defined(window.ActiveXObject)) { var prefixes = [ "MSXML2", "Microsoft", "MSXML", "MSXML3" ]; for (var i = 0; i < prefixes.length; i++) { try { @@ -184,12 +184,12 @@ core.Utils.createDocument = function() { } ; - if (core.Utils.isDefined(doc)) { + if ($defined(doc)) { break; } } } else if ((_document.implementation) && - (_document.implementation.createDocument)) { + (_document.implementation.createDocument)) { doc = _document.implementation.createDocument("", "", null); } @@ -201,17 +201,16 @@ 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 (!core.Utils.isDefined(mimetype)) { + if (!$defined(mimetype)) { mimetype = "text/xml"; } - if (core.Utils.isDefined(window.DOMParser)) - { + if ($defined(window.DOMParser)) { var parser = new DOMParser(); return parser.parseFromString(str, mimetype); // DOMDocument - } else if (core.Utils.isDefined(window.ActiveXObject)) { + } else if ($defined(window.ActiveXObject)) { var domDoc = core.Utils.createDocument(); - if (core.Utils.isDefined(domDoc)) { + if ($defined(domDoc)) { domDoc.async = false; domDoc.loadXML(str); return domDoc; @@ -221,153 +220,152 @@ core.Utils.createDocumentFromText = function(/*string*/str, /*string?*/mimetype) return null; }; -core.Utils.calculateRelationShipPointCoordinates = function(topic,controlPoint){ +core.Utils.calculateRelationShipPointCoordinates = function(topic, controlPoint) { var size = topic.getSize(); var position = topic.getPosition(); - var m = (position.y-controlPoint.y)/(position.x-controlPoint.x); + var m = (position.y - controlPoint.y) / (position.x - controlPoint.x); var y,x; var gap = 5; - if(controlPoint.y>position.y+(size.height/2)){ - y = position.y+(size.height/2)+gap; - x = position.x-((position.y-y)/m); - if(x>position.x+(size.width/2)){ - x=position.x+(size.width/2); - }else if(x position.y + (size.height / 2)) { + y = position.y + (size.height / 2) + gap; + x = position.x - ((position.y - y) / m); + if (x > position.x + (size.width / 2)) { + x = position.x + (size.width / 2); + } else if (x < position.x - (size.width / 2)) { + x = position.x - (size.width / 2); } - }else if(controlPoint.yposition.x+(size.width/2)){ - x=position.x+(size.width/2); - }else if(x position.x + (size.width / 2)) { + x = position.x + (size.width / 2); + } else if (x < position.x - (size.width / 2)) { + x = position.x - (size.width / 2); } - }else if(controlPoint.x<(position.x-size.width/2)){ - x = position.x-(size.width/2) -gap; - y = position.y-(m*(position.x-x)); - }else{ - x = position.x+(size.width/2) + gap; - y = position.y-(m*(position.x-x)); + } else if (controlPoint.x < (position.x - size.width / 2)) { + x = position.x - (size.width / 2) - gap; + y = position.y - (m * (position.x - x)); + } else { + x = position.x + (size.width / 2) + gap; + y = position.y - (m * (position.x - x)); } - return new core.Point(x,y); + return new core.Point(x, y); }; -core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos){ - var y = srcPos.y-tarPos.y; - var x = srcPos.x-tarPos.x; - var m = y/x; - var l = Math.sqrt(y*y+x*x)/3; - var fix=1; - if(srcPos.x>tarPos.x){ - fix=-1; +core.Utils.calculateDefaultControlPoints = function(srcPos, tarPos) { + var y = srcPos.y - tarPos.y; + var x = srcPos.x - tarPos.x; + var m = y / x; + var l = Math.sqrt(y * y + x * x) / 3; + var fix = 1; + if (srcPos.x > tarPos.x) { + fix = -1; } - - var x1 = srcPos.x + Math.sqrt(l*l/(1+(m*m)))*fix; - var y1 = m*(x1-srcPos.x)+srcPos.y; - 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)]; + var x1 = srcPos.x + Math.sqrt(l * l / (1 + (m * m))) * fix; + var y1 = m * (x1 - srcPos.x) + srcPos.y; + 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)]; }; -core.Utils.setVisibilityAnimated = function(elems, isVisible, doneFn){ +core.Utils.setVisibilityAnimated = function(elems, isVisible, doneFn) { core.Utils.animateVisibility(elems, isVisible, doneFn); }; -core.Utils.setChildrenVisibilityAnimated = function(rootElem, isVisible){ +core.Utils.setChildrenVisibilityAnimated = function(rootElem, isVisible) { var children = core.Utils._addInnerChildrens(rootElem); core.Utils.animateVisibility(children, isVisible); }; -core.Utils.animateVisibility = function (elems, isVisible, doneFn){ - var _fadeEffect=null; - var _opacity = (isVisible?0:1); - if(isVisible){ - elems.forEach(function(child, index){ - if(core.Utils.isDefined(child)){ - child.setOpacity(_opacity); - child.setVisibility(isVisible); - } - }); +core.Utils.animateVisibility = function (elems, isVisible, doneFn) { + var _fadeEffect = null; + var _opacity = (isVisible ? 0 : 1); + if (isVisible) { + elems.forEach(function(child, index) { + if ($defined(child)) { + child.setOpacity(_opacity); + child.setVisibility(isVisible); + } + }); } - var fadeEffect = function(index) - { + var fadeEffect = function(index) { var step = 10; - if((_opacity<=0 && !isVisible) || (_opacity>=1 && isVisible)){ + if ((_opacity <= 0 && !isVisible) || (_opacity >= 1 && isVisible)) { $clear(_fadeEffect); _fadeEffect = null; - elems.forEach(function(child, index){ - if(core.Utils.isDefined(child)){ + elems.forEach(function(child, index) { + if ($defined(child)) { child.setVisibility(isVisible); } }); - if(core.Utils.isDefined(doneFn)) + if ($defined(doneFn)) doneFn.attempt(); } - else{ + else { var fix = 1; - if(isVisible){ + if (isVisible) { fix = -1; } - _opacity-=(1/step)*fix; - elems.forEach(function(child, index){ - if(core.Utils.isDefined(child)){ + _opacity -= (1 / step) * fix; + elems.forEach(function(child, index) { + if ($defined(child)) { child.setOpacity(_opacity); } }); } }; - _fadeEffect =fadeEffect.periodical(10); + _fadeEffect = fadeEffect.periodical(10); }; -core.Utils.animatePosition = function (elems, doneFn, designer){ +core.Utils.animatePosition = function (elems, doneFn, designer) { var _moveEffect = null; var i = 10; var step = 10; - var moveEffect = function (){ - if(i>0){ + var moveEffect = function () { + if (i > 0) { var keys = elems.keys(); - for(var j = 0; j= 0, 'Illegal absIndex value'); index = index * sign; } @@ -82,14 +82,14 @@ mindplot.BidirectionalArray = new Class({ }, set : function(index, elem) { - core.assert(core.Utils.isDefined(index), 'Illegal index value'); + core.assert($defined(index), 'Illegal index value'); var array = (index >= 0) ? this._rightElem : this._leftElem; array[Math.abs(index)] = elem; }, length : function(index) { - core.assert(core.Utils.isDefined(index), 'Illegal index value'); + core.assert($defined(index), 'Illegal index value'); return (index >= 0) ? this._rightElem.length : this._leftElem.length; }, diff --git a/mindplot/src/main/javascript/BoardEntry.js b/mindplot/src/main/javascript/BoardEntry.js index 37139ff4..a7369371 100644 --- a/mindplot/src/main/javascript/BoardEntry.js +++ b/mindplot/src/main/javascript/BoardEntry.js @@ -18,7 +18,7 @@ mindplot.BoardEntry = new Class({ initialize:function(lowerLimit, upperLimit, order) { - if (core.Utils.isDefined(lowerLimit) && core.Utils.isDefined(upperLimit)) { + if ($defined(lowerLimit) && $defined(upperLimit)) { core.assert(lowerLimit < upperLimit, 'lowerLimit can not be greater that upperLimit'); } this._upperLimit = upperLimit; @@ -42,7 +42,7 @@ mindplot.BoardEntry = new Class({ }, setUpperLimit : function(value) { - core.assert(core.Utils.isDefined(value), "upper limit can not be null"); + core.assert($defined(value), "upper limit can not be null"); core.assert(!isNaN(value), "illegal value"); this._upperLimit = value; }, @@ -56,7 +56,7 @@ mindplot.BoardEntry = new Class({ }, setLowerLimit : function(value) { - core.assert(core.Utils.isDefined(value), "upper limit can not be null"); + core.assert($defined(value), "upper limit can not be null"); core.assert(!isNaN(value), "illegal value"); this._lowerLimit = value; }, @@ -89,18 +89,18 @@ mindplot.BoardEntry = new Class({ }, setTopic : function(topic, updatePosition) { - if (!core.Utils.isDefined(updatePosition) || (core.Utils.isDefined(updatePosition) && !updatePosition)) { + if (!$defined(updatePosition) || ($defined(updatePosition) && !updatePosition)) { updatePosition = true; } this._topic = topic; - if (core.Utils.isDefined(topic)) { + if ($defined(topic)) { // Fixed positioning. Only for main topic ... var position = null; var topicPosition = topic.getPosition(); // Must update position base on the border limits? - if (core.Utils.isDefined(this._xPos)) { + if ($defined(this._xPos)) { position = new core.Point(); // Update x position ... @@ -128,7 +128,7 @@ mindplot.BoardEntry = new Class({ }, isAvailable : function() { - return !core.Utils.isDefined(this._topic); + return !$defined(this._topic); }, getOrder : function() { diff --git a/mindplot/src/main/javascript/BubbleTip.js b/mindplot/src/main/javascript/BubbleTip.js index 062e4695..53d70e35 100644 --- a/mindplot/src/main/javascript/BubbleTip.js +++ b/mindplot/src/main/javascript/BubbleTip.js @@ -151,7 +151,7 @@ mindplot.BubbleTip = new Class({ mindplot.BubbleTip.getInstance = function(divContainer) { var result = mindplot.BubbleTip.instance; - if (!core.Utils.isDefined(result)) { + if (!$defined(result)) { mindplot.BubbleTip.instance = new mindplot.BubbleTip(divContainer); result = mindplot.BubbleTip.instance; } diff --git a/mindplot/src/main/javascript/CentralTopic.js b/mindplot/src/main/javascript/CentralTopic.js index e00c2800..77166149 100644 --- a/mindplot/src/main/javascript/CentralTopic.js +++ b/mindplot/src/main/javascript/CentralTopic.js @@ -56,7 +56,7 @@ mindplot.CentralTopic.prototype.createChildModel = function(prepositionate) var childModel = mindmap.createNode(mindplot.NodeModel.MAIN_TOPIC_TYPE); if(prepositionate){ - if (!core.Utils.isDefined(this.___siblingDirection)) + if (!$defined(this.___siblingDirection)) { this.___siblingDirection = 1; } diff --git a/mindplot/src/main/javascript/Command.js b/mindplot/src/main/javascript/Command.js index 4707823b..5235deb7 100644 --- a/mindplot/src/main/javascript/Command.js +++ b/mindplot/src/main/javascript/Command.js @@ -38,7 +38,7 @@ mindplot.Command = new Class( mindplot.Command._nextUUID = function() { - if (!core.Utils.isDefined(mindplot.Command._uuid)) + if (!$defined(mindplot.Command._uuid)) { mindplot.Command._uuid = 1; } diff --git a/mindplot/src/main/javascript/ConnectionLine.js b/mindplot/src/main/javascript/ConnectionLine.js index af8f2382..e43e3f98 100644 --- a/mindplot/src/main/javascript/ConnectionLine.js +++ b/mindplot/src/main/javascript/ConnectionLine.js @@ -58,7 +58,7 @@ mindplot.ConnectionLine = new Class({ }, _createLine : function(lineType, defaultStyle) { - if (!core.Utils.isDefined(lineType)) { + if (!$defined(lineType)) { lineType = defaultStyle; } lineType = parseInt(lineType); diff --git a/mindplot/src/main/javascript/ControlPoint.js b/mindplot/src/main/javascript/ControlPoint.js index 867741cb..cf8c4c2b 100644 --- a/mindplot/src/main/javascript/ControlPoint.js +++ b/mindplot/src/main/javascript/ControlPoint.js @@ -38,7 +38,7 @@ mindplot.ControlPoint = new Class({ }, setLine : function(line) { - if (core.Utils.isDefined(this._line)) { + if ($defined(this._line)) { this._removeLine(); } this._line = line; @@ -52,7 +52,7 @@ mindplot.ControlPoint = new Class({ }, redraw : function() { - if (core.Utils.isDefined(this._line)) + if ($defined(this._line)) this._createControlPoint(); }, diff --git a/mindplot/src/main/javascript/DesignerActionRunner.js b/mindplot/src/main/javascript/DesignerActionRunner.js index 3cefe1ba..0d9c4403 100644 --- a/mindplot/src/main/javascript/DesignerActionRunner.js +++ b/mindplot/src/main/javascript/DesignerActionRunner.js @@ -114,7 +114,7 @@ mindplot.CommandContext = new Class({ var result = []; lineIds.forEach(function(lineId, index) { var line = this._designer._relationships[lineId]; - if (core.Utils.isDefined(line)) { + if ($defined(line)) { result.push(line); } }.bind(this)); diff --git a/mindplot/src/main/javascript/DragManager.js b/mindplot/src/main/javascript/DragManager.js index 44ee33f0..ff1a4c6b 100644 --- a/mindplot/src/main/javascript/DragManager.js +++ b/mindplot/src/main/javascript/DragManager.js @@ -96,7 +96,7 @@ mindplot.DragManager.prototype._buildMouseMoveListener = function(workspace, dra // Call mouse move listeners ... var dragListener = dragManager._listeners['dragging']; - if (core.Utils.isDefined(dragListener)) + if ($defined(dragListener)) { dragListener(event, dragNode); } diff --git a/mindplot/src/main/javascript/DragPivot.js b/mindplot/src/main/javascript/DragPivot.js index c78b3177..debb2058 100644 --- a/mindplot/src/main/javascript/DragPivot.js +++ b/mindplot/src/main/javascript/DragPivot.js @@ -139,7 +139,7 @@ mindplot.DragPivot = new Class({ var connectRect = this._connectRect; connectRect.setVisibility(value); - if (core.Utils.isDefined(this._line)) { + if ($defined(this._line)) { this._line.setVisibility(value); } }, @@ -177,11 +177,11 @@ mindplot.DragPivot = new Class({ var connectToRect = this._connectRect; workspace.removeChild(connectToRect); - if (core.Utils.isDefined(this._straightLine)) { + if ($defined(this._straightLine)) { workspace.removeChild(this._straightLine); } - if (core.Utils.isDefined(this._curvedLine)) { + if ($defined(this._curvedLine)) { workspace.removeChild(this._curvedLine); } }, diff --git a/mindplot/src/main/javascript/DragTopic.js b/mindplot/src/main/javascript/DragTopic.js index 4865c14d..884e026f 100644 --- a/mindplot/src/main/javascript/DragTopic.js +++ b/mindplot/src/main/javascript/DragTopic.js @@ -18,8 +18,8 @@ mindplot.DragTopic = function(dragShape, draggedNode) { - core.assert(core.Utils.isDefined(dragShape), 'Rect can not be null.'); - core.assert(core.Utils.isDefined(draggedNode), 'draggedNode can not be null.'); + core.assert($defined(dragShape), 'Rect can not be null.'); + core.assert($defined(draggedNode), 'draggedNode can not be null.'); this._elem2d = dragShape; this._order = null; @@ -68,7 +68,7 @@ mindplot.DragTopic.prototype.disconnect = function(workspace) mindplot.DragTopic.prototype.canBeConnectedTo = function(targetTopic) { - core.assert(core.Utils.isDefined(targetTopic), 'parent can not be null'); + core.assert($defined(targetTopic), 'parent can not be null'); var result = true; if (!targetTopic.areChildrenShrinked() && !targetTopic.isCollapsed()) @@ -135,7 +135,7 @@ mindplot.DragTopic.prototype._getDragPivot = function() mindplot.DragTopic.__getDragPivot = function() { var result = mindplot.DragTopic._dragPivot; - if (!core.Utils.isDefined(result)) + if (!$defined(result)) { result = new mindplot.DragPivot(); mindplot.DragTopic._dragPivot = result; diff --git a/mindplot/src/main/javascript/DragTopicPositioner.js b/mindplot/src/main/javascript/DragTopicPositioner.js index 3ea82b33..f921216e 100644 --- a/mindplot/src/main/javascript/DragTopicPositioner.js +++ b/mindplot/src/main/javascript/DragTopicPositioner.js @@ -46,7 +46,7 @@ mindplot.DragTopicPositioner = new Class({ // Must be disconnected from their current connection ?. var mainTopicToMainTopicConnection = this._lookUpForMainTopicToMainTopicConnection(dragTopic); var currentConnection = dragTopic.getConnectedToTopic(); - if (core.Utils.isDefined(currentConnection)) { + if ($defined(currentConnection)) { // MainTopic->MainTopicConnection. if (currentConnection.getType() == mindplot.NodeModel.MAIN_TOPIC_TYPE) { if (mainTopicToMainTopicConnection != currentConnection) { @@ -58,7 +58,7 @@ mindplot.DragTopicPositioner = new Class({ var dragXPosition = dragTopic.getPosition().x; var currentXPosition = currentConnection.getPosition().x; - if (core.Utils.isDefined(mainTopicToMainTopicConnection)) { + if ($defined(mainTopicToMainTopicConnection)) { // I have to change the current connection to a main topic. dragTopic.disconnect(this._workspace); } else @@ -71,7 +71,7 @@ mindplot.DragTopicPositioner = new Class({ // Finally, connect nodes ... if (!dragTopic.isConnected()) { var centalTopic = topics[0]; - if (core.Utils.isDefined(mainTopicToMainTopicConnection)) { + if ($defined(mainTopicToMainTopicConnection)) { dragTopic.connectTo(mainTopicToMainTopicConnection); } else if (Math.abs(dragTopic.getPosition().x - centalTopic.getPosition().x) <= mindplot.DragTopicPositioner.CENTRAL_TO_MAINTOPIC_MAX_HORIZONTAL_DISTANCE) { dragTopic.connectTo(centalTopic); diff --git a/mindplot/src/main/javascript/FixedDistanceBoard.js b/mindplot/src/main/javascript/FixedDistanceBoard.js index bb8036aa..5b9bab55 100644 --- a/mindplot/src/main/javascript/FixedDistanceBoard.js +++ b/mindplot/src/main/javascript/FixedDistanceBoard.js @@ -72,7 +72,7 @@ mindplot.FixedDistanceBoard = new Class({ for (var i = 0; i < entries.length; i++) { var entry = entries[i]; - if (core.Utils.isDefined(entry)) { + if ($defined(entry)) { var upperLimit = entry.getUpperLimit() + yOffset; var lowerLimit = entry.getLowerLimit() + yOffset; entry.setUpperLimit(upperLimit); @@ -172,7 +172,7 @@ mindplot.FixedDistanceBoard = new Class({ if (entries.length > 0) { var l = 0; for (l = 0; l < entries.length; l++) { - if (core.Utils.isDefined(entries[l])) + if ($defined(entries[l])) break; } var topic = entries[l].getTopic(); @@ -245,7 +245,7 @@ mindplot.FixedDistanceBoard = new Class({ }, lookupEntryByPosition : function(pos) { - core.assert(core.Utils.isDefined(pos), 'position can not be null'); + core.assert($defined(pos), 'position can not be null'); var entries = this._entries; var result = null; diff --git a/mindplot/src/main/javascript/IconGroup.js b/mindplot/src/main/javascript/IconGroup.js index 41fe2e8f..798a1fe1 100644 --- a/mindplot/src/main/javascript/IconGroup.js +++ b/mindplot/src/main/javascript/IconGroup.js @@ -156,7 +156,7 @@ mindplot.IconGroup = new Class({ registerListeners : function() { this.options.nativeElem.addEventListener('click', function(event) { // Avoid node creation ... - if (core.Utils.isDefined(event.stopPropagation)) { + if ($defined(event.stopPropagation)) { event.stopPropagation(true); } else { event.cancelBubble = true; @@ -165,7 +165,7 @@ mindplot.IconGroup = new Class({ }); this.options.nativeElem.addEventListener('dblclick', function(event) { // Avoid node creation ... - if (core.Utils.isDefined(event.stopPropagation)) { + if ($defined(event.stopPropagation)) { event.stopPropagation(true); } else { event.cancelBubble = true; diff --git a/mindplot/src/main/javascript/IconModel.js b/mindplot/src/main/javascript/IconModel.js index bdd4fd75..04cb0b04 100644 --- a/mindplot/src/main/javascript/IconModel.js +++ b/mindplot/src/main/javascript/IconModel.js @@ -57,7 +57,7 @@ mindplot.IconModel.prototype.isIconModel = function() */ mindplot.IconModel._nextUUID = function() { - if (!core.Utils.isDefined(this._uuid)) + if (!$defined(this._uuid)) { this._uuid = 0; } diff --git a/mindplot/src/main/javascript/ImageIcon.js b/mindplot/src/main/javascript/ImageIcon.js index aea0ffc6..f3580179 100644 --- a/mindplot/src/main/javascript/ImageIcon.js +++ b/mindplot/src/main/javascript/ImageIcon.js @@ -39,7 +39,7 @@ mindplot.ImageIcon = function(iconModel, topic, designer) { removeImage.src = "../images/bin.png"; removeImage.inject(container); - if (!core.Utils.isDefined(designer._viewMode)|| (core.Utils.isDefined(designer._viewMode) && !designer._viewMode)) + if (!$defined(designer._viewMode)|| ($defined(designer._viewMode) && !designer._viewMode)) { removeImage.addEvent('click', function(event) { diff --git a/mindplot/src/main/javascript/LinkIcon.js b/mindplot/src/main/javascript/LinkIcon.js index f8e62bb8..76c22ccd 100644 --- a/mindplot/src/main/javascript/LinkIcon.js +++ b/mindplot/src/main/javascript/LinkIcon.js @@ -72,7 +72,7 @@ mindplot.LinkIcon = function(urlModel, topic, designer) { attribution.inject(element); element.inject(container); - if(!core.Utils.isDefined(designer._viewMode)|| (core.Utils.isDefined(designer._viewMode) && !designer._viewMode)){ + if(!$defined(designer._viewMode)|| ($defined(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); diff --git a/mindplot/src/main/javascript/MainTopic.js b/mindplot/src/main/javascript/MainTopic.js index 55ab63b5..db52b311 100644 --- a/mindplot/src/main/javascript/MainTopic.js +++ b/mindplot/src/main/javascript/MainTopic.js @@ -120,7 +120,7 @@ mindplot.MainTopic.prototype.updateTopicShape = function(targetTopic, workspace) var shapeType = model.getShapeType(); if (targetTopic.getType() != mindplot.NodeModel.CENTRAL_TOPIC_TYPE) { - if (!core.Utils.isDefined(shapeType)) + if (!$defined(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 (!core.Utils.isDefined(shapeType)) + if (!$defined(shapeType)) { // Change figure ... shapeType = this.getShapeType(); @@ -163,7 +163,7 @@ mindplot.MainTopic.prototype._updatePositionOnChangeSize = function(oldSize, new else{ var xOffset = Math.round((newSize.width - oldSize.width) / 2); var pos = this.getPosition(); - if (core.Utils.isDefined(pos)) + if ($defined(pos)) { if (pos.x > 0) { @@ -277,7 +277,7 @@ mindplot.MainTopic.prototype._defaultText = function() { var targetTopic = this.getOutgoingConnectedTopic(); var result = ""; - if (core.Utils.isDefined(targetTopic)) + if ($defined(targetTopic)) { if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) { @@ -297,7 +297,7 @@ mindplot.MainTopic.prototype._defaultFontStyle = function() { var targetTopic = this.getOutgoingConnectedTopic(); var result; - if (core.Utils.isDefined(targetTopic)) + if ($defined(targetTopic)) { if (targetTopic.getType() == mindplot.NodeModel.CENTRAL_TOPIC_TYPE) { diff --git a/mindplot/src/main/javascript/MainTopicBoard.js b/mindplot/src/main/javascript/MainTopicBoard.js index 401cf7ee..65a6162a 100644 --- a/mindplot/src/main/javascript/MainTopicBoard.js +++ b/mindplot/src/main/javascript/MainTopicBoard.js @@ -27,7 +27,7 @@ mindplot.MainTopicBoard = new Class({ _getBoard: function() { - if (!core.Utils.isDefined(this._board)) { + if (!$defined(this._board)) { var topic = this._topic; this._board = new mindplot.FixedDistanceBoard(mindplot.MainTopicBoard.DEFAULT_MAIN_TOPIC_HEIGHT, topic, this._layoutManager); } @@ -89,7 +89,7 @@ mindplot.MainTopicBoard = new Class({ addBranch : function(topic) { var order = topic.getOrder(); - core.assert(core.Utils.isDefined(order), "Order must be defined"); + core.assert($defined(order), "Order must be defined"); // If the entry is not available, I must swap the the entries... var board = this._getBoard(); diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js index abc600f3..e17f0ec6 100644 --- a/mindplot/src/main/javascript/MindmapDesigner.js +++ b/mindplot/src/main/javascript/MindmapDesigner.js @@ -18,7 +18,7 @@ mindplot.MindmapDesigner = function(profile, divElement) { - core.assert(core.Utils.isDefined(profile.zoom), "zoom must be defined"); + core.assert($defined(profile.zoom), "zoom must be defined"); // Undo manager ... this._actionRunner = new mindplot.DesignerActionRunner(this); @@ -87,7 +87,7 @@ mindplot.MindmapDesigner.prototype._registerEvents = function() var workspace = this._workspace; var screenManager = workspace.getScreenManager(); - if (!core.Utils.isDefined(this._viewMode) || (core.Utils.isDefined(this._viewMode) && !this._viewMode)) + if (!$defined(this._viewMode) || ($defined(this._viewMode) && !this._viewMode)) { // Initialize workspace event listeners. // Create nodes on double click... @@ -175,7 +175,7 @@ mindplot.MindmapDesigner.prototype.onObjectFocusEvent = function(currentObject, this.getEditor().lostFocus(); var selectableObjects = this.getSelectedObjects(); // Disable all nodes on focus but not the current if Ctrl key isn't being pressed - if (!core.Utils.isDefined(event) || event.ctrlKey == false) + if (!$defined(event) || event.ctrlKey == false) { for (var i = 0; i < selectableObjects.length; i++) { @@ -285,7 +285,7 @@ mindplot.MindmapDesigner.prototype.addRelationShip2SelectedNode = function(event var pos = screen.getWorkspaceMousePosition(event); var selectedTopics = this.getSelectedNodes(); if(selectedTopics.length >0 && - (!core.Utils.isDefined(this._creatingRelationship) || (core.Utils.isDefined(this._creatingRelationship) && !this._creatingRelationship))){ + (!$defined(this._creatingRelationship) || ($defined(this._creatingRelationship) && !this._creatingRelationship))){ this._workspace.enableWorkspaceEvents(false); var fromNodePosition = selectedTopics[0].getPosition(); this._relationship = new web2d.CurvedLine(); @@ -313,10 +313,10 @@ mindplot.MindmapDesigner.prototype._relationshipMouseMove = function(event){ mindplot.MindmapDesigner.prototype._relationshipMouseClick = function (event, fromNode) { var target = event.target; - while(target.tagName != "g" && core.Utils.isDefined(target.parentNode)){ + while(target.tagName != "g" && $defined(target.parentNode)){ target=target.parentNode; } - if(core.Utils.isDefined(target.virtualRef)){ + if($defined(target.virtualRef)){ var targetNode = target.virtualRef; this.addRelationship(fromNode, targetNode); } @@ -347,7 +347,7 @@ mindplot.MindmapDesigner.prototype.needsSave = function() mindplot.MindmapDesigner.prototype.autoSaveEnabled = function(value) { - if (core.Utils.isDefined(value) && value) + if ($defined(value) && value) { var autosave = function() { @@ -467,7 +467,7 @@ mindplot.MindmapDesigner.prototype._nodeModelToNodeGraph = function(nodeModel, i core.assert(nodeModel, "Node model can not be null"); var nodeGraph = this._buildNodeGraph(nodeModel); - if(core.Utils.isDefined(isVisible)) + if($defined(isVisible)) nodeGraph.setVisibility(isVisible); var children = nodeModel.getChildren().slice(); @@ -477,7 +477,7 @@ mindplot.MindmapDesigner.prototype._nodeModelToNodeGraph = function(nodeModel, i for (var i = 0; i < children.length; i++) { var child = children[i]; - if(core.Utils.isDefined(child)) + if($defined(child)) this._nodeModelToNodeGraph(child); } @@ -545,11 +545,11 @@ mindplot.MindmapDesigner.prototype._buildRelationship = function (model) { // Create node graph ... var relationLine = new mindplot.RelationshipLine(fromTopic, toTopic, model.getLineType()); - if(core.Utils.isDefined(model.getSrcCtrlPoint())){ + if($defined(model.getSrcCtrlPoint())){ var srcPoint = model.getSrcCtrlPoint().clone(); relationLine.setSrcControlPoint(srcPoint); } - if(core.Utils.isDefined(model.getDestCtrlPoint())){ + if($defined(model.getDestCtrlPoint())){ var destPoint = model.getDestCtrlPoint().clone(); relationLine.setDestControlPoint(destPoint); } @@ -598,7 +598,7 @@ mindplot.MindmapDesigner.prototype._removeNode = function(node) var model = node.getModel(); model.deleteNode(); - if (core.Utils.isDefined(parent)) + if ($defined(parent)) { this._goToNode(parent); } @@ -719,7 +719,7 @@ mindplot.MindmapDesigner.prototype._getValidSelectedObjectsIds = function(valida for (var i = 0; i < selectedNodes.length; i++) { var selectedNode = selectedNodes[i]; - if (core.Utils.isDefined(validate)) + if ($defined(validate)) { isValid = validate(selectedNode); } @@ -736,7 +736,7 @@ mindplot.MindmapDesigner.prototype._getValidSelectedObjectsIds = function(valida for( var j = 0; j< selectedRelationshipLines.length; j++){ var selectedLine = selectedRelationshipLines[j]; isValid = true; - if(core.Utils.isDefined(validate)){ + if($defined(validate)){ isValid = validate(selectedLine); } @@ -1047,9 +1047,9 @@ mindplot.MindmapDesigner.prototype.keyEventHandler = function(event) if (evt.keyCode == 8) { - if (core.Utils.isDefined(event)) + if ($defined(event)) { - if (core.Utils.isDefined(event.preventDefault)) { + if ($defined(event.preventDefault)) { event.preventDefault(); } else { event.returnValue = false; diff --git a/mindplot/src/main/javascript/NodeModel.js b/mindplot/src/main/javascript/NodeModel.js index 2396c05f..bb943fb5 100644 --- a/mindplot/src/main/javascript/NodeModel.js +++ b/mindplot/src/main/javascript/NodeModel.js @@ -29,8 +29,8 @@ mindplot.NodeModel = new Class({ this._notes = []; this._size = {width:50,height:20}; this._position = null; - if (core.Utils.isDefined(id)) { - if (!core.Utils.isDefined(mindplot.NodeModel._uuid) || id > mindplot.NodeModel._uuid) { + if ($defined(id)) { + if (!$defined(mindplot.NodeModel._uuid) || id > mindplot.NodeModel._uuid) { mindplot.NodeModel._uuid = id; } this._id = id; @@ -183,10 +183,10 @@ mindplot.NodeModel = new Class({ }, setPosition : function(x, y) { - core.assert(core.Utils.isDefined(x), "x coordinate must be defined"); - core.assert(core.Utils.isDefined(y), "y coordinate must be defined"); + core.assert($defined(x), "x coordinate must be defined"); + core.assert($defined(y), "y coordinate must be defined"); - if (!core.Utils.isDefined(this._position)) { + if (!$defined(this._position)) { this._position = new core.Point(); } this._position.x = parseInt(x); @@ -198,10 +198,10 @@ mindplot.NodeModel = new Class({ }, setFinalPosition : function(x, y) { - core.assert(core.Utils.isDefined(x), "x coordinate must be defined"); - core.assert(core.Utils.isDefined(y), "y coordinate must be defined"); + core.assert($defined(x), "x coordinate must be defined"); + core.assert($defined(y), "y coordinate must be defined"); - if (!core.Utils.isDefined(this._finalPosition)) { + if (!$defined(this._finalPosition)) { this._finalPosition = new core.Point(); } this._finalPosition.x = parseInt(x); @@ -253,7 +253,7 @@ mindplot.NodeModel = new Class({ canBeConnected : function(sourceModel, sourcePosition, targetTopicHeight) { core.assert(sourceModel != this, 'The same node can not be parent and child if itself.'); core.assert(sourcePosition, 'childPosition can not be null.'); - core.assert(core.Utils.isDefined(targetTopicHeight), 'childrenWidth can not be null.'); + core.assert($defined(targetTopicHeight), 'childrenWidth can not be null.'); // Only can be connected if the node is in the left or rigth. var targetModel = this; @@ -412,7 +412,7 @@ mindplot.NodeModel = new Class({ } var parent = this._parent; - if (core.Utils.isDefined(parent)) { + if ($defined(parent)) { // if it is connected, I must remove it from the parent.. mindmap.disconnect(this); } @@ -443,7 +443,7 @@ mindplot.NodeModel.MAIN_TOPIC_TO_MAIN_TOPIC_DISTANCE = 220; * @todo: This method must be implemented. */ mindplot.NodeModel._nextUUID = function() { - if (!core.Utils.isDefined(this._uuid)) { + if (!$defined(this._uuid)) { this._uuid = 0; } diff --git a/mindplot/src/main/javascript/Note.js b/mindplot/src/main/javascript/Note.js index 8d64b431..52979339 100644 --- a/mindplot/src/main/javascript/Note.js +++ b/mindplot/src/main/javascript/Note.js @@ -41,7 +41,7 @@ mindplot.Note = new Class({ imgContainer.inject(container); - if (!core.Utils.isDefined(designer._viewMode) || (core.Utils.isDefined(designer._viewMode) && !designer._viewMode)) { + if (!$defined(designer._viewMode) || ($defined(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); diff --git a/mindplot/src/main/javascript/PersistanceManager.js b/mindplot/src/main/javascript/PersistanceManager.js index 6442eb1e..cac0046d 100644 --- a/mindplot/src/main/javascript/PersistanceManager.js +++ b/mindplot/src/main/javascript/PersistanceManager.js @@ -41,7 +41,7 @@ mindplot.PersistanceManager.save = function(mindmap, editorProperties, onSavedHa } else { // Execute on success handler ... - if (core.Utils.isDefined(onSavedHandler)) + if ($defined(onSavedHandler)) { onSavedHandler(); } diff --git a/mindplot/src/main/javascript/RelationshipModel.js b/mindplot/src/main/javascript/RelationshipModel.js index e3b6c8af..490c1d7e 100644 --- a/mindplot/src/main/javascript/RelationshipModel.js +++ b/mindplot/src/main/javascript/RelationshipModel.js @@ -100,7 +100,7 @@ mindplot.RelationshipModel.prototype.clone = function(model){ */ mindplot.RelationshipModel._nextUUID = function() { - if (!core.Utils.isDefined(this._uuid)) + if (!$defined(this._uuid)) { this._uuid = 0; } diff --git a/mindplot/src/main/javascript/RichTextEditor.js b/mindplot/src/main/javascript/RichTextEditor.js index 61a3a58f..eb91567f 100644 --- a/mindplot/src/main/javascript/RichTextEditor.js +++ b/mindplot/src/main/javascript/RichTextEditor.js @@ -86,7 +86,7 @@ mindplot.RichTextEditor = mindplot.TextEditor.extend({ } }.bind(this); _animEffect = effect.periodical(10); - $(this.inputText).value = core.Utils.isDefined(this.initialText)&& this.initialText!=""? this.initialText: node.getText(); + $(this.inputText).value = $defined(this.initialText)&& this.initialText!=""? this.initialText: node.getText(); this._editor = new nicEditor({iconsPath: '../images/nicEditorIcons.gif', buttonList : ['bold','italic','underline','removeformat','forecolor', 'fontSize', 'fontFamily', 'xhtml']}).panelInstance("inputText2"); }, init:function(node){ diff --git a/mindplot/src/main/javascript/ScreenManager.js b/mindplot/src/main/javascript/ScreenManager.js index c44e26c7..a9e3a12f 100644 --- a/mindplot/src/main/javascript/ScreenManager.js +++ b/mindplot/src/main/javascript/ScreenManager.js @@ -24,7 +24,7 @@ mindplot.ScreenManager = function(width, height, divElement) mindplot.ScreenManager.prototype.setScale = function(scale) { - core.assert(core.Utils.isDefined(scale), 'Screen scale can not be null'); + core.assert($defined(scale), 'Screen scale can not be null'); this._workspaceScale = scale; }; diff --git a/mindplot/src/main/javascript/TextEditor.js b/mindplot/src/main/javascript/TextEditor.js index 1b177aec..b44abfb9 100644 --- a/mindplot/src/main/javascript/TextEditor.js +++ b/mindplot/src/main/javascript/TextEditor.js @@ -135,7 +135,7 @@ mindplot.TextEditor = new Class({ _updateNode : function () { - if (core.Utils.isDefined(this._currentNode) && this._currentNode.getText() != this.getText()) + if ($defined(this._currentNode) && this._currentNode.getText() != this.getText()) { var text = this.getText(); var topicId = this._currentNode.getId(); @@ -161,7 +161,7 @@ mindplot.TextEditor = new Class({ if (stopPropagation) { - if (core.Utils.isDefined(event.stopPropagation)) + if ($defined(event.stopPropagation)) { event.stopPropagation(true); } else @@ -244,19 +244,19 @@ mindplot.TextEditor = new Class({ { var inputField = $("inputText"); var spanField = $("spanText"); - if (!core.Utils.isDefined(fontStyle.font)) + if (!$defined(fontStyle.font)) { fontStyle.font = "Arial"; } - if (!core.Utils.isDefined(fontStyle.style)) + if (!$defined(fontStyle.style)) { fontStyle.style = "normal"; } - if (!core.Utils.isDefined(fontStyle.weight)) + if (!$defined(fontStyle.weight)) { fontStyle.weight = "normal"; } - if (!core.Utils.isDefined(fontStyle.size)) + if (!$defined(fontStyle.size)) { fontStyle.size = 12; } @@ -367,7 +367,7 @@ mindplot.TextEditor = new Class({ }, clickEvent : function(event){ if(this.isVisible()){ - if (core.Utils.isDefined(event.stopPropagation)) + if ($defined(event.stopPropagation)) { event.stopPropagation(true); } else @@ -380,7 +380,7 @@ mindplot.TextEditor = new Class({ }, mouseDownEvent : function(event){ if(this.isVisible()){ - if (core.Utils.isDefined(event.stopPropagation)) + if ($defined(event.stopPropagation)) { event.stopPropagation(true); } else diff --git a/mindplot/src/main/javascript/Tip.js b/mindplot/src/main/javascript/Tip.js index ec79d225..0e1c634a 100644 --- a/mindplot/src/main/javascript/Tip.js +++ b/mindplot/src/main/javascript/Tip.js @@ -135,7 +135,7 @@ mindplot.Tip.prototype.moveTopic=function(offset, panelHeight){ mindplot.Tip.getInstance = function(divContainer) { var result = mindplot.Tip.instance; - if(!core.Utils.isDefined(result)) + if(!$defined(result)) { mindplot.Tip.instance = new mindplot.Tip(divContainer); result = mindplot.Tip.instance; diff --git a/mindplot/src/main/javascript/Topic.js b/mindplot/src/main/javascript/Topic.js index 5695397d..b2689caf 100644 --- a/mindplot/src/main/javascript/Topic.js +++ b/mindplot/src/main/javascript/Topic.js @@ -60,7 +60,7 @@ mindplot.Topic.prototype._setShapeType = function(type, updateModel) { // Remove inner shape figure ... var model = this.getModel(); - if (core.Utils.isDefined(updateModel)&& updateModel) + if ($defined(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(core.Utils.isDefined(dispatcher)) + if($defined(dispatcher)) { for(var i = 1; i0){ var selectedNode = this._layoutManager.getDesigner().getSelectedNodes()[0]; - if(!core.Utils.isDefined(pos)){ + if(!$defined(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(core.Utils.isDefined(pos)){ + if($defined(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(core.Utils.isDefined(modifiedTopics.set)){ + if($defined(modifiedTopics.set)){ var key = entry.getId(); if(modifiedTopics.has(key)){ pos = modifiedTopics.get(key).originalPos; diff --git a/mindplot/src/main/javascript/layoutManagers/boards/freeMindBoards/CentralTopicBoard.js b/mindplot/src/main/javascript/layoutManagers/boards/freeMindBoards/CentralTopicBoard.js index 4374538b..29926b1e 100644 --- a/mindplot/src/main/javascript/layoutManagers/boards/freeMindBoards/CentralTopicBoard.js +++ b/mindplot/src/main/javascript/layoutManagers/boards/freeMindBoards/CentralTopicBoard.js @@ -15,7 +15,7 @@ mindplot.layoutManagers.boards.freeMindBoards.CentralTopicBoard = mindplot.layou { position = altPosition; } - if(!core.Utils.isDefined(position)){ + if(!$defined(position)){ if(Math.sign(node.getParent().getPosition().x) == -1){ i=1; } diff --git a/mindplot/src/main/javascript/layoutManagers/boards/freeMindBoards/Entry.js b/mindplot/src/main/javascript/layoutManagers/boards/freeMindBoards/Entry.js index 074c396c..ea6d0564 100644 --- a/mindplot/src/main/javascript/layoutManagers/boards/freeMindBoards/Entry.js +++ b/mindplot/src/main/javascript/layoutManagers/boards/freeMindBoards/Entry.js @@ -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 && core.Utils.isDefined(pos)){ + if(useFinalPosition && $defined(pos)){ this.setPosition(pos.x, pos.y); } else{ pos = node.getPosition(); - if(!core.Utils.isDefined(pos)){ + if(!$defined(pos)){ var parent = node.getParent(); pos = parent.getPosition().clone(); var pwidth = parent.getSize().width; diff --git a/mindplot/src/main/javascript/util/Shape.js b/mindplot/src/main/javascript/util/Shape.js index 83ff7716..176e146e 100644 --- a/mindplot/src/main/javascript/util/Shape.js +++ b/mindplot/src/main/javascript/util/Shape.js @@ -39,7 +39,7 @@ mindplot.util.Shape = { core.assert(rectCenterPoint, 'rectCenterPoint can not be null'); core.assert(rectSize, 'rectSize can not be null'); - core.assert(core.Utils.isDefined(isAtRight), 'isRight can not be null'); + core.assert($defined(isAtRight), 'isRight can not be null'); // Node is placed at the right ? var result = new core.Point(); @@ -68,7 +68,7 @@ mindplot.util.Shape = var y = sPos.y - tPos.y; var gradient = 0; - if (core.Utils.isDefined(x)) + if ($defined(x)) { gradient = y / x; } diff --git a/web2d/src/main/javascript/Element.js b/web2d/src/main/javascript/Element.js index fb5e1d5a..4ad27aeb 100644 --- a/web2d/src/main/javascript/Element.js +++ b/web2d/src/main/javascript/Element.js @@ -25,7 +25,7 @@ web2d.Element = function(peer, attributes) } this._dispatcherByEventType = new Hash({}); - if (core.Utils.isDefined(attributes)) + if ($defined(attributes)) { this._initialize(attributes); } @@ -42,7 +42,7 @@ web2d.Element.prototype._initialize = function(attributes) { var funcName = this._attributeNameToFuncName(key, 'set'); var funcArgs = batchExecute[funcName]; - if (!core.Utils.isDefined(funcArgs)) + if (!$defined(funcArgs)) { funcArgs = []; } @@ -63,7 +63,7 @@ web2d.Element.prototype._initialize = function(attributes) for (var key in batchExecute) { var func = this[key]; - if (!core.Utils.isDefined(func)) + if (!$defined(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 (!core.Utils.isDefined(signature)) + if (!$defined(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 (!core.Utils.isDefined(attibuteName)) + if (!$defined(attibuteName)) { throw "Could not find attribute mapping for:" + key; } var result = getterResult[attibuteName]; - if (!core.Utils.isDefined(result)) + if (!$defined(result)) { throw "Could not find attribute with name:" + attibuteName; } diff --git a/web2d/src/main/javascript/EventDispatcher.js b/web2d/src/main/javascript/EventDispatcher.js index 5d887f6d..2778b9f2 100644 --- a/web2d/src/main/javascript/EventDispatcher.js +++ b/web2d/src/main/javascript/EventDispatcher.js @@ -35,7 +35,7 @@ web2d.EventDispatcher = function(element) web2d.EventDispatcher.prototype.addListener = function(type, listener) { - if (!core.Utils.isDefined(listener)) + if (!$defined(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 (!core.Utils.isDefined(listener)) + if (!$defined(listener)) { throw "Listener can not be null."; } diff --git a/web2d/src/main/javascript/Group.js b/web2d/src/main/javascript/Group.js index d154920c..4c4cad2e 100644 --- a/web2d/src/main/javascript/Group.js +++ b/web2d/src/main/javascript/Group.js @@ -37,7 +37,7 @@ objects.extend(web2d.Group, web2d.Element); */ web2d.Group.prototype.removeChild = function(element) { - if (!core.Utils.isDefined(element)) + if (!$defined(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 (!core.Utils.isDefined(element)) + if (!$defined(element)) { throw "Child element can not be null"; } @@ -144,7 +144,7 @@ web2d.Group.prototype.getCoordSize = function() web2d.Group.prototype.appendDomChild = function(DomElement) { - if (!core.Utils.isDefined(DomElement)) + if (!$defined(DomElement)) { throw "Child element can not be null"; } diff --git a/web2d/src/main/javascript/Workspace.js b/web2d/src/main/javascript/Workspace.js index 896266c5..b979a12e 100644 --- a/web2d/src/main/javascript/Workspace.js +++ b/web2d/src/main/javascript/Workspace.js @@ -56,7 +56,7 @@ web2d.Workspace.prototype._disableTextSelection = function() contaier.onselectstart = new Function("return false"); //if the browser is NS6 - if (core.Utils.isDefined(window.sidebar)) + if ($defined(window.sidebar)) { contaier.onmousedown = disabletext; contaier.onclick = reEnable; @@ -73,7 +73,7 @@ web2d.Workspace.prototype.getType = function() */ web2d.Workspace.prototype.appendChild = function(element) { - if (!core.Utils.isDefined(element)) + if (!$defined(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 (!core.Utils.isDefined(element)) + if (!$defined(element)) { throw "Workspace div container can not be null"; } @@ -131,13 +131,13 @@ web2d.Workspace.prototype._createDivContainer = function(domElement) web2d.Workspace.prototype.setSize = function(width, height) { // HTML container must have the size of the group element. - if (core.Utils.isDefined(width)) + if ($defined(width)) { this._htmlContainer.style.width = width; } - if (core.Utils.isDefined(height)) + if ($defined(height)) { this._htmlContainer.style.height = height; } @@ -232,7 +232,7 @@ web2d.Workspace.prototype.getCoordSize = function() */ web2d.Workspace.prototype.removeChild = function(element) { - if (!core.Utils.isDefined(element)) + if (!$defined(element)) { throw "Child element can not be null"; } diff --git a/web2d/src/main/javascript/peer/svg/ArrowPeer.js b/web2d/src/main/javascript/peer/svg/ArrowPeer.js index 86b3225c..a8eacfeb 100644 --- a/web2d/src/main/javascript/peer/svg/ArrowPeer.js +++ b/web2d/src/main/javascript/peer/svg/ArrowPeer.js @@ -51,7 +51,7 @@ web2d.peer.svg.ArrowPeer.prototype.setStrokeWidth = function(width) }; web2d.peer.svg.ArrowPeer.prototype.setDashed = function(isDashed, length, spacing){ - if(core.Utils.isDefined(isDashed) && isDashed && core.Utils.isDefined(length) && core.Utils.isDefined(spacing)){ + if($defined(isDashed) && isDashed && $defined(length) && $defined(spacing)){ this._native.setAttribute("stroke-dasharray",length+","+spacing); } else { this._native.setAttribute("stroke-dasharray",""); diff --git a/web2d/src/main/javascript/peer/svg/CurvedLinePeer.js b/web2d/src/main/javascript/peer/svg/CurvedLinePeer.js index 958f5b73..bbd14568 100644 --- a/web2d/src/main/javascript/peer/svg/CurvedLinePeer.js +++ b/web2d/src/main/javascript/peer/svg/CurvedLinePeer.js @@ -34,7 +34,7 @@ objects.extend(web2d.peer.svg.CurvedLinePeer, web2d.peer.svg.ElementPeer); web2d.peer.svg.CurvedLinePeer.prototype.setSrcControlPoint = function(control){ this._customControlPoint_1 = true; var change = this._control1.x!=control.x || this._control1.y!=control.y; - if(core.Utils.isDefined(control.x)){ + if($defined(control.x)){ this._control1 = control; this._control1.x = parseInt(this._control1.x); this._control1.y = parseInt(this._control1.y) @@ -46,7 +46,7 @@ web2d.peer.svg.CurvedLinePeer.prototype.setSrcControlPoint = function(control){ web2d.peer.svg.CurvedLinePeer.prototype.setDestControlPoint = function(control){ this._customControlPoint_2 = true; var change = this._control2.x!=control.x || this._control2.y!=control.y; - if(core.Utils.isDefined(control.x)){ + if($defined(control.x)){ this._control2 = control; this._control2.x = parseInt(this._control2.x); this._control2.y = parseInt(this._control2.y) @@ -160,7 +160,7 @@ web2d.peer.svg.CurvedLinePeer.prototype.isShowStartArrow = function(){ web2d.peer.svg.CurvedLinePeer.prototype._updatePath = function(avoidControlPointFix) { - if(core.Utils.isDefined(this._x1) && core.Utils.isDefined(this._y1) && core.Utils.isDefined(this._x2) && core.Utils.isDefined(this._y2)) + if($defined(this._x1) && $defined(this._y1) && $defined(this._x2) && $defined(this._y2)) { this._calculateAutoControlPoints(avoidControlPointFix); var path = "M"+this._x1+","+this._y1 @@ -189,18 +189,18 @@ web2d.peer.svg.CurvedLinePeer.prototype._updateStyle = function() web2d.peer.svg.CurvedLinePeer.prototype._calculateAutoControlPoints = function(avoidControlPointFix){ //Both points available, calculate real points var defaultpoints = core.Utils.calculateDefaultControlPoints(new core.Point(this._x1, this._y1),new core.Point(this._x2,this._y2)); - if(!this._customControlPoint_1 && !(core.Utils.isDefined(avoidControlPointFix) && avoidControlPointFix==0)){ + if(!this._customControlPoint_1 && !($defined(avoidControlPointFix) && avoidControlPointFix==0)){ this._control1.x = defaultpoints[0].x; this._control1.y = defaultpoints[0].y; } - if(!this._customControlPoint_2 && !(core.Utils.isDefined(avoidControlPointFix) && avoidControlPointFix==1)){ + if(!this._customControlPoint_2 && !($defined(avoidControlPointFix) && avoidControlPointFix==1)){ this._control2.x = defaultpoints[1].x; this._control2.y = defaultpoints[1].y; } }; web2d.peer.svg.CurvedLinePeer.prototype.setDashed = function(length,spacing){ - if(core.Utils.isDefined(length) && core.Utils.isDefined(spacing)){ + if($defined(length) && $defined(spacing)){ this._native.setAttribute("stroke-dasharray",length+","+spacing); } else { this._native.setAttribute("stroke-dasharray",""); diff --git a/web2d/src/main/javascript/peer/svg/ElementPeer.js b/web2d/src/main/javascript/peer/svg/ElementPeer.js index 3167b2d9..b974f897 100644 --- a/web2d/src/main/javascript/peer/svg/ElementPeer.js +++ b/web2d/src/main/javascript/peer/svg/ElementPeer.js @@ -36,7 +36,7 @@ web2d.peer.svg.ElementPeer.prototype.setChildren = function(children) web2d.peer.svg.ElementPeer.prototype.getChildren = function() { var result = this._children; - if (!core.Utils.isDefined(result)) + if (!$defined(result)) { result = []; this._children = result; @@ -152,13 +152,13 @@ web2d.peer.svg.ElementPeer.prototype.removeEventListener = function(type, listen web2d.peer.svg.ElementPeer.prototype.setSize = function(width, height) { - if (core.Utils.isDefined(width) && this._size.width != parseInt(width)) + if ($defined(width) && this._size.width != parseInt(width)) { this._size.width = parseInt(width); this._native.setAttribute('width', parseInt(width)); } - if (core.Utils.isDefined(height) && this._size.height != parseInt(height)) + if ($defined(height) && this._size.height != parseInt(height)) { this._size.height = parseInt(height); this._native.setAttribute('height', parseInt(height)); @@ -174,11 +174,11 @@ web2d.peer.svg.ElementPeer.prototype.getSize = function() web2d.peer.svg.ElementPeer.prototype.setFill = function(color, opacity) { - if (core.Utils.isDefined(color)) + if ($defined(color)) { this._native.setAttribute('fill', color); } - if (core.Utils.isDefined(opacity)) + if ($defined(opacity)) { this._native.setAttribute('fill-opacity', opacity); } @@ -204,15 +204,15 @@ web2d.peer.svg.ElementPeer.prototype.getStroke = function() web2d.peer.svg.ElementPeer.prototype.__stokeStyleToStrokDasharray = {solid:[],dot:[1,3],dash:[4,3],longdash:[10,2],dashdot:[5,3,1,3]}; web2d.peer.svg.ElementPeer.prototype.setStroke = function(width, style, color, opacity) { - if (core.Utils.isDefined(width)) + if ($defined(width)) { this._native.setAttribute('stroke-width', width + "px"); } - if (core.Utils.isDefined(color)) + if ($defined(color)) { this._native.setAttribute('stroke', color); } - if (core.Utils.isDefined(style)) + if ($defined(style)) { // Scale the dash array in order to be equal to VML. In VML, stroke style doesn't scale. var dashArrayPoints = this.__stokeStyleToStrokDasharray[style]; @@ -235,7 +235,7 @@ web2d.peer.svg.ElementPeer.prototype.setStroke = function(width, style, color, o this._stokeStyle = style; } - if (core.Utils.isDefined(opacity)) + if ($defined(opacity)) { this._native.setAttribute('stroke-opacity', opacity); } @@ -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 (!core.Utils.isDefined(listener)) + if (!$defined(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 (!core.Utils.isDefined(listeners)) + if (!$defined(listeners)) { listeners = []; this._changeListeners[type] = listeners; diff --git a/web2d/src/main/javascript/peer/svg/ElipsePeer.js b/web2d/src/main/javascript/peer/svg/ElipsePeer.js index f8575175..644d52f2 100644 --- a/web2d/src/main/javascript/peer/svg/ElipsePeer.js +++ b/web2d/src/main/javascript/peer/svg/ElipsePeer.js @@ -29,12 +29,12 @@ objects.extend(web2d.peer.svg.ElipsePeer, web2d.peer.svg.ElementPeer); web2d.peer.svg.ElipsePeer.prototype.setSize = function(width, height) { web2d.peer.svg.ElipsePeer.superClass.setSize.call(this, width, height); - if (core.Utils.isDefined(width)) + if ($defined(width)) { this._native.setAttribute('rx', width / 2); } - if (core.Utils.isDefined(height)) + if ($defined(height)) { this._native.setAttribute('ry', height / 2); } @@ -48,12 +48,12 @@ web2d.peer.svg.ElipsePeer.prototype.setPosition = function(cx, cy) var size =this.getSize(); cx =cx + size.width/2; cy =cy + size.height/2; - if (core.Utils.isDefined(cx)) + if ($defined(cx)) { this._native.setAttribute('cx', cx); } - if (core.Utils.isDefined(cy)) + if ($defined(cy)) { this._native.setAttribute('cy', cy); } diff --git a/web2d/src/main/javascript/peer/svg/Font.js b/web2d/src/main/javascript/peer/svg/Font.js index 0922f1be..40d4cfa0 100644 --- a/web2d/src/main/javascript/peer/svg/Font.js +++ b/web2d/src/main/javascript/peer/svg/Font.js @@ -25,15 +25,15 @@ web2d.peer.svg.Font = function() web2d.peer.svg.Font.prototype.init = function(args) { - if (core.Utils.isDefined(args.size)) + if ($defined(args.size)) { this._size = parseInt(args.size); } - if (core.Utils.isDefined(args.style)) + if ($defined(args.style)) { this._style = args.style; } - if (core.Utils.isDefined(args.weight)) + if ($defined(args.weight)) { this._weight = args.weight; } diff --git a/web2d/src/main/javascript/peer/svg/GroupPeer.js b/web2d/src/main/javascript/peer/svg/GroupPeer.js index 83148fdc..49c60c9b 100644 --- a/web2d/src/main/javascript/peer/svg/GroupPeer.js +++ b/web2d/src/main/javascript/peer/svg/GroupPeer.js @@ -84,12 +84,12 @@ web2d.peer.svg.GroupPeer.prototype.updateTransform = function() web2d.peer.svg.GroupPeer.prototype.setCoordOrigin = function(x, y) { var change = x!=this._coordOrigin.x || y!=this._coordOrigin.y; - if (core.Utils.isDefined(x)) + if ($defined(x)) { this._coordOrigin.x = x; } - if (core.Utils.isDefined(y)) + if ($defined(y)) { this._coordOrigin.y = y; } @@ -108,12 +108,12 @@ web2d.peer.svg.GroupPeer.prototype.setSize = function(width, height) web2d.peer.svg.GroupPeer.prototype.setPosition = function(x, y) { var change = x!=this._position.x || y!=this._position.y; - if (core.Utils.isDefined(x)) + if ($defined(x)) { this._position.x = parseInt(x); } - if (core.Utils.isDefined(y)) + if ($defined(y)) { this._position.y = parseInt(y); } diff --git a/web2d/src/main/javascript/peer/svg/LinePeer.js b/web2d/src/main/javascript/peer/svg/LinePeer.js index 68f09c53..39341917 100644 --- a/web2d/src/main/javascript/peer/svg/LinePeer.js +++ b/web2d/src/main/javascript/peer/svg/LinePeer.js @@ -55,12 +55,12 @@ web2d.peer.svg.LinePeer.prototype.getTo = function(){ */ web2d.peer.svg.LinePeer.prototype.setArrowStyle = function(startStyle, endStyle) { - if (core.Utils.isDefined(startStyle)) + if ($defined(startStyle)) { // Todo: This must be implemented ... } - if (core.Utils.isDefined(endStyle)) + if ($defined(endStyle)) { // Todo: This must be implemented ... } diff --git a/web2d/src/main/javascript/peer/svg/PolyLinePeer.js b/web2d/src/main/javascript/peer/svg/PolyLinePeer.js index d08cbc3a..dad1af28 100644 --- a/web2d/src/main/javascript/peer/svg/PolyLinePeer.js +++ b/web2d/src/main/javascript/peer/svg/PolyLinePeer.js @@ -79,7 +79,7 @@ web2d.peer.svg.PolyLinePeer.prototype._updatePath = function() web2d.peer.svg.PolyLinePeer.prototype._updateStraightPath = function() { - if (core.Utils.isDefined(this._x1) && core.Utils.isDefined(this._x2) && core.Utils.isDefined(this._y1) && core.Utils.isDefined(this._y2)) + if ($defined(this._x1) && $defined(this._x2) && $defined(this._y1) && $defined(this._y2)) { var path = web2d.PolyLine.buildStraightPath(this.breakDistance, this._x1, this._y1, this._x2, this._y2); this._native.setAttribute('points', path); @@ -92,7 +92,7 @@ web2d.peer.svg.PolyLinePeer.prototype._updateMiddleCurvePath = function() var y1 = this._y1; var x2 = this._x2; var y2 = this._y2; - if (core.Utils.isDefined(x1) && core.Utils.isDefined(x2) && core.Utils.isDefined(y1) && core.Utils.isDefined(y2)) + if ($defined(x1) && $defined(x2) && $defined(y1) && $defined(y2)) { var diff = x2 - x1; var middlex = (diff / 2) + x1; @@ -113,7 +113,7 @@ web2d.peer.svg.PolyLinePeer.prototype._updateMiddleCurvePath = function() web2d.peer.svg.PolyLinePeer.prototype._updateCurvePath = function() { - if (core.Utils.isDefined(this._x1) && core.Utils.isDefined(this._x2) && core.Utils.isDefined(this._y1) && core.Utils.isDefined(this._y2)) + if ($defined(this._x1) && $defined(this._x2) && $defined(this._y1) && $defined(this._y2)) { var path = web2d.PolyLine.buildCurvedPath(this.breakDistance, this._x1, this._y1, this._x2, this._y2); this._native.setAttribute('points', path); diff --git a/web2d/src/main/javascript/peer/svg/RectPeer.js b/web2d/src/main/javascript/peer/svg/RectPeer.js index f48188f3..885fffc6 100644 --- a/web2d/src/main/javascript/peer/svg/RectPeer.js +++ b/web2d/src/main/javascript/peer/svg/RectPeer.js @@ -31,11 +31,11 @@ objects.extend(web2d.peer.svg.RectPeer, web2d.peer.svg.ElementPeer); web2d.peer.svg.RectPeer.prototype.setPosition = function(x, y) { - if (core.Utils.isDefined(x)) + if ($defined(x)) { this._native.setAttribute('x', parseInt(x)); } - if (core.Utils.isDefined(y)) + if ($defined(y)) { this._native.setAttribute('y', parseInt(y)); } @@ -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 (core.Utils.isDefined(this._arc)) + if ($defined(this._arc)) { // Transform percentages to SVG format. var arc = (min / 2) * this._arc; diff --git a/web2d/src/main/javascript/peer/svg/TextPeer.js b/web2d/src/main/javascript/peer/svg/TextPeer.js index 270bcb46..09645c69 100644 --- a/web2d/src/main/javascript/peer/svg/TextPeer.js +++ b/web2d/src/main/javascript/peer/svg/TextPeer.js @@ -45,7 +45,7 @@ web2d.peer.svg.TextPeer.prototype.setText = function(text) { text = core.Utils.escapeInvalidTags(text); var child = this._native.firstChild; - if (core.Utils.isDefined(child)) + if ($defined(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(core.Utils.isDefined(this._parent) && core.Utils.isDefined(this._native.getBBox)) + if($defined(this._parent) && $defined(this._native.getBBox)) height = this.getHeight(); var size = parseInt(height); this._native.setAttribute('y', y+size*3/4); @@ -78,19 +78,19 @@ web2d.peer.svg.TextPeer.prototype.getPosition = function() web2d.peer.svg.TextPeer.prototype.setFont = function(font, size, style, weight) { - if (core.Utils.isDefined(font)) + if ($defined(font)) { this._font = new web2d.Font(font, this); } - if (core.Utils.isDefined(style)) + if ($defined(style)) { this._font.setStyle(style); } - if (core.Utils.isDefined(weight)) + if ($defined(weight)) { this._font.setWeight(weight); } - if (core.Utils.isDefined(size)) + if ($defined(size)) { this._font.setSize(size); } diff --git a/web2d/src/main/javascript/peer/svg/WorkspacePeer.js b/web2d/src/main/javascript/peer/svg/WorkspacePeer.js index 2f7c02d3..ab4bc146 100644 --- a/web2d/src/main/javascript/peer/svg/WorkspacePeer.js +++ b/web2d/src/main/javascript/peer/svg/WorkspacePeer.js @@ -46,12 +46,12 @@ web2d.peer.svg.WorkspacePeer.prototype.setCoordSize = function(width, height) { coords = viewBox.split(/ /); } - if (core.Utils.isDefined(width)) + if ($defined(width)) { coords[2] = width; } - if (core.Utils.isDefined(height)) + if ($defined(height)) { coords[3] = height; } @@ -83,12 +83,12 @@ web2d.peer.svg.WorkspacePeer.prototype.setCoordOrigin = function(x, y) coords = viewBox.split(/ /); } - if (core.Utils.isDefined(x)) + if ($defined(x)) { coords[0] = x; } - if (core.Utils.isDefined(y)) + if ($defined(y)) { coords[1] = y; } diff --git a/web2d/src/main/javascript/peer/utils/EventUtils.js b/web2d/src/main/javascript/peer/utils/EventUtils.js index 758d2fde..99bad792 100644 --- a/web2d/src/main/javascript/peer/utils/EventUtils.js +++ b/web2d/src/main/javascript/peer/utils/EventUtils.js @@ -21,7 +21,7 @@ web2d.peer.utils.EventUtils = broadcastChangeEvent:function (elementPeer, type) { var listeners = elementPeer.getChangeEventListeners(type); - if (core.Utils.isDefined(listeners)) + if ($defined(listeners)) { for (var i = 0; i < listeners.length; i++) { diff --git a/wise-webapp/src/main/webapp/js/IconPanel.js b/wise-webapp/src/main/webapp/js/IconPanel.js index 88a5c281..20699c6f 100644 --- a/wise-webapp/src/main/webapp/js/IconPanel.js +++ b/wise-webapp/src/main/webapp/js/IconPanel.js @@ -17,7 +17,7 @@ */ var IconPanel = new Class({ - Extends:Options, + Implements:[Options,Events], options:{ width:253, initialWidth:0, @@ -28,16 +28,19 @@ var IconPanel = new Class({ onStart:Class.empty, state:'close' }, + initialize:function(options){ this.setOptions(options); - if($chk(this.options.button)) + if($defined(this.options.button)) { this.init(); } }, + setButton:function(button){ this.options.button=button; }, + init:function(){ var panel = new Element('div'); var coord = this.options.button.getCoordinates(); @@ -54,25 +57,28 @@ var IconPanel = new Class({ panel.inject($(document.body)); this.registerOpenPanel(); }, + open:function(){ if(this.options.state=='close') { - if(!$chk(this.options.panel)) + if(!$defined(this.options.panel)) { this.init(); } var panel = this.options.panel; - var options = this.options; panel.setStyles({border: '1px solid #636163', opacity:100}); this.fireEvent('onStart'); + var fx = panel.effects({duration:500, onComplete:function(){ this.registerClosePanel(); }.bind(this)}); + fx.start({'height':[0,this.options.height], 'width':[this.options.initialWidth, this.options.width]}); this.options.state='open'; } }, + close:function(){ if(this.options.state=='open') { @@ -84,12 +90,14 @@ var IconPanel = new Class({ this.options.state = 'close'; } }, + registerOpenPanel:function(){ this.options.button.removeEvents('click'); this.options.button.addEvent('click',function(event){ this.open(); }.bindWithEvent(this)); }, + registerClosePanel:function(){ this.options.button.removeEvents('click'); this.options.button.addEvent('click', function(event){ diff --git a/wise-webapp/src/main/webapp/js/mootools.js b/wise-webapp/src/main/webapp/js/mootools.js index 16c6c936..8861d889 100644 --- a/wise-webapp/src/main/webapp/js/mootools.js +++ b/wise-webapp/src/main/webapp/js/mootools.js @@ -48,8 +48,7 @@ Arguments: function $defined(obj) { return (obj != undefined); -} -; +}; /* Function: $type