You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/01/10 20:21:33 UTC

[royale-asjs] branch develop updated: tour-de-jewel: put in place light flat themes at runtime. Although we need still some tweaks

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 807944a  tour-de-jewel: put in place light flat themes at runtime. Although we need still some tweaks
807944a is described below

commit 807944a6df9fbfcc8e73096f55ea657aac35aed3
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Fri Jan 10 21:21:24 2020 +0100

    tour-de-jewel: put in place light flat themes at runtime. Although we need still some tweaks
---
 .../src/main/royale/WelcomeSection.mxml            | 26 ++++++++++++++++------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/examples/royale/TourDeJewel/src/main/royale/WelcomeSection.mxml b/examples/royale/TourDeJewel/src/main/royale/WelcomeSection.mxml
index fa089bc..eb833db 100644
--- a/examples/royale/TourDeJewel/src/main/royale/WelcomeSection.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/WelcomeSection.mxml
@@ -35,16 +35,25 @@ limitations under the License.
             private var themePrimaryIds:Array = [];
             private var themeSecondaryIds:Array = [];
             private var themeEmphasizedIds:Array = [];
+            private var flat:Boolean = false;
 
-            public function changeCSS(event:Event, emphasis:String, themesArray:Array):void
+            public function changeCSS(event:Event, color:String, emphasis:String, themesArray:Array):void
             {
-                color = event.target.selectedItem;
-
                 // This will remove link tags by Id to avoid store unused themes
                 if(themesArray.length > 0)
                     document.getElementById(themesArray.pop()).outerHTML = "";
+
+                var flatState:String = flat? "Flat" : "NoFlat";
                 
-                themesArray.push(loadCSS("assets/themes/Jewel-Light-NoFlat-" + emphasis + "-" + color + "-Theme/defaults.css"));
+                themesArray.push(loadCSS("assets/themes/Jewel-Light-" + flatState + "-" + emphasis + "-" + color + "-Theme/defaults.css"));
+            }
+
+            public function changeFlat(event:Event):void
+            {
+                flat = event.target.selected;
+                changeCSS(event, String(primary.selectedItem),'Primary', themePrimaryIds);
+                changeCSS(event, String(secondary.selectedItem), 'Secondary', themeEmphasizedIds);
+                changeCSS(event, String(emphasized.selectedItem), 'Emphasized', themeSecondaryIds);
             }
         ]]>
     </fx:Script>
@@ -71,7 +80,7 @@ limitations under the License.
             
             <j:Form>
                 <j:FormItem label="Primary:">
-                    <j:DropDownList change="changeCSS(event, 'Primary', themePrimaryIds)" selectedIndex="3">
+                    <j:DropDownList localId="primary" change="changeCSS(event, event.target.selectedItem, 'Primary', themePrimaryIds)" selectedIndex="3">
                         <j:dataProvider>
                             <js:ArrayList source="[Emerald, Green, Turquoise, Blue, Sapphire, Violet, Amethyst, Red, Topaz, Orange, Sunflower, Yellow]"/>
                         </j:dataProvider>
@@ -81,7 +90,7 @@ limitations under the License.
                     </j:DropDownList>
                 </j:FormItem>
                 <j:FormItem label="Secondary:">
-                    <j:DropDownList change="changeCSS(event, 'Secondary', themeSecondaryIds)" selectedIndex="8">
+                    <j:DropDownList localId="secondary" change="changeCSS(event, event.target.selectedItem, 'Secondary', themeSecondaryIds)" selectedIndex="8">
                         <j:dataProvider>
                             <js:ArrayList source="[Emerald, Green, Turquoise, Blue, Sapphire, Violet, Amethyst, Red, Topaz, Orange, Sunflower, Yellow]"/>
                         </j:dataProvider>
@@ -91,7 +100,7 @@ limitations under the License.
                     </j:DropDownList>
                 </j:FormItem>
                 <j:FormItem label="Emphasized:">
-                    <j:DropDownList change="changeCSS(event, 'Emphasized', themeEmphasizedIds)" selectedIndex="0">
+                    <j:DropDownList localId="emphasized" change="changeCSS(event, event.target.selectedItem, 'Emphasized', themeEmphasizedIds)" selectedIndex="0">
                         <j:dataProvider>
                             <js:ArrayList source="[Emerald, Green, Turquoise, Blue, Sapphire, Violet, Amethyst, Red, Topaz, Orange, Sunflower, Yellow]"/>
                         </j:dataProvider>
@@ -100,6 +109,9 @@ limitations under the License.
                         </j:beads>
                     </j:DropDownList>
                 </j:FormItem>
+                <j:FormItem label="Flat?">
+                    <j:CheckBox change="changeFlat(event)"/>
+                </j:FormItem>
             </j:Form>
         </j:VGroup>