Reorganize full selects, Patch by Alexander Surkov <surkov.alexander@gmail.com>. r=aaronr, Olli.Pettay, b=358712
git-svn-id: svn://10.0.0.236/trunk@216414 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
7563c3b33c
commit
599211201d
@ -26,6 +26,9 @@ xforms.jar:
|
||||
content/xforms/select.xml (resources/content/select.xml)
|
||||
content/xforms/select-xhtml.xml (resources/content/select-xhtml.xml)
|
||||
content/xforms/select-xul.xml (resources/content/select-xul.xml)
|
||||
content/xforms/selects.xml (resources/content/selects.xml)
|
||||
content/xforms/selects-xhtml.xml (resources/content/selects-xhtml.xml)
|
||||
content/xforms/selects-xul.xml (resources/content/selects-xul.xml)
|
||||
content/xforms/bindingex.css (resources/content/bindingex.css)
|
||||
content/xforms/bindingex.xul (resources/content/bindingex.xul)
|
||||
content/xforms/calendar.png (resources/content/calendar.png)
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
/**
|
||||
* Interface implemented by the item element.
|
||||
*/
|
||||
[scriptable, uuid(ec8d3556-8ed2-4143-88d1-6b7b2c8b0b3b)]
|
||||
[scriptable, uuid(e7e65a10-bf37-488f-9c74-add34abdd309)]
|
||||
interface nsIXFormsItemElement : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -83,4 +83,14 @@ interface nsIXFormsItemElement : nsISupports
|
||||
*/
|
||||
readonly attribute nsIDOMNode copyNode;
|
||||
|
||||
/**
|
||||
* Compare given DOM node and copy node (i.e. node that the contained copy
|
||||
* element is bound to.
|
||||
*
|
||||
* @param nsIDOMNode aNode - given DOM node to compare with copy node
|
||||
*
|
||||
* @return boolean - return true if given node equals in copy node
|
||||
*/
|
||||
boolean copyNodeEquals(in nsIDOMNode aNode);
|
||||
};
|
||||
|
||||
|
||||
@ -487,6 +487,19 @@ nsXFormsItemElement::SetIsCopyItem(PRBool aIsCopyItem)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsItemElement::CopyNodeEquals(nsIDOMNode *aNode, PRBool *aIsCopyNode)
|
||||
{
|
||||
NS_ENSURE_ARG(aNode);
|
||||
NS_ENSURE_ARG_POINTER(aIsCopyNode);
|
||||
|
||||
nsCOMPtr<nsIDOMNode> selectedNode;
|
||||
nsresult rv = SelectItemByNode(aNode, getter_AddRefs(selectedNode));
|
||||
*aIsCopyNode = !!(selectedNode);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_HIDDEN_(nsresult)
|
||||
NS_NewXFormsItemElement(nsIXTFElement **aResult)
|
||||
{
|
||||
|
||||
@ -54,6 +54,11 @@
|
||||
<!-- SELECT/SELECT1 CONTROLS
|
||||
The section contains xforms select/select1 controls implementations for XHTML.
|
||||
All controls are inherited from interface bindings realized in select.xml.
|
||||
|
||||
XXX: select of minimal appearance is not implemented (see bug 332928).
|
||||
|
||||
select1 of minimal appearance is implemented in select1.xml file.
|
||||
select/select1 of appearance="full" is implemented in selects-xhtml.xml file.
|
||||
-->
|
||||
|
||||
<!-- SELECT APPEARANCE='COMPACT' : <DEFAULT> -->
|
||||
@ -70,22 +75,6 @@
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<!-- SELECT APPEARANCE='FULL' -->
|
||||
<binding id="xformswidget-select-full"
|
||||
extends="chrome://xforms/content/select.xml#xformswidget-select-base">
|
||||
<content>
|
||||
<html:table xbl:inherits="style">
|
||||
<html:tr>
|
||||
<html:td valign="top"><children includes="label"/></html:td>
|
||||
<html:td>
|
||||
<html:span anonid="control" xbl:inherits="style, accesskey"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
<children/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<!-- SELECT1 APPEARANCE='COMPACT' : <DEFAULT> -->
|
||||
<binding id="xformswidget-select1-compact"
|
||||
extends="chrome://xforms/content/select.xml#xformswidget-select1-base">
|
||||
@ -100,22 +89,6 @@
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<!-- SELECT1 APPEARANCE='FULL' -->
|
||||
<binding id="xformswidget-select1-full"
|
||||
extends="chrome://xforms/content/select.xml#xformswidget-select1-base">
|
||||
<content>
|
||||
<html:table xbl:inherits="style">
|
||||
<html:tr>
|
||||
<html:td valign="top"><children includes="label"/></html:td>
|
||||
<html:td>
|
||||
<html:span anonid="control" xbl:inherits="style, accesskey"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
<children/>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- CONTROL WIDGETS FOR SELECT/SELECT1 CONTROLS
|
||||
All control widgets are underlying controls for select/select1 and serve to
|
||||
@ -229,163 +202,6 @@
|
||||
element only.
|
||||
-->
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- BASE CONTROL WIDGET FOR SELECT/SELECT1 APPEARANCE='FULL' -->
|
||||
<binding id="controlwidget-selects-full-base"
|
||||
extends="chrome://xforms/content/select.xml#controlwidget-nonativewidget-base">
|
||||
|
||||
<implementation>
|
||||
<method name="removeAllItems">
|
||||
<body>
|
||||
for (var i = this.control.childNodes.length; i > 0; i--) {
|
||||
this.control.removeChild(this.control.childNodes[i-1]);
|
||||
}
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="aLabel"/>
|
||||
<parameter name="aValue"/>
|
||||
<parameter name="aGroup"/>
|
||||
<body>
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="appendGroup">
|
||||
<parameter name="aLabel"/>
|
||||
<parameter name="aGroup"/>
|
||||
<body>
|
||||
var mainDiv = document.createElementNS(this.XHTML_NS, "div");
|
||||
|
||||
var labelDiv = document.createElementNS(this.XHTML_NS, "div");
|
||||
if (aLabel) {
|
||||
labelDiv.className = "select-choice-label";
|
||||
labelDiv.appendChild(aLabel.cloneNode(true));
|
||||
}
|
||||
mainDiv.appendChild(labelDiv);
|
||||
|
||||
var contentDiv = document.createElementNS(this.XHTML_NS, "div");
|
||||
contentDiv.className = "select-choice-content";
|
||||
mainDiv.appendChild(contentDiv);
|
||||
|
||||
if (aGroup) {
|
||||
aGroup.appendChild(mainDiv);
|
||||
} else {
|
||||
this.control.appendChild(mainDiv);
|
||||
}
|
||||
|
||||
return contentDiv;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="addItemToSelection">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
aItem.firstChild.checked = true;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemFromSelection">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
aItem.firstChild.checked = false;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="isItemSelected">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
return aItem.firstChild.checked;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="advanceFocusToItem">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
aItem.firstChild.focus();
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="isItemElement">
|
||||
<parameter name="aElement"/>
|
||||
<body>
|
||||
return aElement.getAttribute("anonid") == "wcontrol";
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="change">
|
||||
if (event.originalTarget.getAttribute("anonid") == "wcontrol")
|
||||
this.updateInstanceData(true);
|
||||
</handler>
|
||||
|
||||
<handler event="blur" phase="capturing">
|
||||
if (event.originalTarget.getAttribute("anonid") == "wcontrol")
|
||||
this.updateInstanceData(false);
|
||||
</handler>
|
||||
|
||||
<!--
|
||||
XXX: need to send DOMFocusIn/DOMFocusOut events
|
||||
XXX: when incremental='false' then model data should be updated on
|
||||
'blur' event for xforms:select only
|
||||
-->
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- CONTROL WIDGET FOR SELECT APPEARANCE='FULL' -->
|
||||
<binding id="controlwidget-select-full"
|
||||
extends="#controlwidget-selects-full-base">
|
||||
|
||||
<content>
|
||||
<html:div anonid="control"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="appendItem">
|
||||
<parameter name="aLabel"/>
|
||||
<parameter name="aValue"/>
|
||||
<parameter name="aGroup"/>
|
||||
<body>
|
||||
var div = document.createElementNS(this.XHTML_NS, "div");
|
||||
div.setAttribute("anonid", "itemcontainer");
|
||||
|
||||
var input = document.createElementNS(this.XHTML_NS, "input");
|
||||
input.setAttribute("type", "checkbox");
|
||||
input.setAttribute("value", aValue);
|
||||
input.setAttribute("anonid", "wcontrol");
|
||||
if (this.readonly)
|
||||
input.setAttribute("disabled", "true");
|
||||
|
||||
div.appendChild(input);
|
||||
if (aLabel) {
|
||||
div.appendChild(aLabel.cloneNode(true));
|
||||
}
|
||||
|
||||
if (aGroup) {
|
||||
aGroup.appendChild(div);
|
||||
} else {
|
||||
this.control.appendChild(div);
|
||||
}
|
||||
return div;
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click">
|
||||
if (event.originalTarget.getAttribute("anonid") == "itemcontainer") {
|
||||
event.originalTarget.firstChild.checked =
|
||||
!event.originalTarget.firstChild.checked;
|
||||
this.updateInstanceData(true);
|
||||
}
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
||||
@ -394,13 +210,6 @@
|
||||
controls.
|
||||
-->
|
||||
|
||||
|
||||
<!-- CONTROL WIDGET FOR SELECT1 APPEARANCE='MINIMAL'
|
||||
Now select1 appearance='minimal' control is implemented in select1.xml
|
||||
as separate widget.
|
||||
-->
|
||||
|
||||
|
||||
<!-- CONTROL WIDGET FOR SELECT1 APPEARANCE='COMPACT' -->
|
||||
<binding id="controlwidget-select1-compact"
|
||||
extends="#controlwidget-select-compact">
|
||||
@ -410,59 +219,5 @@
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- CONTROL WIDGET FOR SELECT1 APPEARANCE='FULL' -->
|
||||
<binding id="controlwidget-select1-full"
|
||||
extends="#controlwidget-selects-full-base">
|
||||
|
||||
<content>
|
||||
<html:form anonid="control"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="appendItem">
|
||||
<parameter name="aLabel"/>
|
||||
<parameter name="aValue"/>
|
||||
<parameter name="aGroup"/>
|
||||
<body>
|
||||
var div = document.createElementNS(this.XHTML_NS, "div");
|
||||
div.setAttribute("anonid", "itemcontainer");
|
||||
|
||||
var input = document.createElementNS(this.XHTML_NS, "input");
|
||||
input.setAttribute("type", "radio");
|
||||
input.setAttribute("value", aValue);
|
||||
input.setAttribute("name", "radioControlForXFormsSelect1");
|
||||
input.setAttribute("anonid", "wcontrol");
|
||||
if (this.readonly)
|
||||
input.setAttribute('disabled', 'true');
|
||||
div.appendChild(input);
|
||||
|
||||
if (aLabel)
|
||||
div.appendChild(aLabel.cloneNode(true));
|
||||
|
||||
if (aGroup) {
|
||||
aGroup.appendChild(div);
|
||||
} else {
|
||||
this.control.appendChild(div);
|
||||
}
|
||||
|
||||
return div;
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
if (event.originalTarget.getAttribute("anonid") == "itemcontainer" &&
|
||||
!event.originalTarget.firstChild.checked) {
|
||||
event.originalTarget.firstChild.checked = true;
|
||||
this.updateInstanceData(true);
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
|
||||
@ -54,6 +54,10 @@
|
||||
The section contains xforms select and select1 controls implementations for
|
||||
XUL. All controls are inherited from interface bindings realized in
|
||||
select.xml file.
|
||||
|
||||
XXX: Element select of minimal appearance is not implemented (see bug 332928).
|
||||
|
||||
select/select1 of full appearance are implemented in selects-xul.xml file.
|
||||
-->
|
||||
|
||||
<binding id="xformswidget-select"
|
||||
@ -90,18 +94,12 @@
|
||||
<binding id="xformswidget-select-compact"
|
||||
extends="#xformswidget-select"/>
|
||||
|
||||
<binding id="xformswidget-select-full"
|
||||
extends="#xformswidget-select"/>
|
||||
|
||||
<binding id="xformswidget-select1-minimal"
|
||||
extends="#xformswidget-select1"/>
|
||||
|
||||
<binding id="xformswidget-select1-compact"
|
||||
extends="#xformswidget-select1"/>
|
||||
|
||||
<binding id="xformswidget-select1-full"
|
||||
extends="#xformswidget-select1"/>
|
||||
|
||||
<!-- CONTROL WIDGETS FOR SELECT CONTROLS
|
||||
The section contains underlying widgets implementations needed for xforms
|
||||
select controls. All underlying widgets implement the interface what base
|
||||
@ -109,12 +107,6 @@
|
||||
in 'select.xml' file.
|
||||
-->
|
||||
|
||||
|
||||
<!-- CONTROL WIDGET FOR SELECT APPEARANCE='MINIMAL'
|
||||
XXX: Widget is not implemented.
|
||||
-->
|
||||
|
||||
|
||||
<!-- CONTROL WIDGET FOR SELECT APPEARANCE='COMPACT' -->
|
||||
<binding id="controlwidget-select-compact"
|
||||
extends="chrome://xforms/content/select.xml#controlwidget-base">
|
||||
@ -241,150 +233,6 @@
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- CONTROL WIDGET FOR SELECT APPEARANCE='FULL' -->
|
||||
<binding id="controlwidget-select-full"
|
||||
extends="chrome://xforms/content/select.xml#controlwidget-nonativewidget-base">
|
||||
|
||||
<content>
|
||||
<xul:vbox xbl:inherits="orient" anonid="control"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="removeAllItems">
|
||||
<body>
|
||||
for (var i = this.control.childNodes.length; i > 0; i--) {
|
||||
this.control.removeChild(this.control.childNodes[i-1]);
|
||||
}
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="aLabel"/>
|
||||
<parameter name="aValue"/>
|
||||
<parameter name="aGroup"/>
|
||||
<body>
|
||||
var box = this.ownerDocument.createElementNS(this.XUL_NS, "hbox");
|
||||
box.setAttribute("align", "center");
|
||||
|
||||
var checkbox = this.ownerDocument.createElementNS(this.XUL_NS, "checkbox");
|
||||
checkbox.setAttribute("value", aValue);
|
||||
checkbox.setAttribute("anonid", "wcontrol");
|
||||
if (this.readonly)
|
||||
checkbox.setAttribute("disabled", "true");
|
||||
|
||||
box.appendChild(checkbox);
|
||||
if (aLabel) {
|
||||
// since label node can contains textnodes then we use
|
||||
// 'description' element as container for label node.
|
||||
var description = this.ownerDocument.
|
||||
createElementNS(this.XUL_NS, "description");
|
||||
description.setAttribute("anonid", "labelcontainer");
|
||||
description.appendChild(aLabel.cloneNode(true));
|
||||
box.appendChild(description);
|
||||
}
|
||||
|
||||
if (aGroup) {
|
||||
aGroup.appendChild(box);
|
||||
} else {
|
||||
this.control.appendChild(box);
|
||||
}
|
||||
|
||||
return box;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="appendGroup">
|
||||
<parameter name="aLabel"/>
|
||||
<parameter name="aGroup"/>
|
||||
<body>
|
||||
var mainBox = this.ownerDocument.createElementNS(this.XUL_NS, "vbox");
|
||||
|
||||
var labelBox = this.ownerDocument.createElementNS(this.XUL_NS, "hbox");
|
||||
if (aLabel) {
|
||||
labelBox.className = "select-choice-label";
|
||||
labelBox.appendChild(aLabel.cloneNode(true));
|
||||
}
|
||||
mainBox.appendChild(labelBox);
|
||||
|
||||
var contentBox = this.ownerDocument.createElementNS(this.XUL_NS, "vbox");
|
||||
contentBox.className = "select-choice-content";
|
||||
mainBox.appendChild(contentBox);
|
||||
|
||||
if (aGroup) {
|
||||
aGroup.appendChild(mainBox);
|
||||
} else {
|
||||
this.control.appendChild(mainBox);
|
||||
}
|
||||
|
||||
return contentBox;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="addItemToSelection">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
aItem.firstChild.checked = true;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemFromSelection">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
aItem.firstChild.checked = false;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="isItemSelected">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
return aItem.firstChild.checked;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="advanceFocusToItem">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
aItem.firstChild.focus();
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="isItemElement">
|
||||
<parameter name="aElement"/>
|
||||
<body>
|
||||
return aElement.getAttribute("anonid") == "wcontrol";
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click">
|
||||
if (event.originalTarget.getAttribute("anonid") == "labelcontainer") {
|
||||
event.originalTarget.previousSibling.checked =
|
||||
!event.originalTarget.previousSibling.checked;
|
||||
this.updateInstanceData(true);
|
||||
}
|
||||
</handler>
|
||||
|
||||
<handler event="command">
|
||||
if (event.originalTarget.getAttribute("anonid") == "wcontrol")
|
||||
this.updateInstanceData(true);
|
||||
</handler>
|
||||
|
||||
<handler event="blur" phase="capturing">
|
||||
if (event.originalTarget.getAttribute("anonid") == "wcontrol")
|
||||
this.updateInstanceData(false);
|
||||
</handler>
|
||||
|
||||
<!--
|
||||
XXX: We need to send DOMFocusIn/DOMFocusOut events
|
||||
XXX: When incremental='false' then model data should be updated on
|
||||
'blur' event for xforms:select only
|
||||
-->
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- CONTROL WIDGETS FOR SELECT1 CONTROLS
|
||||
The section contains underlying widgets implementations needed for xforms
|
||||
select1 controls. All underlying widgets implement the interface what base
|
||||
@ -541,140 +389,4 @@
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- CONTROL WIDGET FOR SELECT1 APPEARANCE='FULL' -->
|
||||
<binding id="controlwidget-select1-full"
|
||||
extends="chrome://xforms/content/select.xml#controlwidget-base">
|
||||
|
||||
<content>
|
||||
<xul:radiogroup anonid="control"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="removeAllItems">
|
||||
<body>
|
||||
for (var i = this.control.childNodes.length; i > 0; i--) {
|
||||
this.control.removeChild(this.control.childNodes[i-1]);
|
||||
}
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="aLabel"/>
|
||||
<parameter name="aValue"/>
|
||||
<parameter name="aGroup"/>
|
||||
<body>
|
||||
var box = this.ownerDocument.createElementNS(this.XUL_NS, "hbox");
|
||||
box.setAttribute("align", "center");
|
||||
|
||||
var radio = this.ownerDocument.createElementNS(this.XUL_NS, "radio");
|
||||
radio.setAttribute("value", aValue);
|
||||
radio.setAttribute("anonid", "wcontrol");
|
||||
if (this.readonly)
|
||||
radio.setAttribute("disabled", "true");
|
||||
|
||||
box.appendChild(radio);
|
||||
if (aLabel) {
|
||||
// since label node can contains textnodes then we use
|
||||
// 'description' element as container for label node.
|
||||
var description = this.ownerDocument.
|
||||
createElementNS(this.XUL_NS, "description");
|
||||
description.setAttribute("anonid", "labelcontainer");
|
||||
description.appendChild(aLabel.cloneNode(true));
|
||||
box.appendChild(description);
|
||||
}
|
||||
|
||||
if (aGroup) {
|
||||
aGroup.appendChild(box);
|
||||
} else {
|
||||
this.control.appendChild(box);
|
||||
}
|
||||
|
||||
return box;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="appendGroup">
|
||||
<parameter name="aLabel"/>
|
||||
<parameter name="aGroup"/>
|
||||
<body>
|
||||
var mainBox = this.ownerDocument.createElementNS(this.XUL_NS, "vbox");
|
||||
|
||||
var labelBox = this.ownerDocument.createElementNS(this.XUL_NS, "hbox");
|
||||
if (aLabel) {
|
||||
labelBox.className = "select-choice-label";
|
||||
labelBox.appendChild(aLabel.cloneNode(true));
|
||||
}
|
||||
mainBox.appendChild(labelBox);
|
||||
|
||||
var contentBox = this.ownerDocument.createElementNS(this.XUL_NS, "vbox");
|
||||
contentBox.className = "select-choice-content";
|
||||
mainBox.appendChild(contentBox);
|
||||
|
||||
if (aGroup) {
|
||||
aGroup.appendChild(mainBox);
|
||||
} else {
|
||||
this.control.appendChild(mainBox);
|
||||
}
|
||||
|
||||
return contentBox;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="addItemToSelection">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
// there are a cases when 'radio' binding isn't created yet, therefore
|
||||
// we use setTimeout.
|
||||
window.setTimeout(
|
||||
function(list, item) {
|
||||
list.selectedItem = item;
|
||||
},
|
||||
0,
|
||||
this.control, aItem.firstChild
|
||||
);
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemFromSelection">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
if (aItem.firstChild.selected)
|
||||
this.control.selectedItem = null;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="isItemSelected">
|
||||
<parameter name="aItem"/>
|
||||
<body>
|
||||
return aItem.firstChild.selected;
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click">
|
||||
if (event.originalTarget.getAttribute("anonid") == "labelcontainer") {
|
||||
this.control.selectedItem = event.originalTarget.previousSibling;
|
||||
this.updateInstanceData(true);
|
||||
}
|
||||
</handler>
|
||||
|
||||
<handler event="command">
|
||||
if (event.originalTarget.getAttribute("anonid") == "wcontrol")
|
||||
this.updateInstanceData(true);
|
||||
</handler>
|
||||
|
||||
<handler event="blur" phase="capturing">
|
||||
if (event.originalTarget.getAttribute("anonid") == "control")
|
||||
this.updateInstanceData(false);
|
||||
</handler>
|
||||
|
||||
<!--
|
||||
XXX: need to send DOMFocusIn/DOMFocusOut events
|
||||
XXX: when incremental='false' then model data should be updated on
|
||||
'blur' event for xforms:select1 only
|
||||
-->
|
||||
</handlers>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
||||
@ -39,8 +39,12 @@
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!--
|
||||
<bindings id="xformsSelectBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<!--
|
||||
This file implements the "abstract" UI class for XForms select controls. It
|
||||
have "pure virtual" functions that it expect to be implemented by concrete
|
||||
application and returned in the getElementControl() call. An example is the
|
||||
@ -85,11 +89,6 @@
|
||||
@param value - item value
|
||||
-->
|
||||
|
||||
<bindings id="xformsSelectBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<!-- BASE for select/select1 elements. -->
|
||||
<binding id="xformswidget-selectcontrols-base"
|
||||
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
|
||||
@ -873,15 +872,13 @@
|
||||
<parameter name="aElement"/>
|
||||
<parameter name="aName"/>
|
||||
<body>
|
||||
var ev = document.createEvent("Events");
|
||||
ev.initEvent(aName, true, false);
|
||||
var elm = aElement;
|
||||
<![CDATA[
|
||||
// per http://www.w3.org/TR/2005/PER-xforms-20051006/index-all.html#evt-select
|
||||
// we send the event to the itemset if it is a parent.
|
||||
if (elm.parentNode.localName == "itemset")
|
||||
elm = elm.parentNode;
|
||||
elm.dispatchEvent(ev);
|
||||
return true;
|
||||
var parent = this.ownerDocument.getBindingParent(aElement);
|
||||
var elm = parent && parent.localName == "itemset" ? parent : aElement;
|
||||
return this.dispatchXFormsNotificationEvent(aName, elm);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
@ -1224,61 +1221,4 @@
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- The 'controlwidget-nonativewidget-base' is the base binding for underlying
|
||||
controls which represents the xforms control. This binding is supposed to
|
||||
be used for underlying control that actually haven't native widget. For
|
||||
example, underlying control for select @appearance='full' is represented by
|
||||
checkboxes bundle.
|
||||
This binding implements the 'focus' method to advance focus to the
|
||||
underlying control.
|
||||
|
||||
The widget assumes successors bindings have additional methods:
|
||||
|
||||
advanceFocusToItem(aItem) - makes item focused
|
||||
@param aItem - item element
|
||||
|
||||
isItemElement(aElement) - returns true if element is item
|
||||
@param aElement - DOMElement
|
||||
-->
|
||||
<binding id="controlwidget-nonativewidget-base"
|
||||
extends="#controlwidget-base">
|
||||
|
||||
<implementation>
|
||||
<!-- Advance focus to native widget. -->
|
||||
<method name="focus">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var item = this.currentItem;
|
||||
if (!item) {
|
||||
var options = this.parentControl._controlArray;
|
||||
// If there are selected items then advance focus to first of them
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
item = options[i].option;
|
||||
var selected = this.isItemSelected(item);
|
||||
if (selected)
|
||||
break;
|
||||
}
|
||||
// otherwise we focus first item.
|
||||
if (options.length && i == options.length)
|
||||
item = options[0].option;
|
||||
}
|
||||
|
||||
if (item)
|
||||
this.advanceFocusToItem(item);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="currentItem">null</field>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="focus" phase="capturing">
|
||||
if (this.isItemElement(event.originalTarget))
|
||||
this.currentItem = event.originalTarget;
|
||||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
@ -1145,30 +1145,6 @@
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="xformswidget-itemset"
|
||||
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
|
||||
<content>
|
||||
<html:div style="display:none;">
|
||||
<children/>
|
||||
</html:div>
|
||||
<html:div anonid="insertion"/>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIXFormsItemSetUIElement">
|
||||
<field name="_anonymousItemSetContent">null</field>
|
||||
|
||||
<property name="anonymousItemSetContent" readonly="true">
|
||||
<getter>
|
||||
if (!this._anonymousItemSetContent) {
|
||||
this._anonymousItemSetContent =
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "insertion");
|
||||
}
|
||||
return this._anonymousItemSetContent;
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- The binding for <item> is needed only because of the
|
||||
scrollIntoView method. -->
|
||||
|
||||
@ -49,7 +49,9 @@ refresh,
|
||||
model,
|
||||
instance,
|
||||
submission,
|
||||
bind {
|
||||
bind,
|
||||
value,
|
||||
copy {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@ -61,10 +63,16 @@ html|*:root switch:not(:disabled),
|
||||
html|*:root case,
|
||||
html|*:root select1:not([appearance]) item,
|
||||
html|*:root select1[appearance='minimal'] item,
|
||||
select1[appearance="full"] item,
|
||||
select[appearance="full"] item,
|
||||
html|*:root select1:not([appearance]) itemset,
|
||||
html|*:root select1[appearance='minimal'] itemset,
|
||||
select1[appearance="full"] itemset,
|
||||
select[appearance="full"] itemset,
|
||||
html|*:root select1:not([appearance]) choices,
|
||||
html|*:root select1[appearance='minimal'] choices {
|
||||
html|*:root select1[appearance='minimal'] choices,
|
||||
select1[appearance="full"] choices,
|
||||
select[appearance="full"] choices {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@ -90,19 +98,30 @@ xul|*:root case {
|
||||
display: -moz-box;
|
||||
}
|
||||
|
||||
html|*:root select[appearance="full"] itemset contextcontainer,
|
||||
html|*:root select1[appearance="full"] itemset contextcontainer {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
contextcontainer-inline {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
select item, xul|*:root select1 item,
|
||||
html|*:root select1[appearance='compact'] item,
|
||||
html|*:root select1[appearance='full'] item,
|
||||
select itemset, xul|*:root select1 itemset,
|
||||
html|*:root select1[appearance='compact'] itemset,
|
||||
html|*:root select1[appearance='full'] itemset,
|
||||
select choices, xul|*:root select1 choices,
|
||||
html|*:root select1[appearance='compact'] choices,
|
||||
html|*:root select1[appearance='full'] choices {
|
||||
xul|*:root select1:not([appearance]) item,
|
||||
xul|*:root select1[appearance='minimal'] item,
|
||||
select1[appearance='compact'] item,
|
||||
select:not([appearance]) item,
|
||||
select[appearance='compact'] item,
|
||||
xul|*:root select1:not([appearance]) itemset,
|
||||
xul|*:root select1[appearance='minimal'] itemset,
|
||||
select1[appearance='compact'] itemset,
|
||||
select:not([appearance]) itemset,
|
||||
select[appearance='compact'] itemset,
|
||||
xul|*:root select1:not([appearance]) choices,
|
||||
xul|*:root select1[appearance='minimal'] choices,
|
||||
select1[appearance='compact'] choices,
|
||||
select:not([appearance]) choices,
|
||||
select[appearance='compact'] choices {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -489,7 +508,7 @@ xul|*:root case xul|box[anonid="control"] {
|
||||
|
||||
/* itemset widget */
|
||||
select1 itemset, select itemset {
|
||||
-moz-binding: url('chrome://xforms/content/select1.xml#xformswidget-itemset');
|
||||
-moz-binding: url('chrome://xforms/content/selects.xml#itemset');
|
||||
}
|
||||
|
||||
/* select1 appearance='minimal' (default) */
|
||||
@ -527,17 +546,24 @@ xul|*:root select1[appearance="compact"] xul|box[anonid="control"] {
|
||||
|
||||
/* select1 appearance='full' */
|
||||
html|*:root select1[appearance="full"] {
|
||||
-moz-binding: url('chrome://xforms/content/select-xhtml.xml#xformswidget-select1-full');
|
||||
-moz-binding: url('chrome://xforms/content/selects-xhtml.xml#select1-full');
|
||||
}
|
||||
html|*:root select1[appearance="full"] html|span[anonid="control"] {
|
||||
-moz-binding: url('chrome://xforms/content/select-xhtml.xml#controlwidget-select1-full');
|
||||
html|*:root select1[appearance="full"] item {
|
||||
-moz-binding: url('chrome://xforms/content/selects-xhtml.xml#select1-full-item');
|
||||
}
|
||||
|
||||
xul|*:root select1[appearance="full"] {
|
||||
-moz-binding: url('chrome://xforms/content/select-xul.xml#xformswidget-select1-full');
|
||||
-moz-binding: url('chrome://xforms/content/selects-xul.xml#select1-full');
|
||||
}
|
||||
xul|*:root select1[appearance="full"] xul|box[anonid="control"] {
|
||||
-moz-binding: url('chrome://xforms/content/select-xul.xml#controlwidget-select1-full');
|
||||
xul|*:root select1[appearance="full"] xul|radiogroup {
|
||||
-moz-binding: url('chrome://xforms/content/selects-xul.xml#select1-full-radiogroup') !important;
|
||||
}
|
||||
|
||||
xul|*:root select1[appearance="full"] item {
|
||||
-moz-binding: url('chrome://xforms/content/selects-xul.xml#select1-full-item');
|
||||
}
|
||||
xul|*:root select1[appearance="full"] item xul|radio {
|
||||
-moz-binding: url('chrome://xforms/content/selects-xul.xml#select1-full-item-radio') !important;
|
||||
}
|
||||
|
||||
/* select1[appearance='minimal'] for xhtml styles (most of the select1 specific
|
||||
@ -628,27 +654,34 @@ html|*:root item[_moz_active] {
|
||||
background: Highlight;
|
||||
}
|
||||
|
||||
/* styles for select1[appearance="minimal", select1[appearance="full"],
|
||||
select[appearance="full"] */
|
||||
html|*:root select1:not([appearance]) choices > label,
|
||||
html|*:root select1[appearance='minimal'] choices > label {
|
||||
html|*:root select1[appearance='minimal'] choices > label,
|
||||
select[appearance="full"] choices > label,
|
||||
select1[appearance="full"] choices > label {
|
||||
display: block;
|
||||
font: -moz-list;
|
||||
line-height: normal !important;
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
font-size: inherit;
|
||||
-moz-user-select: none;
|
||||
text-indent: 0;
|
||||
}
|
||||
|
||||
html|*:root select1:not([appearance]) choices > item
|
||||
html|*:root select1[appearance='minimal'] choices > item,
|
||||
html|*:root select1:not([appearance]) choices > item,
|
||||
html|*:root select1:not([appearance]) choices > itemset,
|
||||
html|*:root select1[appearance='minimal'] choices > itemset,
|
||||
html|*:root select1:not([appearance]) choices > choices,
|
||||
html|*:root select1[appearance='minimal'] choices > choices {
|
||||
html|*:root select1[appearance='minimal'] choices > item,
|
||||
html|*:root select1[appearance='minimal'] choices > itemset,
|
||||
html|*:root select1[appearance='minimal'] choices > choices,
|
||||
select[appearance="full"] choices > item,
|
||||
select[appearance="full"] choices > itemset,
|
||||
select[appearance="full"] choices > choices,
|
||||
select1[appearance="full"] choices > item,
|
||||
select1[appearance="full"] choices > itemset,
|
||||
select1[appearance="full"] choices > choices {
|
||||
padding-left: 20px;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* select appearance="compact" (default) */
|
||||
@ -668,29 +701,20 @@ xul|*:root select xul|box[anonid="control"] {
|
||||
|
||||
/* select appearance="full" */
|
||||
html|*:root select[appearance="full"] {
|
||||
-moz-binding: url('chrome://xforms/content/select-xhtml.xml#xformswidget-select-full');
|
||||
-moz-binding: url('chrome://xforms/content/selects-xhtml.xml#select-full');
|
||||
}
|
||||
html|*:root select[appearance="full"] html|span[anonid="control"] {
|
||||
-moz-binding: url('chrome://xforms/content/select-xhtml.xml#controlwidget-select-full');
|
||||
html|*:root select[appearance="full"] item {
|
||||
-moz-binding: url('chrome://xforms/content/selects-xhtml.xml#select-full-item');
|
||||
}
|
||||
|
||||
xul|*:root select[appearance="full"] {
|
||||
-moz-binding: url('chrome://xforms/content/select-xul.xml#xformswidget-select-full');
|
||||
-moz-binding: url('chrome://xforms/content/selects-xul.xml#select-full');
|
||||
}
|
||||
xul|*:root select[appearance="full"] xul|box[anonid="control"] {
|
||||
-moz-binding: url('chrome://xforms/content/select-xul.xml#controlwidget-select-full');
|
||||
xul|*:root select[appearance="full"] item {
|
||||
-moz-binding: url('chrome://xforms/content/selects-xul.xml#select-full-item');
|
||||
}
|
||||
|
||||
/* select, select1 styles*/
|
||||
select *|*.select-choice-label, select1 *|*.select-choice-label {
|
||||
font: -moz-list;
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
select *|*.select-choice-content, select1 *|*.select-choice-content {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
/* XXX: selectors are wrong, styles don't work (bug 351797). */
|
||||
xul|*:root select1[appearance="full"] xul|box xul|radiogroup:focus xul|radio[selected] + label,
|
||||
@ -708,6 +732,16 @@ xul|*:root select, xul|*:root select1 {
|
||||
margin: 2px 4px;
|
||||
}
|
||||
|
||||
xul|*:root select1 item label {
|
||||
margin: 2px 4px;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
item[disabled] label {
|
||||
color: graytext;
|
||||
}
|
||||
|
||||
/* upload widgets */
|
||||
html|*:root upload {
|
||||
-moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-upload-disabled');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user