FLEX-35347 - Add property "value" to CheckBox which will store additional 
information
Update MDLExample with new feature


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

Branch: refs/heads/feature/strand-work
Commit: 04045d39edefa636babe52760abadd45c95ce8af
Parents: 0bc728c
Author: piotrz <pio...@apache.org>
Authored: Thu Aug 3 22:58:34 2017 +0200
Committer: piotrz <pio...@apache.org>
Committed: Thu Aug 3 22:58:34 2017 +0200

----------------------------------------------------------------------
 .../MDLExample/src/main/flex/Toggles.mxml       | 15 +++++------
 .../main/flex/org/apache/flex/mdl/CheckBox.as   | 26 ++++++++++++++++++--
 2 files changed, 32 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/04045d39/examples/flexjs/MDLExample/src/main/flex/Toggles.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/Toggles.mxml 
b/examples/flexjs/MDLExample/src/main/flex/Toggles.mxml
index 784a7f6..7162c0a 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Toggles.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Toggles.mxml
@@ -24,8 +24,8 @@ limitations under the License.
     
     <fx:Script>
         <![CDATA[
-            import org.apache.flex.events.MouseEvent;
-            import org.apache.flex.mdl.materialIcons.MaterialIconType;
+        import org.apache.flex.events.MouseEvent;
+        import org.apache.flex.mdl.materialIcons.MaterialIconType;
 
             [Bindable]
             public var counter:int = 0;
@@ -47,6 +47,7 @@ limitations under the License.
 
             [Bindable]
             public var counter7:int = 0;
+
         ]]>
        </fx:Script>
 
@@ -57,7 +58,7 @@ limitations under the License.
     <mdl:Grid width="250">
     
         <!-- Toggles :: 
https://getmdl.io/components/index.html#toggles-section -->
-        <mdl:CheckBox id="mdlchk" text="Disabled at start" change="counter++"/>
+        <mdl:CheckBox id="mdlchk" text="Disabled at start" value="CheckBox 
Description" change="counter++"/>
         <js:Label text="Chebox throw 'change' event {counter} times"/>
         <mdl:CheckBox id="mdlchk1" text="Selected and with Ripple" 
selected="true" ripple="true"/>
         
@@ -82,13 +83,13 @@ limitations under the License.
         
         <js:Label text="Switch throw 'click' event {counter4} times"/>
         
-        <mdl:Switch id="s2" text="Switch" click="counter5++"/>
+        <mdl:Switch id="s2" text="Switch" click="onClickSwitch(event)"/>
         
         <js:Label text="Switch throw 'click' event {counter5} times"/>
 
-        <mdl:RadioButton groupName="g1" text="Ripple 1" ripple="true" 
change="counter6++"/>
-        <mdl:RadioButton groupName="g1" text="Ripple 2" ripple="true" 
change="counter6++"/>
-        <mdl:RadioButton groupName="g1" text="Ripple 3" ripple="true" 
change="counter6++"/>
+        <mdl:RadioButton groupName="g1" text="Ripple 1" value="Test 1" 
ripple="true" change="counter6++"/>
+        <mdl:RadioButton groupName="g1" text="Ripple 2" value="Test 2" 
ripple="true" change="counter6++"/>
+        <mdl:RadioButton groupName="g1" text="Ripple 3" value="Test 3" 
ripple="true" change="counter6++"/>
 
         <js:Label text="RadioButtons throw 'change' event {counter6} times"/>
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/04045d39/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as
 
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as
index 698be69..aeafe00 100644
--- 
a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as
+++ 
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as
@@ -18,7 +18,7 @@
 
////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.mdl
 {
-    import org.apache.flex.html.CheckBox; 
+    import org.apache.flex.html.CheckBox;
     import org.apache.flex.core.IToggleButtonModel;
     import org.apache.flex.mdl.beads.UpgradeChildren;
     import org.apache.flex.mdl.beads.UpgradeElement;
@@ -103,7 +103,7 @@ package org.apache.flex.mdl
             element.flexjs_wrapper = this;
             
             return element;
-        };
+        }
 
         protected var _ripple:Boolean = false;
 
@@ -165,6 +165,28 @@ package org.apache.flex.mdl
                        }
                }
 
+        /**
+         *  The value associated with the CheckBox.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.9
+         */
+        public function get value():String
+        {
+            return IToggleButtonModel(model).html;
+        }
+        public function set value(newValue:String):void
+        {
+            IToggleButtonModel(model).html = newValue;
+
+            COMPILE::JS
+            {
+                input.value = newValue;
+            }
+        }
+
         COMPILE::JS
         protected var textNode:Text;
 

Reply via email to