Changeset 8799
- Timestamp:
- 05/29/07 09:03:34 (20 months ago)
- Location:
- dijit/trunk/form
- Files:
-
- 3 modified
-
AutoCompleter.js (modified) (3 diffs)
-
DateTextbox.js (modified) (4 diffs)
-
_DropDownTextBox.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/form/AutoCompleter.js
r8749 r8799 443 443 dojo.declare( 444 444 "dijit.form._AutoCompleterMenu", 445 [dijit.base.FormElement, dijit.base.TemplatedWidget , dijit.form._DropDownTextBox.Popup],445 [dijit.base.FormElement, dijit.base.TemplatedWidget], 446 446 447 447 // Bill: … … 475 475 // summary: 476 476 // call all postCreates 477 dijit.form._DropDownTextBox.Popup.prototype.postCreate.apply(this, arguments);478 477 dijit.base.FormElement.prototype.postCreate.apply(this, arguments); 479 478 }, … … 482 481 this.maxListLength=widget.maxListLength; 483 482 this.onValueChanged=dojo.hitch(widget, widget._selectOption); 484 dijit. form._DropDownTextBox.Popup.prototype.open.apply(this, arguments);483 dijit.util.PopupManager.openAround(widget.textbox, this); 485 484 }, 486 485 487 486 close:function(){ 488 dijit.form._DropDownTextBox.Popup.prototype.close.apply(this, arguments);489 487 this._blurOptionNode(); 490 488 }, -
dijit/trunk/form/DateTextbox.js
r8733 r8799 21 21 parse: dojo.date.locale.parse, 22 22 value: new Date(), 23 _popupClass:"dijit._Calendar Popup",23 _popupClass:"dijit._Calendar", 24 24 25 25 postMixInProperties: function(){ … … 40 40 // Sets the date on this textbox 41 41 42 if(!this._popupWidget|| this._popupWidget.parentWidget!=this){42 if(!this._popupWidget||!this._popupWidget.onValueSelected){ 43 43 dijit.form.DateTextbox.superclass.setValue.apply(this, arguments); 44 44 }else{ … … 49 49 postCreate:function(){ 50 50 dijit.form.DateTextbox.superclass.postCreate.apply(this, arguments); 51 // #3000: set popupArgs here so Calendar gets the widget's lang, not the user's lang 52 // TODO: move popup code inside here 53 this._popupArgs={lang:this.lang}; 51 this._popupArgs={ 52 // #3000: set popupArgs here so Calendar gets the widget's lang, not the user's lang 53 lang:this.lang, 54 55 open:function(/*Widget*/ widget){ 56 // summary: 57 // opens the Calendar, and sets the onValueSelected for the Calendar 58 59 this.constraints=widget.constraints; 60 this.setValue(widget.getValue()); 61 this.onValueSelected=dojo.hitch(widget, widget._calendarOnValueSelected); 62 dijit.util.PopupManager.openAround(widget.textbox, this); 63 }, 64 65 isDisabledDate:function(/*Date*/ date){ 66 // summary: 67 // disables dates outside of the min/max of the DateTextbox 68 return(this.constraints!=null&&(dojo.date.compare(this.constraints.min,date)>0||dojo.date.compare(this.constraints.max,date)<0)); 69 } 70 }; 54 71 // convert the arrow image from using style.background-image to the .src property (a11y) 55 72 dijit.util.wai.imageBgToSrc(this.arrowImage); … … 63 80 } 64 81 ); 65 66 dojo.declare(67 "dijit._CalendarPopup",68 [dijit._Calendar, dijit.form._DropDownTextBox.Popup],69 {70 postCreate:function(){71 // summary:72 // call all postCreates73 dijit._Calendar.prototype.postCreate.apply(this, arguments);74 dijit.form._DropDownTextBox.Popup.prototype.postCreate.apply(this, arguments);75 },76 77 open:function(/*Widget*/ widget){78 // summary:79 // opens the menu, and sets the onValueSelected for the Calendar80 81 dijit.form._DropDownTextBox.Popup.prototype.open.apply(this, arguments);82 this.constraints=widget.constraints;83 this.setValue(widget.getValue());84 this.onValueSelected=dojo.hitch(widget, widget._calendarOnValueSelected);85 },86 87 close:function(){88 dijit.form._DropDownTextBox.Popup.prototype.close.apply(this, arguments);89 this.constraints=null;90 },91 92 isDisabledDate:function(/*Date*/ date){93 // summary:94 // disables dates outside of the min/max of the DateTextbox95 return(this.constraints!=null&&(dojo.date.compare(this.constraints.min,date)>0||dojo.date.compare(this.constraints.max,date)<0));96 }97 }98 ); -
dijit/trunk/form/_DropDownTextBox.js
r8776 r8799 57 57 var node=document.createElement("div"); 58 58 document.body.appendChild(node); 59 // If you leave display="", _DropDownTextBox will think that the popup is open. 60 // _DropDownTextBox will call PopupManager.close() to close its last popup. 61 // However, because this popup was never popped up, 62 // PopupManager has an empty popup stack and creates an error. 63 // Setting display="none" prevents this bad call to PopupManager.close(). 64 with(node.style){ 65 display="none"; 66 position="absolute"; 67 overflow="auto"; 68 } 59 69 var popupProto=dojo.getObject(_this._popupClass, false); 60 70 return new popupProto(_this._popupArgs, node); … … 86 96 this.focus(); 87 97 this.makePopup(); 88 if(this. _popupWidget.isShowingNow()){98 if(this.isShowingNow()){ 89 99 this._hideResultList(); 90 100 }else{ … … 96 106 97 107 _hideResultList: function(){ 98 if(this. _popupWidget&&(!this._popupWidget.isShowingNow||this._popupWidget.isShowingNow())){108 if(this.isShowingNow()){ 99 109 dijit.util.PopupManager.close(true); 100 110 this._arrowIdle(); … … 205 215 // summary 206 216 // test if the popup is visible 207 return this._popupWidget&&this._popupWidget. isShowingNow();217 return this._popupWidget&&this._popupWidget.domNode.style.display!="none"; 208 218 }, 209 219 … … 221 231 } 222 232 ); 223 224 dojo.declare(225 "dijit.form._DropDownTextBox.Popup",226 null,227 {228 // summary:229 // Mixin that provides basic open/close behavior for popup widgets230 231 // parentWidget: Widget232 // Reference to parent widget233 parentWidget:null,234 235 postCreate:function(){236 // FIXME: create an external template so template style isn't displaced237 this.domNode.style.display="none";238 this.domNode.style.overflow="auto";239 this.domNode.style.position="absolute";240 },241 242 open:function(/*Widget*/ widget){243 // summary:244 // opens the menu245 246 this.parentWidget=widget;247 setTimeout(dojo.hitch(this, function(){dijit.util.PopupManager.openAround(widget.textbox, this);}), 1);248 },249 250 isShowingNow:function(){251 return this.domNode.style.display!="none";252 },253 254 close: function(/*Boolean*/ force){255 // summary:256 // closes the menu257 258 if(!this.isShowingNow()){259 return;260 }261 this.onValueChanged=function(){262 return;263 };264 this.parentWidget=null;265 }266 }267 );