Changeset 12572
- Timestamp:
- 02/20/08 17:25:50 (11 months ago)
- Location:
- dijit/trunk
- Files:
-
- 29 modified
-
form/Button.js (modified) (2 diffs)
-
form/ComboBox.js (modified) (12 diffs)
-
form/FilteringSelect.js (modified) (2 diffs)
-
form/NumberTextBox.js (modified) (2 diffs)
-
form/Slider.js (modified) (1 diff)
-
form/templates/ComboBox.html (modified) (1 diff)
-
form/templates/Spinner.html (modified) (1 diff)
-
form/templates/TextBox.html (modified) (1 diff)
-
form/templates/ValidationTextBox.html (modified) (1 diff)
-
form/TextBox.js (modified) (1 diff)
-
form/ValidationTextBox.js (modified) (3 diffs)
-
form/_DateTimeTextBox.js (modified) (1 diff)
-
form/_FormWidget.js (modified) (1 diff)
-
InlineEditBox.js (modified) (1 diff)
-
Menu.js (modified) (1 diff)
-
tests/form/test_ComboBox.html (modified) (1 diff)
-
tests/form/test_FilteringSelect.html (modified) (1 diff)
-
tests/form/test_SimpleTextarea.html (modified) (2 diffs)
-
tests/form/test_Textarea.html (modified) (1 diff)
-
tests/form/test_validate.html (modified) (1 diff)
-
tests/layout/test_TabContainer.html (modified) (1 diff)
-
tests/test_Dialog.html (modified) (1 diff)
-
tests/test_Editor.html (modified) (1 diff)
-
tests/tree/test_Tree_v1.html (modified) (1 diff)
-
Tooltip.js (modified) (2 diffs)
-
Tree.js (modified) (1 diff)
-
_editor/plugins/FontChoice.js (modified) (1 diff)
-
_editor/RichText.js (modified) (2 diffs)
-
_Widget.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/form/Button.js
r12437 r12572 195 195 this._closeDropDown(); 196 196 // don't focus on button. the user has explicitly focused on something else. 197 this.inherited(arguments); 197 198 }, 198 199 … … 357 358 }, 358 359 359 _onBlur: function( evt){360 _onBlur: function(){ 360 361 this.inherited(arguments); 361 362 this._focusedNode = null; -
dijit/trunk/form/ComboBox.js
r12555 r12572 73 73 hasDownArrow:true, 74 74 75 // _hasFocus: Boolean76 // Represents focus state of the textbox77 // TODO: get rid of this; it's unnecessary (but currently referenced in FilteringSelect)78 _hasFocus:false,79 80 75 templatePath: dojo.moduleUrl("dijit.form", "templates/ComboBox.html"), 81 76 … … 83 78 84 79 _lastDisplayedValue: "", 85 86 getValue:function(){87 // don't get the textbox value but rather the previously set hidden value88 return dijit.form.TextBox.superclass.getValue.apply(this, arguments);89 },90 80 91 81 setDisplayedValue:function(/*String*/ value){ … … 168 158 }, 169 159 170 onkeypress: function(/*Event*/ evt){160 _onKeyPress: function(/*Event*/ evt){ 171 161 // summary: handles keyboard events 172 162 … … 238 228 // _onBlur handler 239 229 if(pw && ( 240 newvalue == pw._messages["previousMessage"] ||241 newvalue == pw._messages["nextMessage"])230 newvalue == pw._messages["previousMessage"] || 231 newvalue == pw._messages["nextMessage"]) 242 232 ){ 243 233 break; … … 444 434 }, 445 435 446 _onBlur: function(){ 447 // summary: called magically when focus has shifted away from this widget and it's dropdown 448 this._hasFocus=false; 449 this._hasBeenBlurred = true; 450 this._hideResultList(); 451 this._arrowIdle(); 436 _setBlurValue: function(){ 452 437 // if the user clicks away from the textbox OR tabs away, set the 453 438 // value to the textbox value 454 455 439 // #4617: 456 440 // if value is now more choices or previous choices, revert … … 458 442 var newvalue=this.getDisplayedValue(); 459 443 var pw = this._popupWidget; 460 if( pw && (461 newvalue == pw._messages["previousMessage"] ||462 newvalue == pw._messages["nextMessage"]444 if(pw && ( 445 newvalue == pw._messages["previousMessage"] || 446 newvalue == pw._messages["nextMessage"] 463 447 ) 464 448 ){ … … 469 453 }, 470 454 471 onfocus:function(/*Event*/ evt){472 this._hasFocus=true;473 474 // update styling to reflect that we are focused475 this. _onMouse(evt);455 _onBlur: function(){ 456 // summary: called magically when focus has shifted away from this widget and it's dropdown 457 this._hideResultList(); 458 this._arrowIdle(); 459 this.inherited(arguments); 476 460 }, 477 461 … … 702 686 // Focus-less div based menu for internal use in ComboBox 703 687 704 templateString: "<ul class='dijitMenu' dojoAttachEvent='onmousedown ,onmouseup,onmouseover,onmouseout' tabIndex='-1' style='overflow:\"auto\";'>"688 templateString: "<ul class='dijitMenu' dojoAttachEvent='onmousedown:_onMouseDown,onmouseup:_onMouseUp,onmouseover:_onMouseOver,onmouseout:_onMouseOut' tabIndex='-1' style='overflow:\"auto\";'>" 705 689 +"<li class='dijitMenuItem dijitMenuPreviousButton' dojoAttachPoint='previousButton'></li>" 706 690 +"<li class='dijitMenuItem dijitMenuNextButton' dojoAttachPoint='nextButton'></li>" … … 789 773 }, 790 774 791 onmousedown: function(/*Event*/ evt){775 _onMouseDown: function(/*Event*/ evt){ 792 776 dojo.stopEvent(evt); 793 777 }, 794 778 795 onmouseup: function(/*Event*/ evt){779 _onMouseUp: function(/*Event*/ evt){ 796 780 if(evt.target === this.domNode){ 797 781 return; … … 811 795 }, 812 796 813 onmouseover: function(/*Event*/ evt){797 _onMouseOver: function(/*Event*/ evt){ 814 798 if(evt.target === this.domNode){ return; } 815 799 var tgt = evt.target; … … 824 808 }, 825 809 826 onmouseout:function(/*Event*/ evt){810 _onMouseOut:function(/*Event*/ evt){ 827 811 if(evt.target === this.domNode){ return; } 828 812 this._blurOptionNode(); … … 1069 1053 }); 1070 1054 1055 -
dijit/trunk/form/FilteringSelect.js
r12149 r12572 61 61 //this._setValue("", ""); 62 62 //#3285: change CSS to indicate error 63 if(!this._ hasFocus){ this.valueNode.value=""; }64 dijit.form.TextBox.superclass.setValue.call(this, undefined, !this._ hasFocus);63 if(!this._focused){ this.valueNode.value=""; } 64 dijit.form.TextBox.superclass.setValue.call(this, undefined, !this._focused); 65 65 this._isvalid=false; 66 this.validate(this._ hasFocus);66 this.validate(this._focused); 67 67 }else{ 68 68 this._setValueFromItem(result[0], priorityChange); … … 148 148 // return: the label that the ComboBox should display 149 149 return store.getValue(item, this.searchAttr); 150 },151 152 onkeyup: function(/*Event*/ evt){153 // summary: internal function154 155 // FilteringSelect needs to wait for the complete label before156 // committing to a reverse lookup157 158 //this.setDisplayedValue(this.textbox.value);159 150 }, 160 151 -
dijit/trunk/form/NumberTextBox.js
r12482 r12572 17 17 editOptions: { pattern: '#.######' }, 18 18 19 _editing: false, 20 21 onfocus: function(evt){ 22 this._editing = true; 23 // this.inherited(arguments); 24 this.setValue(this.getValue()); 25 }, 26 27 _onBlur: function(evt){ 28 this._editing = false; 29 this.inherited(arguments); 19 _refreshState: function(){ 20 this.setValue(this.getValue(), false); 30 21 }, 31 22 … … 35 26 if(typeof value == "string") { return value; } 36 27 if(isNaN(value)){ return ""; } 37 if(this.editOptions && this._ editing){28 if(this.editOptions && this._focused){ 38 29 constraints = dojo.mixin(dojo.mixin({}, this.editOptions), this.constraints); 39 30 } -
dijit/trunk/form/Slider.js
r12265 r12572 200 200 }, 201 201 202 _onBlur: function(){203 dijit.form.HorizontalSlider.superclass.setValue.call(this, this.value, true);204 },205 206 202 postCreate: function(){ 207 203 if(this.showButtons){ -
dijit/trunk/form/templates/ComboBox.html
r12555 r12572 13 13 ><div class="dijitReset dijitInputField" 14 14 ><input type="text" autocomplete="off" name="${name}" class='dijitReset' 15 dojoAttachEvent="onkeypress , onkeyup, onfocus, compositionend"15 dojoAttachEvent="onkeypress:_onKeyPress, onfocus:_update, compositionend" 16 16 dojoAttachPoint="textbox,focusNode" waiRole="textbox" waiState="haspopup-true,autocomplete-list" 17 17 /></div -
dijit/trunk/form/templates/Spinner.html
r11952 r12572 22 22 ><div class="dijitReset dijitValidationIconText">Χ</div 23 23 ><div class="dijitReset dijitInputField" 24 ><input class='dijitReset' dojoAttachPoint="textbox,focusNode" type="${type}" dojoAttachEvent="onfocus ,onkeyup,onkeypress:_onKeyPress"24 ><input class='dijitReset' dojoAttachPoint="textbox,focusNode" type="${type}" dojoAttachEvent="onfocus:_update,onkeyup:_update,onkeypress:_onKeyPress" 25 25 waiRole="spinbutton" autocomplete="off" name="${name}" 26 26 /></div -
dijit/trunk/form/templates/TextBox.html
r11677 r12572 1 1 <input class="dijit dijitReset dijitLeft" dojoAttachPoint='textbox,focusNode' name="${name}" 2 dojoAttachEvent='onmouseenter:_onMouse,onmouseleave:_onMouse,onfocus:_onMouse,onblur:_onMouse,onkey up,onkeypress:_onKeyPress'2 dojoAttachEvent='onmouseenter:_onMouse,onmouseleave:_onMouse,onfocus:_onMouse,onblur:_onMouse,onkeypress:_onKeyPress' 3 3 autocomplete="off" type="${type}" 4 4 /> -
dijit/trunk/form/templates/ValidationTextBox.html
r11952 r12572 6 6 ><div class="dijitReset dijitValidationIconText">Χ</div 7 7 ><div class="dijitReset dijitInputField" 8 ><input class="dijitReset" dojoAttachPoint='textbox,focusNode' dojoAttachEvent='onfocus ,onblur:_onMouse,onkeyup,onkeypress:_onKeyPress' autocomplete="off"8 ><input class="dijitReset" dojoAttachPoint='textbox,focusNode' dojoAttachEvent='onfocus:_update,onkeyup:_update,onblur:_onMouse,onkeypress:_onKeyPress' autocomplete="off" 9 9 type='${type}' name='${name}' 10 10 /></div -
dijit/trunk/form/TextBox.js
r12193 r12572 105 105 }, 106 106 107 // event handlers, you can over-ride these in your own subclasses 108 _onBlur: function(){ 107 _setBlurValue: function(){ 109 108 this.setValue(this.getValue(), (this.isValid ? this.isValid() : true)); 110 109 }, 111 110 112 onkeyup: function(){ 113 // TODO: it would be nice to massage the value (ie: automatic uppercase, etc) as the user types 114 // but this messes up the cursor position if you are typing into the middle of a word, and 115 // also trimming doesn't work correctly (it prevents spaces between words too!) 116 // this.setValue(this.getValue()); 111 _onBlur: function(){ 112 this._setBlurValue(); 113 this.inherited(arguments); 117 114 } 118 115 } -
dijit/trunk/form/ValidationTextBox.js
r12482 r12572 56 56 setValue: function(){ 57 57 this.inherited(arguments); 58 this.validate( false);58 this.validate(this._focused); 59 59 }, 60 60 … … 123 123 }, 124 124 125 _hasBeenBlurred: false, 126 127 _onBlur: function(){ 128 this._hasBeenBlurred = true; 129 this.validate(false); 130 this.inherited(arguments); 125 _refreshState: function(){ 126 this.validate(this._focused); 131 127 }, 132 128 133 129 _update: function(/*Event*/e){ 134 this. validate(true);130 this._refreshState(); 135 131 this._onMouse(e); // update CSS classes 136 },137 138 reset: function(){139 this.inherited(arguments);140 this._hasBeenBlurred = false;141 132 }, 142 133 … … 154 145 var p = this.regExpGen(this.constraints); 155 146 this.regExp = p; 156 // make value a string for all types so that form reset works well157 158 this.connect(this, "onfocus", this._update);159 this.connect(this, "onkeyup", this._update);160 147 } 161 148 } -
dijit/trunk/form/_DateTimeTextBox.js
r12352 r12572 119 119 // summary: called magically when focus has shifted away from this widget and it's dropdown 120 120 this._close(); 121 this.inherited( '_onBlur',arguments);121 this.inherited(arguments); 122 122 // don't focus on <input>. the user has explicitly focused on something else. 123 123 }, -
dijit/trunk/form/_FormWidget.js
r12482 r12572 235 235 236 236 reset: function(){ 237 this._hasBeenBlurred = false; 237 238 if(this._resetValue !== undefined){ 238 239 if(this.setValue && !this._getValueDeprecated){ -
dijit/trunk/InlineEditBox.js
r12495 r12572 349 349 // summary: 350 350 // Called when focus moves outside the editor 351 this.inherited(arguments); 351 352 if(this._exitInProgress){ 352 353 // when user clicks the "save" button, focus is shifted back to display text, causing this -
dijit/trunk/Menu.js
r12321 r12572 265 265 266 266 this._onBlur = function(){ 267 this.inherited(arguments); 267 268 // Usually the parent closes the child widget but if this is a context 268 269 // menu then there is no parent -
dijit/trunk/tests/form/test_ComboBox.html
r11973 r12572 144 144 <option>Wyoming</option> 145 145 </select> 146 onChange:<input id="oc1" disabled value="not fired yet!" autocomplete="off"> 146 <br>onChange:<input id="oc1" disabled value="not fired yet!" autocomplete="off"> 147 <input type="button" value="Set displayed value to Kentucky" onClick="dijit.byId('setvaluetest').setDisplayedValue('Kentucky')"> 148 <input type="button" value="Set displayed value to Canada" onClick="dijit.byId('setvaluetest').setDisplayedValue('Canada')"> 147 149 148 150 <hr> -
dijit/trunk/tests/form/test_FilteringSelect.html
r11949 r12572 67 67 invalidMessage="Invalid state name" 68 68 onChange="dojo.byId('oc1').value=arguments[0]" 69 onFocus="console.log('user focus handler')" 70 onBlur="console.log('user blur handler')" 69 71 > 70 72 <option value="blank"></option> -
dijit/trunk/tests/form/test_SimpleTextarea.html
r12428 r12572 12 12 </style> 13 13 14 <script type="text/javascript" djConfig="isDebug: false, parseOnLoad: true"14 <script type="text/javascript" djConfig="isDebug:true, parseOnLoad: true" 15 15 src="../../../dojo/dojo.js"></script> 16 16 … … 33 33 34 34 <h2>Plain textarea (rows=5, cols=50)</h2> 35 <textarea dojoType="dijit.form.SimpleTextarea" name="ta2" rows=5 cols=50> 35 <textarea dojoType="dijit.form.SimpleTextarea" name="ta2" rows=5 cols=50 36 onFocus="console.log('user focus handler')" 37 onBlur="console.log('user blur handler')" 38 > 36 39 shichashaw, textarea text baw. 37 40 </textarea> -
dijit/trunk/tests/form/test_Textarea.html
r11994 r12572 42 42 <br><label for="simple">Inline:</label><div name="simpleTextArea" dojoType="dijit.form.Textarea" id="simple" style="width:33%;border:20px solid red;" 43 43 onChange="dojo.byId('ocSimple').value=arguments[0]" 44 onFocus="console.log('user focus handler')" 45 onBlur="console.log('user blur handler')" 44 46 >this is a very simple resizable text area</div> 45 47 onChange:<textarea id="ocSimple" readOnly>not fired yet!</textarea> -
dijit/trunk/tests/form/test_validate.html
r12482 r12572 68 68 dojoType="dijit.form.TextBox" 69 69 trim="true" 70 onfocus="console.log('user onfocus handler')" 71 onblur="console.log('user onblur handler')" 70 72 onChange="dojo.byId('oc1').value=arguments[0]" 71 73 propercase="true" /> -
dijit/trunk/tests/layout/test_TabContainer.html
r12280 r12572 117 117 </p> 118 118 119 <div id="ttabs" dojoType="dijit.layout.TabContainer" tabPosition="top" style="width: 100%; height: 10em;"> 119 <div id="ttabs" dojoType="dijit.layout.TabContainer" tabPosition="top" style="width: 100%; height: 10em;" 120 onfocus="console.log('user focus handler')" 121 onblur="console.log('user blur handler')" 122 > 120 123 <div id="ttab1" dojoType="dijit.layout.ContentPane" href="tab1.html" title="First" closable="true"></div> 121 124 <div id="ttab2" dojoType="dijit.layout.ContentPane" href="tab2.html" refreshOnShow="true" title="Second"></div> -
dijit/trunk/tests/test_Dialog.html
r12449 r12572 60 60 61 61 <div dojoType="dijit.Dialog" id="dialog1" title="First Dialog" 62 onfocus="console.log('user focus handler')" 63 onblur="console.log('user blur handler')" 62 64 execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0], true));"> 63 65 <table> -
dijit/trunk/tests/test_Editor.html
r12335 r12572 41 41 <textarea dojoType="dijit.Editor" height="" 42 42 extraPlugins="['dijit._editor.plugins.AlwaysShowToolbar']" 43 onfocus="console.log('user focus handler')" 44 onblur="console.log('user blur handler')" 43 45 styleSheets="../../dojo/resources/dojo.css" id="thud"> 44 46 <p> -
dijit/trunk/tests/tree/test_Tree_v1.html
r12481 r12572 33 33 <p>Clicking a folder node will open/close it (openOnclick==true), and clicking a leaf node will popup an alert.</p> 34 34 <div dojoType="dijit.Tree" id="mytree" store="continentStore" query="{type:'continent'}" 35 onfocus="console.log('user focus handler')" 36 onblur="console.log('user blur handler')" 35 37 labelAttr="name" label="Continents" openOnClick="true"> 36 38 <script type="dojo/method" event="onClick" args="item"> -
dijit/trunk/Tooltip.js
r11893 r12572