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 2018/07/02 16:08:43 UTC

[royale-asjs] branch develop updated: Jewel SectionContent

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 820c681  Jewel SectionContent
820c681 is described below

commit 820c68190f4748adb287fa165baf67979006ce69
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Mon Jul 2 18:08:38 2018 +0200

    Jewel SectionContent
---
 .../JewelExample/src/main/royale/MainContent.mxml  |  4 +-
 .../projects/Jewel/src/main/resources/defaults.css |  7 ++
 .../Jewel/src/main/resources/jewel-manifest.xml    |  3 +-
 .../apache/royale/jewel/ApplicationMainContent.as  |  2 +-
 .../main/royale/org/apache/royale/jewel/Drawer.as  |  4 +-
 ...ApplicationMainContent.as => SectionContent.as} | 74 +++++++++++-----------
 .../src/main/sass/components/_sectioncontent.sass  | 33 ++++++++++
 .../projects/Jewel/src/main/sass/defaults.sass     |  1 +
 8 files changed, 86 insertions(+), 42 deletions(-)

diff --git a/examples/royale/JewelExample/src/main/royale/MainContent.mxml b/examples/royale/JewelExample/src/main/royale/MainContent.mxml
index 2011f06..31fa94e 100644
--- a/examples/royale/JewelExample/src/main/royale/MainContent.mxml
+++ b/examples/royale/JewelExample/src/main/royale/MainContent.mxml
@@ -46,7 +46,7 @@ limitations under the License.
             <j:Image src="assets/apache-royale-jewel-logo-white.svg"/>
         </j:DrawerHeader>
         <j:DrawerContent>
-            <j:Navigation id="nav2" click="clickHandler(event)" className="navIconLinItemRenderer">
+            <j:Navigation click="clickHandler(event)" className="navIconLinItemRenderer">
                 <j:beads>
                     <js:ConstantBinding
                         sourceID="mainNavigationModel"
@@ -55,7 +55,7 @@ limitations under the License.
                 </j:beads>
             </j:Navigation>
             <j:Divider/>
-            <j:Navigation id="nav" click="clickHandler(event)" className="navIconLinItemRenderer">
+            <j:Navigation click="clickHandler(event)" className="navIconLinItemRenderer">
                 <j:beads>
                     <js:ConstantBinding
                         sourceID="mainNavigationModel"
diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css b/frameworks/projects/Jewel/src/main/resources/defaults.css
index 8ff4fd8..0849e1d 100644
--- a/frameworks/projects/Jewel/src/main/resources/defaults.css
+++ b/frameworks/projects/Jewel/src/main/resources/defaults.css
@@ -2519,6 +2519,13 @@ j|Navigation {
     IBeadView: ClassReference("org.apache.royale.jewel.beads.views.RadioButtonView");
   }
 }
+.jewel.section {
+  display: none;
+}
+.jewel.section.is-active {
+  display: block;
+}
+
 .jewel.slider {
   position: relative;
   height: 27px;
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index 3e80aef..f300753 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -52,13 +52,14 @@
     <component id="TopAppBarSection" class="org.apache.royale.jewel.TopAppBarSection"/>
     <component id="TopAppBarTitle" class="org.apache.royale.jewel.TopAppBarTitle"/>
     <component id="ApplicationMainContent" class="org.apache.royale.jewel.ApplicationMainContent"/>
+    <component id="SectionContent" class="org.apache.royale.jewel.SectionContent"/>
     <component id="Drawer" class="org.apache.royale.jewel.Drawer"/>
     <component id="DrawerHeader" class="org.apache.royale.jewel.DrawerHeader"/>
     <component id="DrawerContent" class="org.apache.royale.jewel.DrawerContent"/>
     <component id="Divider" class="org.apache.royale.jewel.Divider"/>
 
     <component id="Image" class="org.apache.royale.jewel.Image"/>
-
+    
     <component id="Card" class="org.apache.royale.jewel.Card"/>
     
     <component id="DropDownListList" class="org.apache.royale.jewel.supportClasses.DropDownListList"/>
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as
index 98d6d13..ade2756 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as
@@ -29,7 +29,7 @@ package org.apache.royale.jewel
 	/**
 	 *  The ApplicationMainContent class is a Container component capable of parenting
 	 *  the other organized content that implements IActivable interface
-	 *  (i.e, a Section container)
+	 *  (i.e, a SectionContent)
 	 *
 	 *  @langversion 3.0
 	 *  @playerversion Flash 10.2
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Drawer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Drawer.as
index c9f10e1..4dcff90 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Drawer.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Drawer.as
@@ -61,10 +61,10 @@ package org.apache.royale.jewel
 
             typeNames = "jewel drawer";
 
-			addEventListener(org.apache.royale.events.MouseEvent.CLICK, internalMouseHandler);
+			addEventListener(MouseEvent.CLICK, internalMouseHandler);
 		}
 
-		private function internalMouseHandler(event:org.apache.royale.events.MouseEvent):void
+		private function internalMouseHandler(event:MouseEvent):void
 		{
 			COMPILE::JS
 			{
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SectionContent.as
similarity index 59%
copy from frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as
copy to frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SectionContent.as
index 98d6d13..101a3b7 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ApplicationMainContent.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/SectionContent.as
@@ -18,8 +18,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.jewel
 {
-	import org.apache.royale.jewel.supportClasses.IActivable;
-
+    import org.apache.royale.jewel.supportClasses.IActivable;
+    
     COMPILE::JS
     {
         import org.apache.royale.core.WrappedHTMLElement;
@@ -27,16 +27,16 @@ package org.apache.royale.jewel
     }
 
 	/**
-	 *  The ApplicationMainContent class is a Container component capable of parenting
-	 *  the other organized content that implements IActivable interface
-	 *  (i.e, a Section container)
+	 *  The SectionContent class is a Container component capable of parenting other
+	 *  components. This class is used along with Tabs to separate content and
+	 *  present and organize data for the user.
 	 *
 	 *  @langversion 3.0
 	 *  @playerversion Flash 10.2
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.3
 	 */
-	public class ApplicationMainContent extends Container
+	public class SectionContent extends Group implements IActivable
 	{
 		/**
 		 *  constructor.
@@ -46,39 +46,12 @@ package org.apache.royale.jewel
 		 *  @playerversion AIR 2.6
 		 *  @productversion Royale 0.9.3
 		 */
-		public function ApplicationMainContent()
+		public function SectionContent()
 		{
 			super();
 
-            typeNames = "jewel main";
+            typeNames = "jewel section";
 		}
-		
-		/**
-		 *  shows a concrete content and hides the rest
-		 * 
-		 *  @param id, the id of the container to show
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.3
-		 */
-        public function showContent(id:String):void
-        {
-			for (var i:int = 0; i < numElements; i++)
-			{
-				var content:IActivable = getElementAt(i) as IActivable;
-				
-				if(content.id == id)
-				{
-					content.isActive = true;
-				}
-				else
-				{
-					content.isActive = false;
-				}
-			}
-        }
 
         /**
          * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
@@ -86,7 +59,36 @@ package org.apache.royale.jewel
         COMPILE::JS
         override protected function createElement():WrappedHTMLElement
         {
-			return addElementToWrapper(this,'main');
+			return addElementToWrapper(this,'section');
         }
+
+		private var _isActive:Boolean;
+
+        /**
+         *  a boolean flag to indicate if the container is active or not
+         *  defaults to false.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.3
+         */
+		public function get isActive():Boolean
+		{
+            return _isActive;
+		}
+
+		public function set isActive(value:Boolean):void
+		{
+            if (_isActive != value)
+            {
+                _isActive = value;
+
+                COMPILE::JS
+                {
+                    toggleClass("is-active", _isActive);
+                }
+            }
+		}
 	}
 }
diff --git a/frameworks/projects/Jewel/src/main/sass/components/_sectioncontent.sass b/frameworks/projects/Jewel/src/main/sass/components/_sectioncontent.sass
new file mode 100644
index 0000000..8a4fe88
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/sass/components/_sectioncontent.sass
@@ -0,0 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+// Jewel SectionContent
+
+// SectionContent variables
+
+.jewel.section
+    //padding: 40px
+    display: none
+    
+    &.is-active
+        display: block
+
+j|SectionContent
+    // IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.VerticalLayout")
+    // gap: 3
diff --git a/frameworks/projects/Jewel/src/main/sass/defaults.sass b/frameworks/projects/Jewel/src/main/sass/defaults.sass
index f7f0b40..dd72ac6 100644
--- a/frameworks/projects/Jewel/src/main/sass/defaults.sass
+++ b/frameworks/projects/Jewel/src/main/sass/defaults.sass
@@ -38,6 +38,7 @@
 @import "components/list"
 @import "components/navigation"
 @import "components/radiobutton"
+@import "components/sectioncontent"
 @import "components/slider"
 @import "components/textinput"
 @import "components/titlebar"