You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by pe...@apache.org on 2017/12/12 16:14:54 UTC

[royale-asjs] branch develop updated: Added initial version of TreeGrid, a Tree+DataGrid hybrid component. Modified TreeExample to demonstrate TreeGrid.

This is an automated email from the ASF dual-hosted git repository.

pent pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new a7f90b3  Added initial version of TreeGrid, a Tree+DataGrid hybrid component. Modified TreeExample to demonstrate TreeGrid.
a7f90b3 is described below

commit a7f90b32f59bd7ef178b55d7fe65b208ebacd0cb
Author: Peter Ent <pe...@apache.org>
AuthorDate: Tue Dec 12 11:15:28 2017 -0500

    Added initial version of TreeGrid, a Tree+DataGrid hybrid component. Modified TreeExample to demonstrate TreeGrid.
---
 .../TreeExample/src/main/royale/MyInitialView.mxml |  26 ++-
 .../TreeExample/src/main/royale/models/MyModel.as  |  19 +-
 .../Basic/src/main/resources/basic-manifest.xml    |   3 +
 .../projects/Basic/src/main/resources/defaults.css |  11 +
 .../projects/Basic/src/main/royale/BasicClasses.as |   7 +
 .../main/royale/org/apache/royale/html/TreeGrid.as |  86 ++++++++
 .../org/apache/royale/html/beads/TreeGridView.as   | 244 +++++++++++++++++++++
 .../royale/html/beads/layouts/TreeGridLayout.as    | 152 +++++++++++++
 .../royale/html/beads/models/TreeGridModel.as      |  99 +++++++++
 .../royale/html/supportClasses/TreeGridColumn.as   |  44 ++++
 .../supportClasses/TreeGridControlItemRenderer.as  | 107 +++++++++
 11 files changed, 796 insertions(+), 2 deletions(-)

diff --git a/examples/royale/TreeExample/src/main/royale/MyInitialView.mxml b/examples/royale/TreeExample/src/main/royale/MyInitialView.mxml
index aa6f0c0..65ee26a 100644
--- a/examples/royale/TreeExample/src/main/royale/MyInitialView.mxml
+++ b/examples/royale/TreeExample/src/main/royale/MyInitialView.mxml
@@ -19,6 +19,16 @@ limitations under the License.
 -->
 <js:View xmlns:fx="http://ns.adobe.com/mxml/2009"
 				xmlns:js="library://ns.apache.org/royale/basic">
+	
+	<fx:Style>
+		@namespace js "library://ns.apache.org/royale/basic";
+		
+	</fx:Style>
+	
+	<fx:Script>
+		<![CDATA[
+		]]>
+	</fx:Script>
     
     <js:beads>
         <js:ViewDataBinding />
@@ -29,9 +39,23 @@ limitations under the License.
 		<js:beads>
 			<js:ConstantBinding
 				sourceID="applicationModel"
-				sourcePropertyName="treeData"
+				sourcePropertyName="gridData"
 				destinationPropertyName="dataProvider" />
 		</js:beads>
 	</js:Tree>
+	
+	<js:TreeGrid id="treeGrid" x="450" y="30" width="400" height="300">
+		<js:beads>
+			<js:ConstantBinding
+				sourceID="applicationModel"
+				sourcePropertyName="gridData"
+				destinationPropertyName="dataProvider" />
+		</js:beads>
+		<js:columns>
+			<js:TreeGridColumn dataField="title" label="Title" columnWidth="200" />
+			<js:TreeGridColumn dataField="status" label="Status" columnWidth="125" />
+			<js:TreeGridColumn dataField="hours" label="Hours" columnWidth="75" />
+		</js:columns>
+	</js:TreeGrid>
 
 </js:View>
diff --git a/examples/royale/TreeExample/src/main/royale/models/MyModel.as b/examples/royale/TreeExample/src/main/royale/models/MyModel.as
index 7d80cd5..c23b394 100644
--- a/examples/royale/TreeExample/src/main/royale/models/MyModel.as
+++ b/examples/royale/TreeExample/src/main/royale/models/MyModel.as
@@ -18,9 +18,9 @@
 ////////////////////////////////////////////////////////////////////////////////
 package models
 {
+	import org.apache.royale.collections.HierarchicalData;
 	import org.apache.royale.events.Event;
 	import org.apache.royale.events.EventDispatcher;
-	import org.apache.royale.collections.HierarchicalData;
 
 	public class MyModel extends EventDispatcher
 	{
@@ -28,6 +28,9 @@ package models
 		{
 			treeData = new HierarchicalData(store);
 			treeData.childrenField = "children";
+			
+			gridData = new HierarchicalData(process);
+			gridData.childrenField = "children";
 		}
 
 		public var treeData:HierarchicalData;
@@ -67,6 +70,20 @@ package models
         						]}
         				]}
         		]};
+		
+		public var gridData:HierarchicalData;
+		
+		private var process:Object = {title:"Projects",
+									  children:[
+										  {title:"Layout Branch", status:"in progress", hours:120, children:[
+											  {title:"Accordion", status:"finalized", hours:42},
+											  {title:"Multiview", status:"finalized", hours:34}
+										  ]},
+										  {title:"Data branch", status:"in progress", hours:150, children:[
+											  {title:"List", status:"finalized", hours:50}
+										  ]},
+										  {title:"Calendar", status:"planning", hours:0}
+									  ]};
 
 	}
 }
diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index 4e5b9ad..7b1f06d 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -185,5 +185,8 @@
 
     <component id="UIModule" class="org.apache.royale.html.UIModule"/>
     <component id="UIModuleLoader" class="org.apache.royale.html.UIModuleLoader"/>
+    
+    <component id="TreeGrid" class="org.apache.royale.html.TreeGrid" />
+    <component id="TreeGridColumn" class="org.apache.royale.html.supportClasses.TreeGridColumn" />
 
 </componentPackage>
diff --git a/frameworks/projects/Basic/src/main/resources/defaults.css b/frameworks/projects/Basic/src/main/resources/defaults.css
index 13f8930..8f87548 100644
--- a/frameworks/projects/Basic/src/main/resources/defaults.css
+++ b/frameworks/projects/Basic/src/main/resources/defaults.css
@@ -416,6 +416,17 @@ Tree
 	border-color: #222222;
 }
 
+TreeGrid
+{
+	IBeadModel: ClassReference("org.apache.royale.html.beads.models.TreeGridModel");
+	IBeadView: ClassReference("org.apache.royale.html.beads.TreeGridView");
+	IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.TreeGridLayout");
+}
+
+.TreeGridContentArea .List {
+	display: inline-block;
+}
+
 NumericStepper
 {
 	IBeadModel: ClassReference("org.apache.royale.html.beads.models.RangeModel");
diff --git a/frameworks/projects/Basic/src/main/royale/BasicClasses.as b/frameworks/projects/Basic/src/main/royale/BasicClasses.as
index 39c2538..2bad00e 100644
--- a/frameworks/projects/Basic/src/main/royale/BasicClasses.as
+++ b/frameworks/projects/Basic/src/main/royale/BasicClasses.as
@@ -253,6 +253,13 @@ internal class BasicClasses
 		import org.apache.royale.css2.DragMove; DragMove;
 		import org.apache.royale.css2.DragReject; DragReject;
     }
+	
+	import org.apache.royale.html.TreeGrid; TreeGrid;
+	import org.apache.royale.html.supportClasses.TreeGridColumn; TreeGridColumn;
+	import org.apache.royale.html.supportClasses.TreeGridControlItemRenderer; TreeGridControlItemRenderer;
+	import org.apache.royale.html.beads.models.TreeGridModel; TreeGridModel;
+	import org.apache.royale.html.beads.layouts.TreeGridLayout; TreeGridLayout;
+	import org.apache.royale.html.beads.TreeGridView; TreeGridView;
 }
 
 }
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/TreeGrid.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/TreeGrid.as
new file mode 100644
index 0000000..eb02629
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/TreeGrid.as
@@ -0,0 +1,86 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.html
+{
+	import org.apache.royale.core.UIBase;
+	import org.apache.royale.html.beads.models.TreeGridModel;
+	
+	/**
+	 * A TreeGrid is a combination of a Tree and a DataGrid. The first column of the
+	 * TreeGrid is a Tree; the remaining columns are Lists. Each column of the TreeGrid
+	 * is defined by the TreeGridColumn, which names the data field within each datum 
+	 * to be displayed. The dataProvider should be a HierarchicalData object with
+	 * "children" properties to build the tree.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+	public class TreeGrid extends UIBase
+	{
+		/**
+		 * Constructor.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function TreeGrid()
+		{
+			super();
+		}
+		
+		/**
+		 * The dataProvider should be of type HierarchicalData.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 *  @see org.apache.royale.collections.HierarchicalData.
+		 */
+		public function get dataProvider():Object
+		{
+			return (model as TreeGridModel).dataProvider;
+		}
+		public function set dataProvider(value:Object):void
+		{
+			(model as TreeGridModel).dataProvider = value;
+		}
+		
+		/**
+		 * The TreeGridColumns that define each column displayed.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function get columns():Array
+		{
+			return (model as TreeGridModel).columns;
+		}
+		public function set columns(value:Array):void
+		{
+			(model as TreeGridModel).columns = value;
+		}
+	}
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TreeGridView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TreeGridView.as
new file mode 100644
index 0000000..908ee4e
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TreeGridView.as
@@ -0,0 +1,244 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.html.beads
+{
+	import org.apache.royale.collections.ArrayList;
+	import org.apache.royale.core.IBeadLayout;
+	import org.apache.royale.core.IBeadModel;
+	import org.apache.royale.core.IBeadView;
+	import org.apache.royale.core.ISelectionModel;
+	import org.apache.royale.core.IStrand;
+	import org.apache.royale.core.IUIBase;
+	import org.apache.royale.core.ItemRendererClassFactory;
+	import org.apache.royale.core.UIBase;
+	import org.apache.royale.core.ValuesManager;
+	import org.apache.royale.events.Event;
+	import org.apache.royale.events.IEventDispatcher;
+	import org.apache.royale.html.ButtonBar;
+	import org.apache.royale.html.List;
+	import org.apache.royale.html.Tree;
+	import org.apache.royale.html.beads.layouts.TreeGridLayout;
+	import org.apache.royale.html.beads.models.ArrayListSelectionModel;
+	import org.apache.royale.html.beads.models.ButtonBarModel;
+	import org.apache.royale.html.beads.models.TreeGridModel;
+	import org.apache.royale.html.supportClasses.TreeGridColumn;
+	import org.apache.royale.html.supportClasses.TreeGridControlItemRenderer;
+	
+	/**
+	 * The TreeGridView class is responsible for creating the sub-components of the TreeGrid:
+	 * the ButtonBar header, the Tree (first column), and Lists (rest of the columns), as well
+	 * as the container that holds the columns. This bead will also add in a TreeGridLayout
+	 * if one has not already been created or specified in CSS.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+	public class TreeGridView implements IBeadView
+	{
+		/**
+		 * Constructor.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function TreeGridView()
+		{
+		}
+		
+		private var _strand: IStrand;
+		
+		private var _controlColumn:Tree;
+		private var controlColumnDataProvider:Object;
+		
+		private var _header: ButtonBar;
+		
+		/**
+		 * The ButtonBar header for the TreeGrid.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function get header(): ButtonBar
+		{
+			return _header;
+		}
+		
+		private var _contentArea: UIBase;
+		
+		/**
+		 * The component that contains the Tree/List columns.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function get contentArea(): UIBase
+		{
+			return _contentArea;
+		}
+		
+		private var _displayedColumns:Array;
+		
+		/**
+		 * The array of the displayed columns with a Tree at index zero.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function get displayedColumns():Array
+		{
+			return _displayedColumns;
+		}
+		
+		public function get host():IUIBase
+		{
+			return _strand as IUIBase;
+		}
+		private function get uiHost():UIBase
+		{
+			return _strand as UIBase;
+		}
+		
+		/**
+		 * @see org.apache.royale.core.IStrand
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			(_strand as IEventDispatcher).addEventListener("beadsAdded", finishSetup);
+		}
+		
+		private function finishSetup(event:Event):void
+		{
+			var layout:IBeadLayout = _strand.getBeadByType(TreeGridLayout) as IBeadLayout;
+			if (layout == null) {
+				var layoutClass:Class = ValuesManager.valuesImpl.getValue(_strand, "iBeadLayout") as Class;
+				if (layoutClass != null) {
+					layout = new layoutClass() as IBeadLayout;
+				} else {
+					layout = new TreeGridLayout(); // default
+				}
+				_strand.addBead(layout);
+			}
+			
+			_contentArea = new UIBase();
+			_contentArea.typeNames = "TreeGridContentArea";
+			
+			_header = new ButtonBar();
+			_header.typeNames = "TreedGridHeader";
+			
+			var columnLabels:Array = [];
+			
+			var model:TreeGridModel = uiHost.model as TreeGridModel;
+			_displayedColumns = [];
+			
+			for(var i:int=0; i < model.columns.length; i++) {
+				var columnDef:TreeGridColumn = model.columns[i] as TreeGridColumn;
+				
+				columnLabels.push(columnDef.label);
+				
+				if (i == 0) {
+					_controlColumn = new Tree();
+					_controlColumn.typeNames = "TreeGridColumn";
+					_controlColumn.dataProvider = model.dataProvider;
+					_controlColumn.labelField = columnDef.dataField;
+					
+					_displayedColumns.push(_controlColumn);
+					_contentArea.addElement(_controlColumn, false);
+					
+					_controlColumn.addEventListener("change", handleTreeChange);
+					
+					// remember this so all of the lists get the same model data
+					controlColumnDataProvider = _controlColumn.model.dataProvider as ArrayList;
+					(_controlColumn.model as IEventDispatcher).addEventListener("selectedIndexChanged", handleSelectedIndexChanged);
+				}
+				else {
+					var columnList:List = new List();
+					columnList.typeNames = "TreeGridColumn";
+					
+					columnList.model = new ArrayListSelectionModel();
+					columnList.dataProvider = controlColumnDataProvider; 
+					columnList.labelField = columnDef.dataField;
+					columnList.addBead(new DynamicItemsRendererFactoryForArrayListData());
+					
+					_displayedColumns.push(columnList);
+					_contentArea.addElement(columnList, false);
+					
+					(columnList.model as IEventDispatcher).addEventListener("selectedIndexChanged", handleSelectedIndexChanged);
+				}
+			}
+			
+			_header.dataProvider = columnLabels;
+			uiHost.addElement(_header, false);
+			
+			uiHost.addElement(_contentArea, false);
+			
+			// request the layout to do its thing
+			(_strand as IEventDispatcher).dispatchEvent(new Event("layoutNeeded"));
+		}
+		
+		/**
+		 * Handles the changes to the tree nodes (open and close) and updates the other column
+		 * lists to reflect that.
+		 * 
+		 * @private
+		 */
+		private function handleTreeChange(event:Event):void
+		{
+			var tree:Tree = event.currentTarget as Tree;
+			for(var i:int=1; i < _displayedColumns.length; i++) {
+				var columnList:List = _displayedColumns[i] as List;
+				columnList.dataProvider = null;
+				columnList.dataProvider = _controlColumn.model.dataProvider as ArrayList;
+			}
+		}
+		
+		/**
+		 * Handles selection from one column and selects the same index in the other
+		 * columns.
+		 * 
+		 * @private
+		 */
+		private function handleSelectedIndexChanged(event:Event):void
+		{
+			trace("selection changed on the model");
+			if (event.currentTarget is ISelectionModel) {
+				var newIndex:int = (event.currentTarget as ISelectionModel).selectedIndex;
+				for(var i:int=0; i < _displayedColumns.length; i++) {
+					_displayedColumns[i].selectedIndex = newIndex;
+				}
+			}
+		}
+	}
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/TreeGridLayout.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/TreeGridLayout.as
new file mode 100644
index 0000000..ef97c78
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/layouts/TreeGridLayout.as
@@ -0,0 +1,152 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.html.beads.layouts
+{
+	import org.apache.royale.core.IBeadLayout;
+	import org.apache.royale.core.IStrand;
+	import org.apache.royale.core.IUIBase;
+	import org.apache.royale.core.UIBase;
+	import org.apache.royale.events.Event;
+	import org.apache.royale.events.IEventDispatcher;
+	import org.apache.royale.html.ButtonBar;
+	import org.apache.royale.html.beads.TreeGridView;
+	import org.apache.royale.html.beads.models.ButtonBarModel;
+	import org.apache.royale.html.beads.models.TreeGridModel;
+	import org.apache.royale.html.supportClasses.TreeGridColumn;
+	
+	/**
+	 * The TreeGridLayout class provides the sizing and positioning for the sub-components
+	 * that make up the TreeGrid.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+	public class TreeGridLayout implements IBeadLayout
+	{
+		/**
+		 * Constructor.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function TreeGridLayout()
+		{
+		}
+		
+		private var _strand:IStrand;
+		
+		/**
+		 * @see org.apache.royale.core.IStrand
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			(_strand as IEventDispatcher).addEventListener("widthChanged", handleSizeChanges);
+			(_strand as IEventDispatcher).addEventListener("heightChanged", handleSizeChanges);
+			(_strand as IEventDispatcher).addEventListener("sizeChanged", handleSizeChanges);
+			(_strand as IEventDispatcher).addEventListener("layoutNeeded", handleLayoutNeeded);
+		}
+		
+		private function get host():IUIBase
+		{
+			return _strand as IUIBase;
+		}
+		private function get uiHost():UIBase
+		{
+			return _strand as UIBase;
+		}
+		
+		private function handleSizeChanges(event:Event):void
+		{
+			layout();
+		}
+		
+		private function handleLayoutNeeded(event:Event):void
+		{
+			layout();
+		}
+		
+		/**
+		 * Performs the layout function, placing the ButtonBar header at the top
+		 * and spread across the width and the columns below that, laid out horizontally.
+		 * The size of the columns is taken from the TreeGridColumn definitions stored
+		 * in the TreeGridModel.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function layout():Boolean
+		{
+			var model:TreeGridModel = uiHost.model as TreeGridModel;
+			var header:ButtonBar = (uiHost.view as TreeGridView).header;
+			var contentArea:UIBase = (uiHost.view as TreeGridView).contentArea;
+			var displayedColumns:Array = (uiHost.view as TreeGridView).displayedColumns;
+			
+			// size and position the header
+			header.x = 0;
+			header.y = 0;
+			header.setWidthAndHeight(uiHost.width, 25); 
+			
+			// size and position the elements that make up the content
+			var xpos:Number = 0;
+			var defaultColumnWidth:Number = contentArea.width / model.columns.length;
+			var columnWidths:Array = [];
+			
+			for(var i:int=0; i < displayedColumns.length; i++) {
+				var columnDef:TreeGridColumn = model.columns[i] as TreeGridColumn;
+				var columnList:UIBase = displayedColumns[i] as UIBase;
+				columnList.x = xpos;
+				columnList.y = 0;
+				//columnList.setWidthAndHeight(columnWidth, _contentArea.height);
+				if (isNaN(columnDef.columnWidth)) {
+					columnList.width = defaultColumnWidth;
+				} else {
+					columnList.width = columnDef.columnWidth;
+				}
+				
+				columnWidths.push(columnList.width);
+				
+				xpos += columnList.width;
+			}
+			
+			var bbmodel:ButtonBarModel = header.getBeadByType(ButtonBarModel) as ButtonBarModel;
+			bbmodel.buttonWidths = columnWidths;
+			header.dispatchEvent(new Event("layoutNeeded"));
+			
+			// size and position the contentArea
+			contentArea.x = 0;
+			contentArea.y = header.height; 
+			contentArea.setWidthAndHeight(uiHost.width, uiHost.height - header.height);
+			
+			return true;
+		}
+	}
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/TreeGridModel.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/TreeGridModel.as
new file mode 100644
index 0000000..7171c07
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/TreeGridModel.as
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.html.beads.models
+{
+	import org.apache.royale.collections.ArrayList;
+	import org.apache.royale.collections.FlattenedList;
+	import org.apache.royale.collections.HierarchicalData;
+	import org.apache.royale.utils.ObjectMap;
+
+	/**
+	 * The data model for the TreeGrid. This contains the list of TreeGridColumn
+	 * definitions, the HierarchicalData used to populate the TreeGrid, and
+	 * the FlattendList of the HD which is actually displayed.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+	public class TreeGridModel extends ArrayListSelectionModel
+	{
+		/**
+		 * Constructor.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function TreeGridModel()
+		{
+			super();
+		}
+		
+		private var _columns:Array;
+		
+		/**
+		 * The TreeGridColumn definitions.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function get columns():Array
+		{
+			return _columns;
+		}
+		public function set columns(value:Array):void
+		{
+			_columns = value;
+		}
+		
+		private var _hierarchicalData:HierarchicalData;
+		
+		/**
+		 * @private
+		 */
+		override public function get dataProvider():Object
+		{
+			return _hierarchicalData;
+		}
+		override public function set dataProvider(value:Object):void
+		{
+			if (value == _hierarchicalData) return;
+			
+			_hierarchicalData = value as HierarchicalData;
+			
+			_flatList = new FlattenedList(_hierarchicalData);
+			super.dataProvider = _flatList;
+		}
+		
+		private var _flatList:FlattenedList;
+		
+		/**
+		 * @private
+		 */
+		public function get flatList():FlattenedList
+		{
+			return _flatList;
+		}
+	}
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeGridColumn.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeGridColumn.as
new file mode 100644
index 0000000..573ab0f
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeGridColumn.as
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.html.supportClasses
+{
+	/**
+	 * A TreeGridColumn defines the property of a specific column in the TreeGrid.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9
+	 */
+	public class TreeGridColumn extends DataGridColumn
+	{
+		/**
+		 * Constructor.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function TreeGridColumn()
+		{
+			super();
+		}
+	}
+}
\ No newline at end of file
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeGridControlItemRenderer.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeGridControlItemRenderer.as
new file mode 100644
index 0000000..b18ee9a
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeGridControlItemRenderer.as
@@ -0,0 +1,107 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.html.supportClasses
+{
+	import org.apache.royale.core.IItemRenderer;
+	import org.apache.royale.core.IItemRendererClassFactory;
+	import org.apache.royale.core.IItemRendererParent;
+	import org.apache.royale.core.UIBase;
+	import org.apache.royale.events.IEventDispatcher;
+	import org.apache.royale.events.ItemAddedEvent;
+	import org.apache.royale.html.TextButton;
+
+	public class TreeGridControlItemRenderer extends UIItemRendererBase implements IItemRendererParent
+	{
+		public function TreeGridControlItemRenderer()
+		{
+			super();
+			
+			_controlButton = new TextButton();
+		}
+		
+		private var _controlButton: TextButton;
+		public function get controlButton():TextButton
+		{
+			return _controlButton;
+		}
+		
+		private var _originalItemRenderer: IItemRendererClassFactory;
+		
+		public function get originalItemRenderer(): IItemRendererClassFactory
+		{
+			return _originalItemRenderer;
+		}
+		public function set originalItemRenderer(value: IItemRendererClassFactory):void
+		{
+			_originalItemRenderer = value;
+			
+			child = value.createItemRenderer(this) as UIBase;
+			(child as IItemRenderer).data = this.data;
+			this.addElement(child);
+		}
+		
+		private var child:UIBase;
+		
+		override public function adjustSize():void
+		{
+			var treeData:TreeListData = listData as TreeListData;
+			var controlLabel:String = treeData.hasChildren ? (treeData.isOpen ? "▼" : "▶") : " ";
+			_controlButton.text = controlLabel;
+			
+			_controlButton.x = 0;
+			_controlButton.y = 0;
+			_controlButton.setWidthAndHeight(20, this.height);
+			
+			child.x = _controlButton.width;
+			child.y = 0;
+			child.setWidthAndHeight(this.width - _controlButton.width, this.height);			
+		}
+		
+		// IItemRendererParent implementation
+		
+		public function addItemRenderer(renderer:IItemRenderer):void
+		{
+			this.addElement(renderer);
+		}
+
+		public function addItemRendererAt(renderer:IItemRenderer, index:int):void
+		{
+			this.addElementAt(renderer, index);
+		}
+		
+		public function removeItemRenderer(renderer:IItemRenderer):void
+		{
+			this.removeElement(renderer);
+		}
+		
+		public function getItemRendererForIndex(index:int):IItemRenderer
+		{
+			return child as IItemRenderer;
+		}
+		
+		public function removeAllItemRenderers():void
+		{
+			this.removeElement(child);
+		}
+		
+		public function updateAllItemRenderers():void
+		{
+		}
+	}
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <co...@royale.apache.org>'].