TileLayout update. Removed unused classes.

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

Branch: refs/heads/dual
Commit: 02d4118f0be875a38eaa52dfdce76bff25fee6a5
Parents: d7fb6b1
Author: Peter Ent <p...@apache.org>
Authored: Fri Apr 7 14:30:12 2017 -0400
Committer: Peter Ent <p...@apache.org>
Committed: Fri Apr 7 14:30:12 2017 -0400

----------------------------------------------------------------------
 .../flex/html/beads/layouts/TileLayout.as       |  21 +++-
 .../flex/html/supportClasses/DataContentBead.as | 124 -------------------
 .../html/supportClasses/GroupContentProxy.as    |  91 --------------
 3 files changed, 17 insertions(+), 219 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02d4118f/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
 
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
index eb4b3c9..4ff6565 100644
--- 
a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
+++ 
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TileLayout.as
@@ -30,6 +30,9 @@ package org.apache.flex.html.beads.layouts
        import org.apache.flex.core.UIBase;
        import org.apache.flex.events.Event;
        import org.apache.flex.events.IEventDispatcher;
+       import org.apache.flex.geom.Rectangle;
+       import org.apache.flex.utils.CSSUtils;
+       import org.apache.flex.utils.CSSContainerUtils;
 
        /**
         *  The TileLayout class bead sizes and positions the elements it 
manages into rows and columns.
@@ -121,6 +124,9 @@ package org.apache.flex.html.beads.layouts
          */
                override public function layout():Boolean
                {
+                       var paddingMetrics:Rectangle = 
CSSContainerUtils.getPaddingMetrics(host);
+                       var borderMetrics:Rectangle = 
CSSContainerUtils.getBorderMetrics(host);
+                       
                        COMPILE::SWF
                        {
                                var area:UIBase = layoutView as UIBase;
@@ -131,6 +137,9 @@ package org.apache.flex.html.beads.layouts
                                var useHeight:Number = rowHeight;
                                var n:Number = area.numElements;
                                if (n == 0) return false;
+                               
+                               var adjustedWidth:Number = 
Math.floor(host.width - borderMetrics.left - borderMetrics.right);
+                               var adjustedHeight:Number = 
Math.floor(host.height - borderMetrics.top - borderMetrics.bottom);
 
                                var realN:Number = n;
                                for(var j:int=0; j < n; j++)
@@ -139,12 +148,12 @@ package org.apache.flex.html.beads.layouts
                                        if (testChild == null || 
!testChild.visible) realN--;
                                }
 
-                               if (isNaN(useWidth)) useWidth = 
Math.floor(host.width / numColumns); // + gap
+                               if (isNaN(useWidth)) useWidth = 
Math.floor(adjustedWidth / numColumns); // + gap
                                if (isNaN(useHeight)) {
                                        // given the width and total number of 
items, how many rows?
                                        var numRows:Number = 
Math.floor(realN/numColumns);
                                        if (host.isHeightSizedToContent) 
useHeight = 30; // default height
-                                       else useHeight = Math.floor(host.height 
/ numRows);
+                                       else useHeight = 
Math.floor(adjustedHeight / numRows);
                                }
 
                                var maxWidth:Number = useWidth;
@@ -190,6 +199,8 @@ package org.apache.flex.html.beads.layouts
                                var ypos:Number;
                                var useWidth:Number;
                                var useHeight:Number;
+                               var adjustedWidth:Number = 
Math.floor(host.width - borderMetrics.left - borderMetrics.right);
+                               var adjustedHeight:Number = 
Math.floor(host.height - borderMetrics.top - borderMetrics.bottom);
 
                                var contentView:IParentIUIBase = layoutView as 
IParentIUIBase;
                                
@@ -212,12 +223,14 @@ package org.apache.flex.html.beads.layouts
                                useWidth = columnWidth;
                                useHeight = rowHeight;
 
-                               if (isNaN(useWidth)) useWidth = 
Math.floor(host.width / numColumns); // + gap
+                               if (isNaN(useWidth)) {
+                                       useWidth = Math.floor(adjustedWidth / 
numColumns); // + gap
+                               }
                                if (isNaN(useHeight)) {
                                        // given the width and total number of 
items, how many rows?
                                        var numRows:Number = Math.floor(realN / 
numColumns);
                                        if (host.isHeightSizedToContent) 
useHeight = 30; // default height
-                                       else useHeight = Math.floor(host.height 
/ numRows);
+                                       else useHeight = 
Math.floor(adjustedHeight / numRows);
                                }
 
                                for (i = 0; i < n; i++)

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02d4118f/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataContentBead.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataContentBead.as
 
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataContentBead.as
deleted file mode 100644
index 72db824..0000000
--- 
a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/DataContentBead.as
+++ /dev/null
@@ -1,124 +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.html.supportClasses
-{      
-       import org.apache.flex.core.IBead;
-       
-    import org.apache.flex.core.IChild;
-    import org.apache.flex.core.IContentView;
-    import org.apache.flex.core.IItemRenderer;
-    import org.apache.flex.core.IItemRendererParent;
-       import org.apache.flex.core.IRollOverModel;
-       import org.apache.flex.core.ISelectionModel;
-       import org.apache.flex.core.IStrand;
-    import org.apache.flex.core.UIBase;
-       import org.apache.flex.events.IEventDispatcher;
-       import org.apache.flex.events.Event;
-       import org.apache.flex.events.ItemAddedEvent;
-       import org.apache.flex.events.ItemClickedEvent;
-       import org.apache.flex.events.ItemRemovedEvent;
-
-    /**
-     *  The DataGroup class is the IItemRendererParent used internally
-     *  by org.apache.flex.html.List class.
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion FlexJS 0.0
-     */
-       public class DataContent implements IBead
-       {
-        /**
-         *  Constructor.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-               public function DataContent()
-               {
-                       super();
-               }
-               
-               /**
-                * @private
-                */
-               override public function addElement(c:IChild, 
dispatchEvent:Boolean = true):void
-               {
-                       super.addElement(c, dispatchEvent);
-                       
-                       var newEvent:ItemAddedEvent = new 
ItemAddedEvent("itemAdded");
-                       newEvent.item = c;
-                       
-                       var strand:IEventDispatcher = parent as 
IEventDispatcher;
-                       strand.dispatchEvent(newEvent);
-               }
-               
-               /**
-                * @private
-                */
-               override public function removeElement(c:IChild, 
dispatchEvent:Boolean = true):void
-               {       
-                       super.removeElement(c, dispatchEvent);
-                       
-                       var newEvent:ItemRemovedEvent = new 
ItemRemovedEvent("itemRemoved");
-                       newEvent.item = c;
-                       
-                       var strand:IEventDispatcher = parent as 
IEventDispatcher;
-                       strand.dispatchEvent(newEvent);
-               }
-
-        /**
-         *  @copy 
org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        public function getItemRendererForIndex(index:int):IItemRenderer
-        {
-                       if (index < 0 || index >= numElements) return null;
-            return getElementAt(index) as IItemRenderer;
-        }
-               
-               /**
-                *  Refreshes the itemRenderers. Useful after a size change by 
the data group.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-                */
-               public function updateAllItemRenderers():void
-               {
-                       var n:Number = numElements;
-                       for (var i:Number = 0; i < n; i++)
-                       {
-                               var renderer:DataItemRenderer = 
getItemRendererForIndex(i) as DataItemRenderer;
-                               if (renderer) {
-                                       renderer.setWidth(this.width,true);
-                                       renderer.adjustSize();
-                               }
-                       }
-               }
-       }
-}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/02d4118f/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/GroupContentProxy.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/GroupContentProxy.as
 
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/GroupContentProxy.as
deleted file mode 100644
index 6212ba1..0000000
--- 
a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/GroupContentProxy.as
+++ /dev/null
@@ -1,91 +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.html.supportClasses
-{
-       import org.apache.flex.core.IContentProxy;
-       import org.apache.flex.core.UIBase;
-       import org.apache.flex.core.IChild;
-       
-       COMPILE::JS {
-               import org.apache.flex.core.WrappedHTMLElement;
-       }
-       
-    /**
-     *  The ContainerContentArea class implements the contentView for
-     *  a Container on the SWF platform.
-     *  
-     *  @langversion 3.0
-     *  @playerversion Flash 10.2
-     *  @playerversion AIR 2.6
-     *  @productversion FlexJS 0.0
-     */
-       public class GroupContentProxy implements IContentProxy
-       {
-        /**
-         *  Constructor.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-               public function GroupContentProxy(host:Object)
-               {
-                       super();
-                       _host = host;
-               }
-               
-               private var _host:Object;
-               
-               public function set host(value:Object):void
-               {
-                       _host = value;
-               }
-               public function get host():Object
-               {
-                       return _host;
-               }
-               
-               public function get numElements():Number
-               {
-                       return (host as UIBase).numElements;
-               }
-               
-               public function getElementAt(index):IChild
-               {
-                       return (host as UIBase).getElementAt(index);
-               }
-               
-               public function get width():Number
-               {
-                       return (host as UIBase).width;
-               }
-               
-               public function get height():Number
-               {
-                       return (host as UIBase).height;
-               }
-               
-               COMPILE::JS
-               public function get element():WrappedHTMLElement
-               {
-                       return (host as UIBase).element;
-               }
-       }
-}

Reply via email to