Updates to Mobile project. Getting closer.

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

Branch: refs/heads/dual
Commit: e3cbf4fc916a57ad99cd14527ae67168fd702271
Parents: fd5eaae
Author: Peter Ent <[email protected]>
Authored: Fri Apr 14 16:20:30 2017 -0400
Committer: Peter Ent <[email protected]>
Committed: Fri Apr 14 16:20:30 2017 -0400

----------------------------------------------------------------------
 .../html/beads/layouts/HorizontalFlexLayout.as  |  1 +
 .../html/beads/layouts/VerticalFlexLayout.as    |  1 +
 .../Mobile/src/main/flex/MobileClasses.as       |  1 -
 .../apache/flex/mobile/ManagedContentArea.as    | 55 --------------------
 .../flex/mobile/beads/StackedViewManagerView.as | 40 ++++----------
 .../flex/mobile/beads/TabbedViewManagerView.as  | 41 ++++-----------
 .../src/main/resources/basic-manifest.xml       |  1 -
 .../Mobile/src/main/resources/defaults.css      |  7 ---
 8 files changed, 21 insertions(+), 126 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e3cbf4fc/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalFlexLayout.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalFlexLayout.as
 
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalFlexLayout.as
index cad6827..6fb927d 100644
--- 
a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalFlexLayout.as
+++ 
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/HorizontalFlexLayout.as
@@ -255,6 +255,7 @@ package org.apache.flex.html.beads.layouts
                                        var child:UIBase = 
contentView.getElementAt(i) as UIBase;
                                        if (grow >= 0) 
child.element.style["flex-grow"] = String(grow);
                                        if (shrink >= 0) 
child.element.style["flex-shrink"] = String(shrink);
+                                       child.dispatchEvent(new 
Event("layoutNeeded"));
                                }
 
                                return true;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e3cbf4fc/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalFlexLayout.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalFlexLayout.as
 
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalFlexLayout.as
index f495acc..c543425 100644
--- 
a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalFlexLayout.as
+++ 
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/VerticalFlexLayout.as
@@ -251,6 +251,7 @@ package org.apache.flex.html.beads.layouts
                                        var child:UIBase = 
contentView.getElementAt(i) as UIBase;
                                        if (grow >= 0) 
child.element.style["flex-grow"] = String(grow);
                                        if (shrink >= 0) 
child.element.style["flex-shrink"] = String(shrink);
+                                       child.dispatchEvent(new 
Event("layoutNeeded"));
                                }
 
                                return true;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e3cbf4fc/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 ea74217..7c650fd 100644
--- a/frameworks/projects/Mobile/src/main/flex/MobileClasses.as
+++ b/frameworks/projects/Mobile/src/main/flex/MobileClasses.as
@@ -33,7 +33,6 @@ 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/e3cbf4fc/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
deleted file mode 100644
index 16081e5..0000000
--- 
a/frameworks/projects/Mobile/src/main/flex/org/apache/flex/mobile/ManagedContentArea.as
+++ /dev/null
@@ -1,55 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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/e3cbf4fc/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 2e4e009..a500c12 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
@@ -22,13 +22,13 @@ package org.apache.flex.mobile.beads
        import org.apache.flex.core.IStrand;
        import org.apache.flex.core.IViewportModel;
        import org.apache.flex.core.UIBase;
+       import org.apache.flex.core.SimpleCSSStyles;
        import org.apache.flex.events.IEventDispatcher;
        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.IViewManager;
        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;
@@ -63,13 +63,6 @@ package org.apache.flex.mobile.beads
                 * Children
                 */
                
-               private var _contentArea:ManagedContentArea;
-               
-               public function get contentArea():ManagedContentArea
-               {
-                       return _contentArea;
-               }
-               
                public function get toolBar():ToolBar
                {
                        var model:ViewManagerModel = 
strand.getBeadByType(IBeadModel) as ViewManagerModel;
@@ -94,9 +87,6 @@ package org.apache.flex.mobile.beads
                        _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)
@@ -116,11 +106,6 @@ package org.apache.flex.mobile.beads
                        IEventDispatcher(model).addEventListener("viewPushed", 
handlePushEvent);
                        IEventDispatcher(model).addEventListener("viewPopped", 
handlePopEvent);
                        
-                       COMPILE::SWF {
-                               _contentArea.percentWidth = 100;
-                       }
-                       UIBase(_strand).addElement(_contentArea);
-                       
                        if (toolBar) {
                                UIBase(_strand).addElement(toolBar);
                        }
@@ -164,11 +149,11 @@ package org.apache.flex.mobile.beads
                        var model:ViewManagerModel = 
_strand.getBeadByType(IBeadModel) as ViewManagerModel;
                        
                        if (_topView != null) {
-                               contentArea.removeElement(_topView);
+                               UIBase(_strand).removeElement(_topView);
                        }
                        _topView = model.views[index] as IViewManagerView;
                        _topView.viewManager = _strand as IViewManager;
-                       contentArea.addElement(_topView);
+                       UIBase(_strand).addElementAt(_topView,1);
                        
                        COMPILE::JS {
                                if (_topView) {
@@ -176,22 +161,15 @@ package org.apache.flex.mobile.beads
                                }
                        }
                        COMPILE::SWF {
+                               if (UIBase(_topView).style == null) {
+                                       UIBase(_topView).style = new 
SimpleCSSStyles();
+                               }
+                               UIBase(_topView).style.flexGrow = 1;
                                UIBase(_topView).percentWidth = 100;
-                               UIBase(_topView).percentHeight = 100;
-                               contentArea.layoutNeeded();
                        }
-               }
-               
-               override public function afterLayout():void
-               {
-                       super.afterLayout();
                        
-                       COMPILE::SWF {
-                               if (_topView) {
-                                       UIBase(_topView).width = 
contentArea.width;
-                                       UIBase(_topView).height = 
contentArea.height;
-                               }
-                       }
+                       // Now that a view has changed, refresh the layout for 
this component.
+                       UIBase(_strand).dispatchEvent(new 
Event("layoutNeeded"));
                }
        }
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e3cbf4fc/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 7959da0..4ee3a5a 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
@@ -22,13 +22,13 @@ package org.apache.flex.mobile.beads
        import org.apache.flex.core.IStrand;
        import org.apache.flex.core.IViewportModel;
        import org.apache.flex.core.UIBase;
+       import org.apache.flex.core.SimpleCSSStyles;
        import org.apache.flex.events.IEventDispatcher;
        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.IViewManager;
        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;
@@ -64,8 +64,6 @@ package org.apache.flex.mobile.beads
                 * Children
                 */
                
-               private var _contentArea:ManagedContentArea;
-               
                public function get tabBar():TabBar
                {
                        var model:ViewManagerModel = 
strand.getBeadByType(IBeadModel) as ViewManagerModel;
@@ -77,11 +75,6 @@ package org.apache.flex.mobile.beads
                        model.tabBar = value;
                }
                
-               public function get contentArea():ManagedContentArea
-               {
-                       return _contentArea;
-               }
-               
                /*
                 * ViewBead
                 */
@@ -95,9 +88,6 @@ package org.apache.flex.mobile.beads
                        _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
@@ -112,11 +102,6 @@ package org.apache.flex.mobile.beads
                {                       
                        super.handleInitComplete(event);
                        
-                       COMPILE::SWF {
-                               _contentArea.percentWidth = 100;
-                       }
-                       UIBase(_strand).addElement(_contentArea);
-                       
                        if (tabBar) {
                                UIBase(_strand).addElement(tabBar);
                        }
@@ -131,34 +116,28 @@ package org.apache.flex.mobile.beads
                        var model:ViewManagerModel = 
_strand.getBeadByType(IBeadModel) as ViewManagerModel;
                        
                        if (_currentView != null) {
-                               contentArea.removeElement(_currentView);
+                               UIBase(_strand).removeElement(_currentView);
                        }
                        _currentView = model.views[index] as IViewManagerView;
                        _currentView.viewManager = _strand as IViewManager;
-                       contentArea.addElement(_currentView);
+                       UIBase(_strand).addElementAt(_currentView,1);
                        
                        COMPILE::JS {
                                if (_currentView) {
                                        
UIBase(_currentView).element.style["flex-grow"] = "1";
                                }
+                               UIBase(_strand).dispatchEvent(new 
Event("layoutNeeded"));
                        }
                        COMPILE::SWF {
+                               if (UIBase(_currentView).style == null) {
+                                       UIBase(_currentView).style = new 
SimpleCSSStyles();
+                               }
+                               UIBase(_currentView).style.flexGrow = 1;
                                UIBase(_currentView).percentWidth = 100;
-                               UIBase(_currentView).percentHeight = 100;
-                               contentArea.layoutNeeded();
                        }
-               }
-               
-               override public function afterLayout():void
-               {
-                       super.afterLayout();
                        
-                       COMPILE::SWF {
-                               if (_currentView) {
-                                       UIBase(_currentView).width = 
contentArea.width;
-                                       UIBase(_currentView).height = 
contentArea.height;
-                               }
-                       }
+                       // Now that the view has changed, refresh the layout on 
this component.
+                       UIBase(_strand).dispatchEvent(new 
Event("layoutNeeded"));
                }
                
                /**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e3cbf4fc/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 ac85e14..e0f523d 100644
--- a/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Mobile/src/main/resources/basic-manifest.xml
@@ -23,7 +23,6 @@
     <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/e3cbf4fc/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 f360d5c..569904e 100644
--- a/frameworks/projects/Mobile/src/main/resources/defaults.css
+++ b/frameworks/projects/Mobile/src/main/resources/defaults.css
@@ -42,13 +42,6 @@ TabbedViewManager
        IBeadLayout: 
ClassReference("org.apache.flex.html.beads.layouts.VerticalFlexLayout");
 }
 
-ManagedContentArea
-{
-       display: flex;
-       flex-grow: 1;
-       IBeadLayout: 
ClassReference("org.apache.flex.html.beads.layouts.BasicLayout");
-}
-
 TabBar {
        flex-grow: 0;
        height: 40px;

Reply via email to