flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject [1/3] git commit: [flex-asjs] [refs/heads/feature/layouts] - Initial changes for Mobile project.
Date Fri, 14 Apr 2017 12:53:20 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/feature/layouts d89a0109d -> fd5eaae54


Initial changes for Mobile project.


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

Branch: refs/heads/feature/layouts
Commit: e0b3528a795f1a99987ce5e25cc7f89986b6d735
Parents: ae5cb4e
Author: Peter Ent <pent@apache.org>
Authored: Wed Apr 12 15:39:56 2017 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Wed Apr 12 15:39:56 2017 -0400

----------------------------------------------------------------------
 .../ButtonBarButtonItemRenderer.as              |  34 +++-
 .../Mobile/src/main/flex/MobileClasses.as       |   1 +
 .../apache/flex/mobile/ManagedContentArea.as    |  55 ++++++
 .../apache/flex/mobile/StackedViewManager.as    |  51 ++++--
 .../org/apache/flex/mobile/TabbedViewManager.as |  42 +++++
 .../flex/org/apache/flex/mobile/TitleView.as    |   4 -
 .../org/apache/flex/mobile/ViewManagerBase.as   |  52 ++----
 .../flex/mobile/beads/StackedViewManagerView.as | 175 +++++++++++++------
 .../flex/mobile/beads/TabbedViewManagerView.as  | 175 +++++++++++++------
 .../flex/mobile/beads/ViewManagerViewBase.as    | 123 ++++++-------
 .../src/main/resources/basic-manifest.xml       |   1 +
 .../Mobile/src/main/resources/defaults.css      |  21 +++
 12 files changed, 511 insertions(+), 223 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
index 214125e..4e7ed07 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/ButtonBarButtonItemRenderer.as
@@ -26,6 +26,11 @@ package org.apache.flex.html.supportClasses
 	import org.apache.flex.html.TextButton;
 	import org.apache.flex.html.beads.ITextItemRenderer;
 	import org.apache.flex.events.ItemClickedEvent;
+	
+	COMPILE::JS
+	{
+		import org.apache.flex.core.WrappedHTMLElement;            
+	}
 
 	/**
 	 *  The ButtonBarButtonItemRenderer class handles the display of each item for the 
@@ -52,6 +57,18 @@ package org.apache.flex.html.supportClasses
 			super();
 		}
 		
+		/**
+		 * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+		 * @flexjsignorecoercion HTMLElement
+		 */
+		COMPILE::JS
+		override protected function createElement():WrappedHTMLElement
+		{
+			var result:WrappedHTMLElement = super.createElement();
+			trace("Element "+element+"; positioner "+positioner);
+			return result;
+		}
+		
 		protected var textButton:TextButton;
 		
 		/**
@@ -96,8 +113,14 @@ package org.apache.flex.html.supportClasses
 		 */
 		override public function setWidth(value:Number, noEvent:Boolean = false):void
 		{
-			super.setWidth(value, noEvent);
+			super.setWidth(value, true);
 			textButton.width = value;
+			COMPILE::SWF {
+				textButton.height = height;
+			}
+			COMPILE::JS {
+				textButton.percentHeight = 100;
+			}
 		}
 		
 		/**
@@ -105,8 +128,14 @@ package org.apache.flex.html.supportClasses
 		 */
 		override public function setHeight(value:Number, noEvent:Boolean = false):void
 		{
-			super.setHeight(value, noEvent);
+			super.setHeight(value, true);
 			textButton.height = value;
+			COMPILE::SWF {
+				textButton.width = width;
+			}
+			COMPILE::JS {
+				textButton.percentWidth = 100;
+			}
 		}
 		
 		/**
@@ -125,7 +154,6 @@ package org.apache.flex.html.supportClasses
 			var added:Boolean = false;
 			if (textButton == null) {
 				textButton = new TextButton();
-				textButton.percentWidth = 100;
 				
 				// listen for clicks on the button and translate them into
 				// an itemClicked event.

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/flex/MobileClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/MobileClasses.as b/frameworks/projects/Mobile/src/main/flex/MobileClasses.as
index 7c650fd..ea74217 100644
--- a/frameworks/projects/Mobile/src/main/flex/MobileClasses.as
+++ b/frameworks/projects/Mobile/src/main/flex/MobileClasses.as
@@ -33,6 +33,7 @@ internal class MobileClasses
 	import org.apache.flex.mobile.beads.DatePickerView; DatePickerView;
 	import org.apache.flex.mobile.ToggleSwitch; ToggleSwitch;
 	import org.apache.flex.mobile.ViewManagerBase; ViewManagerBase;
+	import org.apache.flex.mobile.ManagedContentArea; ManagedContentArea;
 	import org.apache.flex.mobile.beads.StackedViewManagerView; StackedViewManagerView;
 	import org.apache.flex.mobile.beads.TabbedViewManagerView; TabbedViewManagerView;
 	import org.apache.flex.mobile.beads.ViewManagerViewBase; ViewManagerViewBase;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ManagedContentArea.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ManagedContentArea.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ManagedContentArea.as
new file mode 100644
index 0000000..16081e5
--- /dev/null
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ManagedContentArea.as
@@ -0,0 +1,55 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.flex.mobile
+{
+	import org.apache.flex.core.UIBase;
+	import org.apache.flex.html.Group;
+	import org.apache.flex.events.Event;
+	
+	COMPILE::JS
+	{
+			import org.apache.flex.core.WrappedHTMLElement;
+	}
+	
+	/**
+	 *  The ManagedContentArea is the space in which views are displayed by the 
+	 *  view manager classes.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class ManagedContentArea extends Group
+	{
+		/**
+		 * Constructor.
+	     *  
+	     *  @langversion 3.0
+	     *  @playerversion Flash 10.2
+	     *  @playerversion AIR 2.6
+	     *  @productversion FlexJS 0.0
+		 */
+		public function ManagedContentArea()
+		{
+			super();
+			className = "ManagedContentArea";
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as
index 9322e66..79368fd 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/StackedViewManager.as
@@ -26,6 +26,7 @@ package org.apache.flex.mobile
 	import org.apache.flex.mobile.chrome.NavigationBar;
 	import org.apache.flex.mobile.chrome.ToolBar;
 	import org.apache.flex.mobile.models.ViewManagerModel;
+	import org.apache.flex.mobile.beads.StackedViewManagerView;
 	
 	[Event(name="viewChanged",type="org.apache.flex.events.Event")]
 	
@@ -127,6 +128,22 @@ package org.apache.flex.mobile
 		{
 			return _topView;
 		}
+		
+		/**
+		 * @private
+		 */
+		override public function addedToParent():void
+		{
+			super.addedToParent();
+			
+//			var tabbedView:StackedViewManagerView = getBeadByType(StackedViewManagerView) as StackedViewManagerView;
+//			
+//			var n:int = ViewManagerModel(model).views.length;
+//			if (n > 0) {
+//				var view:IViewManagerView = ViewManagerModel(model).views[0] as IViewManagerView;
+//				push(view);
+//			}
+		}
 
 		
 		/**
@@ -142,13 +159,15 @@ package org.apache.flex.mobile
 			nextView.viewManager = this;
 			ViewManagerModel(model).pushView(nextView);
 			
-			if (_topView != null) {
-				removeElement(_topView);
-			}
-			_topView = nextView;
-			addElement(_topView);
-			
-			dispatchEvent( new Event("viewChanged") );
+//			var stackedView:StackedViewManagerView = getBeadByType(StackedViewManagerView) as StackedViewManagerView;
+//			
+//			if (_topView != null) {
+//				stackedView.contentArea.removeElement(_topView);
+//			}
+//			_topView = nextView;
+//			stackedView.contentArea.addElement(_topView);
+//			
+//			dispatchEvent( new Event("viewChanged") );
 		}
 		
 		/**
@@ -161,14 +180,16 @@ package org.apache.flex.mobile
 		 */
 		public function pop():void
 		{
-			if (ViewManagerModel(model).views.length > 1) {
-				var lastView:IChild = ViewManagerModel(model).popView() as IChild;
-				removeElement(_topView);
-				addElement(lastView);
-				_topView = lastView as IViewManagerView;
-				
-				dispatchEvent( new Event("viewChanged") );
-			}
+			var stackedView:StackedViewManagerView = getBeadByType(StackedViewManagerView) as StackedViewManagerView;
+			
+//			if (ViewManagerModel(model).views.length > 1) {
+//				var lastView:IChild = ViewManagerModel(model).popView() as IChild;
+//				stackedView.contentArea.removeElement(_topView);
+//				stackedView.contentArea.addElement(lastView);
+//				_topView = lastView as IViewManagerView;
+//				
+//				dispatchEvent( new Event("viewChanged") );
+//			}
 		}
 
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as
index 243e285..3b0d89d 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TabbedViewManager.as
@@ -18,11 +18,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.mobile
 {	
+	import org.apache.flex.events.Event;
 	import org.apache.flex.html.Container;
 	import org.apache.flex.mobile.IViewManagerView;
 	import org.apache.flex.mobile.IViewManager;
 	import org.apache.flex.mobile.chrome.TabBar;
 	import org.apache.flex.mobile.models.ViewManagerModel;
+	import org.apache.flex.mobile.beads.TabbedViewManagerView;
 	
 	[Event(name="viewChanged",type="org.apache.flex.events.Event")]
 	
@@ -82,6 +84,46 @@ package org.apache.flex.mobile
 		{
 			ViewManagerModel(model).selectedIndex = value;
 		}
+		
+		/**
+		 * @private
+		 */
+		override public function addedToParent():void
+		{
+			super.addedToParent();
+			
+//			var tabbedView:TabbedViewManagerView = getBeadByType(TabbedViewManagerView) as TabbedViewManagerView;
+//			
+//			var n:int = ViewManagerModel(model).views.length;
+//			if (n > 0) {
+//				for (var i:int = 0; i < n; i++)
+//				{
+//					var view:IViewManagerView = ViewManagerModel(model).views[i] as IViewManagerView;
+//					view.viewManager = this;
+//					if (i == 0) {
+//						tabbedView.contentArea.addElement(view, true);
+//					}
+//				}
+//				ViewManagerModel(model).selectedIndex = 0;
+//			}
+		}
+		
+		/**
+		 * @private
+		 */
+		override protected function changeView( event:Event ):void
+		{
+//			var tabbedView:TabbedViewManagerView = getBeadByType(TabbedViewManagerView) as TabbedViewManagerView;
+//			
+//			var index:Number = ViewManagerModel(model).selectedIndex;
+//			if (currentView) {
+//				tabbedView.contentArea.removeElement(currentView);
+//			}
+//			currentView = views[index];
+//			tabbedView.contentArea.addElement(currentView);
+//
+//			dispatchEvent( new Event("viewChanged") );
+		}
 
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TitleView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TitleView.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TitleView.as
index 504f62e..0200e72 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TitleView.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/TitleView.as
@@ -33,10 +33,6 @@ package org.apache.flex.mobile
 		public function TitleView()
 		{
 			super();
-			
-			// views always take up 100% of their space
-			percentWidth = 100;
-			percentHeight = 100;
 		}
 		
 		private var _title:String;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as
index 6d7175e..cc16ae3 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ViewManagerBase.as
@@ -20,15 +20,12 @@ package org.apache.flex.mobile
 {
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.events.Event;
-	import org.apache.flex.html.Container;
+	import org.apache.flex.html.Group;
 	import org.apache.flex.mobile.IViewManagerView;
 	import org.apache.flex.mobile.IViewManager;
 	import org.apache.flex.mobile.chrome.NavigationBar;
 	import org.apache.flex.mobile.models.ViewManagerModel;
 	
-//	import org.apache.flex.html.beads.SolidBackgroundBead;
-//	import org.apache.flex.html.beads.SingleLineBorderBead;
-	
 	/**
 	 * Event dispatched when the current (selected) view changes.
 	 *  
@@ -47,7 +44,7 @@ package org.apache.flex.mobile
 	 *  @playerversion AIR 2.6
 	 *  @productversion FlexJS 0.0
 	 */
-	public class ViewManagerBase extends UIBase implements IViewManager
+	public class ViewManagerBase extends Group implements IViewManager
 	{
 		/**
 		 * Constructor.
@@ -61,9 +58,7 @@ package org.apache.flex.mobile
 			percentHeight = 100;
 			
 			model.addEventListener("selectedIndexChanged", changeView);
-			
-//			addBead(new SolidBackgroundBead());
-//			addBead(new SingleLineBorderBead());
+
 		}
 		
 		/**
@@ -162,40 +157,21 @@ package org.apache.flex.mobile
 		/**
 		 * @private
 		 */
-		override public function addedToParent():void
+		protected function changeView( event:Event ):void
 		{
-			super.addedToParent();
-			
-			var n:int = ViewManagerModel(model).views.length;
-			if (n > 0) {
-				for (var i:int = 0; i < n; i++)
-				{
-					var view:IViewManagerView = ViewManagerModel(model).views[i] as IViewManagerView;
-					view.viewManager = this;
-					if (i == 0) {
-						addElement(view, true);
-					}
-				}
-				ViewManagerModel(model).selectedIndex = 0;
-			}
-		}
-		
-		/**
-		 * @private
-		 */
-		private function changeView( event:Event ):void
-		{
-			var index:Number = ViewManagerModel(model).selectedIndex;
-			if (_currentView) {
-				removeElement(_currentView);
-			}
-			_currentView = views[index];
-			addElement(_currentView);
-
-			dispatchEvent( new Event("viewChanged") );
+			// handled in subclass
 		}
 		
 		private var _currentView:IViewManagerView;
+		public function get currentView():IViewManagerView
+		{
+			return _currentView;
+		}
+		public function set currentView(value:IViewManagerView):void
+		{
+			_currentView = value;
+			// probably need to dispatch an event or do something more complex
+		}
 		
 		/**
 		 * The currently visible view.

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as
index 85368ae..bd99b00 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/StackedViewManagerView.as
@@ -26,6 +26,8 @@ package org.apache.flex.mobile.beads
 	import org.apache.flex.events.Event;
 	import org.apache.flex.html.beads.ContainerView;
 	import org.apache.flex.html.beads.layouts.HorizontalLayout;
+	import org.apache.flex.mobile.IViewManagerView;
+	import org.apache.flex.mobile.ManagedContentArea;
 	import org.apache.flex.mobile.chrome.NavigationBar;
 	import org.apache.flex.mobile.chrome.ToolBar;
 	import org.apache.flex.mobile.models.ViewManagerModel;
@@ -54,74 +56,145 @@ package org.apache.flex.mobile.beads
 			super();
 		}
 		
-		private var _toolBar:ToolBar;
-
+		private var _strand:IStrand;
+		private var _contentArea:ManagedContentArea;
+		
+		public function get contentArea():ManagedContentArea
+		{
+			return _contentArea;
+		}
+		
+		public function get toolBar():ToolBar
+		{
+			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			return model.toolBar;
+		}
+		public function set toolBar(value:ToolBar):void
+		{
+			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			model.toolBar = value;
+		}
+		
+		override public function get strand():IStrand
+		{
+			return _strand;
+		}
 		override public function set strand(value:IStrand):void
 		{
+			_strand = value;
+			super.strand = value;
+			
+			// The content area will hold the views
+			_contentArea = new ManagedContentArea();
+			
 			var model:ViewManagerModel = value.getBeadByType(IBeadModel) as ViewManagerModel;
 			
 			if (model.toolBarItems)
 			{
-				_toolBar = new ToolBar();
-				_toolBar.controls = model.toolBarItems;
-				_toolBar.addBead(new HorizontalLayout());
-				UIBase(value).addElement(_toolBar,false);
+				var tbar:ToolBar = new ToolBar();
+				tbar.controls = model.toolBarItems;
+				tbar.addBead(new HorizontalLayout());
+				toolBar = tbar;
 			}
-			
-			super.strand = value;
-		}
-		override public function get strand():IStrand
-		{
-			return super.strand;
 		}
 		
-		/**
-		 * @private
-		 */
-		override protected function layoutChromeElements():void
-		{
-			var host:UIBase = strand as UIBase;
-			var contentAreaY:Number = 0;
-			var contentAreaHeight:Number = host.height;
-			var toolbarHeight:Number = _toolBar == null ? 0 : _toolBar.height;
-			
-			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
+		override protected function handleInitComplete(event:Event):void
+		{			
+			super.handleInitComplete(event);
 			
-			if (navigationBar)
-			{
-				navigationBar.x = 0;
-				navigationBar.y = 0;
-				navigationBar.width = host.width;
-				
-				contentAreaHeight -= navigationBar.height;
-				contentAreaY = navigationBar.height;
-				
-				model.navigationBar = navigationBar;
+			COMPILE::SWF {
+				_contentArea.percentWidth = 100;
+				_contentArea.percentHeight = 100;
 			}
+			UIBase(_strand).addElement(_contentArea);
 			
-			if (_toolBar)
-			{
-				_toolBar.x = 0;
-				_toolBar.y = host.height - toolbarHeight;
-				_toolBar.width = host.width;
-				
-				contentAreaHeight -= toolbarHeight;
-				
-				model.toolBar = _toolBar;
+			if (toolBar) {
+				UIBase(_strand).addElement(toolBar);
 			}
 			
-			if (contentAreaY < 0) contentAreaY = 0;
-			if (contentAreaHeight < 0) contentAreaHeight = 0;
+			performLayout(event);
 			
-			model.contentX = 0;
-			model.contentY = contentAreaY;
-			model.contentWidth = host.width;
-			model.contentHeight = contentAreaHeight;
+			showViewByIndex(0);
+		}
+		
+		private var _topView:IViewManagerView;
+		
+		protected function showViewByIndex(index:int):void
+		{
+			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
 			
-			sizeViewsToFitContentArea();
+			if (_topView != null) {
+				contentArea.removeElement(_topView);
+			}
+			_topView = model.views[index] as IViewManagerView;
+			contentArea.addElement(_topView);
 			
-			// notify the views that the content size has changed
-			IEventDispatcher(strand).dispatchEvent( new Event("contentSizeChanged") );
+			COMPILE::JS {
+				if (_topView) {
+					UIBase(_topView).element.style["flex-grow"] = "1";
+				}
+			}
 		}
+		
+		override protected function layoutViewAfterContentLayout():void
+		{
+			super.layoutViewAfterContentLayout();
+			
+			COMPILE::SWF {
+				if (_topView) {
+					UIBase(_topView).width = contentArea.width;
+					UIBase(_topView).height = contentArea.height;
+				}
+			}
+		}
+		
+		/**
+		 * @private
+		 */
+//		override protected function layoutChromeElements():void
+//		{
+//			var host:UIBase = strand as UIBase;
+//			var contentAreaY:Number = 0;
+//			var contentAreaHeight:Number = host.height;
+//			var toolbarHeight:Number = _toolBar == null ? 0 : _toolBar.height;
+//			
+//			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
+//			
+//			if (navigationBar)
+//			{
+//				navigationBar.x = 0;
+//				navigationBar.y = 0;
+//				navigationBar.width = host.width;
+//				
+//				contentAreaHeight -= navigationBar.height;
+//				contentAreaY = navigationBar.height;
+//				
+//				model.navigationBar = navigationBar;
+//			}
+//			
+//			if (_toolBar)
+//			{
+//				_toolBar.x = 0;
+//				_toolBar.y = host.height - toolbarHeight;
+//				_toolBar.width = host.width;
+//				
+//				contentAreaHeight -= toolbarHeight;
+//				
+//				model.toolBar = _toolBar;
+//			}
+//			
+//			if (contentAreaY < 0) contentAreaY = 0;
+//			if (contentAreaHeight < 0) contentAreaHeight = 0;
+//			
+//			model.contentX = 0;
+//			model.contentY = contentAreaY;
+//			model.contentWidth = host.width;
+//			model.contentHeight = contentAreaHeight;
+//			
+//			sizeViewsToFitContentArea();
+//			
+//			// notify the views that the content size has changed
+//			IEventDispatcher(strand).dispatchEvent( new Event("contentSizeChanged") );
+//		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as
index 787375d..227ae74 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/TabbedViewManagerView.as
@@ -26,9 +26,12 @@ package org.apache.flex.mobile.beads
 	import org.apache.flex.events.Event;
 	import org.apache.flex.html.beads.ContainerView;
 	import org.apache.flex.html.beads.layouts.HorizontalLayout;
+	import org.apache.flex.mobile.IViewManagerView;
+	import org.apache.flex.mobile.ManagedContentArea;
 	import org.apache.flex.mobile.chrome.NavigationBar;
 	import org.apache.flex.mobile.chrome.TabBar;
 	import org.apache.flex.mobile.models.ViewManagerModel;
+	import org.apache.flex.mobile.beads.TabbedViewManagerView;
 	
 	/**
 	 * The TabbedViewManagerView constructs the visual elements of the TabbedViewManager. The
@@ -54,9 +57,25 @@ package org.apache.flex.mobile.beads
 			super();
 		}
 		
-		private var _tabBar:TabBar;
-		
 		private var _strand:IStrand;
+		private var _contentArea:ManagedContentArea;
+		
+		public function get tabBar():TabBar
+		{
+			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			return model.tabBar;
+		}
+		public function set tabBar(value:TabBar):void
+		{
+			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			model.tabBar = value;
+		}
+		
+		public function get contentArea():ManagedContentArea
+		{
+			return _contentArea;
+		}
+		
 		override public function get strand():IStrand
 		{
 			return _strand;
@@ -64,17 +83,69 @@ package org.apache.flex.mobile.beads
 		override public function set strand(value:IStrand):void
 		{
 			_strand = value;
+			super.strand = value;
+			
+			// The content area will hold the views
+			_contentArea = new ManagedContentArea();
 			
 			var model:ViewManagerModel = value.getBeadByType(IBeadModel) as ViewManagerModel;
 			
 			// TabbedViewManager always has a TabBar
-			_tabBar = new TabBar();
-			_tabBar.dataProvider = model.views;
-			_tabBar.labelField = "title";
-			_tabBar.addEventListener("change",handleButtonBarChange);
-			UIBase(_strand).addElement(_tabBar, false);
+			var tbar:TabBar = new TabBar();
+			tbar.dataProvider = model.views;
+			tbar.labelField = "title";
+			tbar.addEventListener("change",handleButtonBarChange);
+			tabBar = tbar;
+		}
+		
+		override protected function handleInitComplete(event:Event):void
+		{			
+			super.handleInitComplete(event);
 			
-			super.strand = value;
+			COMPILE::SWF {
+				_contentArea.percentWidth = 100;
+				_contentArea.percentHeight = 100;
+			}
+			UIBase(_strand).addElement(_contentArea);
+			
+			if (tabBar) {
+				UIBase(_strand).addElement(tabBar);
+			}
+			
+			performLayout(event);
+			
+			showViewByIndex(0);
+		}
+		
+		private var _currentView:IViewManagerView;
+		
+		protected function showViewByIndex(index:int):void
+		{
+			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			
+			if (_currentView != null) {
+				contentArea.removeElement(_currentView);
+			}
+			_currentView = model.views[index] as IViewManagerView;
+			contentArea.addElement(_currentView);
+			
+			COMPILE::JS {
+				if (_currentView) {
+					UIBase(_currentView).element.style["flex-grow"] = "1";
+				}
+			}
+		}
+		
+		override protected function layoutViewAfterContentLayout():void
+		{
+			super.layoutViewAfterContentLayout();
+			
+			COMPILE::SWF {
+				if (_currentView) {
+					UIBase(_currentView).width = contentArea.width;
+					UIBase(_currentView).height = contentArea.height;
+				}
+			}
 		}
 		
 		/**
@@ -82,58 +153,60 @@ package org.apache.flex.mobile.beads
 		 */		
 		private function handleButtonBarChange(event:Event):void
 		{
-			var newIndex:Number = _tabBar.selectedIndex;
+			var newIndex:Number = tabBar.selectedIndex;
 			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
 			
 			// doing this will trigger the selectedIndexChanged event which will
 			// tell the strand to switch views
 			model.selectedIndex = newIndex;
+			
+			showViewByIndex(newIndex);
 		}
 		
 		/**
 		 * @private
 		 */
-		override protected function layoutChromeElements():void
-		{
-			var host:UIBase = _strand as UIBase;
-			var contentAreaY:Number = 0;
-			var contentAreaHeight:Number = host.height;
-			
-			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
-			
-			if (navigationBar)
-			{
-				navigationBar.x = 0;
-				navigationBar.y = 0;
-				navigationBar.width = host.width;
-				
-				contentAreaHeight -= navigationBar.height;
-				contentAreaY = navigationBar.height;
-				
-				model.navigationBar = navigationBar;
-			}
-			
-			if (_tabBar)
-			{
-				_tabBar.x = 0;
-				_tabBar.y = host.height - _tabBar.height;
-				_tabBar.width = host.width;
-				_tabBar.dispatchEvent(new Event("layoutNeeded"));
-				
-				contentAreaHeight -= _tabBar.height;
-				
-				model.tabBar = _tabBar;
-			}
-			
-			model.contentX = 0;
-			model.contentY = contentAreaY;
-			model.contentWidth = host.width;
-			model.contentHeight = contentAreaHeight;
-			
-			sizeViewsToFitContentArea();
-			
-			// notify the views that the content size has changed
-			IEventDispatcher(strand).dispatchEvent( new Event("contentSizeChanged") );
-		}
+//		override protected function layoutChromeElements():void
+//		{
+//			var host:UIBase = _strand as UIBase;
+//			var contentAreaY:Number = 0;
+//			var contentAreaHeight:Number = host.height;
+//			
+//			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
+//			
+//			if (navigationBar)
+//			{
+//				navigationBar.x = 0;
+//				navigationBar.y = 0;
+//				navigationBar.width = host.width;
+//				
+//				contentAreaHeight -= navigationBar.height;
+//				contentAreaY = navigationBar.height;
+//				
+//				model.navigationBar = navigationBar;
+//			}
+//			
+//			if (_tabBar)
+//			{
+//				_tabBar.x = 0;
+//				_tabBar.y = host.height - _tabBar.height;
+//				_tabBar.width = host.width;
+//				_tabBar.dispatchEvent(new Event("layoutNeeded"));
+//				
+//				contentAreaHeight -= _tabBar.height;
+//				
+//				model.tabBar = _tabBar;
+//			}
+//			
+//			model.contentX = 0;
+//			model.contentY = contentAreaY;
+//			model.contentWidth = host.width;
+//			model.contentHeight = contentAreaHeight;
+//			
+//			sizeViewsToFitContentArea();
+//			
+//			// notify the views that the content size has changed
+//			IEventDispatcher(strand).dispatchEvent( new Event("contentSizeChanged") );
+//		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as
b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as
index f314fad..5599ad9 100644
--- a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as
+++ b/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/beads/ViewManagerViewBase.as
@@ -28,6 +28,7 @@ package org.apache.flex.mobile.beads
 	import org.apache.flex.events.Event;
 	import org.apache.flex.html.Container;
 	import org.apache.flex.html.beads.layouts.HorizontalLayout;
+	import org.apache.flex.html.beads.GroupView;
 	import org.apache.flex.mobile.IViewManagerView;
 	import org.apache.flex.mobile.chrome.NavigationBar;
 	import org.apache.flex.mobile.models.ViewManagerModel;
@@ -41,7 +42,7 @@ package org.apache.flex.mobile.beads
 	 *  @playerversion AIR 2.6
 	 *  @productversion FlexJS 0.0
 	 */
-	public class ViewManagerViewBase implements IBeadView
+	public class ViewManagerViewBase extends GroupView implements IBeadView
 	{
 		/**
 		 * Constructor.
@@ -56,23 +57,15 @@ package org.apache.flex.mobile.beads
 			super();
 		}
 		
-		public function get host():IUIBase
-		{
-			return _strand as IUIBase;
-		}
-		public function set host(value:IUIBase):void
-		{
-			// not implemented; getter only.
-		}
-		
-		private var _navigationBar:NavigationBar;
 		public function get navigationBar():NavigationBar
 		{
-			return _navigationBar;
+			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			return model.navigationBar;
 		}
 		public function set navigationBar(value:NavigationBar):void
 		{
-			// not implemented; getter only.
+			var model:ViewManagerModel = strand.getBeadByType(IBeadModel) as ViewManagerModel;
+			model.navigationBar = value;
 		}
 		
 		private var _strand:IStrand;
@@ -80,22 +73,29 @@ package org.apache.flex.mobile.beads
 		{
 			return _strand;
 		}
-		public function set strand(value:IStrand):void
+		override public function set strand(value:IStrand):void
 		{
+			super.strand = value;
 			_strand = value;
-			UIBase(_strand).addEventListener("sizeChanged", sizeChangedHandler);
-			UIBase(_strand).addEventListener("widthChanged", sizeChangedHandler);
-			UIBase(_strand).addEventListener("heightChanged", sizeChangedHandler);
 			
 			var model:ViewManagerModel = value.getBeadByType(IBeadModel) as ViewManagerModel;
 			model.addEventListener("selectedIndexChanged", viewsChangedHandler);
 
 			if (model.navigationBarItems)
 			{
-				_navigationBar = new NavigationBar();
-				_navigationBar.controls = model.navigationBarItems;
-				_navigationBar.addBead(new HorizontalLayout());
-				UIBase(_strand).addElement(_navigationBar, false);
+				var navBar:NavigationBar = new NavigationBar();
+				navBar.controls = model.navigationBarItems;
+				navBar.addBead(new HorizontalLayout());
+				navigationBar = navBar;
+			}
+		}
+		
+		override protected function handleInitComplete(event:Event):void
+		{
+			super.handleInitComplete(event);
+			
+			if (navigationBar) {
+				UIBase(_strand).addElement(navigationBar);
 			}
 		}
 		
@@ -110,56 +110,57 @@ package org.apache.flex.mobile.beads
 		/**
 		 * @private
 		 */
-		protected function sizeChangedHandler(event:Event):void
-		{
-			layoutChromeElements();
-		}
+//		protected function sizeChangedHandler(event:Event):void
+//		{
+//			layoutChromeElements();
+//		}
 		
 		/**
 		 * @private
 		 */
 		protected function layoutChromeElements():void
 		{
-			var host:UIBase = _strand as UIBase;
-			var contentAreaY:Number = 0;
-			var contentAreaHeight:Number = host.height;
-			
-			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
-			
-			if (_navigationBar)
-			{
-				_navigationBar.x = 0;
-				_navigationBar.y = 0;
-				_navigationBar.width = host.width;
-				
-				contentAreaHeight -= _navigationBar.height;
-				contentAreaY = _navigationBar.height;
-				
-				model.navigationBar = _navigationBar;
-			}
-			
-			model.contentX = 0;
-			model.contentY = contentAreaY;
-			model.contentWidth = host.width;
-			model.contentHeight = contentAreaHeight;
-			
-			sizeViewsToFitContentArea();
+			performLayout(null);
+//			var host:UIBase = _strand as UIBase;
+//			var contentAreaY:Number = 0;
+//			var contentAreaHeight:Number = host.height;
+//			
+//			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
+//			
+//			if (_navigationBar)
+//			{
+//				_navigationBar.x = 0;
+//				_navigationBar.y = 0;
+//				_navigationBar.width = host.width;
+//				
+//				contentAreaHeight -= _navigationBar.height;
+//				contentAreaY = _navigationBar.height;
+//				
+//				model.navigationBar = _navigationBar;
+//			}
+//			
+//			model.contentX = 0;
+//			model.contentY = contentAreaY;
+//			model.contentWidth = host.width;
+//			model.contentHeight = contentAreaHeight;
+//			
+//			sizeViewsToFitContentArea();
 		}
 		
 		protected function sizeViewsToFitContentArea():void
 		{
-			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
-			
-			var n:int = ViewManagerModel(model).views.length;
-			if (n > 0) {
-				for (var i:int = 0; i < n; i++)
-				{
-					var view:IViewManagerView = ViewManagerModel(model).views[i] as IViewManagerView;
-					UIBase(view).x = model.contentX;
-					UIBase(view).y = model.contentY;
-					UIBase(view).setWidthAndHeight(model.contentWidth, model.contentHeight, true);
-				}
-			}
+//			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
+//			
+//			var n:int = ViewManagerModel(model).views.length;
+//			if (n > 0) {
+//				for (var i:int = 0; i < n; i++)
+//				{
+//					var view:IViewManagerView = ViewManagerModel(model).views[i] as IViewManagerView;
+//					UIBase(view).x = model.contentX;
+//					UIBase(view).y = model.contentY;
+//					UIBase(view).setWidthAndHeight(model.contentWidth, model.contentHeight, true);
+//				}
+//			}
 		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml b/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml
index e0f523d..ac85e14 100644
--- a/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml
@@ -23,6 +23,7 @@
     <component id="StackedViewManager" class="org.apache.flex.mobile.StackedViewManager"
/>
     <component id="TabbedViewManager" class="org.apache.flex.mobile.TabbedViewManager"
/>
     <component id="TitleView" class="org.apache.flex.mobile.TitleView" />
+    <component id="ManagedContentArea" class="org.apache.flex.mobile.ManagedContentArea"
/>
     <component id="NavigationBar" class="org.apache.flex.mobile.chrome.NavigationBar"
/>
     <component id="ToolBar" class="org.apache.flex.mobile.chrome.ToolBar" />
     <component id="TabBar" class="org.apache.flex.mobile.chrome.TabBar" />

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e0b3528a/frameworks/projects/Mobile/src/main/resources/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/src/main/resources/defaults.css b/frameworks/projects/Mobile/src/main/resources/defaults.css
index ddf9229..405a3a5 100644
--- a/frameworks/projects/Mobile/src/main/resources/defaults.css
+++ b/frameworks/projects/Mobile/src/main/resources/defaults.css
@@ -20,16 +20,29 @@
 @namespace "library://ns.apache.org/flexjs/basic";
 @namespace svg "library://ns.apache.org/flexjs/svg";
 
+NavigationBar
+{
+	IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.HorizontalFlexLayout");
+}
+
 StackedViewManager 
 {
 	IBeadModel: ClassReference("org.apache.flex.mobile.models.ViewManagerModel");
 	IBeadView:  ClassReference("org.apache.flex.mobile.beads.StackedViewManagerView");
+	IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalFlexLayout");
 }
 
 TabbedViewManager 
 {
 	IBeadModel: ClassReference("org.apache.flex.mobile.models.ViewManagerModel");
 	IBeadView:  ClassReference("org.apache.flex.mobile.beads.TabbedViewManagerView");
+	IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalFlexLayout");
+}
+
+ManagedContentArea
+{
+	display: flex;
+	flex-grow: 1;
 }
 
 ToggleSwitch
@@ -63,3 +76,11 @@ DatePicker {
 	IBeadModel: ClassReference("org.apache.flex.html.beads.models.RangeModelExtended");
 	IBeadController: ClassReference("org.apache.flex.html.beads.controllers.RangeStepperMouseController");
 }
+
+@media -flex-flash
+{
+	NavigationBar {
+		IBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead");
+		IBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead");
+	}
+}


Mime
View raw message