1 <?xml version="1.0"?>
\r
2 <!DOCTYPE wizard SYSTEM "chrome://cckwizard/locale/cckWizard.dtd">
\r
3 <bindings xmlns="http://www.mozilla.org/xbl"
\r
4 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
\r
5 <binding id="ccklist">
\r
9 <xul:listbox flex="1">
\r
13 <xul:button label="&newButton.label;" accesskey="&newButton.accesskey;" type="new"/>
\r
14 <xul:button label="&editButton.label;" accesskey="&editButton.accesskey;" type="edit"/>
\r
15 <xul:button label="&deleteButton.label;" accesskey="&deleteButton.accesskey;" type="delete"/>
\r
16 <xul:button label="&moveUpButton.label;" accesskey="&moveUpButton.accesskey;" type="moveup"/>
\r
17 <xul:button label="&moveDownButton.label;" accesskey="&moveDownButton.accesskey;" type="movedown"/>
\r
18 <xul:spacer flex="1"/>
\r
24 this._enableDisableButtons();
\r
26 <method name="clear">
\r
29 var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
\r
30 while(listbox.getRowCount() != 0) {
\r
31 listbox.removeItemAt(0);
\r
36 <method name="getRowCount">
\r
39 var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
\r
40 return listbox.getRowCount();
\r
44 <method name="getItemAtIndex">
\r
45 <parameter name="index"/>
\r
48 var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
\r
49 return listbox.getItemAtIndex(index);
\r
53 <method name="appendItem">
\r
54 <parameter name="label"/>
\r
55 <parameter name="value"/>
\r
58 var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
\r
59 listboxitem = listbox.appendItem(label, value);
\r
60 listboxitem.cck = new Array();
\r
61 this._enableDisableButtons();
\r
66 <method name="_enableDisableButtons">
\r
68 var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
\r
69 if (listbox.selectedIndex == -1) {
\r
70 document.getAnonymousNodes(this)[0].childNodes[1].childNodes[1].setAttribute("disabled","true");
\r
71 document.getAnonymousNodes(this)[0].childNodes[1].childNodes[2].setAttribute("disabled","true");
\r
72 document.getAnonymousNodes(this)[0].childNodes[1].childNodes[3].setAttribute("disabled","true");
\r
73 document.getAnonymousNodes(this)[0].childNodes[1].childNodes[4].setAttribute("disabled","true");
\r
75 document.getAnonymousNodes(this)[0].childNodes[1].childNodes[1].setAttribute("disabled","false");
\r
76 document.getAnonymousNodes(this)[0].childNodes[1].childNodes[2].setAttribute("disabled","false");
\r
77 document.getAnonymousNodes(this)[0].childNodes[1].childNodes[3].setAttribute("disabled","false");
\r
78 document.getAnonymousNodes(this)[0].childNodes[1].childNodes[4].setAttribute("disabled","false");
\r
79 if (listbox.selectedIndex == 0)
\r
80 document.getAnonymousNodes(this)[0].childNodes[1].childNodes[3].setAttribute("disabled","true");
\r
81 if (listbox.selectedIndex == listbox.getRowCount()-1)
\r
82 document.getAnonymousNodes(this)[0].childNodes[1].childNodes[4].setAttribute("disabled","true");
\r
86 <property name="selectedItem"
\r
87 onget="return document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0].selectedItem;"
\r
88 onset="document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0].selectedItem = val;"/>
\r
91 <handler event="select">
\r
92 this._enableDisableButtons();
\r
94 <handler event="dblclick">
\r
95 if (event.originalTarget.tagName == "listitem")
\r
96 eval(this.getAttribute("edit"));
\r
98 <handler event="command">
\r
99 if (event.originalTarget.type == "delete") {
\r
100 var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
\r
101 listbox.removeItemAt(listbox.selectedIndex);
\r
102 } else if ((event.originalTarget.type == "moveup") || (event.originalTarget.type == "movedown")) {
\r
103 var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
\r
104 var listitem=listbox.selectedItem;
\r
106 if (event.originalTarget.type == "moveup")
\r
107 index = listbox.selectedIndex-1;
\r
109 index = listbox.selectedIndex+2;
\r
111 if (index >= listbox.getRowCount()) {
\r
112 newlistitem = listbox.appendItem(listitem.label , listitem.value);
\r
114 newlistitem = listbox.insertItemAt(index, listitem.label , listitem.value);
\r
116 newlistitem.cck = listitem.cck;
\r
117 if (listitem.getAttribute("class") == "listitem-iconic") {
\r
118 newlistitem.setAttribute("class", "listitem-iconic");
\r
119 newlistitem.setAttribute("image", listitem.getAttribute("image"));
\r
121 listbox.removeItemAt(listbox.selectedIndex);
\r
122 listbox.selectItem(newlistitem);
\r
124 eval(this.getAttribute(event.originalTarget.type));
\r
126 eval(this.getAttribute("on" + event.originalTarget.type));
\r
127 this._enableDisableButtons();
\r
129 <handler event="keypress" keycode="VK_DELETE">
\r
130 if (event.originalTarget.tagName == "xul:listbox") {
\r
131 var listbox=document.getAnonymousNodes(this)[0].childNodes[0].childNodes[0];
\r
132 listbox.removeItemAt(listbox.selectedIndex);
\r
133 this._enableDisableButtons();
\r