royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [royale-asjs] branch develop updated: StyledUIBase supports components that use ClassSelectorList for class name management
Date Fri, 08 Jun 2018 12:41:09 GMT
This is an automated email from the ASF dual-hosted git repository.

carlosrovira 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 11f2efa  StyledUIBase supports components that use ClassSelectorList for class name
management
11f2efa is described below

commit 11f2efa70fa5512da4807408ee2421081c81bc32
Author: Carlos Rovira <carlosrovira@apache.org>
AuthorDate: Fri Jun 8 14:40:56 2018 +0200

    StyledUIBase supports components that use ClassSelectorList for class name management
---
 .../projects/Core/src/main/royale/CoreClasses.as   |  6 +--
 .../royale/org/apache/royale/core/StyledUIBase.as  | 56 ++++++++++++++++++++++
 .../main/royale/org/apache/royale/jewel/Button.as  | 14 +-----
 .../royale/org/apache/royale/jewel/TextInput.as    | 12 +----
 .../royale/jewel/supportClasses/TextInputBase.as   | 24 ++--------
 5 files changed, 63 insertions(+), 49 deletions(-)

diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
index ee14d3a..283cd3e 100644
--- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
@@ -27,6 +27,7 @@ package {
 internal class CoreClasses
 {
 	import org.apache.royale.core.UIBase; UIBase;
+	import org.apache.royale.core.StyledUIBase; StyledUIBase;
 	import org.apache.royale.core.LayoutBase; LayoutBase;
 	import org.apache.royale.core.ViewBase; ViewBase;
 	import org.apache.royale.core.GroupBase; GroupBase;
@@ -271,11 +272,6 @@ internal class CoreClasses
 		import org.apache.royale.utils.object.defineSimpleGetter; defineSimpleGetter;
 		import org.apache.royale.utils.object.defineProperty; defineProperty;
 		import org.apache.royale.utils.object.defineSimpleProperty; defineSimpleProperty;
-
-		import org.apache.royale.utils.cssclasslist.removeAllStyles; removeAllStyles;
-		import org.apache.royale.utils.cssclasslist.removeStyles; removeStyles;
-		import org.apache.royale.utils.cssclasslist.toggleStyle; toggleStyle;
-		import org.apache.royale.utils.cssclasslist.addStyles; addStyles;
 	}
 	//Package Level Functions
 	import org.apache.royale.debugging.assert; assert;
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledUIBase.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledUIBase.as
new file mode 100644
index 0000000..9a62bef
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyledUIBase.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.core
+{
+    import org.apache.royale.utils.ClassSelectorList;
+
+    /**
+     *  The StyledUIBase is the base class for UIBase components that makes
+     *  heavy use of styles
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.0
+     */
+    public class StyledUIBase extends UIBase
+    {
+        /**
+         *  Constructor.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.3
+         */
+		public function StyledUIBase()
+		{
+            super();
+            classSelectorList = new ClassSelectorList(this);
+		}
+
+        protected var classSelectorList:ClassSelectorList;
+
+        COMPILE::JS
+        override protected function setClassName(value:String):void
+        {
+            classSelectorList.addNames(value);
+        }
+    }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
index 86ebdb4..238e839 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Button.as
@@ -32,7 +32,7 @@ package org.apache.royale.jewel
     COMPILE::JS
     {
         import org.apache.royale.core.WrappedHTMLElement;
-        import org.apache.royale.core.UIBase;
+        import org.apache.royale.core.StyledUIBase;
         import org.apache.royale.html.util.addElementToWrapper;
     }
 
@@ -332,7 +332,7 @@ package org.apache.royale.jewel
      *  @productversion Royale 0.9.3
      */
     COMPILE::JS
-    public class Button extends UIBase implements IStrand, IEventDispatcher, IUIBase
+    public class Button extends StyledUIBase implements IStrand, IEventDispatcher, IUIBase
     {
         /**
          *  Constructor.
@@ -345,12 +345,8 @@ package org.apache.royale.jewel
 		public function Button()
 		{
 			super();
-
-            classSelectorList = new ClassSelectorList(this);
             typeNames = "jewel button";
 		}
-        
-        protected var classSelectorList:ClassSelectorList;
 
         /**
          *  @copy org.apache.royale.html.Label#text
@@ -490,12 +486,6 @@ package org.apache.royale.jewel
                     getValue(this, 'iStatesImpl');
             }*/
             return element;
-        }       
-
-        override protected function setClassName(value:String):void
-        {
-            classSelectorList.addNames(value);
         }
-
 	}
 }
\ No newline at end of file
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TextInput.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TextInput.as
index ea2cf82..e26b591 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TextInput.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TextInput.as
@@ -51,19 +51,9 @@ package org.apache.royale.jewel
 		{
 			super();
 
-            classSelectorList = new ClassSelectorList(this);
-
             typeNames = "jewel textinput";
 		}
-
-        protected var classSelectorList:ClassSelectorList;
-
-        COMPILE::JS
-        override protected function setClassName(value:String):void
-        {
-            classSelectorList.addNames(value);
-        }
-
+        
         COMPILE::JS
 		private var _positioner:WrappedHTMLElement;
 
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/TextInputBase.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/TextInputBase.as
index f04cd6a..f642e90 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/TextInputBase.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/TextInputBase.as
@@ -17,7 +17,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.jewel.supportClasses
 {
-    import org.apache.royale.core.UIBase;
+    import org.apache.royale.core.StyledUIBase;
 	import org.apache.royale.events.Event;
     import org.apache.royale.jewel.supportClasses.ITextInput;
     import org.apache.royale.core.ITextModel;
@@ -26,8 +26,6 @@ package org.apache.royale.jewel.supportClasses
     {
         import goog.events;
         import org.apache.royale.core.WrappedHTMLElement;
-        import org.apache.royale.utils.cssclasslist.toggleStyle;
-        import org.apache.royale.utils.cssclasslist.addStyles; 
     }
     
     /**
@@ -48,7 +46,7 @@ package org.apache.royale.jewel.supportClasses
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.9.3
      */    
-	public class TextInputBase extends UIBase implements ITextInput
+	public class TextInputBase extends StyledUIBase implements ITextInput
 	{
         /**
          *  Constructor.
@@ -231,22 +229,6 @@ package org.apache.royale.jewel.supportClasses
             _label = value;
         }
 
-        
-        /**
-		 *  override UIBase to affect positioner instead of element
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */
-        COMPILE::JS
-		override protected function setClassName(value:String):void
-		{
-			//positioner.className = value;
-            addStyles(this, value);
-		}
-
         private var _isInvalid:Boolean = false;
         /**
 		 *  A boolean flag to activate "is-invalid" effect selector.
@@ -268,7 +250,7 @@ package org.apache.royale.jewel.supportClasses
 
             COMPILE::JS
             {
-                toggleStyle(this, "is-invalid", _isInvalid);
+                classSelectorList.toggle("is-invalid", _isInvalid);
                 //positioner.classList.toggle("is-invalid", _isInvalid);
                 //typeNames = positioner.className;
             }

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

Mime
View raw message