flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Initial work for DataGridColumn, including column-specific custom itemRenderers, for ActionScript and JavaScript. More work needs to be done, but DataGrids with DataGridColumns can be created using this code
Date Fri, 10 Jan 2014 21:55:42 GMT
Updated Branches:
  refs/heads/develop 04e8563f0 -> 3a56dbeb5


Initial work for DataGridColumn, including column-specific custom itemRenderers, for ActionScript
and JavaScript. More work needs to be done, but DataGrids with DataGridColumns can be created
using this code (some properties on the DataGridColumn, such as labelField and dataField,
have yet to be implemented or used).


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

Branch: refs/heads/develop
Commit: 3a56dbeb59c8874bbe35faef3d3ee37ae1bcaaaf
Parents: 04e8563
Author: Peter Ent <pent@apache.org>
Authored: Fri Jan 10 16:55:28 2014 -0500
Committer: Peter Ent <pent@apache.org>
Committed: Fri Jan 10 16:55:28 2014 -0500

----------------------------------------------------------------------
 .../as/projects/FlexJSUI/basic-manifest.xml     |   1 +
 .../as/projects/FlexJSUI/src/FlexJSUIClasses.as |   1 +
 .../src/org/apache/flex/core/IDataGridModel.as  |   3 +
 .../apache/flex/html/staticControls/DataGrid.as |   9 ++
 .../staticControls/beads/DataGridColumnView.as  |  11 ++
 .../html/staticControls/beads/DataGridView.as   |   6 +-
 .../DataItemRendererFactoryForColumnData.as     |   4 +-
 .../beads/models/DataGridModel.as               |  10 ++
 .../supportClasses/DataGridColumn.as            |  69 ++++++++++++
 .../supportClasses/StringItemRenderer.as        |  11 +-
 .../js/FlexJS/src/mx/core/ClassFactory.js       |  12 +--
 .../src/org/apache/flex/core/IDataGridModel.js  |   2 +-
 .../flex/core/ItemRendererClassFactory.js       |   4 +-
 .../apache/flex/html/staticControls/DataGrid.js |  20 ++++
 .../org/apache/flex/html/staticControls/List.js |  21 ++++
 .../staticControls/beads/DataGridColumnView.js  |  21 ++++
 .../html/staticControls/beads/DataGridView.js   |   5 +-
 .../DataItemRendererFactoryForColumnData.js     |   5 +-
 .../beads/models/DataGridModel.js               |  20 ++++
 .../supportClasses/DataGridColumn.js            | 107 +++++++++++++++++++
 .../supportClasses/StringItemRenderer.js        |   7 +-
 21 files changed, 327 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/as/projects/FlexJSUI/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/basic-manifest.xml b/frameworks/as/projects/FlexJSUI/basic-manifest.xml
index 6486704..71d1cc0 100644
--- a/frameworks/as/projects/FlexJSUI/basic-manifest.xml
+++ b/frameworks/as/projects/FlexJSUI/basic-manifest.xml
@@ -30,6 +30,7 @@
     <component id="Button" class="org.apache.flex.html.staticControls.Button"/>
     <component id="ButtonBar" class="org.apache.flex.html.staticControls.ButtonBar"/>
     <component id="DataGrid" class="org.apache.flex.html.staticControls.DataGrid"/>
+    <component id="DataGridColumn" class="org.apache.flex.html.staticControls.supportClasses.DataGridColumn"/>
     <component id="DropDownList" class="org.apache.flex.html.staticControls.DropDownList"/>
     <component id="DropDownListList" class="org.apache.flex.html.staticControls.supportClasses.DropDownListList"/>
     <component id="Image" class="org.apache.flex.html.staticControls.Image"/>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
index 22fa85d..6dc1b9d 100644
--- a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
+++ b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as
@@ -94,6 +94,7 @@ internal class FlexJSUIClasses
     import org.apache.flex.html.staticControls.beads.layouts.VScrollBarLayout; VScrollBarLayout;
     import org.apache.flex.html.staticControls.beads.TextItemRendererFactoryForArrayData;
TextItemRendererFactoryForArrayData;
 	import org.apache.flex.html.staticControls.beads.DataItemRendererFactoryForArrayData; DataItemRendererFactoryForArrayData;
+	import org.apache.flex.html.staticControls.supportClasses.DataGridColumn; DataGridColumn;
     import org.apache.flex.core.ItemRendererClassFactory; ItemRendererClassFactory;  
 	import org.apache.flex.core.FilledRectangle; FilledRectangle;
 	import org.apache.flex.events.CustomEvent; CustomEvent;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IDataGridModel.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IDataGridModel.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IDataGridModel.as
index 606d938..eb7e326 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IDataGridModel.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/IDataGridModel.as
@@ -22,5 +22,8 @@ package org.apache.flex.core
 	{
 		function get labelFields():Object;
 		function set labelFields(value:Object):void;
+		
+		function get columns():Array;
+		function set columns(value:Array):void;
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DataGrid.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DataGrid.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DataGrid.as
index 9a02831..ad35adf 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DataGrid.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/DataGrid.as
@@ -30,6 +30,15 @@ package org.apache.flex.html.staticControls
 			super();
 		}
 		
+		public function get columns():Array
+		{
+			return IDataGridModel(model).columns;
+		}
+		public function set columns(value:Array):void
+		{
+			IDataGridModel(model).columns = value;
+		}
+		
 		public function get dataProvider():Object
 		{
 			return IDataGridModel(model).dataProvider;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataGridColumnView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataGridColumnView.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataGridColumnView.as
index 94dc74c..ae3398a 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataGridColumnView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataGridColumnView.as
@@ -19,6 +19,7 @@
 package org.apache.flex.html.staticControls.beads
 {
 	import org.apache.flex.core.IStrand;
+	import org.apache.flex.html.staticControls.supportClasses.DataGridColumn;
 	
 	public class DataGridColumnView extends ListView
 	{
@@ -43,6 +44,16 @@ package org.apache.flex.html.staticControls.beads
 			_columnIndex = value;
 		}
 		
+		private var _column:DataGridColumn;
+		public function get column():DataGridColumn
+		{
+			return _column;
+		}
+		public function set column(value:DataGridColumn):void
+		{
+			_column = value;
+		}
+		
 		private var _labelField:String;
 		public function get labelField():String
 		{

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataGridView.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataGridView.as
index f2d3cc2..e069688 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataGridView.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataGridView.as
@@ -73,9 +73,11 @@ package org.apache.flex.html.staticControls.beads
 			
 			columns = new Array();
 			for(var i:int=0; i < pm.columnLabels.length; i++) {
-				var column:List = new SimpleList();
+				var column:List = new List(); // NEW (old:) new SimpleList();
 				var columnView:DataGridColumnView = new DataGridColumnView();
-				columnView.labelField = sharedModel.labelFields[i];
+				//columnView.labelField = sharedModel.labelFields[i];
+				columnView.column = sharedModel.columns[i]; // NEW
+				column.itemRenderer = columnView.column.itemRenderer;
 				var factory:DataItemRendererFactoryForColumnData = new DataItemRendererFactoryForColumnData();
 				columnView.columnIndex = i;
 				column.addBead(sharedModel);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataItemRendererFactoryForColumnData.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataItemRendererFactoryForColumnData.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataItemRendererFactoryForColumnData.as
index be79c1c..fc9e88a 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataItemRendererFactoryForColumnData.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/DataItemRendererFactoryForColumnData.as
@@ -87,10 +87,10 @@ package org.apache.flex.html.staticControls.beads
 			for (var i:int = 0; i < n; i++)
 			{
 				
-				var tf:ITextItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ITextItemRenderer;
+				var tf:DataItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as DataItemRenderer;
 				tf.index = i;
 				dataGroup.addElement(tf);
-				tf.text = dp[i][view.labelField];
+				tf.data = dp[i];
 			}
 			
 			IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/models/DataGridModel.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/models/DataGridModel.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/models/DataGridModel.as
index bc71bff..74dbf2c 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/models/DataGridModel.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/beads/models/DataGridModel.as
@@ -41,5 +41,15 @@ package org.apache.flex.html.staticControls.beads.models
 				dispatchEvent( new Event("labelFieldsChanged"));
 			}
 		}
+		
+		private var _columns:Array;
+		public function get columns():Array
+		{
+			return _columns;
+		}
+		public function set columns(value:Array):void
+		{
+			_columns = value;
+		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DataGridColumn.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DataGridColumn.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DataGridColumn.as
new file mode 100644
index 0000000..a0b9769
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/DataGridColumn.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.staticControls.supportClasses
+{
+	import mx.core.IFactory;
+
+	public class DataGridColumn
+	{
+		public function DataGridColumn()
+		{
+		}
+		
+		private var _itemRenderer:IFactory;
+		public function get itemRenderer():IFactory
+		{
+			return _itemRenderer;
+		}
+		public function set itemRenderer(value:IFactory):void
+		{
+			_itemRenderer = value;
+		}
+		
+		private var _columnWidth:Number = 100;
+		public function get columnWidth():Number
+		{
+			return _columnWidth;
+		}
+		public function set columnWidth(value:Number):void
+		{
+			_columnWidth = value;
+		}
+		
+		private var _label:String;
+		public function get label():String
+		{
+			return _label;
+		}
+		public function set label(value:String):void
+		{
+			_label = value;
+		}
+		
+		private var _dataField:String;
+		public function get dataField():String
+		{
+			return _dataField;
+		}
+		public function set dataField(value:String):void
+		{
+			_dataField = value;
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/StringItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/StringItemRenderer.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/StringItemRenderer.as
index f6da1d6..3242024 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/StringItemRenderer.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/StringItemRenderer.as
@@ -18,13 +18,14 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.staticControls.supportClasses
 {
+	import flash.text.TextFieldAutoSize;
 	import flash.text.TextFieldType;
 	
 	import org.apache.flex.core.CSSTextField;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.html.staticControls.beads.ITextItemRenderer;
 
-	public class StringItemRenderer extends UIItemRendererBase implements ITextItemRenderer
+	public class StringItemRenderer extends DataItemRenderer implements ITextItemRenderer
 	{
 		public function StringItemRenderer()
 		{
@@ -32,6 +33,7 @@ package org.apache.flex.html.staticControls.supportClasses
 			
 			textField = new CSSTextField();
 			textField.type = TextFieldType.DYNAMIC;
+			textField.autoSize = TextFieldAutoSize.LEFT;
 			textField.selectable = false;
 		}
 		
@@ -48,10 +50,13 @@ package org.apache.flex.html.staticControls.supportClasses
 		
 		override public function adjustSize():void
 		{
+			var cy:Number = this.height/2;
+			
 			textField.x = 0;
-			textField.y = 0;
+			textField.y = cy - textField.height/2;
 			textField.width = this.width;
-			textField.height = this.height;
+			
+			updateRenderer();
 		}
 		
 		public function get text():String

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/mx/core/ClassFactory.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/mx/core/ClassFactory.js b/frameworks/js/FlexJS/src/mx/core/ClassFactory.js
index d240d0e..0e0f68f 100644
--- a/frameworks/js/FlexJS/src/mx/core/ClassFactory.js
+++ b/frameworks/js/FlexJS/src/mx/core/ClassFactory.js
@@ -24,8 +24,8 @@ goog.require('mx.core.IFactory');
  * @param {Object} generator The class definition to use for newInstance.
  */
 mx.core.ClassFactory = function(generator) {
-  this.generator = generator;
-  this.properties = null;
+  this.generator_ = generator;
+  this.properties_ = null;
 };
 
 
@@ -47,12 +47,12 @@ mx.core.ClassFactory.prototype.
  */
 mx.core.ClassFactory.
     prototype.newInstance = function() {
-  var obj = new this.generator();
+  var obj = new this.generator_();
 
-  if (this.properties) {
+  if (this.properties_) {
     var prop;
-    for (prop in this.properties) {
-      obj[prop] = this.properties[prop];
+    for (prop in this.properties_) {
+      obj[prop] = this.properties_[prop];
     }
   }
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/org/apache/flex/core/IDataGridModel.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/IDataGridModel.js b/frameworks/js/FlexJS/src/org/apache/flex/core/IDataGridModel.js
index 21a8a0b..12dd93a 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/IDataGridModel.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/IDataGridModel.js
@@ -38,4 +38,4 @@ org.apache.flex.core.IDataGridModel = function() {
 org.apache.flex.core.IDataGridModel.prototype.FLEXJS_CLASS_INFO =
 { names: [{ name: 'IDataGridModel',
                 qName: 'org.apache.flex.core.IDataGridModel' }],
-      interfaces: [org.apache.flex.core.ISelectionModel] };
\ No newline at end of file
+      interfaces: [org.apache.flex.core.ISelectionModel] };

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/org/apache/flex/core/ItemRendererClassFactory.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ItemRendererClassFactory.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ItemRendererClassFactory.js
index 24f425e..d8ac005 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/ItemRendererClassFactory.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ItemRendererClassFactory.js
@@ -51,8 +51,8 @@ org.apache.flex.core.ItemRendererClassFactory.
 
   // see if the _strand has an itemRenderer property that isn't empty. if that's
   // true, use that value instead of pulling it from the the style
-  if (this.strand_.hasOwnProperty('itemRenderer')) {
-    this.itemRendererClassFactory = this.strand_['itemRenderer'];
+  if (this.strand_.get_itemRenderer) {
+    this.itemRendererClassFactory = this.strand_.get_itemRenderer();
     if (this.itemRendererClassFactory) {
         this.createFunction = this.createFromClass;
         return;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/DataGrid.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/DataGrid.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/DataGrid.js
index d71686c..a2b1fc0 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/DataGrid.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/DataGrid.js
@@ -104,6 +104,26 @@ org.apache.flex.html.staticControls.DataGrid.prototype.set_labelFields
=
 
 /**
  * @expose
+ * @param {Array} value The DataGridColumn definitions for this DataGrid.
+ */
+org.apache.flex.html.staticControls.DataGrid.prototype.set_columns =
+    function(value) {
+  this.get_model().set_columns(value);
+};
+
+
+/**
+ * @expose
+ * @return {Array} The DataGridColumns in this DataGrid.
+ */
+org.apache.flex.html.staticControls.DataGrid.prototype.get_columns =
+    function() {
+  return this.get_model().get_columns();
+};
+
+
+/**
+ * @expose
  * @return {string} value The current selectedIndex.
  */
 org.apache.flex.html.staticControls.DataGrid.prototype.get_selectedIndex =

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/List.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/List.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/List.js
index 7858482..341d7e9 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/List.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/List.js
@@ -14,6 +14,7 @@
 
 goog.provide('org.apache.flex.html.staticControls.List');
 
+goog.require('mx.core.IFactory');
 goog.require('org.apache.flex.core.IDataProviderItemRendererMapper');
 goog.require('org.apache.flex.core.IItemRendererClassFactory');
 goog.require('org.apache.flex.core.ItemRendererClassFactory');
@@ -49,6 +50,26 @@ org.apache.flex.html.staticControls.List.prototype.FLEXJS_CLASS_INFO =
 
 
 /**
+ * @expose
+ * @return {mx.core.IFactory} The itemRenderer generator.
+ */
+org.apache.flex.html.staticControls.List.prototype.get_itemRenderer =
+function() {
+  return this.itemRenderer_;
+};
+
+
+/**
+ * @expose
+ * @param {mx.core.IFactory} value The itemRenderer generator.
+ */
+org.apache.flex.html.staticControls.List.prototype.set_itemRenderer =
+function(value) {
+  this.itemRenderer_ = value;
+};
+
+
+/**
  * @override
  */
 org.apache.flex.html.staticControls.List.prototype.createElement =

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataGridColumnView.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataGridColumnView.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataGridColumnView.js
index fe589d2..4b64f20 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataGridColumnView.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataGridColumnView.js
@@ -15,6 +15,7 @@
 goog.provide('org.apache.flex.html.staticControls.beads.DataGridColumnView');
 
 goog.require('org.apache.flex.html.staticControls.beads.ListView');
+goog.require('org.apache.flex.html.staticControls.supportClasses.DataGridColumn');
 
 
 
@@ -94,3 +95,23 @@ org.apache.flex.html.staticControls.beads.DataGridColumnView.prototype.
     set_labelField = function(value) {
   this.labelField_ = value;
 };
+
+
+/**
+ * @expose
+ * @return {org.apache.flex.html.staticControls.supportClasses.DataGridColumn} The column
data being displayed.
+ */
+org.apache.flex.html.staticControls.beads.DataGridColumnView.prototype.get_column =
+function() {
+  return this.column_;
+};
+
+
+/**
+ * @expose
+ * @param {org.apache.flex.html.staticControls.supportClasses.DataGridColumn} value The column
data being displayed.
+ */
+org.apache.flex.html.staticControls.beads.DataGridColumnView.prototype.set_column =
+function(value) {
+  this.column_ = value;
+};

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataGridView.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataGridView.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataGridView.js
index a365759..a580902 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataGridView.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataGridView.js
@@ -19,7 +19,7 @@ goog.require('org.apache.flex.core.IItemRendererParent');
 goog.require('org.apache.flex.events.Event');
 goog.require('org.apache.flex.html.staticControls.ButtonBar');
 goog.require('org.apache.flex.html.staticControls.Container');
-goog.require('org.apache.flex.html.staticControls.SimpleList');
+goog.require('org.apache.flex.html.staticControls.List');
 goog.require('org.apache.flex.html.staticControls.beads.DataGridColumnView');
 goog.require('org.apache.flex.html.staticControls.beads.DataItemRendererFactoryForColumnData');
 goog.require('org.apache.flex.html.staticControls.beads.TextItemRendererFactoryForArrayData');
@@ -27,6 +27,7 @@ goog.require('org.apache.flex.html.staticControls.beads.layouts.NonVirtualHorizo
 goog.require('org.apache.flex.html.staticControls.beads.models.ArraySelectionModel');
 goog.require('org.apache.flex.html.staticControls.beads.models.DataGridModel');
 goog.require('org.apache.flex.html.staticControls.beads.models.DataGridPresentationModel');
+goog.require('org.apache.flex.html.staticControls.supportClasses.DataGridColumn');
 
 
 
@@ -99,11 +100,13 @@ org.apache.flex.html.staticControls.beads.DataGridView.prototype.set_strand
=
         org.apache.flex.html.staticControls.beads.DataGridColumnView();
     columnView.set_columnIndex(i);
     columnView.set_labelField(sharedModel.get_labelFields()[i]);
+    columnView.set_column(sharedModel.get_columns()[i]);
 
     var factory = new org.apache.flex.html.staticControls.beads.
         DataItemRendererFactoryForColumnData();
 
     var column = new org.apache.flex.html.staticControls.List();
+    column.set_itemRenderer(columnView.get_column().get_itemRenderer());
     column.set_dataProvider(this.strand_.get_dataProvider());
     column.set_width(columnWidth);
     column.set_height(columnHeight);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataItemRendererFactoryForColumnData.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataItemRendererFactoryForColumnData.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataItemRendererFactoryForColumnData.js
index 90aa954..72ec02e 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataItemRendererFactoryForColumnData.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/DataItemRendererFactoryForColumnData.js
@@ -124,10 +124,9 @@ org.apache.flex.html.staticControls.beads.DataItemRendererFactoryForColumnData.
     fieldName = view.get_labelField();
 
     // todo: grab an itemRenderer from a factory for this column
-    opt = new org.apache.flex.html.staticControls.
-        supportClasses.StringItemRenderer();
+    opt = this.itemRendererFactory_.createItemRenderer(this.dataGroup);
     this.dataGroup.addElement(opt);
-    opt.set_text(dp[i][fieldName]);
+    opt.set_data(dp[i]);
   }
 
   newEvent = new org.apache.flex.events.Event('itemsCreated');

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/DataGridModel.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/DataGridModel.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/DataGridModel.js
index 9d70367..ec720c8 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/DataGridModel.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/beads/models/DataGridModel.js
@@ -77,3 +77,23 @@ org.apache.flex.html.staticControls.beads.models.DataGridModel.prototype.
     get_labelFields = function() {
   return this.labelFields_;
 };
+
+
+/**
+ * @expose
+ * @param {Array} value Array of DataGridColumn instances.
+ */
+org.apache.flex.html.staticControls.beads.models.DataGridModel.prototype.
+    set_columns = function(value) {
+  this.columns_ = value;
+};
+
+
+/**
+ * @expose
+ * @return {Array} Array of DataGridColumn instances.
+ */
+org.apache.flex.html.staticControls.beads.models.DataGridModel.prototype.
+    get_columns = function() {
+  return this.columns_;
+};

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/DataGridColumn.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/DataGridColumn.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/DataGridColumn.js
new file mode 100644
index 0000000..ec84b55
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/DataGridColumn.js
@@ -0,0 +1,107 @@
+/**
+ * Licensed 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.
+ */
+
+goog.provide('org.apache.flex.html.staticControls.supportClasses.DataGridColumn');
+
+goog.require('mx.core.IFactory');
+
+
+
+/**
+ * @constructor
+ */
+org.apache.flex.html.staticControls.supportClasses.DataGridColumn =
+    function() {
+};
+
+
+/**
+ * @expose
+ * @return {mx.core.IFactory} The object factory for the itemRenderer.
+ */
+org.apache.flex.html.staticControls.supportClasses.DataGridColumn.prototype.get_itemRenderer
=
+function() {
+   return this.itemRenderer_;
+};
+
+
+/**
+ * @expose
+ * @param {mx.core.IFactory} value The object factory for the itemRenderer.
+ */
+org.apache.flex.html.staticControls.supportClasses.DataGridColumn.prototype.set_itemRenderer
=
+function(value) {
+  this.itemRenderer_ = value;
+};
+
+
+/**
+ * @expose
+ * @return {Number} The width of the column.
+ */
+org.apache.flex.html.staticControls.supportClasses.DataGridColumn.prototype.get_columnWidth
=
+function() {
+  return this.columnWidth_;
+};
+
+
+/**
+ * @expose
+ * @param {Number} value The width of the column.
+ */
+org.apache.flex.html.staticControls.supportClasses.DataGridColumn.prototype.set_columnWidth
=
+function(value) {
+  this.columnWidth_ = value;
+};
+
+
+/**
+ * @expose
+ * @return {String} The label for the column.
+ */
+org.apache.flex.html.staticControls.supportClasses.DataGridColumn.prototype.get_label =
+function() {
+  return this.label_;
+};
+
+
+/**
+ * @expose
+ * @param {String} value The label for the column.
+ */
+org.apache.flex.html.staticControls.supportClasses.DataGridColumn.prototype.set_label =
+function(value) {
+  this.label_ = value;
+};
+
+
+/**
+ * @expose
+ * @return {String} The field for the data for the column.
+ */
+org.apache.flex.html.staticControls.supportClasses.DataGridColumn.prototype.get_dataField
=
+function() {
+  return this.dataField_;
+};
+
+
+/**
+ * @expose
+ * @param {String} value The field for the data for the column.
+ */
+org.apache.flex.html.staticControls.supportClasses.DataGridColumn.prototype.set_dataField
=
+function(value) {
+  this.dataField_ = value;
+};
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/3a56dbeb/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/StringItemRenderer.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/StringItemRenderer.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/StringItemRenderer.js
index 0833a00..46247a3 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/StringItemRenderer.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/supportClasses/StringItemRenderer.js
@@ -17,12 +17,13 @@ goog.provide('org.apache.flex.html.staticControls.supportClasses.StringItemRende
 goog.require('org.apache.flex.core.IItemRenderer');
 goog.require('org.apache.flex.core.UIBase');
 goog.require('org.apache.flex.html.staticControls.beads.controllers.ItemRendererMouseController');
+goog.require('org.apache.flex.html.staticControls.supportClasses.DataItemRenderer');
 
 
 
 /**
  * @constructor
- * @extends {org.apache.flex.core.UIBase}
+ * @extends {org.apache.flex.html.staticControls.supportClasses.DataItemRenderer}
  * @implements {org.apache.flex.core.IItemRenderer}
  */
 org.apache.flex.html.staticControls.supportClasses.StringItemRenderer =
@@ -31,7 +32,7 @@ org.apache.flex.html.staticControls.supportClasses.StringItemRenderer =
 };
 goog.inherits(
     org.apache.flex.html.staticControls.supportClasses.StringItemRenderer,
-    org.apache.flex.core.UIBase);
+    org.apache.flex.html.staticControls.supportClasses.DataItemRenderer);
 
 
 /**
@@ -160,6 +161,8 @@ org.apache.flex.html.staticControls.supportClasses.StringItemRenderer.
 org.apache.flex.html.staticControls.supportClasses.StringItemRenderer.
     prototype.set_data = function(value) {
 
+  goog.base(this, 'set_data', value);
+
   if (value.toString) {
     this.element.innerHTML = value.toString();
   } else {


Mime
View raw message