flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pio...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - FLEX-35248 - Apply selection in case of SWF using className
Date Thu, 19 Jan 2017 16:44:42 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop bdae42bd2 -> e98c41213


FLEX-35248 - Apply selection in case of SWF using className


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

Branch: refs/heads/develop
Commit: e98c41213c1baad005cf157c45ef09e471b2fb02
Parents: bdae42b
Author: piotrz <piotrz@apache.org>
Authored: Thu Jan 19 17:44:36 2017 +0100
Committer: piotrz <piotrz@apache.org>
Committed: Thu Jan 19 17:44:36 2017 +0100

----------------------------------------------------------------------
 .../org/apache/flex/html/ToggleTextButton.as    | 51 +++++++++++++-------
 .../flex/html/beads/CSSTextToggleButtonView.as  |  4 +-
 2 files changed, 36 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e98c4121/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as
index a476f74..fb5ff4e 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as
@@ -126,6 +126,8 @@ package org.apache.flex.html
             {
                 IToggleButtonModel(model).selected = value;
 
+                internalSelected();
+
                 dispatchEvent(new Event("change"));
             }
             COMPILE::JS
@@ -163,30 +165,45 @@ package org.apache.flex.html
             selected = !selected;
         }
 
-        COMPILE::JS
         private function internalSelected():void
         {
-            var isToggleTextButtonSelected:Boolean = element.classList.contains("toggleTextButton_Selected");
-            if (!isToggleTextButtonSelected && _selected == true)
-            {
-                element.classList.add("toggleTextButton_Selected");
-            }
-            else if (isToggleTextButtonSelected && _selected == false)
+            COMPILE::SWF
             {
-                element.classList.toggle("toggleTextButton_Selected");
+                var name:String = super.className;
+                if (selected)
+                {
+                    className = "toggleTextButton_Selected" + (name ? " " + name : "");
+                }
+                else
+                {
+                    className = "toggleTextButton" + (name ? " " + name : "");
+                }
             }
 
-            var isToggleTextButton:Boolean = element.classList.contains("toggleTextButton");
-            if (!isToggleTextButton && _selected == false)
-            {
-                element.classList.add("toggleTextButton");
-            }
-            else if (isToggleTextButton && _selected == true)
+            COMPILE::JS
             {
-                element.classList.toggle("toggleTextButton");
-            }
+                var isToggleTextButtonSelected:Boolean = element.classList.contains("toggleTextButton_Selected");
+                if (!isToggleTextButtonSelected && _selected == true)
+                {
+                    element.classList.add("toggleTextButton_Selected");
+                }
+                else if (isToggleTextButtonSelected && _selected == false)
+                {
+                    element.classList.toggle("toggleTextButton_Selected");
+                }
 
-            typeNames = element.className;
+                var isToggleTextButton:Boolean = element.classList.contains("toggleTextButton");
+                if (!isToggleTextButton && _selected == false)
+                {
+                    element.classList.add("toggleTextButton");
+                }
+                else if (isToggleTextButton && _selected == true)
+                {
+                    element.classList.toggle("toggleTextButton");
+                }
+
+                typeNames = element.className;
+            }
         }
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e98c4121/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/CSSTextToggleButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/CSSTextToggleButtonView.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/CSSTextToggleButtonView.as
index a9cf01b..77c90f8 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/CSSTextToggleButtonView.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/CSSTextToggleButtonView.as
@@ -90,13 +90,13 @@ package org.apache.flex.html.beads
             var className:String = IStyleableObject(_strand).className;
             if (toggleButtonModel.selected)
             {
-                if (className.indexOf(SELECTED) == className.length - SELECTED.length)
+                if (className && className.indexOf(SELECTED) == className.length
- SELECTED.length)
                     IStyleableObject(_strand).className = className.substring(0, className.length
- SELECTED.length);
                 setupSkins();
             }
             else
             {
-                if (className.indexOf(SELECTED) == -1)
+                if (className && className.indexOf(SELECTED) == -1)
                     IStyleableObject(_strand).className += SELECTED;
                 setupSkins();                
             }


Mime
View raw message