1 |
/*
|
1 |
/*
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
3 |
All Rights Reserved.
|
3 |
All Rights Reserved.
|
4 |
|
4 |
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
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:
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
7 |
|
7 |
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
9 |
*/
|
9 |
*/
|
- |
|
10 |
|
- |
|
11 |
|
10 |
|
12 |
|
11 |
dojo.provide("dojo.widget.DropdownContainer");
|
13 |
dojo.provide("dojo.widget.DropdownContainer");
|
12 |
dojo.require("dojo.widget.*");
|
14 |
dojo.require("dojo.widget.*");
|
13 |
dojo.require("dojo.widget.HtmlWidget");
|
15 |
dojo.require("dojo.widget.HtmlWidget");
|
14 |
dojo.require("dojo.widget.PopupContainer");
|
16 |
dojo.require("dojo.widget.PopupContainer");
|
15 |
dojo.require("dojo.event.*");
|
17 |
dojo.require("dojo.event.*");
|
16 |
dojo.require("dojo.html.layout");
|
18 |
dojo.require("dojo.html.layout");
|
17 |
dojo.require("dojo.html.display");
|
19 |
dojo.require("dojo.html.display");
|
18 |
dojo.require("dojo.html.iframe");
|
20 |
dojo.require("dojo.html.iframe");
|
19 |
dojo.require("dojo.html.util");
|
21 |
dojo.require("dojo.html.util");
|
20 |
dojo.widget.defineWidget("dojo.widget.DropdownContainer", dojo.widget.HtmlWidget, {inputWidth:"7em", id:"", inputId:"", inputName:"", iconURL:dojo.uri.moduleUri("dojo.widget", "templates/images/combo_box_arrow.png"), copyClasses:false, iconAlt:"", containerToggle:"plain", containerToggleDuration:150, templateString:"<span style=\"white-space:nowrap\"><input type=\"hidden\" name=\"\" value=\"\" dojoAttachPoint=\"valueNode\" /><input name=\"\" type=\"text\" value=\"\" style=\"vertical-align:middle;\" dojoAttachPoint=\"inputNode\" autocomplete=\"off\" /> <img src=\"${this.iconURL}\" alt=\"${this.iconAlt}\" dojoAttachEvent=\"onclick:onIconClick\" dojoAttachPoint=\"buttonNode\" style=\"vertical-align:middle; cursor:pointer; cursor:hand\" /></span>", templateCssPath:"", isContainer:true, attachTemplateNodes:function () {
|
22 |
dojo.widget.defineWidget("dojo.widget.DropdownContainer", dojo.widget.HtmlWidget, {inputWidth:"7em", id:"", inputId:"", inputName:"", iconURL:dojo.uri.moduleUri("dojo.widget", "templates/images/combo_box_arrow.png"), copyClasses:false, iconAlt:"", containerToggle:"plain", containerToggleDuration:150, templateString:"<span style=\"white-space:nowrap\"><input type=\"hidden\" name=\"\" value=\"\" dojoAttachPoint=\"valueNode\" /><input name=\"\" type=\"text\" value=\"\" style=\"vertical-align:middle;\" dojoAttachPoint=\"inputNode\" autocomplete=\"off\" /> <img src=\"${this.iconURL}\" alt=\"${this.iconAlt}\" dojoAttachEvent=\"onclick:onIconClick\" dojoAttachPoint=\"buttonNode\" style=\"vertical-align:middle; cursor:pointer; cursor:hand\" /></span>", templateCssPath:"", isContainer:true, attachTemplateNodes:function () {
|
21 |
dojo.widget.DropdownContainer.superclass.attachTemplateNodes.apply(this, arguments);
|
23 |
dojo.widget.DropdownContainer.superclass.attachTemplateNodes.apply(this, arguments);
|
22 |
this.popup = dojo.widget.createWidget("PopupContainer", {toggle:this.containerToggle, toggleDuration:this.containerToggleDuration});
|
24 |
this.popup = dojo.widget.createWidget("PopupContainer", {toggle:this.containerToggle, toggleDuration:this.containerToggleDuration});
|
23 |
this.containerNode = this.popup.domNode;
|
25 |
this.containerNode = this.popup.domNode;
|
24 |
}, fillInTemplate:function (args, frag) {
|
26 |
}, fillInTemplate:function (args, frag) {
|
25 |
this.domNode.appendChild(this.popup.domNode);
|
27 |
this.domNode.appendChild(this.popup.domNode);
|
26 |
if (this.id) {
|
28 |
if (this.id) {
|
27 |
this.domNode.id = this.id;
|
29 |
this.domNode.id = this.id;
|
28 |
}
|
30 |
}
|
29 |
if (this.inputId) {
|
31 |
if (this.inputId) {
|
30 |
this.inputNode.id = this.inputId;
|
32 |
this.inputNode.id = this.inputId;
|
31 |
}
|
33 |
}
|
32 |
if (this.inputName) {
|
34 |
if (this.inputName) {
|
33 |
this.inputNode.name = this.inputName;
|
35 |
this.inputNode.name = this.inputName;
|
34 |
}
|
36 |
}
|
35 |
this.inputNode.style.width = this.inputWidth;
|
37 |
this.inputNode.style.width = this.inputWidth;
|
36 |
this.inputNode.disabled = this.disabled;
|
38 |
this.inputNode.disabled = this.disabled;
|
37 |
if (this.copyClasses) {
|
39 |
if (this.copyClasses) {
|
38 |
this.inputNode.style = "";
|
40 |
this.inputNode.style = "";
|
39 |
this.inputNode.className = this.getFragNodeRef(frag).className;
|
41 |
this.inputNode.className = this.getFragNodeRef(frag).className;
|
40 |
}
|
42 |
}
|
41 |
dojo.event.connect(this.inputNode, "onchange", this, "onInputChange");
|
43 |
dojo.event.connect(this.inputNode, "onchange", this, "onInputChange");
|
42 |
}, onIconClick:function (evt) {
|
44 |
}, onIconClick:function (evt) {
|
43 |
if (this.disabled) {
|
45 |
if (this.disabled) {
|
44 |
return;
|
46 |
return;
|
45 |
}
|
47 |
}
|
46 |
if (!this.popup.isShowingNow) {
|
48 |
if (!this.popup.isShowingNow) {
|
47 |
this.popup.open(this.inputNode, this, this.buttonNode);
|
49 |
this.popup.open(this.inputNode, this, this.buttonNode);
|
48 |
} else {
|
50 |
} else {
|
49 |
this.popup.close();
|
51 |
this.popup.close();
|
50 |
}
|
52 |
}
|
51 |
}, hideContainer:function () {
|
53 |
}, hideContainer:function () {
|
52 |
if (this.popup.isShowingNow) {
|
54 |
if (this.popup.isShowingNow) {
|
53 |
this.popup.close();
|
55 |
this.popup.close();
|
54 |
}
|
56 |
}
|
55 |
}, onInputChange:function () {
|
57 |
}, onInputChange:function () {
|
56 |
}, enable:function () {
|
58 |
}, enable:function () {
|
57 |
this.inputNode.disabled = false;
|
59 |
this.inputNode.disabled = false;
|
58 |
dojo.widget.DropdownContainer.superclass.enable.apply(this, arguments);
|
60 |
dojo.widget.DropdownContainer.superclass.enable.apply(this, arguments);
|
59 |
}, disable:function () {
|
61 |
}, disable:function () {
|
60 |
this.inputNode.disabled = true;
|
62 |
this.inputNode.disabled = true;
|
61 |
dojo.widget.DropdownContainer.superclass.disable.apply(this, arguments);
|
63 |
dojo.widget.DropdownContainer.superclass.disable.apply(this, arguments);
|
62 |
}});
|
64 |
}});
|
63 |
|
65 |
|