| 1 |
define(["dojo/_base/kernel", |
| 2 |
"dojo/_base/declare", |
| 3 |
"dojo/_base/connect", |
| 4 |
"dojo/_base/window", |
| 5 |
"dojo/_base/array", |
| 6 |
"dojo/_base/sniff", |
| 7 |
"dojo/_base/lang", |
| 8 |
"dojo/query", |
| 9 |
"dojo/topic", |
| 10 |
"dojo/dom-class", |
| 11 |
"dojo/dom-geometry", |
| 12 |
"dojo/dom-construct", |
| 13 |
"dijit/registry", |
| 14 |
"dijit/_Widget", |
| 15 |
"./Moveable", |
| 16 |
"dojox/mdnd/AutoScroll" |
| 17 |
],function(dojo, declare, connect, win, array, sniff, lang, query, topic, domClass, geom, domConstruct, registry, _Widget, Moveable, AutoScroll){ |
| 18 |
var am = declare( |
| 19 |
"dojox.mdnd.AreaManager", |
| 20 |
null, |
| 21 |
{ |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
autoRefresh: true, |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
areaClass: "dojoxDndArea", |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
dragHandleClass: "dojoxDragHandle", |
| 37 |
|
| 38 |
constructor: function(){ |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
this._areaList = []; |
| 45 |
this.resizeHandler = connect.connect(dojo.global,"onresize", this, function(){ |
| 46 |
this._dropMode.updateAreas(this._areaList); |
| 47 |
}); |
| 48 |
|
| 49 |
this._oldIndexArea = this._currentIndexArea = this._oldDropIndex = this._currentDropIndex = this._sourceIndexArea = this._sourceDropIndex = -1; |
| 50 |
}, |
| 51 |
|
| 52 |
init: function(){ |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
this.registerByClass(); |
| 58 |
}, |
| 59 |
|
| 60 |
registerByNode: function(area, notInitAreas){ |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
var index = this._getIndexArea(area); |
| 70 |
if(area && index == -1){ |
| 71 |
var acceptType = area.getAttribute("accept"); |
| 72 |
var accept = (acceptType) ? acceptType.split(/\s*,\s*/) : ["text"]; |
| 73 |
var obj = { |
| 74 |
'node': area, |
| 75 |
'items': [], |
| 76 |
'coords': {}, |
| 77 |
'margin': null, |
| 78 |
'accept': accept, |
| 79 |
'initItems': false |
| 80 |
}; |
| 81 |
array.forEach(this._getChildren(area), function(item){ |
| 82 |
this._setMarginArea(obj, item); |
| 83 |
obj.items.push(this._addMoveableItem(item)); |
| 84 |
}, this); |
| 85 |
this._areaList = this._dropMode.addArea(this._areaList, obj); |
| 86 |
if(!notInitAreas){ |
| 87 |
this._dropMode.updateAreas(this._areaList); |
| 88 |
} |
| 89 |
connect.publish("/dojox/mdnd/manager/register",[area]); |
| 90 |
} |
| 91 |
}, |
| 92 |
|
| 93 |
registerByClass: function(){ |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
query('.'+this.areaClass).forEach(function(area){ |
| 100 |
this.registerByNode(area, true); |
| 101 |
}, this); |
| 102 |
this._dropMode.updateAreas(this._areaList); |
| 103 |
}, |
| 104 |
|
| 105 |
unregister: function(area){ |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
var index = this._getIndexArea(area); |
| 115 |
if(index != -1){ |
| 116 |
array.forEach(this._areaList[index].items, function(item){ |
| 117 |
this._deleteMoveableItem(item); |
| 118 |
}, this); |
| 119 |
this._areaList.splice(index,1); |
| 120 |
|
| 121 |
this._dropMode.updateAreas(this._areaList); |
| 122 |
return true; |
| 123 |
} |
| 124 |
return false; |
| 125 |
}, |
| 126 |
|
| 127 |
_addMoveableItem: function(node){ |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
node.setAttribute("tabIndex", "0"); |
| 139 |
var handle = this._searchDragHandle(node); |
| 140 |
var moveable = new Moveable({ 'handle': handle, 'skip': true }, node); |
| 141 |
|
| 142 |
domClass.add(handle || node, "dragHandle"); |
| 143 |
var type = node.getAttribute("dndType"); |
| 144 |
var item = { |
| 145 |
'item': moveable, |
| 146 |
'type': type ? type.split(/\s*,\s*/) : ["text"], |
| 147 |
'handlers': [connect.connect(moveable, "onDragStart", this, "onDragStart")] |
| 148 |
} |
| 149 |
|
| 150 |
if(registry && registry.byNode){ |
| 151 |
var widget = registry.byNode(node); |
| 152 |
if(widget){ |
| 153 |
item.type = widget.dndType ? widget.dndType.split(/\s*,\s*/) : ["text"]; |
| 154 |
item.handlers.push( |
| 155 |
connect.connect(widget, "uninitialize", this, function(){ |
| 156 |
this.removeDragItem(node.parentNode, moveable.node); |
| 157 |
}) |
| 158 |
); |
| 159 |
} |
| 160 |
} |
| 161 |
return item; |
| 162 |
}, |
| 163 |
|
| 164 |
_deleteMoveableItem: function( objItem){ |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
array.forEach(objItem.handlers, function(handler){ |
| 175 |
connect.disconnect(handler); |
| 176 |
}); |
| 177 |
|
| 178 |
var node = objItem.item.node, |
| 179 |
handle = this._searchDragHandle(node); |
| 180 |
domClass.remove(handle || node, "dragHandle"); |
| 181 |
|
| 182 |
objItem.item.destroy(); |
| 183 |
}, |
| 184 |
|
| 185 |
_getIndexArea: function(area){ |
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
if(area){ |
| 197 |
for(var i = 0; i < this._areaList.length; i++){ |
| 198 |
if(this._areaList[i].node === area){ |
| 199 |
return i; |
| 200 |
} |
| 201 |
} |
| 202 |
} |
| 203 |
return -1; |
| 204 |
}, |
| 205 |
|
| 206 |
_searchDragHandle: function(node){ |
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
if(node){ |
| 218 |
var cssArray = this.dragHandleClass.split(' '), |
| 219 |
length = cssArray.length, |
| 220 |
queryCss = ""; |
| 221 |
array.forEach(cssArray, function(css, i){ |
| 222 |
queryCss += "." + css; |
| 223 |
if(i != length - 1){ |
| 224 |
queryCss += ", "; |
| 225 |
} |
| 226 |
}); |
| 227 |
return query(queryCss, node)[0]; |
| 228 |
} |
| 229 |
}, |
| 230 |
|
| 231 |
addDragItem: function(area, node, index, notCheckParent){ |
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
var add = true; |
| 247 |
if(!notCheckParent){ |
| 248 |
add = area && node && (node.parentNode === null || (node.parentNode && node.parentNode.nodeType !== 1)); |
| 249 |
} |
| 250 |
if(add){ |
| 251 |
var indexArea = this._getIndexArea(area); |
| 252 |
if(indexArea !== -1){ |
| 253 |
var item = this._addMoveableItem(node), |
| 254 |
items = this._areaList[indexArea].items; |
| 255 |
if(0 <= index && index < items.length){ |
| 256 |
var firstListChild = items.slice(0, index), |
| 257 |
lastListChild = items.slice(index, items.length); |
| 258 |
firstListChild[firstListChild.length] = item; |
| 259 |
this._areaList[indexArea].items = firstListChild.concat(lastListChild); |
| 260 |
area.insertBefore(node, items[index].item.node); |
| 261 |
} |
| 262 |
else{ |
| 263 |
this._areaList[indexArea].items.push(item); |
| 264 |
area.appendChild(node); |
| 265 |
} |
| 266 |
this._setMarginArea(this._areaList[indexArea], node); |
| 267 |
this._areaList[indexArea].initItems = false; |
| 268 |
return true; |
| 269 |
} |
| 270 |
} |
| 271 |
return false; |
| 272 |
}, |
| 273 |
|
| 274 |
removeDragItem: function(area, node){ |
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
var index = this._getIndexArea(area); |
| 286 |
if(area && index !== -1){ |
| 287 |
var items = this._areaList[index].items; |
| 288 |
for(var j = 0; j < items.length; j++){ |
| 289 |
if(items[j].item.node === node){ |
| 290 |
this._deleteMoveableItem(items[j]); |
| 291 |
|
| 292 |
items.splice(j, 1); |
| 293 |
return area.removeChild(node); |
| 294 |
} |
| 295 |
} |
| 296 |
} |
| 297 |
return null; |
| 298 |
}, |
| 299 |
|
| 300 |
_getChildren: function(area){ |
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
var children = []; |
| 312 |
array.forEach(area.childNodes, function(child){ |
| 313 |
|
| 314 |
if(child.nodeType == 1){ |
| 315 |
if(registry && registry.byNode){ |
| 316 |
var widget = registry.byNode(child); |
| 317 |
if(widget){ |
| 318 |
if(!widget.dragRestriction){ |
| 319 |
children.push(child); |
| 320 |
} |
| 321 |
} |
| 322 |
else{ |
| 323 |
children.push(child); |
| 324 |
} |
| 325 |
} |
| 326 |
else{ |
| 327 |
children.push(child); |
| 328 |
} |
| 329 |
} |
| 330 |
}); |
| 331 |
return children; |
| 332 |
}, |
| 333 |
|
| 334 |
_setMarginArea: function(area,node){ |
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
if(area && area.margin === null && node){ |
| 347 |
area.margin = geom.getMarginExtents(node); |
| 348 |
} |
| 349 |
}, |
| 350 |
|
| 351 |
findCurrentIndexArea: function(coords, size){ |
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
this._oldIndexArea = this._currentIndexArea; |
| 364 |
this._currentIndexArea = this._dropMode.getTargetArea(this._areaList, coords, this._currentIndexArea); |
| 365 |
if(this._currentIndexArea != this._oldIndexArea){ |
| 366 |
if(this._oldIndexArea != -1){ |
| 367 |
this.onDragExit(coords, size); |
| 368 |
} |
| 369 |
if(this._currentIndexArea != -1){ |
| 370 |
this.onDragEnter(coords, size); |
| 371 |
} |
| 372 |
} |
| 373 |
return this._currentIndexArea; |
| 374 |
}, |
| 375 |
|
| 376 |
_isAccepted: function( type, accept){ |
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
this._accept = false; |
| 384 |
for(var i = 0; i < accept.length; ++i){ |
| 385 |
for(var j = 0; j < type.length;++j){ |
| 386 |
if(type[j] == accept[i]){ |
| 387 |
this._accept = true; |
| 388 |
break; |
| 389 |
} |
| 390 |
} |
| 391 |
} |
| 392 |
}, |
| 393 |
|
| 394 |
onDragStart: function(node, coords, size){ |
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
if(this.autoRefresh){ |
| 408 |
this._dropMode.updateAreas(this._areaList); |
| 409 |
} |
| 410 |
|
| 411 |
|
| 412 |
var _html = (sniff("webkit")) ? dojo.body() : dojo.body().parentNode; |
| 413 |
if(!this._cover){ |
| 414 |
this._cover = domConstruct.create('div', { |
| 415 |
'class': "dndCover" |
| 416 |
}); |
| 417 |
this._cover2 = lang.clone(this._cover); |
| 418 |
domClass.add(this._cover2, "dndCover2"); |
| 419 |
} |
| 420 |
var h = _html.scrollHeight+"px"; |
| 421 |
this._cover.style.height = this._cover2.style.height = h; |
| 422 |
dojo.body().appendChild(this._cover); |
| 423 |
dojo.body().appendChild(this._cover2); |
| 424 |
|
| 425 |
this._dragStartHandler = connect.connect(node.ownerDocument, "ondragstart", dojo, "stopEvent"); |
| 426 |
|
| 427 |
this._sourceIndexArea = this._lastValidIndexArea = this._currentIndexArea = this._getIndexArea(node.parentNode); |
| 428 |
|
| 429 |
var sourceArea = this._areaList[this._sourceIndexArea]; |
| 430 |
var children = sourceArea.items; |
| 431 |
for(var i = 0; i < children.length; i++){ |
| 432 |
if(children[i].item.node == node){ |
| 433 |
this._dragItem = children[i]; |
| 434 |
this._dragItem.handlers.push(connect.connect(this._dragItem.item, "onDrag", this, "onDrag")); |
| 435 |
this._dragItem.handlers.push(connect.connect(this._dragItem.item, "onDragEnd", this, "onDrop")); |
| 436 |
children.splice(i,1); |
| 437 |
this._currentDropIndex = this._sourceDropIndex = i; |
| 438 |
break; |
| 439 |
} |
| 440 |
} |
| 441 |
var nodeRef = null; |
| 442 |
if(this._sourceDropIndex !== sourceArea.items.length){ |
| 443 |
nodeRef = sourceArea.items[this._sourceDropIndex].item.node; |
| 444 |
} |
| 445 |
|
| 446 |
if(sniff("ie")> 7){ |
| 447 |
|
| 448 |
this._eventsIE7 = [ |
| 449 |
connect.connect(this._cover, "onmouseover", dojo, "stopEvent"), |
| 450 |
connect.connect(this._cover, "onmouseout", dojo, "stopEvent"), |
| 451 |
connect.connect(this._cover, "onmouseenter", dojo, "stopEvent"), |
| 452 |
connect.connect(this._cover, "onmouseleave", dojo, "stopEvent") |
| 453 |
]; |
| 454 |
} |
| 455 |
|
| 456 |
var s = node.style; |
| 457 |
s.left = coords.x+"px"; |
| 458 |
s.top = coords.y+"px"; |
| 459 |
|
| 460 |
if(s.position == "relative" || s.position == ""){ |
| 461 |
s.position = "absolute"; |
| 462 |
} |
| 463 |
this._cover.appendChild(node); |
| 464 |
|
| 465 |
this._dropIndicator.place(sourceArea.node, nodeRef, size); |
| 466 |
|
| 467 |
domClass.add(node, "dragNode"); |
| 468 |
|
| 469 |
this._accept = true; |
| 470 |
connect.publish("/dojox/mdnd/drag/start",[node, sourceArea, this._sourceDropIndex]); |
| 471 |
}, |
| 472 |
|
| 473 |
onDragEnter: function(coords, size){ |
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
if(this._currentIndexArea === this._sourceIndexArea){ |
| 485 |
this._accept = true; |
| 486 |
} |
| 487 |
else{ |
| 488 |
this._isAccepted(this._dragItem.type, this._areaList[this._currentIndexArea].accept); |
| 489 |
} |
| 490 |
}, |
| 491 |
|
| 492 |
onDragExit: function(coords, size){ |
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
this._accept = false; |
| 504 |
}, |
| 505 |
|
| 506 |
onDrag: function(node, coords, size, mousePosition){ |
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
var coordinates = this._dropMode.getDragPoint(coords, size, mousePosition); |
| 523 |
this.findCurrentIndexArea(coordinates, size); |
| 524 |
if(this._currentIndexArea !== -1 && this._accept){ |
| 525 |
this.placeDropIndicator(coordinates, size); |
| 526 |
} |
| 527 |
}, |
| 528 |
|
| 529 |
placeDropIndicator: function(coords, size){ |
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
this._oldDropIndex = this._currentDropIndex; |
| 542 |
|
| 543 |
var area = this._areaList[this._currentIndexArea]; |
| 544 |
if(!area.initItems){ |
| 545 |
this._dropMode.initItems(area); |
| 546 |
} |
| 547 |
|
| 548 |
this._currentDropIndex = this._dropMode.getDropIndex(area, coords); |
| 549 |
if(!(this._currentIndexArea === this._oldIndexArea && this._oldDropIndex === this._currentDropIndex)){ |
| 550 |
this._placeDropIndicator(size); |
| 551 |
} |
| 552 |
return this._currentDropIndex; |
| 553 |
}, |
| 554 |
|
| 555 |
_placeDropIndicator: function(size){ |
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
var oldArea = this._areaList[this._lastValidIndexArea]; |
| 564 |
var currentArea = this._areaList[this._currentIndexArea]; |
| 565 |
|
| 566 |
this._dropMode.refreshItems(oldArea, this._oldDropIndex, size, false); |
| 567 |
|
| 568 |
var node = null; |
| 569 |
if(this._currentDropIndex != -1){ |
| 570 |
node = currentArea.items[this._currentDropIndex].item.node; |
| 571 |
} |
| 572 |
this._dropIndicator.place(currentArea.node, node); |
| 573 |
this._lastValidIndexArea = this._currentIndexArea; |
| 574 |
|
| 575 |
this._dropMode.refreshItems(currentArea, this._currentDropIndex, size, true); |
| 576 |
}, |
| 577 |
|
| 578 |
onDropCancel: function(){ |
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
if(!this._accept){ |
| 587 |
var index = this._getIndexArea(this._dropIndicator.node.parentNode); |
| 588 |
if(index != -1){ |
| 589 |
this._currentIndexArea = index; |
| 590 |
} |
| 591 |
else{ |
| 592 |
|
| 593 |
|
| 594 |
this._currentIndexArea = 0; |
| 595 |
} |
| 596 |
} |
| 597 |
}, |
| 598 |
|
| 599 |
onDrop: function(node){ |
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
this.onDropCancel(); |
| 610 |
var targetArea = this._areaList[this._currentIndexArea]; |
| 611 |
domClass.remove(node, "dragNode"); |
| 612 |
var style = node.style; |
| 613 |
style.position = "relative"; |
| 614 |
style.left = "0"; |
| 615 |
style.top = "0"; |
| 616 |
style.width = "auto"; |
| 617 |
if(targetArea.node == this._dropIndicator.node.parentNode){ |
| 618 |
targetArea.node.insertBefore(node, this._dropIndicator.node); |
| 619 |
} |
| 620 |
else{ |
| 621 |
|
| 622 |
targetArea.node.appendChild(node); |
| 623 |
this._currentDropIndex = targetArea.items.length; |
| 624 |
} |
| 625 |
|
| 626 |
var indexChild = this._currentDropIndex; |
| 627 |
if(indexChild == -1){ |
| 628 |
indexChild = targetArea.items.length; |
| 629 |
} |
| 630 |
var children = targetArea.items; |
| 631 |
var firstListArea = children.slice(0, indexChild); |
| 632 |
var lastListArea = children.slice(indexChild, children.length); |
| 633 |
firstListArea[firstListArea.length] = this._dragItem; |
| 634 |
targetArea.items = firstListArea.concat(lastListArea); |
| 635 |
|
| 636 |
this._setMarginArea(targetArea, node); |
| 637 |
array.forEach(this._areaList, function(obj){ |
| 638 |
obj.initItems = false; |
| 639 |
}); |
| 640 |
|
| 641 |
connect.disconnect(this._dragItem.handlers.pop()); |
| 642 |
connect.disconnect(this._dragItem.handlers.pop()); |
| 643 |
this._resetAfterDrop(); |
| 644 |
|
| 645 |
if(this._cover){ |
| 646 |
dojo.body().removeChild(this._cover); |
| 647 |
dojo.body().removeChild(this._cover2); |
| 648 |
} |
| 649 |
connect.publish("/dojox/mdnd/drop",[node, targetArea, indexChild]); |
| 650 |
}, |
| 651 |
|
| 652 |
_resetAfterDrop: function(){ |
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
this._accept = false; |
| 659 |
this._dragItem = null; |
| 660 |
this._currentDropIndex = -1; |
| 661 |
this._currentIndexArea = -1; |
| 662 |
this._oldDropIndex = -1; |
| 663 |
this._sourceIndexArea = -1; |
| 664 |
this._sourceDropIndex = -1; |
| 665 |
this._dropIndicator.remove(); |
| 666 |
if(this._dragStartHandler){ |
| 667 |
connect.disconnect(this._dragStartHandler); |
| 668 |
} |
| 669 |
if(sniff("ie") > 7){ |
| 670 |
array.forEach(this._eventsIE7, connect.disconnect); |
| 671 |
} |
| 672 |
}, |
| 673 |
|
| 674 |
destroy: function(){ |
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
while(this._areaList.length > 0){ |
| 681 |
if(!this.unregister(this._areaList[0].node)){ |
| 682 |
throw new Error("Error while destroying AreaManager"); |
| 683 |
} |
| 684 |
} |
| 685 |
connect.disconnect(this.resizeHandler); |
| 686 |
this._dropIndicator.destroy(); |
| 687 |
this._dropMode.destroy(); |
| 688 |
if(AutoScroll.autoScroll){ |
| 689 |
AutoScroll.autoScroll.destroy(); |
| 690 |
} |
| 691 |
if(this.refreshListener){ |
| 692 |
connect.unsubscribe(this.refreshListener); |
| 693 |
} |
| 694 |
|
| 695 |
if(this._cover){ |
| 696 |
domConstruct.destroy(this._cover); |
| 697 |
domConstruct.destroy(this._cover2); |
| 698 |
delete this._cover; |
| 699 |
delete this._cover2; |
| 700 |
} |
| 701 |
} |
| 702 |
}); |
| 703 |
|
| 704 |
if(_Widget){ |
| 705 |
|
| 706 |
lang.extend(_Widget, { |
| 707 |
|
| 708 |
|
| 709 |
dndType : "text" |
| 710 |
}); |
| 711 |
} |
| 712 |
|
| 713 |
am._areaManager = null; |
| 714 |
am.areaManager = function(){ |
| 715 |
|
| 716 |
|
| 717 |
if(!am._areaManager){ |
| 718 |
am._areaManager = new am(); |
| 719 |
} |
| 720 |
return am._areaManager; |
| 721 |
}; |
| 722 |
return am; |
| 723 |
}); |