Replace core.Utils.isDefined for $defined.

This commit is contained in:
Paulo Veiga 2011-07-27 13:44:09 -03:00
parent f60755fd8e
commit 0b67b42045
66 changed files with 406 additions and 401 deletions

View File

@ -18,17 +18,24 @@
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') {
@ -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,7 +184,7 @@ core.Utils.createDocument = function() {
}
;
if (core.Utils.isDefined(doc)) {
if ($defined(doc)) {
break;
}
}
@ -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;
@ -285,25 +284,24 @@ core.Utils.animateVisibility = function (elems, isVisible, doneFn){
var _opacity = (isVisible ? 0 : 1);
if (isVisible) {
elems.forEach(function(child, index) {
if(core.Utils.isDefined(child)){
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)) {
$clear(_fadeEffect);
_fadeEffect = null;
elems.forEach(function(child, index) {
if(core.Utils.isDefined(child)){
if ($defined(child)) {
child.setVisibility(isVisible);
}
});
if(core.Utils.isDefined(doneFn))
if ($defined(doneFn))
doneFn.attempt();
}
else {
@ -313,7 +311,7 @@ core.Utils.animateVisibility = function (elems, isVisible, doneFn){
}
_opacity -= (1 / step) * fix;
elems.forEach(function(child, index) {
if(core.Utils.isDefined(child)){
if ($defined(child)) {
child.setOpacity(_opacity);
}
});
@ -356,7 +354,7 @@ core.Utils.animatePosition = function (elems, doneFn, designer){
})[0];
currentTopic.setPosition(mod.originalPos, false);
}
if(core.Utils.isDefined(doneFn))
if ($defined(doneFn))
doneFn.attempt();
}
i--;

View File

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

View File

@ -66,8 +66,8 @@ mindplot.BidirectionalArray = new Class({
},
get :function(index, sign) {
core.assert(core.Utils.isDefined(index), 'Illegal argument, index must be passed.');
if (core.Utils.isDefined(sign)) {
core.assert($defined(index), 'Illegal argument, index must be passed.');
if ($defined(sign)) {
core.assert(index >= 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;
},

View File

@ -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() {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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();
},

View File

@ -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));

View File

@ -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);
}

View File

@ -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);
}
},

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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) {

View File

@ -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);

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 (!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)
{

View File

@ -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();

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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){

View File

@ -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;
};

View File

@ -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

View File

@ -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;

View File

@ -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; i<dispatcher._listeners.length; i++)
{
@ -122,7 +122,7 @@ mindplot.Topic.prototype.getShapeType = function()
{
var model = this.getModel();
var result = model.getShapeType();
if (!core.Utils.isDefined(result))
if (!$defined(result))
{
result = this._defaultShapeType();
}
@ -140,7 +140,7 @@ mindplot.Topic.prototype._removeInnerShape = function()
mindplot.Topic.prototype.INNER_RECT_ATTRIBUTES = {stroke:'0.5 solid'};
mindplot.Topic.prototype.getInnerShape = function()
{
if (!core.Utils.isDefined(this._innerShape))
if (!$defined(this._innerShape))
{
// Create inner box.
this._innerShape = this.buildShape(this.INNER_RECT_ATTRIBUTES);
@ -170,7 +170,7 @@ mindplot.Topic.prototype.getInnerShape = function()
mindplot.Topic.prototype.buildShape = function(attributes, type)
{
var result;
if (!core.Utils.isDefined(type))
if (!$defined(type))
{
type = this.getShapeType();
}
@ -247,7 +247,7 @@ mindplot.Topic.OUTER_SHAPE_ATTRIBUTES = {fillColor:'#dbe2e6',stroke:'1 solid #77
mindplot.Topic.prototype.getOuterShape = function()
{
if (!core.Utils.isDefined(this._outerShape))
if (!$defined(this._outerShape))
{
var rect = this.buildShape(mindplot.Topic.OUTER_SHAPE_ATTRIBUTES, mindplot.NodeModel.SHAPE_TYPE_ROUNDED_RECT);
rect.setPosition(-2, -3);
@ -260,7 +260,7 @@ mindplot.Topic.prototype.getOuterShape = function()
mindplot.Topic.prototype.getTextShape = function()
{
if (!core.Utils.isDefined(this._text))
if (!$defined(this._text))
{
var model = this.getModel();
this._text = this._buildTextShape();
@ -274,7 +274,7 @@ mindplot.Topic.prototype.getTextShape = function()
mindplot.Topic.prototype.getOrBuildIconGroup = function()
{
if (!core.Utils.isDefined(this._icon))
if (!$defined(this._icon))
{
this._icon = this._buildIconGroup();
var group = this.get2DElement();
@ -459,7 +459,7 @@ mindplot.Topic.prototype._buildTextShape = function(disableEventsListeners)
result.addEventListener('mousedown', function(event)
{
var eventDispatcher = topic.getInnerShape()._dispatcherByEventType['mousedown'];
if (core.Utils.isDefined(eventDispatcher))
if ($defined(eventDispatcher))
{
eventDispatcher.eventListener(event);
}
@ -514,7 +514,7 @@ mindplot.Topic.prototype.setFontFamily = function(value, updateModel)
{
var textShape = this.getTextShape();
textShape.setFontFamily(value);
if (core.Utils.isDefined(updateModel) && updateModel)
if ($defined(updateModel) && updateModel)
{
var model = this.getModel();
model.setFontFamily(value);
@ -536,7 +536,7 @@ mindplot.Topic.prototype.setFontSize = function(value, updateModel)
{
var textShape = this.getTextShape();
textShape.setSize(value);
if (core.Utils.isDefined(updateModel) && updateModel)
if ($defined(updateModel) && updateModel)
{
var model = this.getModel();
model.setFontSize(value);
@ -559,7 +559,7 @@ mindplot.Topic.prototype.setFontStyle = function(value, updateModel)
{
var textShape = this.getTextShape();
textShape.setStyle(value);
if (core.Utils.isDefined(updateModel) && updateModel)
if ($defined(updateModel) && updateModel)
{
var model = this.getModel();
model.setFontStyle(value);
@ -581,7 +581,7 @@ mindplot.Topic.prototype.setFontWeight = function(value, updateModel)
{
var textShape = this.getTextShape();
textShape.setWeight(value);
if (core.Utils.isDefined(updateModel) && updateModel)
if ($defined(updateModel) && updateModel)
{
var model = this.getModel();
model.setFontWeight(value);
@ -592,7 +592,7 @@ mindplot.Topic.prototype.getFontWeight = function()
{
var model = this.getModel();
var result = model.getFontWeight();
if (!core.Utils.isDefined(result))
if (!$defined(result))
{
var font = this._defaultFontStyle();
result = font.weight;
@ -604,7 +604,7 @@ mindplot.Topic.prototype.getFontFamily = function()
{
var model = this.getModel();
var result = model.getFontFamily();
if (!core.Utils.isDefined(result))
if (!$defined(result))
{
var font = this._defaultFontStyle();
result = font.font;
@ -616,7 +616,7 @@ mindplot.Topic.prototype.getFontColor = function()
{
var model = this.getModel();
var result = model.getFontColor();
if (!core.Utils.isDefined(result))
if (!$defined(result))
{
var font = this._defaultFontStyle();
result = font.color;
@ -628,7 +628,7 @@ mindplot.Topic.prototype.getFontStyle = function()
{
var model = this.getModel();
var result = model.getFontStyle();
if (!core.Utils.isDefined(result))
if (!$defined(result))
{
var font = this._defaultFontStyle();
result = font.style;
@ -640,7 +640,7 @@ mindplot.Topic.prototype.getFontSize = function()
{
var model = this.getModel();
var result = model.getFontSize();
if (!core.Utils.isDefined(result))
if (!$defined(result))
{
var font = this._defaultFontStyle();
result = font.size;
@ -652,7 +652,7 @@ mindplot.Topic.prototype.setFontColor = function(value, updateModel)
{
var textShape = this.getTextShape();
textShape.setColor(value);
if (core.Utils.isDefined(updateModel) && updateModel)
if ($defined(updateModel) && updateModel)
{
var model = this.getModel();
model.setFontColor(value);
@ -675,7 +675,7 @@ mindplot.Topic.prototype._setText = function(text, updateModel)
setTimeout(executor(this), 0);*/
core.Executor.instance.delay(this.updateNode, 0,this, [updateModel]);
if (core.Utils.isDefined(updateModel) && updateModel)
if ($defined(updateModel) && updateModel)
{
var model = this.getModel();
model.setText(text);
@ -691,7 +691,7 @@ mindplot.Topic.prototype.getText = function()
{
var model = this.getModel();
var result = model.getText();
if (!core.Utils.isDefined(result))
if (!$defined(result))
{
result = this._defaultText();
}
@ -710,7 +710,7 @@ mindplot.Topic.prototype._setBackgroundColor = function(color, updateModel)
var connector = this.getShrinkConnector();
connector.setFill(color);
if (core.Utils.isDefined(updateModel) && updateModel)
if ($defined(updateModel) && updateModel)
{
var model = this.getModel();
model.setBackgroundColor(color);
@ -721,7 +721,7 @@ mindplot.Topic.prototype.getBackgroundColor = function()
{
var model = this.getModel();
var result = model.getBackgroundColor();
if (!core.Utils.isDefined(result))
if (!$defined(result))
{
result = this._defaultBackgroundColor();
}
@ -742,7 +742,7 @@ mindplot.Topic.prototype._setBorderColor = function(color, updateModel)
connector.setAttribute('strokeColor', color);
if (core.Utils.isDefined(updateModel) && updateModel)
if ($defined(updateModel) && updateModel)
{
var model = this.getModel();
model.setBorderColor(color);
@ -753,7 +753,7 @@ mindplot.Topic.prototype.getBorderColor = function()
{
var model = this.getModel();
var result = model.getBorderColor();
if (!core.Utils.isDefined(result))
if (!$defined(result))
{
result = this._defaultBorderColor();
}
@ -934,7 +934,7 @@ mindplot.Topic.prototype.getIncomingLines = function()
{
var node = children[i];
var line = node.getOutgoingLine();
if (core.Utils.isDefined(line))
if ($defined(line))
{
result.push(line);
}
@ -946,7 +946,7 @@ mindplot.Topic.prototype.getOutgoingConnectedTopic = function()
{
var result = null;
var line = this.getOutgoingLine();
if (core.Utils.isDefined(line))
if ($defined(line))
{
result = line.getTargetTopic();
}
@ -958,7 +958,7 @@ mindplot.Topic.prototype._updateConnectionLines = function()
{
// Update this to parent line ...
var outgoingLine = this.getOutgoingLine();
if (core.Utils.isDefined(outgoingLine))
if ($defined(outgoingLine))
{
outgoingLine.redraw();
}
@ -1008,7 +1008,7 @@ mindplot.Topic.prototype.moveToBack = function(){
this._relationships[j].moveToBack();
}
var connector = this.getShrinkConnector();
if(core.Utils.isDefined(connector)){
if($defined(connector)){
connector.moveToBack();
}
@ -1021,7 +1021,7 @@ mindplot.Topic.prototype.moveToFront = function(){
this.get2DElement().moveToFront();
var connector = this.getShrinkConnector();
if(core.Utils.isDefined(connector)){
if($defined(connector)){
connector.moveToFront();
}
// Update relationship lines
@ -1152,7 +1152,7 @@ mindplot.Topic.prototype.removeEventListener = function(type, listener)
mindplot.Topic.prototype._setSize = function(size)
{
core.assert(size, "size can not be null");
core.assert(core.Utils.isDefined(size.width), "size seem not to be a valid element");
core.assert($defined(size.width), "size seem not to be a valid element");
mindplot.Topic.superClass.setSize.call(this, size);
@ -1186,7 +1186,7 @@ mindplot.Topic.prototype._updatePositionOnChangeSize = function(oldSize, newSize
mindplot.Topic.prototype.disconnect = function(workspace)
{
var outgoingLine = this.getOutgoingLine();
if (core.Utils.isDefined(outgoingLine))
if ($defined(outgoingLine))
{
core.assert(workspace, 'workspace can not be null');
@ -1264,7 +1264,7 @@ mindplot.Topic.prototype.connectTo = function(targetTopic, workspace, isVisible)
// Create a connection line ...
var outgoingLine = new mindplot.ConnectionLine(this, targetTopic);
if(core.Utils.isDefined(isVisible))
if($defined(isVisible))
outgoingLine.setVisibility(isVisible);
this._outgoingLine = outgoingLine;
workspace.appendChild(outgoingLine);
@ -1309,7 +1309,7 @@ mindplot.Topic.prototype._removeChild = function(child)
mindplot.Topic.prototype._getChildren = function()
{
var result = this._children;
if (!core.Utils.isDefined(result))
if (!$defined(result))
{
this._children = [];
result = this._children;
@ -1322,7 +1322,7 @@ mindplot.Topic.prototype.removeFromWorkspace = function(workspace)
var elem2d = this.get2DElement();
workspace.removeChild(elem2d);
var line = this.getOutgoingLine();
if (core.Utils.isDefined(line))
if ($defined(line))
{
workspace.removeChild(line);
}
@ -1346,7 +1346,7 @@ mindplot.Topic.prototype.createDragNode = function()
// Is the node already connected ?
var targetTopic = this.getOutgoingConnectedTopic();
if (core.Utils.isDefined(targetTopic))
if ($defined(targetTopic))
{
dragNode.connectTo(targetTopic);
}
@ -1377,7 +1377,7 @@ mindplot.Topic.prototype.updateNode = function(updatePosition)
textShape.setPosition(iconOffset+this._offset+2, pos);
textShape.setTextSize(sizeWidth, sizeHeight);
var iconGroup = this.getIconGroup();
if(core.Utils.isDefined(iconGroup))
if($defined(iconGroup))
iconGroup.updateIconGroupPosition();
}
};

View File

@ -30,7 +30,7 @@ mindplot.VariableDistanceBoard = new Class({
var index = this._orderToIndex(order);
var result = entries.get(index);
if (!core.Utils.isDefined(result)) {
if (!$defined(result)) {
// I've not found a entry. I have to create a new one.
var i = 1;
var zeroEntry = entries.get(0);
@ -103,7 +103,7 @@ mindplot.VariableDistanceBoard = 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 zeroEntry = entries.get(0);
if (zeroEntry.isCoordinateIn(pos.y)) {
@ -123,7 +123,7 @@ mindplot.VariableDistanceBoard = new Class({
// Move to the next entry ...
var index = i * sign;
var entry = entries.get(index);
if (core.Utils.isDefined(entry)) {
if ($defined(entry)) {
currentEntry = entry;
} else {
// Calculate boundaries...
@ -174,16 +174,16 @@ mindplot.VariableDistanceBoard = new Class({
var i = Math.abs(index) + 1;
while (currentTopic) {
var e = entries.get(i, indexSign);
if (core.Utils.isDefined(currentTopic) && !core.Utils.isDefined(e)) {
if ($defined(currentTopic) && !$defined(e)) {
var entryOrder = this._indexToOrder(i * indexSign);
e = this.lookupEntryByOrder(entryOrder);
}
// Move the topic to the next entry ...
var topic = null;
if (core.Utils.isDefined(e)) {
if ($defined(e)) {
topic = e.getTopic();
if (core.Utils.isDefined(currentTopic)) {
if ($defined(currentTopic)) {
e.setTopic(currentTopic);
}
this.update(e);

View File

@ -73,7 +73,7 @@ mindplot.Workspace = new Class({
},
appendChild: function(shape) {
if (core.Utils.isDefined(shape.addToWorkspace)) {
if ($defined(shape.addToWorkspace)) {
shape.addToWorkspace(this);
} else {
this._workspace.appendChild(shape);
@ -82,7 +82,7 @@ mindplot.Workspace = new Class({
removeChild: function(shape) {
// Element is a node, not a web2d element?
if (core.Utils.isDefined(shape.removeFromWorkspace)) {
if ($defined(shape.removeFromWorkspace)) {
shape.removeFromWorkspace(this);
} else {
this._workspace.removeChild(shape);
@ -152,7 +152,7 @@ mindplot.Workspace = new Class({
var mWorkspace = this;
var mouseDownListener = function(event)
{
if (!core.Utils.isDefined(workspace.mouseMoveListener)) {
if (!$defined(workspace.mouseMoveListener)) {
if (mWorkspace.isWorkspaceEventsEnabled()) {
mWorkspace.enableWorkspaceEvents(false);

View File

@ -28,7 +28,7 @@ mindplot.XMLMindmapSerializerFactory.getSerializerFromDocument = function(domDoc
mindplot.XMLMindmapSerializerFactory.getSerializer = function(version){
if(!core.Utils.isDefined(version)){
if(!$defined(version)){
version = mindplot.ModelCodeName.BETA;
}
var codeNames = mindplot.XMLMindmapSerializerFactory._codeNames;

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 (core.Utils.isDefined(name))
if ($defined(name))
{
mapElem.setAttribute('name', name);
}
@ -69,12 +69,12 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
}
var text = topic.getText();
if (core.Utils.isDefined(text)) {
if ($defined(text)) {
parentTopic.setAttribute('text', text);
}
var shape = topic.getShapeType();
if (core.Utils.isDefined(shape)) {
if ($defined(shape)) {
parentTopic.setAttribute('shape', shape);
}
@ -101,19 +101,19 @@ mindplot.XMLMindmapSerializer_Beta.prototype._topicToXML = function(document, to
var fontStyle = topic.getFontStyle();
font += (fontStyle ? fontStyle : '') + ';';
if (core.Utils.isDefined(fontFamily) || core.Utils.isDefined(fontSize) || core.Utils.isDefined(fontColor)
|| core.Utils.isDefined(fontWeight )|| core.Utils.isDefined(fontStyle))
if ($defined(fontFamily) || $defined(fontSize) || $defined(fontColor)
|| $defined(fontWeight )|| $defined(fontStyle))
{
parentTopic.setAttribute('fontStyle', font);
}
var bgColor = topic.getBackgroundColor();
if (core.Utils.isDefined(bgColor)) {
if ($defined(bgColor)) {
parentTopic.setAttribute('bgColor', bgColor);
}
var brColor = topic.getBorderColor();
if (core.Utils.isDefined(brColor)) {
if ($defined(brColor)) {
parentTopic.setAttribute('brColor', brColor);
}
@ -208,28 +208,28 @@ mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem
// Load attributes...
var text = domElem.getAttribute('text');
if (core.Utils.isDefined(text)) {
if ($defined(text)) {
topic.setText(text);
}
var order = domElem.getAttribute('order');
if (core.Utils.isDefined(order)) {
if ($defined(order)) {
topic.setOrder(order);
}
var shape = domElem.getAttribute('shape');
if (core.Utils.isDefined(shape)) {
if ($defined(shape)) {
topic.setShapeType(shape);
}
var isShrink = domElem.getAttribute('shrink');
if(core.Utils.isDefined(isShrink))
if($defined(isShrink))
{
topic.setChildrenShrinked(isShrink);
}
var fontStyle = domElem.getAttribute('fontStyle');
if (core.Utils.isDefined(fontStyle)) {
if ($defined(fontStyle)) {
var font = fontStyle.split(';');
if (font[0])
@ -259,17 +259,17 @@ mindplot.XMLMindmapSerializer_Beta.prototype._deserializeNode = function(domElem
}
var bgColor = domElem.getAttribute('bgColor');
if (core.Utils.isDefined(bgColor)) {
if ($defined(bgColor)) {
topic.setBackgroundColor(bgColor);
}
var borderColor = domElem.getAttribute('brColor');
if (core.Utils.isDefined(borderColor)) {
if ($defined(borderColor)) {
topic.setBorderColor(borderColor);
}
var position = domElem.getAttribute('position');
if (core.Utils.isDefined(position)) {
if ($defined(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 (core.Utils.isDefined(name))
if ($defined(name))
{
mapElem.setAttribute('name', name);
}
var version = mindmap.getVersion();
if (core.Utils.isDefined(version))
if ($defined(version))
{
mapElem.setAttribute('version', version);
}
@ -88,12 +88,12 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
}
var text = topic.getText();
if (core.Utils.isDefined(text)) {
if ($defined(text)) {
parentTopic.setAttribute('text', text);
}
var shape = topic.getShapeType();
if (core.Utils.isDefined(shape)) {
if ($defined(shape)) {
parentTopic.setAttribute('shape', shape);
}
@ -123,19 +123,19 @@ mindplot.XMLMindmapSerializer_Pela.prototype._topicToXML = function(document, to
var fontStyle = topic.getFontStyle();
font += (fontStyle ? fontStyle : '') + ';';
if (core.Utils.isDefined(fontFamily) || core.Utils.isDefined(fontSize) || core.Utils.isDefined(fontColor)
|| core.Utils.isDefined(fontWeight) || core.Utils.isDefined(fontStyle))
if ($defined(fontFamily) || $defined(fontSize) || $defined(fontColor)
|| $defined(fontWeight) || $defined(fontStyle))
{
parentTopic.setAttribute('fontStyle', font);
}
var bgColor = topic.getBackgroundColor();
if (core.Utils.isDefined(bgColor)) {
if ($defined(bgColor)) {
parentTopic.setAttribute('bgColor', bgColor);
}
var brColor = topic.getBorderColor();
if (core.Utils.isDefined(brColor)) {
if ($defined(brColor)) {
parentTopic.setAttribute('brColor', brColor);
}
@ -206,11 +206,11 @@ mindplot.XMLMindmapSerializer_Pela.prototype._relationshipToXML = function(docum
var lineType = relationship.getLineType();
relationDom.setAttribute("lineType",lineType);
if(lineType==mindplot.ConnectionLine.CURVED || lineType==mindplot.ConnectionLine.SIMPLE_CURVED){
if(core.Utils.isDefined(relationship.getSrcCtrlPoint())){
if($defined(relationship.getSrcCtrlPoint())){
var srcPoint = relationship.getSrcCtrlPoint();
relationDom.setAttribute("srcCtrlPoint",srcPoint.x+","+srcPoint.y);
}
if(core.Utils.isDefined(relationship.getDestCtrlPoint())){
if($defined(relationship.getDestCtrlPoint())){
var destPoint = relationship.getDestCtrlPoint();
relationDom.setAttribute("destCtrlPoint",destPoint.x+","+destPoint.y);
}
@ -263,7 +263,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(core.Utils.isDefined(id)) {
if($defined(id)) {
id=parseInt(id);
}
@ -276,28 +276,28 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
var topic = mindmap.createNode(type, id);
var text = domElem.getAttribute('text');
if (core.Utils.isDefined(text)) {
if ($defined(text)) {
topic.setText(text);
}
var order = domElem.getAttribute('order');
if (core.Utils.isDefined(order)) {
if ($defined(order)) {
topic.setOrder(parseInt(order));
}
var shape = domElem.getAttribute('shape');
if (core.Utils.isDefined(shape)) {
if ($defined(shape)) {
topic.setShapeType(shape);
}
var isShrink = domElem.getAttribute('shrink');
if(core.Utils.isDefined(isShrink))
if($defined(isShrink))
{
topic.setChildrenShrinked(isShrink);
}
var fontStyle = domElem.getAttribute('fontStyle');
if (core.Utils.isDefined(fontStyle)) {
if ($defined(fontStyle)) {
var font = fontStyle.split(';');
if (font[0])
@ -327,17 +327,17 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeNode = function(domElem
}
var bgColor = domElem.getAttribute('bgColor');
if (core.Utils.isDefined(bgColor)) {
if ($defined(bgColor)) {
topic.setBackgroundColor(bgColor);
}
var borderColor = domElem.getAttribute('brColor');
if (core.Utils.isDefined(borderColor)) {
if ($defined(borderColor)) {
topic.setBorderColor(borderColor);
}
var position = domElem.getAttribute('position');
if (core.Utils.isDefined(position)) {
if ($defined(position)) {
var pos = position.split(',');
topic.setPosition(pos[0], pos[1]);
topic.setFinalPosition(pos[0], pos[1]);
@ -400,10 +400,10 @@ mindplot.XMLMindmapSerializer_Pela.prototype._deserializeRelationship = function
}
var model = mindmap.createRelationship(srcId, destId);
model.setLineType(lineType);
if(core.Utils.isDefined(srcCtrlPoint) && srcCtrlPoint!=""){
if($defined(srcCtrlPoint) && srcCtrlPoint!=""){
model.setSrcCtrlPoint(core.Point.fromString(srcCtrlPoint));
}
if(core.Utils.isDefined(destCtrlPoint) && destCtrlPoint!=""){
if($defined(destCtrlPoint) && destCtrlPoint!=""){
model.setDestCtrlPoint(core.Point.fromString(destCtrlPoint));
}
model.setEndArrow(endArrow=="true");

View File

@ -25,7 +25,7 @@ mindplot.commands.AddTopicCommand = new Class(
this._model = model;
this._parentId = parentTopicId;
this._id = mindplot.Command._nextUUID();
this._animated = core.Utils.isDefined(animated)?animated:false;
this._animated = $defined(animated)?animated:false;
},
execute: function(commandContext)
{
@ -34,7 +34,7 @@ mindplot.commands.AddTopicCommand = new Class(
var topic = commandContext.createTopic(this._model, !this._animated);
// Connect to topic ...
if (core.Utils.isDefined(this._parentId))
if ($defined(this._parentId))
{
var parentTopic = commandContext.findTopics(this._parentId)[0];
commandContext.connect(topic, parentTopic, !this._animated);

View File

@ -47,7 +47,7 @@ mindplot.commands.DragTopicCommand = new Class(
// }
// Disconnect topic ..
if (core.Utils.isDefined(origParentTopic))
if ($defined(origParentTopic))
{
commandContext.disconnect(topic);
}
@ -70,7 +70,7 @@ mindplot.commands.DragTopicCommand = new Class(
this._position = origPosition;
// Finally, connect topic ...
if (core.Utils.isDefined(this._parentId))
if ($defined(this._parentId))
{
var parentTopic = commandContext.findTopics([this._parentId])[0];
commandContext.connect(topic, parentTopic);
@ -78,7 +78,7 @@ mindplot.commands.DragTopicCommand = new Class(
// Backup old parent id ...
this._parentId = null;
if (core.Utils.isDefined(origParentTopic))
if ($defined(origParentTopic))
{
this._parentId = origParentTopic.getId();
}

View File

@ -70,7 +70,7 @@ mindplot.commands.MoveControlPointCommand = new Class(
var model = line.getModel();
switch (this._point){
case 0:
if(core.Utils.isDefined(this._oldControlPoint)){
if($defined(this._oldControlPoint)){
line.setFrom(this._originalEndPoint.x, this._originalEndPoint.y);
model.setSrcCtrlPoint(this._oldControlPoint.clone());
line.setSrcControlPoint(this._oldControlPoint.clone());
@ -78,7 +78,7 @@ mindplot.commands.MoveControlPointCommand = new Class(
}
break;
case 1:
if(core.Utils.isDefined(this._oldControlPoint)){
if($defined(this._oldControlPoint)){
line.setTo(this._originalEndPoint.x, this._originalEndPoint.y);
model.setDestCtrlPoint(this._oldControlPoint.clone());
line.setDestControlPoint(this._oldControlPoint.clone());

View File

@ -16,7 +16,7 @@
* limitations under the License.
*/
if(core.Utils.isDefined(afterMindpotLibraryLoading))
if($defined(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(!core.Utils.isDefined(result)){
if(!$defined(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(core.Utils.isDefined(node.relationship)){
if($defined(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(core.Utils.isDefined(node.relationship)){
if($defined(node.relationship)){
}
else{
this.parent(targetNode, node);
@ -64,7 +64,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
}
// Register editor events ...
if (!core.Utils.isDefined(this.getDesigner()._viewMode)|| (core.Utils.isDefined(this.getDesigner()._viewMode) && !this.getDesigner()._viewMode))
if (!$defined(this.getDesigner()._viewMode)|| ($defined(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(core.Utils.isDefined(this._modifiedTopics.set)){
if($defined(this._modifiedTopics.set)){
var key = node.getId();
if(this._modifiedTopics.has(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(core.Utils.isDefined(modifiedTopics.set)){
if($defined(modifiedTopics.set)){
var key = node.getId();
if(modifiedTopics.has(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(core.Utils.isDefined(line)){
if($defined(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(core.Utils.isDefined(this._modifiedTopics.set)){
if($defined(this._modifiedTopics.set)){
var key = node.getId();
if(this._modifiedTopics.has(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(core.Utils.isDefined(line)){
if($defined(line)){
line.setVisibility(true);
}
core.Utils.animatePosition(this._modifiedTopics, null, this.getDesigner());
@ -498,7 +498,7 @@ mindplot.layoutManagers.FreeMindLayoutManager = mindplot.layoutManagers.BaseLayo
}
},
_createIndicatorShapes:function(){
if(!core.Utils.isDefined(this._createChildShape) || !core.Utils.isDefined(this._createSiblingShape)){
if(!$defined(this._createChildShape) || !$defined(this._createSiblingShape)){
var rectAttributes = {fillColor:'#CC0033',opacity:0.4,width:30,height:30,strokeColor:'#FF9933'};
var rect = new web2d.Rect(0, rectAttributes);
rect.setVisibility(false);
@ -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(core.Utils.isDefined(modifiedTopics.set)){
if($defined(modifiedTopics.set)){
if(modifiedTopics.has(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(core.Utils.isDefined(manager)){
if($defined(manager)){
return manager;
}
else{

View File

@ -40,7 +40,7 @@ mindplot.layoutManagers.OriginalLayoutManager = new Class({
for (var i = 0; i < children.length; i++) {
var child = children[i];
var order = child.getOrder();
if (!core.Utils.isDefined(order)) {
if (!$defined(order)) {
order = ++maxOrder;
child.setOrder(order);
}
@ -131,7 +131,7 @@ mindplot.layoutManagers.OriginalLayoutManager = new Class({
}
// Register editor events ...
if (!core.Utils.isDefined(this.getDesigner()._viewMode) || (core.Utils.isDefined(this.getDesigner()._viewMode) && !this.getDesigner()._viewMode)) {
if (!$defined(this.getDesigner()._viewMode) || ($defined(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(core.Utils.isDefined(node._originalPosition))
if($defined(node._originalPosition))
pos = node._originalPosition;
var result = this.findNodeEntryIndex(node, pos);
core.assert(result.index<result.table.length,"node not found. Could not remove");
@ -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(!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;

View File

@ -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;
}

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 && 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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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.";
}

View File

@ -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";
}

View File

@ -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";
}

View File

@ -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","");

View File

@ -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","");

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 (!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;

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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 ...
}

View File

@ -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);

View File

@ -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;

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 (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);
}

View File

@ -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;
}

View File

@ -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++)
{

View File

@ -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){

View File

@ -48,8 +48,7 @@ Arguments:
function $defined(obj) {
return (obj != undefined);
}
;
};
/*
Function: $type