false
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
return this.getAttribute("selection");
this.setAttribute("selection", val);
if (val == "open")
this.control.allowFreeEntry(true);
else
this.control.allowFreeEntry(false);
1 && this.localName == "select1")
break;
// When the string is empty, the method returns an array
// containing one empty string, rather than an empty array.
// We'll allow that into the defaultHash so that
// 'xforms-out-of-range' will be correctly generated if none of
// the items in the select have an empty string as a value.
var selectedArray = this._getValuesArray(string);
for (var run = 0; run < selectedArray.length; run++) {
this._defaultHash[selectedArray[run]] = {hits: 0}
}
}
} else {
if (++childcount > 1 && this.localName == "select1")
break;
// if it's not a text node, we'll assume that we are looking at
// a node worth comparing. As such, look for an
// item with a copy element that might match this node.
this._selectedElementArray.push({element: child, hits: 0});
}
}
if (this.localName == "select1") {
var outOfRange = childcount > 1;
if (outOfRange != this._outOfRange) {
this._outOfRange = outOfRange;
this.accessors.setInRange(!outOfRange);
if (outOfRange)
return;
}
}
]]>
// cache the item's label/value
aItem = aItem.QueryInterface(Components.interfaces.nsIXFormsItemElement);
var labels = aItem.getElementsByTagNameNS(this.XFORMS_NS, "label");
var controlitem;
if (labels[0]) {
controlitem = this.control.
appendItem(labels[0].nodeValue, aItem.value, aParentGroup);
} else {
controlitem = this.control.
appendItem(null, aItem.value, aParentGroup);
}
var selected = false;
if (aItem.value in this._defaultHash) {
selected = true;
this.control.addItemToSelection(controlitem);
this._defaultHash[aItem.value].hits++;
}
this._controlArray.push(
{control: aItem, option: controlitem, wasSelected: selected}
);
0) {
item = item.QueryInterface(Components.interfaces.nsIXFormsSelectChild);
for (var j = 0; j < this._selectedElementArray.length; j++ ) {
var selectedItem =
item.selectItemByNode(this._selectedElementArray[j].element);
if (selectedItem) {
this.control.addItemToSelection(controlitem);
selected = true;
this._selectedElementArray[j].hits++;
// XXX It is possible that two identical elements are under the
// bound node. I guess we shouldn't mark one and not the other
// if there is an item in the select that matches it. So we'll
// go through the whole list. But this is quite an edge case
// and will cause more inefficiency just to prevent an errant
// xforms-out-of-range.
}
}
}
if (!copyItem) {
if (item.value in this._defaultHash) {
this.control.addItemToSelection(controlitem);
selected = true;
this._defaultHash[item.value].hits++;
}
}
this._controlArray.push(
{control: item, option: controlitem, wasSelected: selected}
);
}
]]>
// When the instance value is empty, then we return an array
// containing one empty string, rather than an empty array. We'll
// allow that into the defaultHash so that 'xforms-out-of-range' event
// will be correctly generated if none of the items in the select have
// an empty string as a value.
if (!aValue) {
aValue = this.accessors.getValue();
if (!aValue) {
aValue = "";
}
}
if (this.localName == "select1")
return [aValue];
// A limitation of the XML Schema list datatypes is that white space
// characters in the storage values (the value element) are always
// interpreted as separators between individual data values.
// Therefore, authors should avoid using white space characters within
// storage values with list simpleContent.
// Replace new line (\n), tabs (\t) and carriage returns (\r) with
// space (" ").
aValue = aValue.replace(/\n|\t|\r/g, " ");
return aValue.split(/\s/);
0) {
selectedValues += " ";
}
var item = options[i].control.
QueryInterface(Components.interfaces.nsIXFormsItemElement);
if (item.isCopyItem) {
if (boundType && (boundType != Node.ELEMENT_NODE)) {
// if we are trying to do a copy without being bound to an
// element node, then we need to throw a binding exception
// per spec.
var bindingException = document.createEvent("Events");
bindingException.initEvent("xforms-binding-exception", true, false);
this.dispatchEvent(bindingException);
// we should probably un-select the option so that the list
// of selected data is accurate. This WON'T cause a
// xforms-select/deselect to fire. Since the user just
// selected this item and we are automatically deselecting
// it from underneath the user, we'll treat it like nothing
// happened.
this.control.removeItemFromSelection(options[i].option);
} else {
copyNode = item.copyNode;
if (copyNode) {
var clone = contentDocument.importNode(copyNode, true);
contentEnvelope.appendChild(clone);
if (!options[i].wasSelected) {
if (aIsACopyItemSelectedOrDeselected &&
aIsACopyItemSelectedOrDeselected.value != true) {
aIsACopyItemSelectedOrDeselected.value = true;
}
}
}
}
} else {
// not a copyItem, so grab the item's value and append it to our
// space seperated list.
selectedValues += options[i].control.
QueryInterface(Components.interfaces.nsIXFormsSelectChild).value;
}
} else {
// it was selected before, but now unselected
if (options[i].wasSelected) {
// if a copyItem was deselected, we need to make sure to do a
// rebuild. By setting aIsACopyItemSelectedOrDeselected, this
// should tell _handleSelection to use setContent with
// aForceUpdate = true
var item = options[i].control.
QueryInterface(Components.interfaces.nsIXFormsItemElement);
if (item.isCopyItem) {
if (aIsACopyItemSelectedOrDeselected &&
aIsACopyItemSelectedOrDeselected.value != true) {
aIsACopyItemSelectedOrDeselected.value = true;
}
}
}
}
}
// write out the text nodes before we handle copy
if (boundType == Node.ELEMENT_NODE) {
if (selectedValues.length > 0) {
var textNode = contentDocument.createTextNode(selectedValues);
if (copyNode) {
// making sure all selected 'values' are in the first text node
// under the bound node.
var firstChild = contentEnvelope.firstChild;
contentEnvelope.insertBefore(textNode, firstChild);
} else {
contentEnvelope.appendChild(textNode);
}
}
} else {
contentEnvelope.nodeValue = selectedValues;
}
this._dispatchSelectEvents();
return contentEnvelope;
]]>
new Array()
new Array()
null
null
false
return document.getAnonymousElementByAttribute(this, "anonid", "control");
var nativeitem = this.getNativeItem(aItem);
if (!this.control.isItemSelected(nativeitem)) {
this.control.addItemToSelection(nativeitem);
this.updateInstanceData();
}
var nativeitem = this.getNativeItem(aItem);
if (this.control.isItemSelected(nativeitem)) {
this.control.removeItemFromSelection(nativeitem);
this.updateInstanceData();
}
return this.control.isItemSelected(this.getNativeItem(aItem));
null
if (!this._control) {
this._control =
document.getAnonymousElementByAttribute(this, "anonid", "control");
}
return this._control;
null
return this.getAttribute("readonly") == "true" ? true : false;
if (val) {
this.setAttribute("readonly", "true");
} else {
this.removeAttribute("readonly");
}
this.control.focus();
if (this.parentControl)
this.parentControl.dispatchDOMUIEvent(aType);
return "";
if (this.parentControl.selection == "open")
this.allowFreeEntry(true);
else
this.allowFreeEntry(false);