root / trunk / web / dojo / dijit / TooltipDialog.js @ 9
History | View | Annotate | Download (2.32 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["dijit.TooltipDialog"]){ |
9 |
dojo._hasResource["dijit.TooltipDialog"]=true; |
10 |
dojo.provide("dijit.TooltipDialog");
|
11 |
dojo.require("dijit.layout.ContentPane");
|
12 |
dojo.require("dijit._Templated");
|
13 |
dojo.require("dijit.form._FormMixin");
|
14 |
dojo.require("dijit._DialogMixin");
|
15 |
dojo.declare("dijit.TooltipDialog",[dijit.layout.ContentPane,dijit._Templated,dijit.form._FormMixin,dijit._DialogMixin],{title:"",doLayout:false,autofocus:true,baseClass:"dijitTooltipDialog",_firstFocusItem:null,_lastFocusItem:null,templateString:dojo.cache("dijit","templates/TooltipDialog.html","<div waiRole=\"presentation\">\n\t<div class=\"dijitTooltipContainer\" waiRole=\"presentation\">\n\t\t<div class =\"dijitTooltipContents dijitTooltipFocusNode\" dojoAttachPoint=\"containerNode\" tabindex=\"-1\" waiRole=\"dialog\"></div>\n\t</div>\n\t<div class=\"dijitTooltipConnector\" waiRole=\"presentation\"></div>\n</div>\n"),postCreate:function(){ |
16 |
this.inherited(arguments); |
17 |
this.connect(this.containerNode,"onkeypress","_onKey"); |
18 |
this.containerNode.title=this.title; |
19 |
},orient:function(_1,_2,_3){ |
20 |
var c=this._currentOrientClass; |
21 |
if(c){
|
22 |
dojo.removeClass(this.domNode,c);
|
23 |
} |
24 |
c="dijitTooltipAB"+(_3.charAt(1)=="L"?"Left":"Right")+" dijitTooltip"+(_3.charAt(0)=="T"?"Below":"Above"); |
25 |
dojo.addClass(this.domNode,c);
|
26 |
this._currentOrientClass=c;
|
27 |
},onOpen:function(_4){ |
28 |
this.orient(this.domNode,_4.aroundCorner,_4.corner); |
29 |
this._onShow();
|
30 |
if(this.autofocus){ |
31 |
this._getFocusItems(this.containerNode); |
32 |
dijit.focus(this._firstFocusItem);
|
33 |
} |
34 |
},onClose:function(){ |
35 |
this.onHide();
|
36 |
},_onKey:function(_5){ |
37 |
var _6=_5.target;
|
38 |
var dk=dojo.keys;
|
39 |
if(_5.charOrCode===dk.TAB){
|
40 |
this._getFocusItems(this.containerNode); |
41 |
} |
42 |
var _7=(this._firstFocusItem==this._lastFocusItem); |
43 |
if(_5.charOrCode==dk.ESCAPE){
|
44 |
setTimeout(dojo.hitch(this,"onCancel"),0); |
45 |
dojo.stopEvent(_5); |
46 |
}else{
|
47 |
if(_6==this._firstFocusItem&&_5.shiftKey&&_5.charOrCode===dk.TAB){ |
48 |
if(!_7){
|
49 |
dijit.focus(this._lastFocusItem);
|
50 |
} |
51 |
dojo.stopEvent(_5); |
52 |
}else{
|
53 |
if(_6==this._lastFocusItem&&_5.charOrCode===dk.TAB&&!_5.shiftKey){ |
54 |
if(!_7){
|
55 |
dijit.focus(this._firstFocusItem);
|
56 |
} |
57 |
dojo.stopEvent(_5); |
58 |
}else{
|
59 |
if(_5.charOrCode===dk.TAB){
|
60 |
_5.stopPropagation(); |
61 |
} |
62 |
} |
63 |
} |
64 |
} |
65 |
}}); |
66 |
} |