You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2017/04/24 20:24:47 UTC

[5/8] git commit: [flex-asjs] [refs/heads/dual] - Added new Table component and pieces.

Added new Table component and pieces.


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

Branch: refs/heads/dual
Commit: 8a00b50ecabe11c94a878d1f38dedcc37899ac2c
Parents: 5ab55c2
Author: Peter Ent <pe...@apache.org>
Authored: Fri Apr 21 15:15:47 2017 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Fri Apr 21 15:15:47 2017 -0400

----------------------------------------------------------------------
 .../projects/HTML/src/main/flex/HTMLClasses.as  |   9 +
 .../src/main/flex/org/apache/flex/html/Table.as |  67 ++++++
 .../main/flex/org/apache/flex/html/TableCell.as |  68 ++++++
 .../flex/org/apache/flex/html/TableHeader.as    |  67 ++++++
 .../main/flex/org/apache/flex/html/TableRow.as  |  69 ++++++
 .../org/apache/flex/html/beads/TableCellView.as |  54 +++++
 .../html/beads/layouts/SimpleTableLayout.as     | 213 +++++++++++++++++++
 .../flex/html/beads/layouts/TableCellLayout.as  | 120 +++++++++++
 .../html/beads/layouts/TableHeaderLayout.as     | 124 +++++++++++
 .../HTML/src/main/resources/basic-manifest.xml  |   5 +
 .../HTML/src/main/resources/defaults.css        |  34 +++
 11 files changed, 830 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
index 1b7441d..38fae24 100644
--- a/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
+++ b/frameworks/projects/HTML/src/main/flex/HTMLClasses.as
@@ -222,6 +222,15 @@ internal class HTMLClasses
 	}
 	
 	import org.apache.flex.html.SubAppLoader; SubAppLoader;
+	
+	import org.apache.flex.html.Table; Table;
+	import org.apache.flex.html.TableRow; TableRow;
+	import org.apache.flex.html.TableCell; TableCell;
+	import org.apache.flex.html.TableHeader; TableHeader;
+	import org.apache.flex.html.beads.TableCellView; TableCellView;
+	import org.apache.flex.html.beads.layouts.SimpleTableLayout; SimpleTableLayout;
+	import org.apache.flex.html.beads.layouts.TableCellLayout; TableCellLayout;
+	import org.apache.flex.html.beads.layouts.TableHeaderLayout; TableHeaderLayout;
 }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Table.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Table.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Table.as
new file mode 100644
index 0000000..2a572d4
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Table.as
@@ -0,0 +1,67 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;            
+    }
+
+	/**
+	 *  The Table class represents an HTML <table> element
+     *  
+	 *  
+     *  @toplevel
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class Table extends Group
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function Table()
+		{
+			super();
+			
+			className = "Table";
+		}
+
+        /**
+         * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+         */
+        COMPILE::JS
+        override protected function createElement():WrappedHTMLElement
+        {
+			element = document.createElement('table') as WrappedHTMLElement;
+
+            positioner = element;
+            element.flexjs_wrapper = this;
+            
+            return element;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableCell.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableCell.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableCell.as
new file mode 100644
index 0000000..863eeb7
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableCell.as
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;            
+    }
+	
+	/**
+	 *  The TableCell class defines a table data cell in the Table component. This element
+	 *  may have nearly any type of FlexJS component as children.
+     *  
+	 *  
+     *  @toplevel
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class TableCell extends Group
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function TableCell()
+		{
+			super();
+			
+			className = "TableCell";
+		}
+		
+		/**
+		 * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+		 */
+		COMPILE::JS
+		override protected function createElement():WrappedHTMLElement
+		{
+			element = document.createElement('td') as WrappedHTMLElement;
+			
+			positioner = element;
+			element.flexjs_wrapper = this;
+			
+			return element;
+		}
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableHeader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableHeader.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableHeader.as
new file mode 100644
index 0000000..9c6e043
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableHeader.as
@@ -0,0 +1,67 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;            
+    }
+	
+	/**
+	 *  The TableHeader class defines a table header cell in the Table component. 
+     *  
+	 *  
+     *  @toplevel
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class TableHeader extends TableCell
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function TableHeader()
+		{
+			super();
+			
+			className = "TableHeader";
+		}
+		
+		/**
+		 * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+		 */
+		COMPILE::JS
+		override protected function createElement():WrappedHTMLElement
+		{
+			element = document.createElement('th') as WrappedHTMLElement;
+			
+			positioner = element;
+			element.flexjs_wrapper = this;
+			
+			return element;
+		}
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableRow.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableRow.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableRow.as
new file mode 100644
index 0000000..f5bc359
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TableRow.as
@@ -0,0 +1,69 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+	import org.apache.flex.core.UIBase;
+	
+	COMPILE::JS
+	{
+		import org.apache.flex.core.WrappedHTMLElement;            
+	}
+	
+	/**
+	 *  The TableRow class defines a row of a Table. This will translate to a <tr> elemement
+     *  
+	 *  
+     *  @toplevel
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class TableRow extends Group
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function TableRow()
+		{
+			super();
+			
+			className = "TableRow";
+		}
+		
+		/**
+		 * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+		 */
+		COMPILE::JS
+		override protected function createElement():WrappedHTMLElement
+		{
+			element = document.createElement('tr') as WrappedHTMLElement;
+			
+			positioner = element;
+			element.flexjs_wrapper = this;
+			
+			return element;
+		}
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/TableCellView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/TableCellView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/TableCellView.as
new file mode 100644
index 0000000..443b4c3
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/TableCellView.as
@@ -0,0 +1,54 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.beads
+{
+    
+	
+	/**
+	 *  The TableCellView class is the view bead for TableCell. It has no function
+	 *  on the JS platform, but with SWF, it prevents the cell from shrinking
+	 *  to fit its content.
+	 *  
+	 *  @viewbead
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class TableCellView extends GroupView
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function TableCellView()
+		{
+			super();
+		}
+		
+		override public function afterLayout():void
+		{
+			// do nothing for TableCell
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/SimpleTableLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/SimpleTableLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/SimpleTableLayout.as
new file mode 100644
index 0000000..bf8b35a
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/SimpleTableLayout.as
@@ -0,0 +1,213 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.beads.layouts
+{
+	import org.apache.flex.core.LayoutBase;
+	
+	import org.apache.flex.core.IBeadLayout;
+	import org.apache.flex.core.ILayoutView;
+	import org.apache.flex.html.TableCell;
+	import org.apache.flex.html.TableRow;
+	
+	COMPILE::SWF {
+		import org.apache.flex.geom.Rectangle;
+		import org.apache.flex.utils.CSSUtils;
+		import org.apache.flex.utils.CSSContainerUtils;
+	}
+
+    /**
+     *  The SimpleTableLayout is the layout for the Table component. On the SWF platform it mimics
+	 *  the HTML <table> element and makes sure all the columns and rows are even. It does not
+	 *  support column or row spanning.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+	public class SimpleTableLayout extends LayoutBase implements IBeadLayout
+	{
+        /**
+         *  Constructor.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function SimpleTableLayout()
+		{
+			super();
+		}
+
+        /**
+         * @copy org.apache.flex.core.IBeadLayout#layout
+		 * @flexjsignorecoercion org.apache.flex.core.ILayoutHost
+		 * @flexjsignorecoercion org.apache.flex.core.UIBase
+         */
+		override public function layout():Boolean
+		{
+            COMPILE::SWF
+            {
+				var contentView:ILayoutView = layoutView;
+				
+				var n:int = contentView.numElements;
+				if (n == 0) return false;
+
+				var hostWidthSizedToContent:Boolean = host.isWidthSizedToContent();
+				var hostHeightSizedToContent:Boolean = host.isHeightSizedToContent();
+				var hostWidth:Number = hostWidthSizedToContent ? host.width : contentView.width;
+				var hostHeight:Number = hostHeightSizedToContent ? host.height : contentView.height;
+				
+				var paddingMetrics:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+				var borderMetrics:Rectangle = CSSContainerUtils.getBorderMetrics(host);
+				
+				// adjust the host's usable size by the metrics. If hostSizedToContent, then the
+				// resulting adjusted value may be less than zero.
+				hostWidth -= paddingMetrics.left + paddingMetrics.right + borderMetrics.left + borderMetrics.right;
+				hostHeight -= paddingMetrics.top + paddingMetrics.bottom + borderMetrics.top + borderMetrics.bottom;
+				
+				var numRows:int = n;
+				var numCols:int = 0;
+
+				// pass 1: figure out the number of columns (numRows is already given)
+                for (var i:int = 0; i < n; i++)
+                {
+                    var row:TableRow = contentView.getElementAt(i) as TableRow;
+					if (row == null || !row.visible) {
+						numRows -= 1;
+						continue;
+					}
+					
+					numCols = Math.max(numCols,row.numElements);
+				}
+				
+				// these defaults may change once the next pass is complete.
+				var defaultColWidth:Number = hostWidth / numCols;
+				var defaultRowHeight:Number = hostHeight / numRows;
+				
+				var remainingWidth:Number = hostWidth;
+				var remainingHeight:Number = hostHeight;
+				
+				var colWidths:Array = new Array(numCols);
+				var colActuals:Array = new Array(numCols);
+				for(j=0; j < numCols; j++) { colWidths[j] = 0; colActuals[j] = 0; }
+				
+				var rowHeights:Array = new Array(numRows);
+				for(i=0; i < numRows; i++) rowHeights[i] = 0;
+				
+				// pass2: figure out the sizes things should be
+				for(i=0; i < n; i++)
+				{
+					row = contentView.getElementAt(i) as TableRow;
+					if (row == null || !row.visible) continue;
+					
+					for(var j:int=0; j < row.numElements; j++)
+					{
+						var cell:TableCell = row.getElementAt(j) as TableCell;
+						if (cell == null || !cell.visible) continue;
+						
+						if (cell.isWidthSizedToContent()) {
+							colWidths[j] = Math.max(colWidths[j],0);
+							colActuals[j] = Math.max(colActuals[j],cell.width);
+						} else {
+							if (isNaN(cell.percentWidth)) {
+								colWidths[j] = Math.max(colWidths[j],cell.width);
+							} else {
+								colWidths[j] = Math.max(colWidths[j],(hostWidth*cell.percentWidth/100.0));
+							}
+							colActuals[j] = Math.max(colActuals[j],colWidths[j]);
+						}
+						
+						if (cell.isHeightSizedToContent()) {
+							rowHeights[i] = Math.max(rowHeights[i],0);
+						} else {
+							if (isNaN(cell.percentHeight)) {
+								rowHeights[i] = Math.max(rowHeights[i],cell.height);
+							} else {
+								rowHeights[i] = Math.max(rowHeights[i],(hostHeight*cell.percentHeight/100.0));
+							}
+						}
+					}
+                }
+				
+				var needsDefaultColWidthCount:int = 0;
+				var needsDefaultRowHeightCount:int = 0;
+				
+				// pass3: determine default sizes for cells without size
+				for(i=0; i < rowHeights.length; i++) {
+					if (!isNaN(rowHeights[i]) && rowHeights[i] > 0) remainingHeight -= rowHeights[i];
+					else needsDefaultRowHeightCount++;
+				}
+				for(j=0; j < colWidths.length; j++) {
+					if (colWidths[j] == 0) {
+						if (colActuals[j] > defaultColWidth) {
+							colWidths[j] = colActuals[j];
+							remainingWidth -= colActuals[j];
+						}
+						else {
+							needsDefaultColWidthCount++;
+						}
+					} else {
+						remainingWidth -= colWidths[j];
+					}
+				}
+				
+				defaultColWidth = remainingWidth / needsDefaultColWidthCount;
+				defaultRowHeight = remainingHeight / needsDefaultRowHeightCount;
+				
+				var ypos:Number = paddingMetrics.top + borderMetrics.top;
+				
+				// pass4: size everything
+				for(i=0; i < n; i++)
+				{
+					row = contentView.getElementAt(i) as TableRow;
+					if (row == null || !row.visible) continue;
+					
+					var xpos:Number = paddingMetrics.left + borderMetrics.left;
+					
+					for(j=0; j < row.numElements; j++)
+					{
+						cell = row.getElementAt(j) as TableCell;
+						if (cell == null || !cell.visible) continue;
+						
+						var useWidth:Number = colWidths[j] > 0 ? colWidths[j] : defaultColWidth;
+						var useHeight:Number = rowHeights[i] > 0 ? rowHeights[i] : defaultRowHeight;
+						
+						cell.x = xpos;
+						cell.y = ypos;
+						cell.setWidthAndHeight(useWidth, useHeight);
+						
+						xpos += useWidth;
+					}
+					
+					ypos += rowHeights[i] > 0 ? rowHeights[i] : defaultRowHeight;
+				}
+
+                return true;
+
+            }
+
+            COMPILE::JS
+            {
+                return true;
+            }
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TableCellLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TableCellLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TableCellLayout.as
new file mode 100644
index 0000000..0dd9dc4
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TableCellLayout.as
@@ -0,0 +1,120 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.beads.layouts
+{
+	import org.apache.flex.core.LayoutBase;
+	
+	import org.apache.flex.core.IBeadLayout;
+	import org.apache.flex.core.ILayoutChild;
+	import org.apache.flex.core.ILayoutView;
+	import org.apache.flex.html.TableCell;
+	import org.apache.flex.html.TableRow;
+	
+	COMPILE::SWF {
+		import org.apache.flex.geom.Rectangle;
+		import org.apache.flex.utils.CSSUtils;
+		import org.apache.flex.utils.CSSContainerUtils;
+	}
+
+    /**
+     *  The TableCellLayout is the default layout for TableCell items. It places the cell's contents
+	 *  vertically centered within the cell.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+	public class TableCellLayout extends HorizontalLayout implements IBeadLayout
+	{
+        /**
+         *  Constructor.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function TableCellLayout()
+		{
+			super();
+		}
+
+        /**
+         * @copy org.apache.flex.core.IBeadLayout#layout
+		 * @flexjsignorecoercion org.apache.flex.core.ILayoutHost
+		 * @flexjsignorecoercion org.apache.flex.core.UIBase
+         */
+		override public function layout():Boolean
+		{
+            COMPILE::SWF
+            {
+				if (!super.layout()) return false;
+				
+				var contentView:ILayoutView = layoutView;
+				var n:int = contentView.numElements;
+				if (n == 0) return false;
+				
+				// find the overall size and position in the centervar contentView:ILayoutView = layoutView;
+				
+				var hostWidthSizedToContent:Boolean = host.isWidthSizedToContent();
+				var hostHeightSizedToContent:Boolean = host.isHeightSizedToContent();
+				var hostWidth:Number = hostWidthSizedToContent ? host.width : contentView.width;
+				var hostHeight:Number = hostHeightSizedToContent ? host.height : contentView.height;
+				
+				var paddingMetrics:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+				var borderMetrics:Rectangle = CSSContainerUtils.getBorderMetrics(host);
+				
+				// adjust the host's usable size by the metrics. If hostSizedToContent, then the
+				// resulting adjusted value may be less than zero.
+				hostWidth -= paddingMetrics.left + paddingMetrics.right + borderMetrics.left + borderMetrics.right;
+				hostHeight -= paddingMetrics.top + paddingMetrics.bottom + borderMetrics.top + borderMetrics.bottom;
+				
+				var totalHeight:Number = 0;
+				
+				for(var i:int=0; i < n; i++)
+				{
+					var child:ILayoutChild = contentView.getElementAt(i) as ILayoutChild;
+					if (child == null || !child.visible) continue;
+					var positions:Object = childPositions(child);
+					var margins:Object = childMargins(child, hostWidth, hostHeight);
+					
+					totalHeight += margins.top + child.height + margins.bottom;
+				}
+				
+				var shiftBy:Number = (hostHeight - totalHeight)/2;
+				
+				for(i=0; i < n; i++)
+				{
+					child = contentView.getElementAt(i) as ILayoutChild;
+					if (child == null || !child.visible) continue;
+					child.y += shiftBy;
+				}
+
+                return true;
+
+            }
+
+            COMPILE::JS
+            {
+                return true;
+            }
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TableHeaderLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TableHeaderLayout.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TableHeaderLayout.as
new file mode 100644
index 0000000..a955c83
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/layouts/TableHeaderLayout.as
@@ -0,0 +1,124 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.beads.layouts
+{
+	import org.apache.flex.core.LayoutBase;
+	
+	import org.apache.flex.core.IBeadLayout;
+	import org.apache.flex.core.ILayoutChild;
+	import org.apache.flex.core.ILayoutView;
+	import org.apache.flex.html.TableCell;
+	import org.apache.flex.html.TableRow;
+	
+	COMPILE::SWF {
+		import org.apache.flex.geom.Rectangle;
+		import org.apache.flex.utils.CSSUtils;
+		import org.apache.flex.utils.CSSContainerUtils;
+	}
+
+    /**
+     *  The TableHeaderLayout is the default layout for TableHeader items. It places the cell's contents
+	 *  vertically and horizontally centered within the cell.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+	public class TableHeaderLayout extends HorizontalLayout implements IBeadLayout
+	{
+        /**
+         *  Constructor.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function TableHeaderLayout()
+		{
+			super();
+		}
+
+        /**
+         * @copy org.apache.flex.core.IBeadLayout#layout
+		 * @flexjsignorecoercion org.apache.flex.core.ILayoutHost
+		 * @flexjsignorecoercion org.apache.flex.core.UIBase
+         */
+		override public function layout():Boolean
+		{
+            COMPILE::SWF
+            {
+				if (!super.layout()) return false;
+				
+				var contentView:ILayoutView = layoutView;
+				var n:int = contentView.numElements;
+				if (n == 0) return false;
+				
+				// find the overall size and position in the centervar contentView:ILayoutView = layoutView;
+				
+				var hostWidthSizedToContent:Boolean = host.isWidthSizedToContent();
+				var hostHeightSizedToContent:Boolean = host.isHeightSizedToContent();
+				var hostWidth:Number = hostWidthSizedToContent ? host.width : contentView.width;
+				var hostHeight:Number = hostHeightSizedToContent ? host.height : contentView.height;
+				
+				var paddingMetrics:Rectangle = CSSContainerUtils.getPaddingMetrics(host);
+				var borderMetrics:Rectangle = CSSContainerUtils.getBorderMetrics(host);
+				
+				// adjust the host's usable size by the metrics. If hostSizedToContent, then the
+				// resulting adjusted value may be less than zero.
+				hostWidth -= paddingMetrics.left + paddingMetrics.right + borderMetrics.left + borderMetrics.right;
+				hostHeight -= paddingMetrics.top + paddingMetrics.bottom + borderMetrics.top + borderMetrics.bottom;
+				
+				var totalHeight:Number = 0;
+				var totalWidth:Number = 0;
+				
+				for(var i:int=0; i < n; i++)
+				{
+					var child:ILayoutChild = contentView.getElementAt(i) as ILayoutChild;
+					if (child == null || !child.visible) continue;
+					var positions:Object = childPositions(child);
+					var margins:Object = childMargins(child, hostWidth, hostHeight);
+					
+					totalHeight += margins.top + child.height + margins.bottom;
+					totalWidth += margins.left + child.width + margins.right;
+				}
+				
+				var shiftYBy:Number = (hostHeight - totalHeight)/2;
+				var shiftXBy:Number = (hostWidth - totalWidth)/2;
+				
+				for(i=0; i < n; i++)
+				{
+					child = contentView.getElementAt(i) as ILayoutChild;
+					if (child == null || !child.visible) continue;
+					child.x += shiftXBy;
+					child.y += shiftYBy;
+				}
+
+                return true;
+
+            }
+
+            COMPILE::JS
+            {
+                return true;
+            }
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
index 4778ae8..b677d55 100644
--- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
@@ -174,5 +174,10 @@
 
     <component id="InnerHTML" class="org.apache.flex.html.beads.InnerHTML" />
     <component id="TextNode" class="org.apache.flex.html.TextNode" />
+    
+    <component id="Table" class="org.apache.flex.html.Table"/>
+    <component id="TableRow" class="org.apache.flex.html.TableRow"/>
+    <component id="TableCell" class="org.apache.flex.html.TableCell"/>
+    <component id="TableHeader" class="org.apache.flex.html.TableHeader"/>
 
 </componentPackage>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a00b50e/frameworks/projects/HTML/src/main/resources/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/resources/defaults.css b/frameworks/projects/HTML/src/main/resources/defaults.css
index ffd48e2..43f352b 100644
--- a/frameworks/projects/HTML/src/main/resources/defaults.css
+++ b/frameworks/projects/HTML/src/main/resources/defaults.css
@@ -451,6 +451,22 @@ AccordionItemRenderer
 	flex-grow: 1;
 }
 
+Table
+{
+	IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.SimpleTableLayout");
+}
+
+TableHeader
+{
+	font-weight: bold;
+	border: 1px solid #999999;
+}
+
+TableCell
+{
+	border: 1px solid #999999;
+}
+
 TreeItemRenderer
 {
 	IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController");
@@ -791,6 +807,24 @@ global
 		IBeadController: ClassReference("org.apache.flex.html.beads.controllers.SpinnerMouseController");
 	}
 	
+	Table
+	{
+		IBorderBead: ClassReference("org.apache.flex.html.beads.SingleLineBorderBead");
+		IBackgroundBead: ClassReference("org.apache.flex.html.beads.SolidBackgroundBead");
+	}
+	
+	TableCell
+	{
+		IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.TableCellLayout");
+		IBeadView: ClassReference("org.apache.flex.html.beads.TableCellView");
+	}
+	
+	TableHeader
+	{
+		IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.TableHeaderLayout");
+		IBeadView: ClassReference("org.apache.flex.html.beads.TableCellView");
+	}
+	
 	TextArea
 	{
 		IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel");