Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
11
dojo.provide("dojo.widget.ComboBox");
12
dojo.require("dojo.widget.*");
13
dojo.require("dojo.event.*");
14
dojo.require("dojo.io.*");
15
dojo.require("dojo.html.*");
16
dojo.require("dojo.string");
17
dojo.require("dojo.widget.html.stabile");
18
dojo.require("dojo.widget.PopupContainer");
19
dojo.declare("dojo.widget.incrementalComboBoxDataProvider", null, function (options) {
20
	this.searchUrl = options.dataUrl;
21
	this._cache = {};
22
	this._inFlight = false;
23
	this._lastRequest = null;
24
	this.allowCache = false;
25
}, {_addToCache:function (keyword, data) {
26
	if (this.allowCache) {
27
		this._cache[keyword] = data;
28
	}
29
}, startSearch:function (searchStr, callback) {
30
	if (this._inFlight) {
31
	}
32
	var tss = encodeURIComponent(searchStr);
33
	var realUrl = dojo.string.substituteParams(this.searchUrl, {"searchString":tss});
34
	var _this = this;
35
	var request = this._lastRequest = dojo.io.bind({url:realUrl, method:"get", mimetype:"text/json", load:function (type, data, evt) {
36
		_this._inFlight = false;
37
		if (!dojo.lang.isArray(data)) {
38
			var arrData = [];
39
			for (var key in data) {
40
				arrData.push([data[key], key]);
41
			}
42
			data = arrData;
43
		}
44
		_this._addToCache(searchStr, data);
45
		if (request == _this._lastRequest) {
46
			callback(data);
47
		}
48
	}});
49
	this._inFlight = true;
50
}});
51
dojo.declare("dojo.widget.basicComboBoxDataProvider", null, function (options, node) {
52
	this._data = [];
53
	this.searchLimit = 30;
54
	this.searchType = "STARTSTRING";
55
	this.caseSensitive = false;
56
	if (!dj_undef("dataUrl", options) && !dojo.string.isBlank(options.dataUrl)) {
57
		this._getData(options.dataUrl);
58
	} else {
59
		if ((node) && (node.nodeName.toLowerCase() == "select")) {
60
			var opts = node.getElementsByTagName("option");
61
			var ol = opts.length;
62
			var data = [];
63
			for (var x = 0; x < ol; x++) {
64
				var text = opts[x].textContent || opts[x].innerText || opts[x].innerHTML;
65
				var keyValArr = [String(text), String(opts[x].value)];
66
				data.push(keyValArr);
67
				if (opts[x].selected) {
68
					options.setAllValues(keyValArr[0], keyValArr[1]);
69
				}
70
			}
71
			this.setData(data);
72
		}
73
	}
74
}, {_getData:function (url) {
75
	dojo.io.bind({url:url, load:dojo.lang.hitch(this, function (type, data, evt) {
76
		if (!dojo.lang.isArray(data)) {
77
			var arrData = [];
78
			for (var key in data) {
79
				arrData.push([data[key], key]);
80
			}
81
			data = arrData;
82
		}
83
		this.setData(data);
84
	}), mimetype:"text/json"});
85
}, startSearch:function (searchStr, callback) {
86
	this._performSearch(searchStr, callback);
87
}, _performSearch:function (searchStr, callback) {
88
	var st = this.searchType;
89
	var ret = [];
90
	if (!this.caseSensitive) {
91
		searchStr = searchStr.toLowerCase();
92
	}
93
	for (var x = 0; x < this._data.length; x++) {
94
		if ((this.searchLimit > 0) && (ret.length >= this.searchLimit)) {
95
			break;
96
		}
97
		var dataLabel = new String((!this.caseSensitive) ? this._data[x][0].toLowerCase() : this._data[x][0]);
98
		if (dataLabel.length < searchStr.length) {
99
			continue;
100
		}
101
		if (st == "STARTSTRING") {
102
			if (searchStr == dataLabel.substr(0, searchStr.length)) {
103
				ret.push(this._data[x]);
104
			}
105
		} else {
106
			if (st == "SUBSTRING") {
107
				if (dataLabel.indexOf(searchStr) >= 0) {
108
					ret.push(this._data[x]);
109
				}
110
			} else {
111
				if (st == "STARTWORD") {
112
					var idx = dataLabel.indexOf(searchStr);
113
					if (idx == 0) {
114
						ret.push(this._data[x]);
115
					}
116
					if (idx <= 0) {
117
						continue;
118
					}
119
					var matches = false;
120
					while (idx != -1) {
121
						if (" ,/(".indexOf(dataLabel.charAt(idx - 1)) != -1) {
122
							matches = true;
123
							break;
124
						}
125
						idx = dataLabel.indexOf(searchStr, idx + 1);
126
					}
127
					if (!matches) {
128
						continue;
129
					} else {
130
						ret.push(this._data[x]);
131
					}
132
				}
133
			}
134
		}
135
	}
136
	callback(ret);
137
}, setData:function (pdata) {
138
	this._data = pdata;
139
}});
140
dojo.widget.defineWidget("dojo.widget.ComboBox", dojo.widget.HtmlWidget, {forceValidOption:false, searchType:"stringstart", dataProvider:null, autoComplete:true, searchDelay:100, dataUrl:"", fadeTime:200, maxListLength:8, mode:"local", selectedResult:null, dataProviderClass:"", buttonSrc:dojo.uri.moduleUri("dojo.widget", "templates/images/combo_box_arrow.png"), dropdownToggle:"fade", templateString:"<span _=\"whitespace and CR's between tags adds &nbsp; in FF\"\n\tclass=\"dojoComboBoxOuter\"\n\t><input style=\"display:none\"  tabindex=\"-1\" name=\"\" value=\"\" \n\t\tdojoAttachPoint=\"comboBoxValue\"\n\t><input style=\"display:none\"  tabindex=\"-1\" name=\"\" value=\"\" \n\t\tdojoAttachPoint=\"comboBoxSelectionValue\"\n\t><input type=\"text\" autocomplete=\"off\" class=\"dojoComboBox\"\n\t\tdojoAttachEvent=\"key:_handleKeyEvents; keyUp: onKeyUp; compositionEnd; onResize;\"\n\t\tdojoAttachPoint=\"textInputNode\"\n\t><img hspace=\"0\"\n\t\tvspace=\"0\"\n\t\tclass=\"dojoComboBox\"\n\t\tdojoAttachPoint=\"downArrowNode\"\n\t\tdojoAttachEvent=\"onMouseUp: handleArrowClick; onResize;\"\n\t\tsrc=\"${this.buttonSrc}\"\n></span>\n", templateCssString:".dojoComboBoxOuter {\n\tborder: 0px !important;\n\tmargin: 0px !important;\n\tpadding: 0px !important;\n\tbackground: transparent !important;\n\twhite-space: nowrap !important;\n}\n\n.dojoComboBox {\n\tborder: 1px inset #afafaf;\n\tmargin: 0px;\n\tpadding: 0px;\n\tvertical-align: middle !important;\n\tfloat: none !important;\n\tposition: static !important;\n\tdisplay: inline !important;\n}\n\n/* the input box */\ninput.dojoComboBox {\n\tborder-right-width: 0px !important; \n\tmargin-right: 0px !important;\n\tpadding-right: 0px !important;\n}\n\n/* the down arrow */\nimg.dojoComboBox {\n\tborder-left-width: 0px !important;\n\tpadding-left: 0px !important;\n\tmargin-left: 0px !important;\n}\n\n/* IE vertical-alignment calculations can be off by +-1 but these margins are collapsed away */\n.dj_ie img.dojoComboBox {\n\tmargin-top: 1px; \n\tmargin-bottom: 1px; \n}\n\n/* the drop down */\n.dojoComboBoxOptions {\n\tfont-family: Verdana, Helvetica, Garamond, sans-serif;\n\t/* font-size: 0.7em; */\n\tbackground-color: white;\n\tborder: 1px solid #afafaf;\n\tposition: absolute;\n\tz-index: 1000; \n\toverflow: auto;\n\tcursor: default;\n}\n\n.dojoComboBoxItem {\n\tpadding-left: 2px;\n\tpadding-top: 2px;\n\tmargin: 0px;\n}\n\n.dojoComboBoxItemEven {\n\tbackground-color: #f4f4f4;\n}\n\n.dojoComboBoxItemOdd {\n\tbackground-color: white;\n}\n\n.dojoComboBoxItemHighlight {\n\tbackground-color: #63709A;\n\tcolor: white;\n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/ComboBox.css"), setValue:function (value) {
141
	this.comboBoxValue.value = value;
142
	if (this.textInputNode.value != value) {
143
		this.textInputNode.value = value;
144
		dojo.widget.html.stabile.setState(this.widgetId, this.getState(), true);
145
		this.onValueChanged(value);
146
	}
147
}, onValueChanged:function (value) {
148
}, getValue:function () {
149
	return this.comboBoxValue.value;
150
}, getState:function () {
151
	return {value:this.getValue()};
152
}, setState:function (state) {
153
	this.setValue(state.value);
154
}, enable:function () {
155
	this.disabled = false;
156
	this.textInputNode.removeAttribute("disabled");
157
}, disable:function () {
158
	this.disabled = true;
159
	this.textInputNode.setAttribute("disabled", true);
160
}, _getCaretPos:function (element) {
161
	if (dojo.lang.isNumber(element.selectionStart)) {
162
		return element.selectionStart;
163
	} else {
164
		if (dojo.render.html.ie) {
165
			var tr = document.selection.createRange().duplicate();
166
			var ntr = element.createTextRange();
167
			tr.move("character", 0);
168
			ntr.move("character", 0);
169
			try {
170
				ntr.setEndPoint("EndToEnd", tr);
171
				return String(ntr.text).replace(/\r/g, "").length;
172
			}
173
			catch (e) {
174
				return 0;
175
			}
176
		}
177
	}
178
}, _setCaretPos:function (element, location) {
179
	location = parseInt(location);
180
	this._setSelectedRange(element, location, location);
181
}, _setSelectedRange:function (element, start, end) {
182
	if (!end) {
183
		end = element.value.length;
184
	}
185
	if (element.setSelectionRange) {
186
		element.focus();
187
		element.setSelectionRange(start, end);
188
	} else {
189
		if (element.createTextRange) {
190
			var range = element.createTextRange();
191
			with (range) {
192
				collapse(true);
193
				moveEnd("character", end);
194
				moveStart("character", start);
195
				select();
196
			}
197
		} else {
198
			element.value = element.value;
199
			element.blur();
200
			element.focus();
201
			var dist = parseInt(element.value.length) - end;
202
			var tchar = String.fromCharCode(37);
203
			var tcc = tchar.charCodeAt(0);
204
			for (var x = 0; x < dist; x++) {
205
				var te = document.createEvent("KeyEvents");
206
				te.initKeyEvent("keypress", true, true, null, false, false, false, false, tcc, tcc);
207
				element.dispatchEvent(te);
208
			}
209
		}
210
	}
211
}, _handleKeyEvents:function (evt) {
212
	if (evt.ctrlKey || evt.altKey || !evt.key) {
213
		return;
214
	}
215
	this._prev_key_backspace = false;
216
	this._prev_key_esc = false;
217
	var k = dojo.event.browser.keys;
218
	var doSearch = true;
219
	switch (evt.key) {
220
	  case k.KEY_DOWN_ARROW:
221
		if (!this.popupWidget.isShowingNow) {
222
			this._startSearchFromInput();
223
		}
224
		this._highlightNextOption();
225
		dojo.event.browser.stopEvent(evt);
226
		return;
227
	  case k.KEY_UP_ARROW:
228
		this._highlightPrevOption();
229
		dojo.event.browser.stopEvent(evt);
230
		return;
231
	  case k.KEY_TAB:
232
		if (!this.autoComplete && this.popupWidget.isShowingNow && this._highlighted_option) {
233
			dojo.event.browser.stopEvent(evt);
234
			this._selectOption({"target":this._highlighted_option, "noHide":false});
235
			this._setSelectedRange(this.textInputNode, this.textInputNode.value.length, null);
236
		} else {
237
			this._selectOption();
238
			return;
239
		}
240
		break;
241
	  case k.KEY_ENTER:
242
		if (this.popupWidget.isShowingNow) {
243
			dojo.event.browser.stopEvent(evt);
244
		}
245
		if (this.autoComplete) {
246
			this._selectOption();
247
			return;
248
		}
249
	  case " ":
250
		if (this.popupWidget.isShowingNow && this._highlighted_option) {
251
			dojo.event.browser.stopEvent(evt);
252
			this._selectOption();
253
			this._hideResultList();
254
			return;
255
		}
256
		break;
257
	  case k.KEY_ESCAPE:
258
		this._hideResultList();
259
		this._prev_key_esc = true;
260
		return;
261
	  case k.KEY_BACKSPACE:
262
		this._prev_key_backspace = true;
263
		if (!this.textInputNode.value.length) {
264
			this.setAllValues("", "");
265
			this._hideResultList();
266
			doSearch = false;
267
		}
268
		break;
269
	  case k.KEY_RIGHT_ARROW:
270
	  case k.KEY_LEFT_ARROW:
271
		doSearch = false;
272
		break;
273
	  default:
274
		if (evt.charCode == 0) {
275
			doSearch = false;
276
		}
277
	}
278
	if (this.searchTimer) {
279
		clearTimeout(this.searchTimer);
280
	}
281
	if (doSearch) {
282
		this._blurOptionNode();
283
		this.searchTimer = setTimeout(dojo.lang.hitch(this, this._startSearchFromInput), this.searchDelay);
284
	}
285
}, compositionEnd:function (evt) {
286
	evt.key = evt.keyCode;
287
	this._handleKeyEvents(evt);
288
}, onKeyUp:function (evt) {
289
	this.setValue(this.textInputNode.value);
290
}, setSelectedValue:function (value) {
291
	this.comboBoxSelectionValue.value = value;
292
}, setAllValues:function (value1, value2) {
293
	this.setSelectedValue(value2);
294
	this.setValue(value1);
295
}, _focusOptionNode:function (node) {
296
	if (this._highlighted_option != node) {
297
		this._blurOptionNode();
298
		this._highlighted_option = node;
299
		dojo.html.addClass(this._highlighted_option, "dojoComboBoxItemHighlight");
300
	}
301
}, _blurOptionNode:function () {
302
	if (this._highlighted_option) {
303
		dojo.html.removeClass(this._highlighted_option, "dojoComboBoxItemHighlight");
304
		this._highlighted_option = null;
305
	}
306
}, _highlightNextOption:function () {
307
	if ((!this._highlighted_option) || !this._highlighted_option.parentNode) {
308
		this._focusOptionNode(this.optionsListNode.firstChild);
309
	} else {
310
		if (this._highlighted_option.nextSibling) {
311
			this._focusOptionNode(this._highlighted_option.nextSibling);
312
		}
313
	}
314
	dojo.html.scrollIntoView(this._highlighted_option);
315
}, _highlightPrevOption:function () {
316
	if (this._highlighted_option && this._highlighted_option.previousSibling) {
317
		this._focusOptionNode(this._highlighted_option.previousSibling);
318
	} else {
319
		this._highlighted_option = null;
320
		this._hideResultList();
321
		return;
322
	}
323
	dojo.html.scrollIntoView(this._highlighted_option);
324
}, _itemMouseOver:function (evt) {
325
	if (evt.target === this.optionsListNode) {
326
		return;
327
	}
328
	this._focusOptionNode(evt.target);
329
	dojo.html.addClass(this._highlighted_option, "dojoComboBoxItemHighlight");
330
}, _itemMouseOut:function (evt) {
331
	if (evt.target === this.optionsListNode) {
332
		return;
333
	}
334
	this._blurOptionNode();
335
}, onResize:function () {
336
	var inputSize = dojo.html.getContentBox(this.textInputNode);
337
	if (inputSize.height <= 0) {
338
		dojo.lang.setTimeout(this, "onResize", 100);
339
		return;
340
	}
341
	var buttonSize = {width:inputSize.height, height:inputSize.height};
342
	dojo.html.setContentBox(this.downArrowNode, buttonSize);
343
}, fillInTemplate:function (args, frag) {
344
	dojo.html.applyBrowserClass(this.domNode);
345
	var source = this.getFragNodeRef(frag);
346
	if (!this.name && source.name) {
347
		this.name = source.name;
348
	}
349
	this.comboBoxValue.name = this.name;
350
	this.comboBoxSelectionValue.name = this.name + "_selected";
351
	dojo.html.copyStyle(this.domNode, source);
352
	dojo.html.copyStyle(this.textInputNode, source);
353
	dojo.html.copyStyle(this.downArrowNode, source);
354
	with (this.downArrowNode.style) {
355
		width = "0px";
356
		height = "0px";
357
	}
358
	var dpClass;
359
	if (this.dataProviderClass) {
360
		if (typeof this.dataProviderClass == "string") {
361
			dpClass = dojo.evalObjPath(this.dataProviderClass);
362
		} else {
363
			dpClass = this.dataProviderClass;
364
		}
365
	} else {
366
		if (this.mode == "remote") {
367
			dpClass = dojo.widget.incrementalComboBoxDataProvider;
368
		} else {
369
			dpClass = dojo.widget.basicComboBoxDataProvider;
370
		}
371
	}
372
	this.dataProvider = new dpClass(this, this.getFragNodeRef(frag));
373
	this.popupWidget = new dojo.widget.createWidget("PopupContainer", {toggle:this.dropdownToggle, toggleDuration:this.toggleDuration});
374
	dojo.event.connect(this, "destroy", this.popupWidget, "destroy");
375
	this.optionsListNode = this.popupWidget.domNode;
376
	this.domNode.appendChild(this.optionsListNode);
377
	dojo.html.addClass(this.optionsListNode, "dojoComboBoxOptions");
378
	dojo.event.connect(this.optionsListNode, "onclick", this, "_selectOption");
379
	dojo.event.connect(this.optionsListNode, "onmouseover", this, "_onMouseOver");
380
	dojo.event.connect(this.optionsListNode, "onmouseout", this, "_onMouseOut");
381
	dojo.event.connect(this.optionsListNode, "onmouseover", this, "_itemMouseOver");
382
	dojo.event.connect(this.optionsListNode, "onmouseout", this, "_itemMouseOut");
383
}, _openResultList:function (results) {
384
	if (this.disabled) {
385
		return;
386
	}
387
	this._clearResultList();
388
	if (!results.length) {
389
		this._hideResultList();
390
	}
391
	if ((this.autoComplete) && (results.length) && (!this._prev_key_backspace) && (this.textInputNode.value.length > 0)) {
392
		var cpos = this._getCaretPos(this.textInputNode);
393
		if ((cpos + 1) > this.textInputNode.value.length) {
394
			this.textInputNode.value += results[0][0].substr(cpos);
395
			this._setSelectedRange(this.textInputNode, cpos, this.textInputNode.value.length);
396
		}
397
	}
398
	var even = true;
399
	while (results.length) {
400
		var tr = results.shift();
401
		if (tr) {
402
			var td = document.createElement("div");
403
			td.appendChild(document.createTextNode(tr[0]));
404
			td.setAttribute("resultName", tr[0]);
405
			td.setAttribute("resultValue", tr[1]);
406
			td.className = "dojoComboBoxItem " + ((even) ? "dojoComboBoxItemEven" : "dojoComboBoxItemOdd");
407
			even = (!even);
408
			this.optionsListNode.appendChild(td);
409
		}
410
	}
411
	this._showResultList();
412
}, _onFocusInput:function () {
413
	this._hasFocus = true;
414
}, _onBlurInput:function () {
415
	this._hasFocus = false;
416
	this._handleBlurTimer(true, 500);
417
}, _handleBlurTimer:function (clear, millisec) {
418
	if (this.blurTimer && (clear || millisec)) {
419
		clearTimeout(this.blurTimer);
420
	}
421
	if (millisec) {
422
		this.blurTimer = dojo.lang.setTimeout(this, "_checkBlurred", millisec);
423
	}
424
}, _onMouseOver:function (evt) {
425
	if (!this._mouseover_list) {
426
		this._handleBlurTimer(true, 0);
427
		this._mouseover_list = true;
428
	}
429
}, _onMouseOut:function (evt) {
430
	var relTarget = evt.relatedTarget;
431
	try {
432
		if (!relTarget || relTarget.parentNode != this.optionsListNode) {
433
			this._mouseover_list = false;
434
			this._handleBlurTimer(true, 100);
435
			this._tryFocus();
436
		}
437
	}
438
	catch (e) {
439
	}
440
}, _isInputEqualToResult:function (result) {
441
	var input = this.textInputNode.value;
442
	if (!this.dataProvider.caseSensitive) {
443
		input = input.toLowerCase();
444
		result = result.toLowerCase();
445
	}
446
	return (input == result);
447
}, _isValidOption:function () {
448
	var tgt = dojo.html.firstElement(this.optionsListNode);
449
	var isValidOption = false;
450
	while (!isValidOption && tgt) {
451
		if (this._isInputEqualToResult(tgt.getAttribute("resultName"))) {
452
			isValidOption = true;
453
		} else {
454
			tgt = dojo.html.nextElement(tgt);
455
		}
456
	}
457
	return isValidOption;
458
}, _checkBlurred:function () {
459
	if (!this._hasFocus && !this._mouseover_list) {
460
		this._hideResultList();
461
		if (!this.textInputNode.value.length) {
462
			this.setAllValues("", "");
463
			return;
464
		}
465
		var isValidOption = this._isValidOption();
466
		if (this.forceValidOption && !isValidOption) {
467
			this.setAllValues("", "");
468
			return;
469
		}
470
		if (!isValidOption) {
471
			this.setSelectedValue("");
472
		}
473
	}
474
}, _selectOption:function (evt) {
475
	var tgt = null;
476
	if (!evt) {
477
		evt = {target:this._highlighted_option};
478
	}
479
	if (!dojo.html.isDescendantOf(evt.target, this.optionsListNode)) {
480
		if (!this.textInputNode.value.length) {
481
			return;
482
		}
483
		tgt = dojo.html.firstElement(this.optionsListNode);
484
		if (!tgt || !this._isInputEqualToResult(tgt.getAttribute("resultName"))) {
485
			return;
486
		}
487
	} else {
488
		tgt = evt.target;
489
	}
490
	while ((tgt.nodeType != 1) || (!tgt.getAttribute("resultName"))) {
491
		tgt = tgt.parentNode;
492
		if (tgt === dojo.body()) {
493
			return false;
494
		}
495
	}
496
	this.selectedResult = [tgt.getAttribute("resultName"), tgt.getAttribute("resultValue")];
497
	this.setAllValues(tgt.getAttribute("resultName"), tgt.getAttribute("resultValue"));
498
	if (!evt.noHide) {
499
		this._hideResultList();
500
		this._setSelectedRange(this.textInputNode, 0, null);
501
	}
502
	this._tryFocus();
503
}, _clearResultList:function () {
504
	if (this.optionsListNode.innerHTML) {
505
		this.optionsListNode.innerHTML = "";
506
	}
507
}, _hideResultList:function () {
508
	this.popupWidget.close();
509
}, _showResultList:function () {
510
	var childs = this.optionsListNode.childNodes;
511
	if (childs.length) {
512
		var visibleCount = Math.min(childs.length, this.maxListLength);
513
		with (this.optionsListNode.style) {
514
			display = "";
515
			if (visibleCount == childs.length) {
516
				height = "";
517
			} else {
518
				height = visibleCount * dojo.html.getMarginBox(childs[0]).height + "px";
519
			}
520
			width = (dojo.html.getMarginBox(this.domNode).width - 2) + "px";
521
		}
522
		this.popupWidget.open(this.domNode, this, this.downArrowNode);
523
	} else {
524
		this._hideResultList();
525
	}
526
}, handleArrowClick:function () {
527
	this._handleBlurTimer(true, 0);
528
	this._tryFocus();
529
	if (this.popupWidget.isShowingNow) {
530
		this._hideResultList();
531
	} else {
532
		this._startSearch("");
533
	}
534
}, _tryFocus:function () {
535
	try {
536
		this.textInputNode.focus();
537
	}
538
	catch (e) {
539
	}
540
}, _startSearchFromInput:function () {
541
	this._startSearch(this.textInputNode.value);
542
}, _startSearch:function (key) {
543
	this.dataProvider.startSearch(key, dojo.lang.hitch(this, "_openResultList"));
544
}, postCreate:function () {
545
	this.onResize();
546
	dojo.event.connect(this.textInputNode, "onblur", this, "_onBlurInput");
547
	dojo.event.connect(this.textInputNode, "onfocus", this, "_onFocusInput");
548
	if (this.disabled) {
549
		this.disable();
550
	}
551
	var s = dojo.widget.html.stabile.getState(this.widgetId);
552
	if (s) {
553
		this.setState(s);
554
	}
555
}});
556