I fixed it a bit more and made similar changes to RadioButton.

We need to do the same for IconToggle, but I’m out of time right now. If 
someone can do that, it would be great.

Thanks,
Harbs

> On Aug 18, 2017, at 3:35 PM, Harbs <harbs.li...@gmail.com> wrote:
> 
> My latest commit should now work whether selected is being set via MXML or by 
> code.
> 
>> On Aug 18, 2017, at 3:29 PM, Harbs <harbs.li...@gmail.com> wrote:
>> 
>> Yes. You are right. I forgot to remove that line after I added check() and 
>> uncheck().
>> 
>> Hmm. On second thought:
>> 
>> This is going to break setting the value via MXML. Let me fix that...
>> 
>>> On Aug 18, 2017, at 3:06 PM, Piotr Zarzycki <piotrzarzyck...@gmail.com> 
>>> wrote:
>>> 
>>> Hi Harbs,
>>> 
>>> Ohh! Cool I didn't look into CheckBox in MDL and didn't know that there are
>>> some methods "check()" :) Maybe we don't need this line either ?
>>> 
>>> input.checked = value;
>>> 
>>> Thanks,
>>> Piotr
>>> 
>>> 
>>> 2017-08-18 14:01 GMT+02:00 <ha...@apache.org>:
>>> 
>>>> Repository: flex-asjs
>>>> Updated Branches:
>>>> refs/heads/develop f208da8d9 -> 467d4bfdb
>>>> 
>>>> 
>>>> Setting checked state manually now works
>>>> 
>>>> 
>>>> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
>>>> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/467d4bfd
>>>> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/467d4bfd
>>>> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/467d4bfd
>>>> 
>>>> Branch: refs/heads/develop
>>>> Commit: 467d4bfdba723eab442e5f8c12ddc816c7f8bb9f
>>>> Parents: f208da8
>>>> Author: Harbs <ha...@in-tools.com>
>>>> Authored: Fri Aug 18 15:01:23 2017 +0300
>>>> Committer: Harbs <ha...@in-tools.com>
>>>> Committed: Fri Aug 18 15:01:23 2017 +0300
>>>> 
>>>> ----------------------------------------------------------------------
>>>> .../main/flex/org/apache/flex/mdl/CheckBox.as   | 49 +++++++++++++++++---
>>>> .../src/main/resources/defaults.css             | 10 ++--
>>>> 2 files changed, 47 insertions(+), 12 deletions(-)
>>>> ----------------------------------------------------------------------
>>>> 
>>>> 
>>>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>>>> 467d4bfd/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 aeafe00..84afae8 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
>>>> @@ -143,7 +143,14 @@ package org.apache.flex.mdl
>>>>        */
>>>>              override public function get text():String
>>>>              {
>>>> -                       return IToggleButtonModel(model).text;
>>>> +            COMPILE::SWF
>>>> +            {
>>>> +                       return IToggleButtonModel(model).text;
>>>> +            }
>>>> +            COMPILE::JS
>>>> +            {
>>>> +                return textNode ? textNode.nodeValue : "";
>>>> +            }
>>>>              }
>>>> 
>>>>       /**
>>>> @@ -151,11 +158,14 @@ package org.apache.flex.mdl
>>>>        */
>>>>       override public function set text(value:String):void
>>>>              {
>>>> -            IToggleButtonModel(model).text = value;
>>>> +            COMPILE::SWF
>>>> +            {
>>>> +                IToggleButtonModel(model).text = value;
>>>> +            }
>>>> 
>>>>           COMPILE::JS
>>>>                      {
>>>> -                if(textNode == null)
>>>> +                if(!textNode)
>>>>               {
>>>>                   textNode = document.createTextNode('') as Text;
>>>>                   checkbox.appendChild(textNode);
>>>> @@ -175,11 +185,22 @@ package org.apache.flex.mdl
>>>>        */
>>>>       public function get value():String
>>>>       {
>>>> -            return IToggleButtonModel(model).html;
>>>> +            COMPILE::SWF
>>>> +            {
>>>> +                return IToggleButtonModel(model).html;
>>>> +            }
>>>> +
>>>> +            COMPILE::JS
>>>> +            {
>>>> +                return input.value;
>>>> +            }
>>>>       }
>>>>       public function set value(newValue:String):void
>>>>       {
>>>> -            IToggleButtonModel(model).html = newValue;
>>>> +            COMPILE::SWF
>>>> +            {
>>>> +                IToggleButtonModel(model).html = newValue;
>>>> +            }
>>>> 
>>>>           COMPILE::JS
>>>>           {
>>>> @@ -202,7 +223,14 @@ package org.apache.flex.mdl
>>>>        */
>>>>              override public function get selected():Boolean
>>>>              {
>>>> -                       return IToggleButtonModel(model).selected;
>>>> +            COMPILE::SWF
>>>> +            {
>>>> +                       return IToggleButtonModel(model).selected;
>>>> +            }
>>>> +            COMPILE::JS
>>>> +            {
>>>> +                return input.checked;
>>>> +            }
>>>>              }
>>>> 
>>>>       /**
>>>> @@ -210,11 +238,18 @@ package org.apache.flex.mdl
>>>>        */
>>>>       override public function set selected(value:Boolean):void
>>>>       {
>>>> -            IToggleButtonModel(model).selected = value;
>>>> +            COMPILE::SWF
>>>> +            {
>>>> +                IToggleButtonModel(model).selected = value;
>>>> +            }
>>>> 
>>>>           COMPILE::JS
>>>>                      {
>>>>               input.checked = value;
>>>> +                if(value)
>>>> +                    element['MaterialCheckbox'].check();
>>>> +                else
>>>> +                    element['MaterialCheckbox'].uncheck();
>>>>           }
>>>>       }
>>>>   }
>>>> 
>>>> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
>>>> 467d4bfd/frameworks/projects/MaterialDesignLite/src/main/
>>>> resources/defaults.css
>>>> ----------------------------------------------------------------------
>>>> diff --git 
>>>> a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
>>>> b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
>>>> index 096f442..f8b3b05 100644
>>>> --- a/frameworks/projects/MaterialDesignLite/src/main/
>>>> resources/defaults.css
>>>> +++ b/frameworks/projects/MaterialDesignLite/src/main/
>>>> resources/defaults.css
>>>> @@ -54,11 +54,6 @@ TextArea
>>>>   IBeadController: ClassReference("org.apache.
>>>> flex.html.beads.controllers.EditableTextKeyboardController");*/
>>>> }
>>>> 
>>>> -CheckBox
>>>> -{
>>>> -    IBeadModel: ClassReference("org.apache.flex.html.beads.models.
>>>> ToggleButtonModel");
>>>> -}
>>>> -
>>>> IconToggle
>>>> {
>>>>   IBeadModel: ClassReference("org.apache.flex.html.beads.models.
>>>> ToggleButtonModel");
>>>> @@ -170,6 +165,11 @@ DropDownList
>>>> 
>>>> @media -flex-flash
>>>> {
>>>> +    CheckBox
>>>> +    {
>>>> +        IBeadModel: ClassReference("org.apache.flex.html.beads.models.
>>>> ToggleButtonModel");
>>>> +    }
>>>> +
>>>>   Slider
>>>>   {
>>>>       iThumbView: ClassReference("org.apache.flex.mdl.beads.views.
>>>> SliderThumbView");
>>>> 
>>>> 
>> 
> 

Reply via email to