You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/07/28 20:40:39 UTC

[13/36] git commit: [flex-asjs] [refs/heads/develop] - get flatui-like look in both AS and JS Checkbox and RadioButton

get flatui-like look in both AS and JS Checkbox and RadioButton


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

Branch: refs/heads/develop
Commit: 574df850cbbd562fe4c3332184fbfe12952b44fb
Parents: 336c6d0
Author: Alex Harui <ah...@apache.org>
Authored: Thu Jul 16 13:46:55 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Jul 16 13:46:55 2015 -0700

----------------------------------------------------------------------
 frameworks/projects/HTML/as/defaults.css        | 139 +++++++++++++++----
 .../beads/CSSContentAndTextToggleButtonView.as  |  71 +++++-----
 ...CheckboxCSSContentAndTextToggleButtonView.as |  48 +++++++
 .../RadioCSSContentAndTextToggleButtonView.as   |  47 +++++++
 frameworks/projects/HTML/basic-manifest.xml     |   3 +-
 .../js/src/org/apache/flex/html/CheckBox.js     |  68 +++++++--
 .../js/src/org/apache/flex/html/RadioButton.js  |  53 ++++++-
 7 files changed, 357 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/574df850/frameworks/projects/HTML/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/defaults.css b/frameworks/projects/HTML/as/defaults.css
index e9ad38e..cd9389c 100644
--- a/frameworks/projects/HTML/as/defaults.css
+++ b/frameworks/projects/HTML/as/defaults.css
@@ -103,10 +103,73 @@ ButtonBarButtonItemRenderer
     height: 30;
 }
 
-CheckBox
+.checkbox-icon,
+.checkbox-icon-hover,
+.checkbox-icon-checked
+{
+  position: absolute;
+  top: 0;
+  left: 0;
+  display: block;
+  width: 20px;
+  height: 20px;
+  font-size: 20px;
+  line-height: 20px;
+  color: #bdc3c7;
+  text-align: center;
+  cursor: pointer;
+  
+  /* .radio .icon-checked:before */
+  /* .radio .icon-unchecked:before */
+  font-family: 'Flat-UI-Icons';
+  font-style: normal;
+  font-weight: normal;
+  font-variant: normal;
+  text-transform: none;
+
+  speak: none;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;  
+  
+  font-size: 20px;
+  line-height: 20px;
+}
+
+.checkbox-icon:before
 {
   content: "\e60d";
+}
+
+.checkbox-icon-hover:before
+{
+  content: "\e60e";
+}
+
+.checkbox-icon-checked:before 
+{
+  content: "\e60e";
+}
 
+.checkbox-icon-checked 
+{
+  color: #1abc9c;
+}
+
+.checkbox-input
+{
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 20px;
+  height: 20px;
+  padding: 0;
+  margin: 0;
+  outline: none !important;
+  opacity: 0;
+}
+
+CheckBox
+{
   /* .checkbox */
   position: relative;
   padding-left: 32px;
@@ -117,16 +180,6 @@ CheckBox
           transition: color .25s linear;
 }
 
-CheckBox:hover
-{
-  content: "\e60e";
-}
-
-CheckBox:checked
-{
-  content: "\e60e";
-}
-
 Container
 {
     IBeadView: ClassReference("org.apache.flex.html.beads.ContainerView");
@@ -231,8 +284,22 @@ PanelWithControlBar
 	padding: 2px;
 }
 
-.icon-checked 
+.radio-icon,
+.radio-icon-hover,
+.radio-icon-checked
 {
+  position: absolute;
+  top: 0;
+  left: 0;
+  display: block;
+  width: 20px;
+  height: 20px;
+  font-size: 20px;
+  line-height: 20px;
+  color: #bdc3c7;
+  text-align: center;
+  cursor: pointer;
+  
   /* .radio .icon-checked:before */
   /* .radio .icon-unchecked:before */
   font-family: 'Flat-UI-Icons';
@@ -247,19 +314,43 @@ PanelWithControlBar
   
   font-size: 20px;
   line-height: 20px;
-  color: #bdc3c7;
+}
+
+.radio-icon:before
+{
+  content: "\e60b";
+}
 
+.radio-icon-hover:before
+{
+  content: "\e60c";
 }
 
-.icon-checked:checked 
+.radio-icon-checked:before
+{
+  content: "\e60c";
+}
+
+.radio-icon-checked
 {
   color: #1abc9c;
 }
 
-RadioButton
+.radio-input
 {
-  content: "\e60b";
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 20px;
+  height: 20px;
+  padding: 0;
+  margin: 0;
+  outline: none !important;
+  opacity: 0;
+}
 
+RadioButton
+{
   /* .radio */
   position: relative;
   padding-left: 32px;
@@ -270,18 +361,6 @@ RadioButton
           transition: color .25s linear;
 }
 
-RadioButton:hover
-{
-  content: "\e60c";
-
-}
-
-RadioButton:checked
-{
-  content: "\e60c";
-
-}
-
 SimpleList
 {
     IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
@@ -374,7 +453,7 @@ Button
 CheckBox
 {
     IBeadModel: ClassReference("org.apache.flex.html.beads.models.ToggleButtonModel");
-    IBeadView:  ClassReference("org.apache.flex.html.beads.CSSContentAndTextToggleButtonView");			
+    IBeadView:  ClassReference("org.apache.flex.html.beads.CheckboxCSSContentAndTextToggleButtonView");			
 }
 
 CloseButton
@@ -488,7 +567,7 @@ PanelWithControlBar
 RadioButton
 {
     IBeadModel: ClassReference("org.apache.flex.html.beads.models.ValueToggleButtonModel");
-    IBeadView:  ClassReference("org.apache.flex.html.beads.CSSContentAndTextToggleButtonView");			
+    IBeadView:  ClassReference("org.apache.flex.html.beads.RadioCSSContentAndTextToggleButtonView");			
 }
 
 ScrollBar

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/574df850/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CSSContentAndTextToggleButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CSSContentAndTextToggleButtonView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CSSContentAndTextToggleButtonView.as
index 48eb9fe..40bb0c9 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CSSContentAndTextToggleButtonView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CSSContentAndTextToggleButtonView.as
@@ -48,23 +48,33 @@ package org.apache.flex.html.beads
 	public class CSSContentAndTextToggleButtonView extends BeadViewBase implements IBeadView
 	{
         /**
-         *  map of pseudo states.
+         *  map of classname suffixes.
          *  
          *  @langversion 3.0
          *  @playerversion Flash 10.2
          *  @playerversion AIR 2.6
          *  @productversion FlexJS 0.0
          */
-        private static var statesMap:Object = {
-            "upSprite": null,
-            "downSprite": "active",
-            "overSprite": "hover",
-            "upAndSelectedSprite": "checked",
-            "downAndSelectedSprite": "checked",
-            "overAndSelectedSprite": "checked"
+        private static var suffixMap:Object = {
+            "upSprite": "",
+            "downSprite": "-checked",
+            "overSprite": "-hover",
+            "upAndSelectedSprite": "-checked",
+            "downAndSelectedSprite": "-checked",
+            "overAndSelectedSprite": "-checked"
         }
         
         /**
+         *  className to use for styling.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        protected var className:String;
+        
+        /**
          *  Constructor.
          *  
          *  @langversion 3.0
@@ -74,24 +84,6 @@ package org.apache.flex.html.beads
          */
 		public function CSSContentAndTextToggleButtonView()
 		{
-            for (var p:String in statesMap)
-            {
-                var s:Sprite = new Sprite();
-                sprites.push(s);
-                this[p] = s;
-                
-				var tf:CSSTextField = new CSSTextField();
-				tf.type = TextFieldType.DYNAMIC;
-				tf.autoSize = TextFieldAutoSize.LEFT;
-				tf.name = "textField";
-                tf.parentHandlesPadding = true;
-				var icon:StyleableCSSTextField = new StyleableCSSTextField();
-				icon.name = "icon";
-                icon.className = "icon-checked";
-                icon.styleState = statesMap[p];
-				s.addChild(icon);
-				s.addChild(tf);
-			}
 		}
 		
 		private var upSprite:Sprite;
@@ -123,6 +115,24 @@ package org.apache.flex.html.beads
 		{
 			super.strand = value;
             
+            for (var p:String in suffixMap)
+            {
+                var s:Sprite = new Sprite();
+                sprites.push(s);
+                this[p] = s;
+                
+                var tf:CSSTextField = new CSSTextField();
+                tf.type = TextFieldType.DYNAMIC;
+                tf.autoSize = TextFieldAutoSize.LEFT;
+                tf.name = "textField";
+                tf.parentHandlesPadding = true;
+                var icon:StyleableCSSTextField = new StyleableCSSTextField();
+                icon.name = "icon";
+                icon.className = className + suffixMap[p];
+                s.addChild(icon);
+                s.addChild(tf);
+            }
+            
 			_toggleButtonModel = value.getBeadByType(IToggleButtonModel) as IToggleButtonModel;
 			_toggleButtonModel.addEventListener("textChange", textChangeHandler);
 			_toggleButtonModel.addEventListener("htmlChange", htmlChangeHandler);
@@ -267,22 +277,21 @@ package org.apache.flex.html.beads
 		protected function layoutControl() : void
 		{
             // TODO: Layout using descendant selectors (.checkbox .icons)
-			for (var p:String in statesMap)
+			for (var p:String in suffixMap)
 			{
                 var s:Sprite = this[p];
-                var state:String = statesMap[p];
 				var icon:StyleableCSSTextField = s.getChildByName("icon") as StyleableCSSTextField;
                 icon.autoSize = TextFieldAutoSize.LEFT;
 				var tf:CSSTextField = s.getChildByName("textField") as CSSTextField;
 				
                 icon.CSSParent = _strand;
-                var content:String = ValuesManager.valuesImpl.getValue(_strand, "content", state);
+                var content:String = ValuesManager.valuesImpl.getValue(icon, "content", "before");
                 if (content != null)
                     icon.text = content;
 				var mh:Number = Math.max(icon.height,tf.height);
 				
-                var padding:Object = ValuesManager.valuesImpl.getValue(_strand, "padding", state);
-                var paddingLeft:Object = ValuesManager.valuesImpl.getValue(_strand,"padding-left", state);
+                var padding:Object = ValuesManager.valuesImpl.getValue(_strand, "padding");
+                var paddingLeft:Object = ValuesManager.valuesImpl.getValue(_strand,"padding-left");
                 icon.x = CSSUtils.getLeftValue(paddingLeft, padding, s.width);
 				icon.y = (mh - icon.height)/2;
 				

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/574df850/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CheckboxCSSContentAndTextToggleButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CheckboxCSSContentAndTextToggleButtonView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CheckboxCSSContentAndTextToggleButtonView.as
new file mode 100644
index 0000000..e38fd0d
--- /dev/null
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/CheckboxCSSContentAndTextToggleButtonView.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+	
+    /**
+     *  The CheckboxCSSContentAndTextToggleButtonView class is the default view for
+     *  the org.apache.flex.html.Checkbox class.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+	public class CheckboxCSSContentAndTextToggleButtonView extends CSSContentAndTextToggleButtonView
+	{
+        /**
+         *  Constructor.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function CheckboxCSSContentAndTextToggleButtonView()
+		{
+			super();
+			
+			className = "checkbox-icon";
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/574df850/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RadioCSSContentAndTextToggleButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RadioCSSContentAndTextToggleButtonView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RadioCSSContentAndTextToggleButtonView.as
new file mode 100644
index 0000000..8d99f32
--- /dev/null
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/RadioCSSContentAndTextToggleButtonView.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html.beads
+{
+    /**
+     *  The RadioCSSContentAndTextToggleButtonView class is the default view for
+     *  the org.apache.flex.html.RadioButton class.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+	public class RadioCSSContentAndTextToggleButtonView extends CSSContentAndTextToggleButtonView
+	{
+        /**
+         *  Constructor.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function RadioCSSContentAndTextToggleButtonView()
+		{
+			super();
+			
+			className = "radio-icon";
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/574df850/frameworks/projects/HTML/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/basic-manifest.xml b/frameworks/projects/HTML/basic-manifest.xml
index 74002c9..9066637 100644
--- a/frameworks/projects/HTML/basic-manifest.xml
+++ b/frameworks/projects/HTML/basic-manifest.xml
@@ -74,7 +74,8 @@
     <component id="HRule" class="org.apache.flex.html.HRule" />
     <component id="Spacer" class="org.apache.flex.html.Spacer" />
     <component id="ImageAndTextButtonView" class="org.apache.flex.html.beads.ImageAndTextButtonView" />
-    <component id="CSSContentAndTextToggleButtonView" class="org.apache.flex.html.beads.CSSContentAndTextToggleButtonView"/>
+    <component id="CheckboxCSSContentAndTextToggleButtonView" class="org.apache.flex.html.beads.CheckboxCSSContentAndTextToggleButtonView"/>
+    <component id="RadioCSSContentAndTextToggleButtonView" class="org.apache.flex.html.beads.RadioCSSContentAndTextToggleButtonView"/>
     <component id="ScrollingViewport" class="org.apache.flex.html.supportClasses.ScrollingViewport" />
 
     <component id="DataGrid" class="org.apache.flex.html.DataGrid"/>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/574df850/frameworks/projects/HTML/js/src/org/apache/flex/html/CheckBox.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/CheckBox.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/CheckBox.js
index f6232b4..89a129c 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/CheckBox.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/CheckBox.js
@@ -48,40 +48,90 @@ org.apache.flex.html.CheckBox.prototype.createElement =
 
   this.element = document.createElement('label');
 
-  cb = document.createElement('input');
-  cb.type = 'checkbox';
-  this.element.appendChild(cb);
-  this.element.appendChild(document.createTextNode(''));
+  this.input = document.createElement('input');
+  this.input.type = 'checkbox';
+  this.input.className = 'checkbox-input';
+  this.input.addEventListener('change', goog.bind(this.selectionChangeHandler, this));
+  this.element.appendChild(this.input);
+
+  this.checkbox = document.createElement('span');
+  this.checkbox.className = 'checkbox-icon';
+  this.checkbox.addEventListener('mouseover', goog.bind(this.mouseOverHandler, this));
+  this.checkbox.addEventListener('mouseout', goog.bind(this.mouseOutHandler, this));
+  this.element.appendChild(this.checkbox);
+
+  this.textNode = document.createTextNode('');
+  this.element.appendChild(this.textNode);
+  this.element.className = 'CheckBox';
+  this.typeNames = 'CheckBox';
 
   this.positioner = this.element;
-  cb.flexjs_wrapper = this;
+  this.input.flexjs_wrapper = this;
+  this.checkbox.flexjs_wrapper = this;
   this.element.flexjs_wrapper = this;
 
   return this.element;
 };
 
 
+/**
+ * @param {Event} e The event object.
+ */
+org.apache.flex.html.CheckBox.prototype.mouseOverHandler =
+    function(e) {
+  this.checkbox.className = 'checkbox-icon-hover';
+};
+
+
+/**
+ * @param {Event} e The event object.
+ */
+org.apache.flex.html.CheckBox.prototype.mouseOutHandler =
+    function(e) {
+  if (this.input.checked)
+    this.checkbox.className = 'checkbox-icon-checked';
+  else
+    this.checkbox.className = 'checkbox-icon';
+};
+
+
+/**
+ * @param {Event} e The event object.
+ */
+org.apache.flex.html.CheckBox.prototype.selectionChangeHandler =
+    function(e) {
+  if (this.input.checked)
+    this.checkbox.className = 'checkbox-icon-checked';
+  else
+    this.checkbox.className = 'checkbox-icon';
+};
+
+
 Object.defineProperties(org.apache.flex.html.CheckBox.prototype, {
     /** @export */
     text: {
         /** @this {org.apache.flex.html.CheckBox} */
         get: function() {
-            return this.element.childNodes.item(1).nodeValue;
+            return this.textNode.nodeValue;
         },
         /** @this {org.apache.flex.html.CheckBox} */
         set: function(value) {
-            this.element.childNodes.item(1).nodeValue = value;
+            this.textNode.nodeValue = value;
         }
     },
     /** @export */
     selected: {
         /** @this {org.apache.flex.html.CheckBox} */
         get: function() {
-            return this.element.childNodes.item(0).checked;
+            return this.input.checked;
         },
         /** @this {org.apache.flex.html.CheckBox} */
         set: function(value) {
-            this.element.childNodes.item(0).checked = value;
+            this.input.checked = value;
+            if (value)
+              this.checkbox.className = 'checkbox-icon-checked';
+            else
+              this.checkbox.className = 'checkbox-icon';
         }
     }
 });

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/574df850/frameworks/projects/HTML/js/src/org/apache/flex/html/RadioButton.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/RadioButton.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/RadioButton.js
index 5a108fb..7cbfe75 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/RadioButton.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/RadioButton.js
@@ -51,19 +51,33 @@ org.apache.flex.html.RadioButton.radioCounter = 0;
 org.apache.flex.html.RadioButton.prototype.createElement =
     function() {
 
+  // hide this eleement
   this.input = document.createElement('input');
   this.input.type = 'radio';
+  this.input.className = 'radio-input';
   this.input.id = '_radio_' + org.apache.flex.html.RadioButton.radioCounter++;
+  this.input.addEventListener('change', goog.bind(this.selectionChangeHandler, this));
+
+  this.radio = document.createElement('span');
+  this.radio.className = 'radio-icon';
+  this.radio.addEventListener('mouseover', goog.bind(this.mouseOverHandler, this));
+  this.radio.addEventListener('mouseout', goog.bind(this.mouseOutHandler, this));
 
   this.textNode = document.createTextNode('radio button');
 
   this.labelFor = document.createElement('label');
   this.labelFor.appendChild(this.input);
+  this.labelFor.appendChild(this.radio);
   this.labelFor.appendChild(this.textNode);
+  this.labelFor.style.position = 'relative';
 
   this.element = this.labelFor;
+  this.element.className = 'RadioButton';
+  this.typeNames = 'RadioButton';
+
   this.positioner = this.element;
   this.input.flexjs_wrapper = this;
+  this.radio.flexjs_wrapper = this;
   this.element.flexjs_wrapper = this;
   this.textNode.flexjs_wrapper = this;
 
@@ -72,6 +86,37 @@ org.apache.flex.html.RadioButton.prototype.createElement =
 
 
 /**
+ * @param {Event} e The event object.
+ */
+org.apache.flex.html.RadioButton.prototype.mouseOverHandler =
+    function(e) {
+  this.radio.className = 'radio-icon-hover';
+};
+
+
+/**
+ * @param {Event} e The event object.
+ */
+org.apache.flex.html.RadioButton.prototype.mouseOutHandler =
+    function(e) {
+  if (this.input.checked)
+    this.radio.className = 'radio-icon-checked';
+  else
+    this.radio.className = 'radio-icon';
+};
+
+
+/**
+ * @param {Event} e The event object.
+ */
+org.apache.flex.html.RadioButton.prototype.selectionChangeHandler =
+    function(e) {
+  // this should reset the icons in the non-selected radio
+  this.selectedValue = this.value;
+};
+
+
+/**
  * @export
  */
 org.apache.flex.html.RadioButton.prototype.initModel =
@@ -128,6 +173,10 @@ Object.defineProperties(org.apache.flex.html.RadioButton.prototype, {
         /** @this {org.apache.flex.html.RadioButton} */
         set: function(value) {
             this.input.checked = value;
+            if (this.input.checked)
+              this.radio.className = 'radio-icon-checked';
+            else
+              this.radio.className = 'radio-icon';
         }
     },
     /** @export */
@@ -168,8 +217,10 @@ Object.defineProperties(org.apache.flex.html.RadioButton.prototype, {
             for (i = 0; i < n; i++) {
               if (buttons[i].value === value) {
                 buttons[i].checked = true;
-                break;
+                buttons[i].flexjs_wrapper.selected = true;
               }
+              else
+                buttons[i].flexjs_wrapper.selected = false;
             }
         }
     }