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] - Updating DataGrid to restore separation of itemRenderer generation from layout. Modified DataGridPresentionModel to extend ListPresentationModel. Updated JS version of ButtonBarLayout.
Date Thu, 02 Oct 2014 20:23:31 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 36f1ce4ca -> f20b05e53


Updating DataGrid to restore separation of itemRenderer generation from layout. Modified DataGridPresentionModel
to extend ListPresentationModel. Updated JS version of ButtonBarLayout.


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

Branch: refs/heads/develop
Commit: f20b05e5316c36fcbe7785a299395e503125a7ad
Parents: 36f1ce4
Author: Peter Ent <pent@apache.org>
Authored: Thu Oct 2 16:23:26 2014 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Thu Oct 2 16:23:26 2014 -0400

----------------------------------------------------------------------
 .../src/org/apache/flex/html/DataGrid.as        |  9 +++++--
 .../org/apache/flex/html/beads/DataGridView.as  |  8 +++++--
 .../js/FlexJS/src/org/apache/flex/html/List.js  |  3 ---
 .../flex/html/beads/layouts/ButtonBarLayout.js  | 25 +++++++-------------
 .../NonVirtualVerticalScrollingLayout.js        |  6 ++++-
 .../html/supportClasses/NonVirtualDataGroup.js  | 25 ++++++++++++++++++++
 6 files changed, 52 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f20b05e5/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/DataGrid.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/DataGrid.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/DataGrid.as
index cd43c5b..4aa38d2 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/DataGrid.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/DataGrid.as
@@ -18,6 +18,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html
 {
+	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IDataGridModel;
 	import org.apache.flex.core.IDataGridPresentationModel;
 	import org.apache.flex.core.UIBase;
@@ -111,10 +112,14 @@ package org.apache.flex.html
 		 */
 		public function get presentationModel():IDataGridPresentationModel
 		{
-			var presModel:IDataGridPresentationModel = getBeadByType(IDataGridPresentationModel) as
IDataGridPresentationModel;
-			if (presModel == null) {
+			var beadMod:IBead = getBeadByType(IDataGridPresentationModel);
+			var presModel:IDataGridPresentationModel;
+			
+			if (beadMod == null) {
 				presModel = new DataGridPresentationModel();
 				addBead(presModel);
+			} else {
+				presModel = beadMod as IDataGridPresentationModel;
 			}
 			return presModel;
 		}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f20b05e5/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/beads/DataGridView.as
b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/beads/DataGridView.as
index 57e386c..9e36e55 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/beads/DataGridView.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/html/beads/DataGridView.as
@@ -93,11 +93,15 @@ package org.apache.flex.html.beads
 			super.strand = value;
 			
 			// 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) {
+			var modBead:IBead = _strand.getBeadByType(DataGridPresentationModel);
+			var presentationModel:DataGridPresentationModel;
+			if (modBead == null) {
 				presentationModel = new DataGridPresentationModel();
 				_strand.addBead(presentationModel);
 			}
+			else {
+				presentationModel = modBead as DataGridPresentationModel;
+			}
 			
 			var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
 			IEventDispatcher(sharedModel).addEventListener("dataProviderChanged",onDataProviderChanged);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f20b05e5/frameworks/js/FlexJS/src/org/apache/flex/html/List.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/List.js b/frameworks/js/FlexJS/src/org/apache/flex/html/List.js
index 47b6d78..70c0ad5 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/List.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/List.js
@@ -158,9 +158,6 @@ org.apache.flex.html.List.prototype.addedToParent =
     itemRendererFactory = new m2();
     this.addBead(itemRendererFactory);
   }
-
-  var newEvent = new org.apache.flex.events.Event('layoutNeeded');
-  this.dispatchEvent(newEvent);
 };
 
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f20b05e5/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
index abfada9..0b18e60 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
@@ -80,8 +80,6 @@ org.apache.flex.html.beads.layouts.ButtonBarLayout.
         goog.bind(this.changeHandler, this));
     this.strand_.addEventListener('heightChanged',
         goog.bind(this.changeHandler, this));
-    this.strand_.addEventListener('layoutNeeded',
-        goog.bind(this.changeHandler, this));
     this.strand_.element.style.display = 'block';
   }
 };
@@ -92,34 +90,27 @@ org.apache.flex.html.beads.layouts.ButtonBarLayout.
  */
 org.apache.flex.html.beads.layouts.ButtonBarLayout.
     prototype.changeHandler = function(event) {
+
   var layoutParent = this.strand_.getBeadByType(org.apache.flex.core.ILayoutParent);
   var contentView = layoutParent.get_contentView();
-  var selectionModel = this.strand_.get_model();
-  var dp = selectionModel.get_dataProvider();
-
-  var itemRendererFactory = this.strand_.getBeadByType(org.apache.flex.core.IItemRendererClassFactory);
-
-  var n = dp.length;
+  var itemRendererParent = contentView;
 
+  var n = itemRendererParent.get_numElements();
   var xpos = 0;
   var useWidth = this.strand_.get_width() / n;
   var useHeight = this.strand_.get_height();
 
   for (var i = 0; i < n; i++)
   {
-    var ir = contentView.getItemRendererForIndex(i);
-    if (ir == null) {
-      ir = itemRendererFactory.createItemRenderer(contentView);
-    }
-    ir.set_index(i);
-    ir.set_labelField(this.strand_.get_labelField());
-    ir.set_data(dp[i]);
+    var ir = itemRendererParent.getElementAt(i);
+    ir.set_y(0);
+    ir.set_height(useHeight);
+    ir.set_x(xpos);
     ir.element.style['vertical-align'] = 'middle';
     ir.element.style['text-align'] = 'center';
     ir.element.style['left-margin'] = 'auto';
     ir.element.style['right-margin'] = 'auto';
 
-    ir.set_height(useHeight);
     if (this.buttonWidths_ && !isNaN(this.buttonWidths_[i])) ir.set_width(this.buttonWidths_[i]);
     else ir.set_width(useWidth);
 
@@ -127,5 +118,7 @@ org.apache.flex.html.beads.layouts.ButtonBarLayout.
       ir.lastDisplay_ = 'inline-block';
     else
       ir.element.style.display = 'inline-block';
+
+    xpos += ir.get_width();
   }
 };

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f20b05e5/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.js
index 4f567be..4ae20b8 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/layouts/NonVirtualVerticalScrollingLayout.js
@@ -51,7 +51,11 @@ org.apache.flex.html.beads.layouts.
     this.strand_ = value;
     this.strand_.addEventListener('childrenAdded',
         goog.bind(this.changeHandler, this));
-    this.strand_.addEventListener('layoutNeeded',
+    this.strand_.addEventListener('itemsCreated',
+        goog.bind(this.changeHandler, this));
+    this.strand_.addEventListener('widthChanged',
+        goog.bind(this.changeHandler, this));
+    this.strand_.addEventListener('heightChanged',
         goog.bind(this.changeHandler, this));
   }
 };

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f20b05e5/frameworks/js/FlexJS/src/org/apache/flex/html/supportClasses/NonVirtualDataGroup.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/supportClasses/NonVirtualDataGroup.js
b/frameworks/js/FlexJS/src/org/apache/flex/html/supportClasses/NonVirtualDataGroup.js
index 0aacdcd..ceb2217 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/supportClasses/NonVirtualDataGroup.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/supportClasses/NonVirtualDataGroup.js
@@ -102,6 +102,31 @@ org.apache.flex.html.supportClasses.NonVirtualDataGroup.
 
 /**
  * @expose
+ * @return {number} The number of child nodes in the group.
+ */
+org.apache.flex.html.supportClasses.NonVirtualDataGroup.
+    prototype.get_numElements = function() {
+
+  var n = this.element.childNodes.length;
+  return n;
+};
+
+
+/**
+ * @expose
+ * @param {number} index The index of the desired element.
+ * @return {Object} The element at the given index.
+ */
+org.apache.flex.html.supportClasses.NonVirtualDataGroup.
+    prototype.getElementAt = function(index) {
+
+  var e = this.element.childNodes[index];
+  return e.flexjs_wrapper;
+};
+
+
+/**
+ * @expose
  * @param {Object} index The index for the itemRenderer.
  * @return {Object} The itemRenderer that matches the index.
  */


Mime
View raw message