Changeset 8926
- Timestamp:
- 06/05/07 09:23:47 (18 months ago)
- Location:
- dijit/trunk
- Files:
-
- 11 modified
- 7 moved
-
form/ComboBox.js (moved) (moved from dijit/trunk/form/AutoCompleter.js) (20 diffs)
-
form/DateTextbox.js (modified) (1 diff)
-
form/FilteringSelect.js (moved) (moved from dijit/trunk/form/Select.js) (8 diffs)
-
form/templates/ComboBox.html (moved) (moved from dijit/trunk/form/templates/AutoCompleter.html) (1 diff)
-
form/_DropDownTextBox.js (modified) (2 diffs)
-
tests/form/comboBoxData.json (moved) (moved from dijit/trunk/tests/form/autoCompleterData.json)
-
tests/form/test_ComboBox.html (moved) (moved from dijit/trunk/tests/form/test_AutoCompleter.html) (10 diffs)
-
tests/form/test_ComboBox_destroy.html (moved) (moved from dijit/trunk/tests/form/test_AutoCompleter_destroy.html) (3 diffs)
-
tests/form/test_FilteringSelect.html (moved) (moved from dijit/trunk/tests/form/test_Select.html) (12 diffs)
-
tests/form/test_InlineEditBox.html (modified) (2 diffs)
-
tests/layout/test_LayoutContainer.html (modified) (4 diffs)
-
themes/dijit.css (modified) (10 diffs)
-
themes/noir/images/images.css (modified) (1 diff)
-
themes/noir/noir.css (modified) (5 diffs)
-
themes/noir/noir.html (modified) (3 diffs)
-
themes/templateThemeTest.html (modified) (3 diffs)
-
themes/themeTester.html (modified) (3 diffs)
-
themes/tundra/tundra.css (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/form/ComboBox.js
r8913 r8926 1 dojo.provide("dijit.form. AutoCompleter");1 dojo.provide("dijit.form.ComboBox"); 2 2 3 3 dojo.require("dijit.util.scroll"); … … 9 9 10 10 dojo.declare( 11 "dijit.form. AutoCompleterMixin",11 "dijit.form.ComboBoxMixin", 12 12 dijit.form._DropDownTextBox, 13 13 { 14 14 // summary: 15 // Auto-completing text box, and base class for Select widget.15 // Auto-completing text box, and base class for FilteringSelect widget. 16 16 // 17 17 // The drop down box's values are populated from an class called … … 19 19 // that the user has typed into the input box. 20 20 // 21 // Some of the options to the AutoCompleterare actually arguments to the data21 // Some of the options to the ComboBox are actually arguments to the data 22 22 // provider. 23 23 … … 29 29 30 30 // store: Object 31 // Reference to data provider object created for this AutoCompleter31 // Reference to data provider object created for this ComboBox 32 32 // according to "dataProviderClass" argument. 33 33 store: null, … … 47 47 // URL argument passed to data provider object (class name specified in "dataProviderClass") 48 48 // An example of the URL format for the default data provider is 49 // " autoCompleterData.js"49 // "comboBoxData.js" 50 50 url: "", 51 51 … … 72 72 73 73 // ignoreCase: Boolean 74 // Does the AutoCompletermenu ignore case?74 // Does the ComboBox menu ignore case? 75 75 ignoreCase: true, 76 76 77 77 // value: String 78 // The initial value of the AutoCompleter.78 // The initial value of the ComboBox. 79 79 // This is the value that actually appears in the text area. 80 80 value:"", 81 81 82 templatePath: dojo.moduleUrl("dijit.form", "templates/ AutoCompleter.html"),82 templatePath: dojo.moduleUrl("dijit.form", "templates/ComboBox.html"), 83 83 84 84 _hasMasterPopup:true, 85 85 86 _popupClass:"dijit.form._ AutoCompleterMenu",86 _popupClass:"dijit.form._ComboBoxMenu", 87 87 88 88 _getCaretPos: function(/*DomNode*/ element){ … … 164 164 this._arrowPressed(); 165 165 // bring up full list 166 this._startSearch(""); 166 //this._startSearch(""); 167 doSearch=true; 167 168 }else{ 168 169 evt.keyCode==dojo.keys.PAGE_DOWN ? this._popupWidget.pageDown(): this._popupWidget._highlightNextOption(); … … 214 215 this._hideResultList(); 215 216 } 216 else{doSearch=t his.autoComplete;}217 else{doSearch=true;} 217 218 break; 218 219 … … 227 228 this._prev_key_esc = false; 228 229 this._prev_key_backspace = true; 229 doSearch=t his.autoComplete;230 doSearch=true; 230 231 if(!this.textbox.value.length){ 231 232 this.setValue(""); … … 244 245 this._prev_key_esc = false; 245 246 if(evt.charCode!=0){ 246 doSearch=t his.autoComplete;247 doSearch=true; 247 248 } 248 249 } … … 299 300 // Bill: above loop could be done w/ "dojo.forEach(results, function(tr){" or better yet map() 300 301 // 301 // But actually the interface between AutoCompleterMenu and Autocompleter is strange to me.302 // AutoCompleterMenu should be in charge of the302 // But actually the interface between ComboBoxMenu and Autocompleter is strange to me. 303 // ComboBoxMenu should be in charge of the 303 304 // DOM manipulation (creating text nodes, etc). autocompleter should just pass in a list of 304 305 // items … … 310 311 _createOption:function(/*Object*/ tr){ 311 312 // summary: creates an option to appear on the popup menu 312 // subclassed by Select313 // subclassed by FilteringSelect 313 314 var td = document.createElement("div"); 314 315 td.appendChild(document.createTextNode(this.store.getValue(tr, this.searchAttr))); … … 400 401 _startSearch: function(/*String*/ key){ 401 402 this.makePopup(); 402 // create a new query to prevent accidentally querying for a hidden value from Select's keyField403 // create a new query to prevent accidentally querying for a hidden value from FilteringSelect's keyField 403 404 var query={}; 404 405 query[this.searchAttr]=key+"*"; … … 409 410 _assignHiddenValue:function(/*Object*/ keyValArr, /*DomNode*/ option){ 410 411 // sets the hidden value of an item created from an <option value="CA"> 411 // AutoCompleter does not care about the value;Select does though412 // Select overrides this method412 // ComboBox does not care about the value; FilteringSelect does though 413 // FilteringSelect overrides this method 413 414 }, 414 415 … … 426 427 // go backwards to create the options list 427 428 // have to go backwards because we are removing the option nodes 428 // the option nodes are visible once the AutoCompleterinitializes429 // the option nodes are visible once the ComboBox initializes 429 430 for(var x=ol-1; x>=0; x--){ 430 431 var text = opts[x].innerHTML; 431 432 var keyValArr ={}; 432 433 keyValArr[this.searchAttr]=String(text); 433 // Select: assign the value attribute to the hidden value434 // FilteringSelect: assign the value attribute to the hidden value 434 435 this._assignHiddenValue(keyValArr, opts[x]); 435 436 data.unshift(keyValArr); … … 444 445 } 445 446 // call the associated Textbox postCreate 446 // ValidationTextbox for AutoCompleter; MappedTextbox forSelect447 // ValidationTextbox for ComboBox; MappedTextbox for FilteringSelect 447 448 this.parentClass=dojo.getObject(this.declaredClass, false).superclass; 448 449 this.parentClass.postCreate.apply(this, arguments); … … 455 456 456 457 dojo.declare( 457 "dijit.form._ AutoCompleterMenu",458 "dijit.form._ComboBoxMenu", 458 459 [dijit.base.FormElement, dijit.base.TemplatedWidget], 459 460 460 461 // Bill: 461 // I'd like the interface to AutoCompleterMenu to be higher level,462 // I'd like the interface to ComboBoxMenu to be higher level, 462 463 // taking a list of items to initialize it, and returns the selected item 463 464 // 464 // new _ AutoCompleterMenu({465 // new _ComboBoxMenu({ 465 466 // items: /*dojo.data.Item[]*/ items, 466 467 // labelFunc: dojo.hitc(this, "_makeLabel"), … … 482 483 { 483 484 // summary: 484 // Focus-less div based menu for internal use in AutoCompleter485 // Focus-less div based menu for internal use in ComboBox 485 486 486 487 templateString:"<div class='dijitMenu' dojoAttachEvent='onclick; onmouseover; onmouseout;' tabIndex='-1' style='display:none; position:absolute; overflow:\"auto\";'></div>", … … 494 495 open:function(/*Widget*/ widget){ 495 496 this.onValueChanged=dojo.hitch(widget, widget._selectOption); 496 // connect onkeypress to AutoCompleter497 // connect onkeypress to ComboBox 497 498 this._onkeypresshandle=dojo.connect(this.domNode, "onkeypress", widget, "onkeypress"); 498 499 return dijit.util.PopupManager.openAround(widget.domNode, this); … … 627 628 628 629 dojo.declare( 629 "dijit.form. AutoCompleter",630 [dijit.form.ValidationTextbox, dijit.form. AutoCompleterMixin],630 "dijit.form.ComboBox", 631 [dijit.form.ValidationTextbox, dijit.form.ComboBoxMixin], 631 632 {} 632 633 ); -
dijit/trunk/form/DateTextbox.js
r8881 r8926 15 15 // A validating, serializable, range-bound date text box. 16 16 // constraints object: min, max 17 templatePath: dojo.moduleUrl("dijit.form", "templates/ AutoCompleter.html"),17 templatePath: dojo.moduleUrl("dijit.form", "templates/ComboBox.html"), 18 18 regExpGen: dojo.date.locale.regexp, 19 19 compare: dojo.date.compare, -
dijit/trunk/form/FilteringSelect.js
r8823 r8926 1 dojo.provide("dijit.form. Select");1 dojo.provide("dijit.form.FilteringSelect"); 2 2 3 dojo.require("dijit.form. AutoCompleter");3 dojo.require("dijit.form.ComboBox"); 4 4 5 5 dojo.declare( 6 "dijit.form. Select",7 [dijit.form.MappedTextbox, dijit.form. AutoCompleterMixin],6 "dijit.form.FilteringSelect", 7 [dijit.form.MappedTextbox, dijit.form.ComboBoxMixin], 8 8 { 9 9 /* … … 40 40 _callbackSetLabel: function(/*Object*/ result){ 41 41 // summary 42 // Callback function that dynamically sets the label of the AutoCompleter42 // Callback function that dynamically sets the label of the ComboBox 43 43 44 44 if(!result.length){ … … 56 56 _setValue:function(/*String*/ value, /*String*/ displayedValue){ 57 57 this.valueNode.value = value; 58 dijit.form. Select.superclass.setValue.apply(this, arguments);58 dijit.form.FilteringSelect.superclass.setValue.apply(this, arguments); 59 59 }, 60 60 … … 86 86 labelFunc: function(/*Object*/ item, /*dojo.data.store*/ store){ 87 87 // summary: Event handler called when the label changes 88 // returns the label that the AutoCompletershould display88 // returns the label that the ComboBox should display 89 89 return store.getValue(item, this.searchAttr); 90 90 }, … … 93 93 // summary: creates an option to appear on the popup menu 94 94 95 var td=dijit.form. AutoCompleterMixin.prototype._createOption.apply(this, arguments);95 var td=dijit.form.ComboBoxMixin.prototype._createOption.apply(this, arguments); 96 96 // #3129 97 97 if(this.labelAttr){ … … 110 110 onkeyup: function(/*Event*/ evt){ 111 111 // summary: internal function 112 // Select needs to wait for the complete label before committing to a reverse lookup112 // FilteringSelect needs to wait for the complete label before committing to a reverse lookup 113 113 //this.setDisplayedValue(this.textbox.value); 114 114 }, … … 116 116 _assignHiddenValue:function(/*Object*/ keyValArr, /*DomNode*/ option){ 117 117 // summary: 118 // Overrides AutoCompleter._assignHiddenValue for creating a data store from an options list.118 // Overrides ComboBox._assignHiddenValue for creating a data store from an options list. 119 119 // Takes the <option value="CA"> and makes the CA the hidden value of the item. 120 120 keyValArr[this.keyAttr]=option.value; … … 123 123 _doSelect: function(/*Event*/ tgt){ 124 124 // summary: 125 // AutoCompleter's menu callback function126 // Select overrides this to set both the visible and hidden value from the information stored in the menu125 // ComboBox's menu callback function 126 // FilteringSelect overrides this to set both the visible and hidden value from the information stored in the menu 127 127 128 128 this._setValueFromItem(tgt.item); -
dijit/trunk/form/templates/ComboBox.html
r8855 r8926 1 <fieldset class='dijit dijitInline dijitLeft dijit AutoCompleter' id="widget_${id}" name="${name}"1 <fieldset class='dijit dijitInline dijitLeft dijitComboBox' id="widget_${id}" name="${name}" 2 2 dojoAttachEvent="onmouseover:setStateClass;onmouseout:setStateClass;" 3 3 > 4 4 <table cellspacing=0 cellpadding=0> 5 5 <tr> 6 <td class='dijitReset dijitStretch dijit AutoCompleterInput'6 <td class='dijitReset dijitStretch dijitComboBoxInput' 7 7 ><input class='XdijitInputField' type="text" autocomplete="off" name="${name}" 8 8 dojoAttachEvent="onkeypress; onkeyup; onfocus; onblur; compositionend;" -
dijit/trunk/form/_DropDownTextBox.js
r8867 r8926 11 11 // Mixin text box with drop down 12 12 13 templatePath: dojo.moduleUrl("dijit.form", "templates/ AutoCompleter.html"),13 templatePath: dojo.moduleUrl("dijit.form", "templates/ComboBox.html"), 14 14 15 15 // _popupWidget: Widget … … 25 25 26 26 // _popupClass: String 27 // Class of master popup (dijit.form._ AutoCompleterMenu)27 // Class of master popup (dijit.form._ComboBoxMenu) 28 28 _popupClass:"", 29 29 -
dijit/trunk/tests/form/test_ComboBox.html
r8729 r8926 3 3 <html> 4 4 <head> 5 <title>Dojo AutoCompleterWidget Test</title>5 <title>Dojo ComboBox Widget Test</title> 6 6 7 7 <script type="text/javascript" src="../testBidi.js"></script> … … 13 13 <script type="text/javascript" src="../../../dojo/dojo.js"></script> 14 14 <script type="text/javascript"> 15 dojo.require("dijit.form. AutoCompleter");15 dojo.require("dijit.form.ComboBox"); 16 16 dojo.require("dijit.util.manager"); 17 17 dojo.require("dijit.util.parser"); // scan page for widgets and instantiate them … … 28 28 function setVal2(val){ 29 29 document.getElementById('value2').value=val; 30 console.debug("Value changed to ["+val+"] in second AutoCompleter(#1652)");30 console.debug("Value changed to ["+val+"] in second ComboBox (#1652)"); 31 31 } 32 32 function setVal3(val){ … … 36 36 function init(){ 37 37 //var store=new dojo.data.JsonItemStore({}); 38 combo = new dijit.form. AutoCompleter({data:{items:[{name:"California", label:"California"}]}, name:"prog",autocomplete:false,searchAttr:"name", labelField:"label", labelType:"text"}, document.getElementById("progCombo"));38 combo = new dijit.form.ComboBox({data:{items:[{name:"California", label:"California"}]}, name:"prog",autocomplete:false,searchAttr:"name", labelField:"label", labelType:"text"}, document.getElementById("progCombo")); 39 39 } 40 40 dojo.addOnLoad(init); … … 50 50 51 51 <body class="tundra"> 52 <h1>Dojo AutoCompleterWidget Test</h1>52 <h1>Dojo ComboBox Widget Test</h1> 53 53 <p> 54 A AutoCompleteris like a text <input> field (ie, you can input any value you want),54 A ComboBox is like a text <input> field (ie, you can input any value you want), 55 55 but it also has a list of suggested values that you can choose from. 56 56 The drop down list is filtered by the data you have already typed in. … … 58 58 <form action="#" method="GET"> 59 59 60 <p> AutoCompleter#1: inlined data, autocomplete=false, default value of CA (California)</p>60 <p>ComboBox #1: inlined data, autocomplete=false, default value of CA (California)</p> 61 61 <label for="setvaluetest">US State test 1: </label> 62 62 <select id="setvaluetest" 63 63 name="state1" 64 dojoType="dijit.form. AutoCompleter"64 dojoType="dijit.form.ComboBox" 65 65 class="medium" 66 66 searchAttr="name" … … 141 141 <hr> 142 142 143 <p> AutoCompleter#2: url, autocomplete=true:</p>143 <p>ComboBox #2: url, autocomplete=true:</p> 144 144 <label for="datatest">US State test 2: </label> 145 <input dojoType="dijit.form. AutoCompleter"145 <input dojoType="dijit.form.ComboBox" 146 146 value="California" 147 147 class="medium" 148 url=" autoCompleterData.json"148 url="comboBoxData.json" 149 149 searchAttr="name" 150 150 labelField="label" … … 160 160 <hr> 161 161 162 <p> AutoCompleter#3: initially disabled, url, autocomplete=false:</p>162 <p>ComboBox #3: initially disabled, url, autocomplete=false:</p> 163 163 <label for="combo3">US State test 3: </label> 164 164 <input id="combo3" 165 dojoType="dijit.form. AutoCompleter"165 dojoType="dijit.form.ComboBox" 166 166 value="California" 167 167 class="medium" 168 url=" autoCompleterData.json"168 url="comboBoxData.json" 169 169 searchAttr="name" 170 170 labelField="label" … … 185 185 <p>Multiple autocompleters on a single line:</p> 186 186 <label for="one">US State 1: </label> 187 <input dojoType="dijit.form. AutoCompleter"187 <input dojoType="dijit.form.ComboBox" 188 188 value="California" 189 189 id="one" 190 url=" autoCompleterData.json"190 url="comboBoxData.json" 191 191 searchAttr="name" 192 192 labelField="label" … … 196 196 autocomplete="false" 197 197 > <label for="two">US State 2: </label> 198 <input dojoType="dijit.form. AutoCompleter"198 <input dojoType="dijit.form.ComboBox" 199 199 value="California" 200 200 id="two" 201 url=" autoCompleterData.json"201 url="comboBoxData.json" 202 202 searchAttr="name" 203 203 labelField="label" -
dijit/trunk/tests/form/test_ComboBox_destroy.html
r8693 r8926 17 17 <script type="text/javascript"> 18 18 19 dojo.require("dijit.form. AutoCompleter");19 dojo.require("dijit.form.ComboBox"); 20 20 dojo.require("dijit.util.manager"); 21 21 dojo.require("dijit.util.parser"); // scan page for widgets and instantiate them … … 27 27 dojo.addOnLoad(init); 28 28 function init(){ 29 //new dijit.form. AutoCompleter({name:"prog", id:"combo_02",autocomplete:false,url:"autoCompleterData.js",searchField:"name"}, document.getElementById("progCombo"));29 //new dijit.form.ComboBox({name:"prog", id:"combo_02",autocomplete:false,url:"comboBoxData.js",searchField:"name"}, document.getElementById("progCombo")); 30 30 dojo.connect(dojo.byId("killit"), "onclick", function() { 31 31 dijit.byId("combo_01").destroy(true); … … 51 51 <form action="#" method="GET"> 52 52 <input type="button" id="killit" name="killit" value="killit" /> 53 <select name="state" searchField="name" keyField="abbreviation" id="combo_01" dojoType="dijit.form. AutoCompleter" style="width: 300px;" name="foo.bar1" autocomplete="false"53 <select name="state" searchField="name" keyField="abbreviation" id="combo_01" dojoType="dijit.form.ComboBox" style="width: 300px;" name="foo.bar1" autocomplete="false" 54 54 > 55 55 <option value="AL">Alabama</option> -
dijit/trunk/tests/form/test_FilteringSelect.html
r8775 r8926 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 2 2 "http://www.w3.org/TR/html4/strict.dtd"> 3 3 <html> 4 4 <head> 5 5 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 6 <title>Dojo Select Widget Test</title>6 <title>Dojo FilteringSelect Widget Test</title> 7 7 8 8 <script type="text/javascript" src="../testBidi.js"></script> … … 14 14 <script type="text/javascript" src="../../../dojo/dojo.js"></script> 15 15 <script type="text/javascript"> 16 dojo.require("dijit.form. Select");16 dojo.require("dijit.form.FilteringSelect"); 17 17 dojo.require("dijit.util.parser"); // scan page for widgets and instantiate them 18 18 </script> … … 33 33 return label; 34 34 } 35