[XForms] Implement accessible objects for xforms input controls. Bug 337250, patch by surkov, r=olli+aaronr

This commit is contained in:
aaronr%us.ibm.com 2006-08-21 21:24:08 +00:00
Родитель 2f0751422d
Коммит 86fb3d46bd
7 изменённых файлов: 94 добавлений и 17 удалений

Просмотреть файл

@ -46,7 +46,7 @@
* http://developer.mozilla.org/en/docs/XForms:Custom_Controls
*
*/
[scriptable, uuid(b88a1c27-47a2-4c25-be7c-170501a93643)]
[scriptable, uuid(f636007c-cc01-4295-b3cb-d525054c4a14)]
interface nsIXFormsUIWidget : nsIDOMElement
{
/**
@ -63,4 +63,19 @@ interface nsIXFormsUIWidget : nsIDOMElement
* During submission, the \<submit\> should be disabled.
*/
void disable(in boolean disable); // for <submit>
/**
* Return "string" value of xforms element that element actually shows.
*
* From time to time current element value can be different from current value
* of instance node that element is bound to. For example:
* 1) When a XForms control has non-incremental update and its value is
* changed due to user interaction, then getCurrentValue will return the
* control's new value even though the bound node has not be updated yet.
* 2) If instace value is out of range then xforms element can't show it.
* Therefore it shows default value and getCurrentValue will return showed
* value.
*/
AString getCurrentValue();
};

Просмотреть файл

@ -88,6 +88,12 @@
</body>
</method>
<method name="getCurrentValue">
<body>
return this.control.value;
</body>
</method>
<method name="updateInstanceData">
<parameter name="aIncremental"/>
<body>
@ -136,6 +142,12 @@
</body>
</method>
<method name="getCurrentValue">
<body>
return this.control.value ? "true" : "false";
</body>
</method>
<!--
updateInstanceData updates the instance data bound to this control under
certain conditions.
@ -166,12 +178,7 @@
}
}
if (this.control.value) {
this.accessors.setValue("true");
} else {
this.accessors.setValue("false");
}
this.accessors.setValue(this.getCurrentValue());
this.changed = false;
]]>
</body>
@ -226,15 +233,19 @@
</body>
</method>
<method name="getCurrentValue">
<body>
// The lexical representation for xsd:gMonth is the left and right
// truncated lexical representation for xsd:date: --MM.
return this.control.value != "" ? "--" + this.control.value : "";
</body>
</method>
<method name="updateInstanceData">
<parameter name="aIncremental"/>
<body>
if (!aIncremental || this.getAttribute("incremental") == "true") {
if (this.control.value != "") {
this.accessors.setValue("--" + this.control.value);
} else {
this.accessors.setValue("");
}
this.accessors.setValue(this.getCurrentValue());
}
</body>
</method>
@ -294,15 +305,19 @@
</body>
</method>
<method name="getCurrentValue">
<body>
// The lexical representation for xsd:gDay is the left truncated
// lexical representation for xsd:date: ---DD.
return this.control.value != "" ? "---" + this.control.value : "";
</body>
</method>
<method name="updateInstanceData">
<parameter name="aIncremental"/>
<body>
if (!aIncremental || this.getAttribute("incremental") == "true") {
if (this.control.value != "") {
this.accessors.setValue("---" + this.control.value);
} else {
this.accessors.setValue("");
}
this.accessors.setValue(this.getCurrentValue());
}
</body>
</method>

Просмотреть файл

@ -400,6 +400,12 @@
</body>
</method>
<method name="getCurrentValue">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<!-- create new range object -->
<method name="createRange">
<parameter name="aCanvas"/>

Просмотреть файл

@ -177,6 +177,12 @@
</body>
</method>
<method name="getCurrentValue">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<property name="incremental">
<getter>
<![CDATA[

Просмотреть файл

@ -715,6 +715,12 @@
</body>
</method>
<method name="getCurrentValue">
<body>
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
</body>
</method>
<method name="selectItemByValue">
<parameter name="aValue"/>
<body>

Просмотреть файл

@ -528,6 +528,9 @@
<method name="getControlElement">
<body>
return {
get value() {
return this._textControl.value;
},
set value(val) {
this._textControl.value = val;
},
@ -598,6 +601,7 @@
<method name="getControlElement">
<body>
return {
get value(){ return ""; }
set value(val){},
set readonly(val){},
focus: function(){}

Просмотреть файл

@ -225,6 +225,20 @@
return false;
</body>
</method>
<!-- Method is called to get current value of xforms element.
Here the method is implemented for those xforms elements that can't be
used to change the bound instance value. For example, xforms:output.
The rest of the xforms elements should override this implementation.
For example, xforms:trigger returns empty string since it actually
hasn't value even if it has a bound.
-->
<method name="getCurrentValue">
<body>
return this.accessors.getValue();
</body>
</method>
</implementation>
</binding>
@ -381,6 +395,11 @@
</body>
</method>
<method name="getCurrentValue">
<body>
return "";
</body>
</method>
</implementation>
</binding>
@ -461,6 +480,12 @@
</body>
</method>
<method name="getCurrentValue">
<body>
return this.control.value;
</body>
</method>
<property name="uploadElement" readonly="true">
<getter>
if (!this._uploadElement) {