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] - Added presentationModel setter/getter to the DataGrid.
Date Thu, 12 Jan 2017 21:29:04 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 162cad3b6 -> dd51e840b


Added presentationModel setter/getter to the DataGrid.


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

Branch: refs/heads/develop
Commit: dd51e840bd7237d6600a8c1cfb419bf25cc49764
Parents: 162cad3
Author: Peter Ent <pent@apache.org>
Authored: Thu Jan 12 16:29:02 2017 -0500
Committer: Peter Ent <pent@apache.org>
Committed: Thu Jan 12 16:29:02 2017 -0500

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/html/DataGrid.as  | 30 ++++++++++++++------
 .../org/apache/flex/html/beads/DataGridView.as  | 20 ++++++-------
 2 files changed, 30 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dd51e840/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataGrid.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataGrid.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataGrid.as
index dd1f814..999b496 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataGrid.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataGrid.as
@@ -22,6 +22,7 @@ package org.apache.flex.html
 	import org.apache.flex.core.IDataGridModel;
 	import org.apache.flex.core.IDataGridPresentationModel;
 	import org.apache.flex.core.UIBase;
+	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.html.beads.models.DataGridPresentationModel;
 	
 	[Event(name="change", type="org.apache.flex.events.Event")]
@@ -110,6 +111,11 @@ package org.apache.flex.html
 		}
 		
 		/**
+		 * @private
+		 */
+		private var _presentationModel:IDataGridPresentationModel;
+		
+		/**
 		 *  The DataGrid's presentation model
 		 *
 		 *  @langversion 3.0
@@ -119,16 +125,22 @@ package org.apache.flex.html
 		 */
 		public function get presentationModel():IDataGridPresentationModel
 		{
-			var beadMod:IBead = getBeadByType(IDataGridPresentationModel);
-			var presModel:IDataGridPresentationModel;
-			
-			if (beadMod == null) {
-				presModel = new DataGridPresentationModel();
-				addBead(presModel);
-			} else {
-				presModel = beadMod as IDataGridPresentationModel;
+			if (_presentationModel == null) {
+				var c:Class = ValuesManager.valuesImpl.getValue(this, "iDataGridPresentationModel");
+				if (c) {
+					var presModel:Object = new c();
+					_presentationModel = presModel as IDataGridPresentationModel;
+					if (_presentationModel != null) {
+						addBead(_presentationModel as IBead);
+					}
+				}
 			}
-			return presModel;
+			
+			return _presentationModel;
+		}
+		public function set presentationModel(value:IDataGridPresentationModel):void
+		{
+			_presentationModel = value;
 		}
 				
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dd51e840/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
index 1fa263c..9c79a3b 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataGridView.as
@@ -23,6 +23,7 @@ package org.apache.flex.html.beads
 	import org.apache.flex.core.IBeadLayout;
 	import org.apache.flex.core.IBeadView;
 	import org.apache.flex.core.IDataGridModel;
+	import org.apache.flex.core.IDataGridPresentationModel;
 	import org.apache.flex.core.ISelectableItemRenderer;
 	import org.apache.flex.core.ISelectionModel;
 	import org.apache.flex.core.IStrand;
@@ -31,6 +32,7 @@ package org.apache.flex.html.beads
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
+	import org.apache.flex.html.DataGrid;
 	import org.apache.flex.html.DataGridButtonBar;
 	import org.apache.flex.html.Container;
 	import org.apache.flex.html.beads.layouts.ButtonBarLayout;
@@ -38,7 +40,6 @@ package org.apache.flex.html.beads
 	import org.apache.flex.html.beads.layouts.HorizontalLayout;
 	import org.apache.flex.html.beads.layouts.IDataGridLayout;
 	import org.apache.flex.html.beads.models.ArraySelectionModel;
-	import org.apache.flex.html.beads.models.DataGridPresentationModel;
 	import org.apache.flex.html.supportClasses.DataGridColumn;
 	import org.apache.flex.html.supportClasses.DataGridColumnList;
 	import org.apache.flex.html.supportClasses.ScrollingViewport;
@@ -149,16 +150,11 @@ package org.apache.flex.html.beads
 		 */
 		private function finishSetup(event:Event):void
 		{
-			var host:UIBase = _strand as UIBase;
+			var host:DataGrid = _strand as DataGrid;
 
 			// see if there is a presentation model already in place. if not, add one.
-			var presentationModel:DataGridPresentationModel = _strand.getBeadByType(DataGridPresentationModel)
as DataGridPresentationModel;
-			if (presentationModel == null) {
-				presentationModel = new DataGridPresentationModel();
-				_strand.addBead(presentationModel);
-			}
-
-			var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
+			var presentationModel:IDataGridPresentationModel = host.presentationModel;
+			var sharedModel:IDataGridModel = host.model as IDataGridModel;
 			IEventDispatcher(sharedModel).addEventListener("dataProviderChanged",handleDataProviderChanged);
 			IEventDispatcher(sharedModel).addEventListener("selectedIndexChanged", handleSelectedIndexChanged);
 
@@ -255,8 +251,10 @@ package org.apache.flex.html.beads
 		 */
 		private function createLists():void
 		{
-			var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
-			var presentationModel:DataGridPresentationModel = _strand.getBeadByType(DataGridPresentationModel)
as DataGridPresentationModel;
+			var host:DataGrid = _strand as DataGrid;
+			
+			var sharedModel:IDataGridModel = host.model as IDataGridModel;
+			var presentationModel:IDataGridPresentationModel = host.presentationModel;
 			var listWidth:Number = host.width / sharedModel.columns.length;
 
 			_lists = new Array();


Mime
View raw message