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 |
|
1422 |
alexandre_ |
11 |
|
|
|
12 |
|
1318 |
alexandre_ |
13 |
dojo.provide("dojo.widget.DropdownContainer");
|
|
|
14 |
dojo.require("dojo.widget.*");
|
|
|
15 |
dojo.require("dojo.widget.HtmlWidget");
|
|
|
16 |
dojo.require("dojo.widget.PopupContainer");
|
|
|
17 |
dojo.require("dojo.event.*");
|
|
|
18 |
dojo.require("dojo.html.layout");
|
|
|
19 |
dojo.require("dojo.html.display");
|
|
|
20 |
dojo.require("dojo.html.iframe");
|
|
|
21 |
dojo.require("dojo.html.util");
|
|
|
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 () {
|
|
|
23 |
dojo.widget.DropdownContainer.superclass.attachTemplateNodes.apply(this, arguments);
|
|
|
24 |
this.popup = dojo.widget.createWidget("PopupContainer", {toggle:this.containerToggle, toggleDuration:this.containerToggleDuration});
|
|
|
25 |
this.containerNode = this.popup.domNode;
|
|
|
26 |
}, fillInTemplate:function (args, frag) {
|
|
|
27 |
this.domNode.appendChild(this.popup.domNode);
|
|
|
28 |
if (this.id) {
|
|
|
29 |
this.domNode.id = this.id;
|
|
|
30 |
}
|
|
|
31 |
if (this.inputId) {
|
|
|
32 |
this.inputNode.id = this.inputId;
|
|
|
33 |
}
|
|
|
34 |
if (this.inputName) {
|
|
|
35 |
this.inputNode.name = this.inputName;
|
|
|
36 |
}
|
|
|
37 |
this.inputNode.style.width = this.inputWidth;
|
|
|
38 |
this.inputNode.disabled = this.disabled;
|
|
|
39 |
if (this.copyClasses) {
|
|
|
40 |
this.inputNode.style = "";
|
|
|
41 |
this.inputNode.className = this.getFragNodeRef(frag).className;
|
|
|
42 |
}
|
|
|
43 |
dojo.event.connect(this.inputNode, "onchange", this, "onInputChange");
|
|
|
44 |
}, onIconClick:function (evt) {
|
|
|
45 |
if (this.disabled) {
|
|
|
46 |
return;
|
|
|
47 |
}
|
|
|
48 |
if (!this.popup.isShowingNow) {
|
|
|
49 |
this.popup.open(this.inputNode, this, this.buttonNode);
|
|
|
50 |
} else {
|
|
|
51 |
this.popup.close();
|
|
|
52 |
}
|
|
|
53 |
}, hideContainer:function () {
|
|
|
54 |
if (this.popup.isShowingNow) {
|
|
|
55 |
this.popup.close();
|
|
|
56 |
}
|
|
|
57 |
}, onInputChange:function () {
|
|
|
58 |
}, enable:function () {
|
|
|
59 |
this.inputNode.disabled = false;
|
|
|
60 |
dojo.widget.DropdownContainer.superclass.enable.apply(this, arguments);
|
|
|
61 |
}, disable:function () {
|
|
|
62 |
this.inputNode.disabled = true;
|
|
|
63 |
dojo.widget.DropdownContainer.superclass.disable.apply(this, arguments);
|
|
|
64 |
}});
|
|
|
65 |
|