You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2013/05/03 01:55:33 UTC

[04/13] git commit: [flex-asjs] [refs/heads/feature/createjs-checkbox] - add missing value and selectedValue properties to JS side

add missing value and selectedValue properties to JS side


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f861b2c6
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f861b2c6
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f861b2c6

Branch: refs/heads/feature/createjs-checkbox
Commit: f861b2c61443c3e2996c14084387650f567f2dc0
Parents: bd1b987
Author: Alex Harui <ah...@apache.org>
Authored: Wed May 1 11:18:13 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Wed May 1 11:18:26 2013 -0700

----------------------------------------------------------------------
 .../apache/flex/html/staticControls/RadioButton.js |   54 +++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f861b2c6/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/RadioButton.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/RadioButton.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/RadioButton.js
index 8953ce9..27ab22e 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/RadioButton.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/RadioButton.js
@@ -101,3 +101,57 @@ org.apache.flex.html.staticControls.RadioButton.prototype.get_selected = functio
 org.apache.flex.html.staticControls.RadioButton.prototype.set_selected = function(value) {
     this.element.childNodes.item(0).checked = value;
 };
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.RadioButton}
+ * @return {Object} The value getter.
+ */
+org.apache.flex.html.staticControls.RadioButton.prototype.get_value = function() {
+    return this.element.childNodes.item(0).value;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.RadioButton}
+ * @param {Object} value The value setter.
+ */
+org.apache.flex.html.staticControls.RadioButton.prototype.set_value = function(value) {
+    this.element.childNodes.item(0).value = value;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.RadioButton}
+ * @return {Object} The value of the selected RadioButton.
+ */
+org.apache.flex.html.staticControls.RadioButton.prototype.get_selectedValue = function() {
+    var groupName = this.element.childNodes.item(0).name;
+    var buttons = document.getElementsByName(groupName);
+    var n = buttons.length;
+    for (var i = 0; i < n; i++)
+    {
+        if (buttons[i].checked)
+            return buttons[i].value;
+    }
+    return null;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.html.staticControls.RadioButton}
+ * @param {Object} value The value of the selected RadioButton.
+ */
+org.apache.flex.html.staticControls.RadioButton.prototype.set_selectedValue = function(value) {
+    var groupName = this.element.childNodes.item(0).name;
+    var buttons = document.getElementsByName(groupName);
+    var n = buttons.length;
+    for (var i = 0; i < n; i++)
+    {
+        if (buttons[i].value == value)
+        {
+            buttons[i].checked = true;
+            break;
+        }
+    }
+};