royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject [royale-asjs] branch develop updated: Assuming we stick with CSSClassList
Date Sun, 04 Mar 2018 13:48:53 GMT
This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 869b486  Assuming we stick with CSSClassList
869b486 is described below

commit 869b486dc1945bebe20dc41372cf7e35d4295659
Author: Harbs <harbs@in-tools.com>
AuthorDate: Sun Mar 4 15:48:46 2018 +0200

    Assuming we stick with CSSClassList
    
    This makes the use of it lighter…
---
 .../main/royale/org/apache/royale/mdl/Button.as    | 29 ++++++++++------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/Button.as
b/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/Button.as
index bd1e186..6144bd8 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/Button.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/Button.as
@@ -122,8 +122,7 @@ package org.apache.royale.mdl
                 _fab = value;
                 COMPILE::JS
                 {
-                    var classVal:String = "mdl-button--fab";
-                    value ? _classList.add(classVal) : _classList.remove(classVal);
+                    addOrRemove("mdl-button--fab",value);
                     setClassName(computeFinalClassNames());
                 }
             }
@@ -154,8 +153,7 @@ package org.apache.royale.mdl
 
                 COMPILE::JS
                 {
-                    var classVal:String = "mdl-button--raised";
-                    value ? _classList.add(classVal) : _classList.remove(classVal);
+                    addOrRemove("mdl-button--raised",value);
                     setClassName(computeFinalClassNames());
                 }
             }
@@ -185,8 +183,7 @@ package org.apache.royale.mdl
 
                 COMPILE::JS
                 {
-                    var classVal:String = "mdl-button--colored";
-                    value ? _classList.add(classVal) : _classList.remove(classVal);
+                    addOrRemove("mdl-button--colored",value);
                     setClassName(computeFinalClassNames());
                 }
             }
@@ -217,8 +214,7 @@ package org.apache.royale.mdl
 
                 COMPILE::JS
                 {
-                    var classVal:String = "mdl-button--accent";
-                    value ? _classList.add(classVal) : _classList.remove(classVal);
+                    addOrRemove("mdl-button--accent",value);
                     setClassName(computeFinalClassNames());
                 }
             }
@@ -249,8 +245,7 @@ package org.apache.royale.mdl
 
                 COMPILE::JS
                 {
-                    var classVal:String = "mdl-button--primary";
-                    value ? _classList.add(classVal) : _classList.remove(classVal);
+                    addOrRemove("mdl-button--primary",value);
                     setClassName(computeFinalClassNames());
                 }
             }
@@ -281,8 +276,7 @@ package org.apache.royale.mdl
 
                 COMPILE::JS
                 {
-                    var classVal:String = "mdl-button--mini-fab";
-                    value ? _classList.add(classVal) : _classList.remove(classVal);
+                    addOrRemove("mdl-button--mini-fab",value);
                     setClassName(computeFinalClassNames());
                 }
             }
@@ -313,8 +307,7 @@ package org.apache.royale.mdl
 
                 COMPILE::JS
                 {
-                    var classVal:String = "mdl-button--icon";
-                    value ? _classList.add(classVal) : _classList.remove(classVal);
+                    addOrRemove("mdl-button--icon",value);
                     setClassName(computeFinalClassNames());
                 }
             }
@@ -343,14 +336,18 @@ package org.apache.royale.mdl
 
                 COMPILE::JS
                 {
-                    var classVal:String = "mdl-js-ripple-effect";
-                    value ? _classList.add(classVal) : _classList.remove(classVal);
+                    addOrRemove("mdl-js-ripple-effect",value);
                     setClassName(computeFinalClassNames());
                 }
             }
         }
 
         COMPILE::JS
+        private function addOrRemove(classNameVal:String,add:Boolean):void
+        {
+            add ? _classList.add(classNameVal) : _classList.remove(classNameVal);
+        }
+        COMPILE::JS
         override protected function computeFinalClassNames():String
         {
             return _classList.compute() + super.computeFinalClassNames();

-- 
To stop receiving notification emails like this one, please contact
harbs@apache.org.

Mime
View raw message