]>
Commit | Line | Data |
---|---|---|
f0cfe83e AD |
1 | define("dijit/_DialogMixin", [ |
2 | "dojo/_base/declare", // declare | |
3 | "./a11y" // _getTabNavigable | |
4 | ], function(declare, a11y){ | |
5 | ||
6 | // module: | |
7 | // dijit/_DialogMixin | |
8 | ||
9 | return declare("dijit._DialogMixin", null, { | |
10 | // summary: | |
11 | // This provides functions useful to Dialog and TooltipDialog | |
12 | ||
13 | execute: function(/*Object*/ /*===== formContents =====*/){ | |
14 | // summary: | |
15 | // Callback when the user hits the submit button. | |
16 | // Override this method to handle Dialog execution. | |
17 | // description: | |
18 | // After the user has pressed the submit button, the Dialog | |
19 | // first calls onExecute() to notify the container to hide the | |
20 | // dialog and restore focus to wherever it used to be. | |
21 | // | |
22 | // *Then* this method is called. | |
23 | // type: | |
24 | // callback | |
25 | }, | |
26 | ||
27 | onCancel: function(){ | |
28 | // summary: | |
29 | // Called when user has pressed the Dialog's cancel button, to notify container. | |
30 | // description: | |
31 | // Developer shouldn't override or connect to this method; | |
32 | // it's a private communication device between the TooltipDialog | |
33 | // and the thing that opened it (ex: `dijit/form/DropDownButton`) | |
34 | // type: | |
35 | // protected | |
36 | }, | |
37 | ||
38 | onExecute: function(){ | |
39 | // summary: | |
40 | // Called when user has pressed the dialog's OK button, to notify container. | |
41 | // description: | |
42 | // Developer shouldn't override or connect to this method; | |
43 | // it's a private communication device between the TooltipDialog | |
44 | // and the thing that opened it (ex: `dijit/form/DropDownButton`) | |
45 | // type: | |
46 | // protected | |
47 | }, | |
48 | ||
49 | _onSubmit: function(){ | |
50 | // summary: | |
51 | // Callback when user hits submit button | |
52 | // type: | |
53 | // protected | |
54 | this.onExecute(); // notify container that we are about to execute | |
55 | this.execute(this.get('value')); | |
56 | }, | |
57 | ||
58 | _getFocusItems: function(){ | |
59 | // summary: | |
60 | // Finds focusable items in dialog, | |
61 | // and sets this._firstFocusItem and this._lastFocusItem | |
62 | // tags: | |
63 | // protected | |
64 | ||
65 | var elems = a11y._getTabNavigable(this.containerNode); | |
66 | this._firstFocusItem = elems.lowest || elems.first || this.closeButtonNode || this.domNode; | |
67 | this._lastFocusItem = elems.last || elems.highest || this._firstFocusItem; | |
68 | } | |
69 | }); | |
70 | }); |