Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / mdnd / LazyManager.js @ 12

History | View | Annotate | Download (1.23 KB)

1 9 andrej.cim
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6
7
8
if(!dojo._hasResource["dojox.mdnd.LazyManager"]){
9
dojo._hasResource["dojox.mdnd.LazyManager"]=true;
10
dojo.provide("dojox.mdnd.LazyManager");
11
dojo.require("dojo.dnd.Manager");
12
dojo.require("dojox.mdnd.PureSource");
13
dojo.declare("dojox.mdnd.LazyManager",null,{constructor:function(){
14
this._registry={};
15
this._fakeSource=new dojox.mdnd.PureSource(dojo.create("div"),{"copyOnly":false});
16
this._fakeSource.startup();
17
dojo.addOnUnload(dojo.hitch(this,"destroy"));
18
this.manager=dojo.dnd.manager();
19
},getItem:function(_1){
20
var _2=_1.getAttribute("dndType");
21
return {"data":_1.getAttribute("dndData")||_1.innerHTML,"type":_2?_2.split(/\s*,\s*/):["text"]};
22
},startDrag:function(e,_3){
23
_3=_3||e.target;
24
if(_3){
25
var m=this.manager,_4=this.getItem(_3);
26
if(_3.id==""){
27
dojo.attr(_3,"id",dojo.dnd.getUniqueId());
28
}
29
dojo.addClass(_3,"dojoDndItem");
30
this._fakeSource.setItem(_3.id,_4);
31
m.startDrag(this._fakeSource,[_3],false);
32
m.onMouseMove(e);
33
}
34
},cancelDrag:function(){
35
var m=this.manager;
36
m.target=null;
37
m.onMouseUp();
38
},destroy:function(){
39
this._fakeSource.destroy();
40
}});
41
}