_DialogMixin.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. Copyright (c) 2004-2012, 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. if(!dojo._hasResource["dijit._DialogMixin"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dijit._DialogMixin"] = true;
  8. dojo.provide("dijit._DialogMixin");
  9. dojo.require("dijit._Widget");
  10. dojo.declare("dijit._DialogMixin", null,
  11. {
  12. // summary:
  13. // This provides functions useful to Dialog and TooltipDialog
  14. attributeMap: dijit._Widget.prototype.attributeMap,
  15. execute: function(/*Object*/ formContents){
  16. // summary:
  17. // Callback when the user hits the submit button.
  18. // Override this method to handle Dialog execution.
  19. // description:
  20. // After the user has pressed the submit button, the Dialog
  21. // first calls onExecute() to notify the container to hide the
  22. // dialog and restore focus to wherever it used to be.
  23. //
  24. // *Then* this method is called.
  25. // type:
  26. // callback
  27. },
  28. onCancel: function(){
  29. // summary:
  30. // Called when user has pressed the Dialog's cancel button, to notify container.
  31. // description:
  32. // Developer shouldn't override or connect to this method;
  33. // it's a private communication device between the TooltipDialog
  34. // and the thing that opened it (ex: `dijit.form.DropDownButton`)
  35. // type:
  36. // protected
  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. _onSubmit: function(){
  49. // summary:
  50. // Callback when user hits submit button
  51. // type:
  52. // protected
  53. this.onExecute(); // notify container that we are about to execute
  54. this.execute(this.get('value'));
  55. },
  56. _getFocusItems: function(){
  57. // summary:
  58. // Finds focusable items in dialog,
  59. // and sets this._firstFocusItem and this._lastFocusItem
  60. // tags:
  61. // protected
  62. var elems = dijit._getTabNavigable(this.containerNode);
  63. this._firstFocusItem = elems.lowest || elems.first || this.closeButtonNode || this.domNode;
  64. this._lastFocusItem = elems.last || elems.highest || this._firstFocusItem;
  65. }
  66. }
  67. );
  68. }