root / trunk / web / dojo / dojox / charting / plot2d / _PlotEvents.js
History | View | Annotate | Download (2.01 KB)
1 |
/*
|
---|---|
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.charting.plot2d._PlotEvents"]){ |
9 |
dojo._hasResource["dojox.charting.plot2d._PlotEvents"]=true; |
10 |
dojo.provide("dojox.charting.plot2d._PlotEvents");
|
11 |
dojo.declare("dojox.charting.plot2d._PlotEvents",null,{constructor:function(){ |
12 |
this._shapeEvents=[];
|
13 |
this._eventSeries={};
|
14 |
},destroy:function(){ |
15 |
this.resetEvents();
|
16 |
this.inherited(arguments); |
17 |
},plotEvent:function(o){ |
18 |
},raiseEvent:function(o){ |
19 |
this.plotEvent(o);
|
20 |
var t=dojo.delegate(o);
|
21 |
t.originalEvent=o.type; |
22 |
t.originalPlot=o.plot; |
23 |
t.type="onindirect";
|
24 |
dojo.forEach(this.chart.stack,function(_1){ |
25 |
if(_1!==this&&_1.plotEvent){ |
26 |
t.plot=_1; |
27 |
_1.plotEvent(t); |
28 |
} |
29 |
},this);
|
30 |
},connect:function(_2,_3){ |
31 |
this.dirty=true; |
32 |
return dojo.connect(this,"plotEvent",_2,_3); |
33 |
},events:function(){ |
34 |
var ls=this.plotEvent._listeners; |
35 |
if(!ls||!ls.length){
|
36 |
return false; |
37 |
} |
38 |
for(var i in ls){ |
39 |
if(!(i in Array.prototype)){ |
40 |
return true; |
41 |
} |
42 |
} |
43 |
return false; |
44 |
},resetEvents:function(){ |
45 |
if(this._shapeEvents.length){ |
46 |
dojo.forEach(this._shapeEvents,function(_4){ |
47 |
_4.shape.disconnect(_4.handle); |
48 |
}); |
49 |
this._shapeEvents=[];
|
50 |
} |
51 |
this.raiseEvent({type:"onplotreset",plot:this}); |
52 |
},_connectSingleEvent:function(o,_5){ |
53 |
this._shapeEvents.push({shape:o.eventMask,handle:o.eventMask.connect(_5,this,function(e){ |
54 |
o.type=_5; |
55 |
o.event=e; |
56 |
this.raiseEvent(o);
|
57 |
o.event=null;
|
58 |
})}); |
59 |
},_connectEvents:function(o){ |
60 |
o.chart=this.chart;
|
61 |
o.plot=this;
|
62 |
o.hAxis=this.hAxis||null; |
63 |
o.vAxis=this.vAxis||null; |
64 |
o.eventMask=o.eventMask||o.shape; |
65 |
this._connectSingleEvent(o,"onmouseover"); |
66 |
this._connectSingleEvent(o,"onmouseout"); |
67 |
this._connectSingleEvent(o,"onclick"); |
68 |
},_reconnectEvents:function(_6){ |
69 |
var a=this._eventSeries[_6]; |
70 |
if(a){
|
71 |
dojo.forEach(a,this._connectEvents,this); |
72 |
} |
73 |
},fireEvent:function(_7,_8,_9,_a){ |
74 |
var s=this._eventSeries[_7]; |
75 |
if(s&&s.length&&_9<s.length){
|
76 |
var o=s[_9];
|
77 |
o.type=_8; |
78 |
o.event=_a||null;
|
79 |
this.raiseEvent(o);
|
80 |
o.event=null;
|
81 |
} |
82 |
}}); |
83 |
} |