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] - Adjusting JavaScript side to account for new way of handling container/layout.
Date Mon, 20 Jul 2015 19:37:58 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 448a571e3 -> 2d5797b89


Adjusting JavaScript side to account for new way of handling container/layout.


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

Branch: refs/heads/develop
Commit: 2d5797b89054e7d99b9aa87af6d4f96d95e477e4
Parents: 448a571
Author: Peter Ent <pent@apache.org>
Authored: Mon Jul 20 15:37:54 2015 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Mon Jul 20 15:37:54 2015 -0400

----------------------------------------------------------------------
 .../js/src/org/apache/flex/core/BeadViewBase.js |  9 +++--
 .../org/apache/flex/html/MXMLBeadViewBase.as    |  2 +
 .../org/apache/flex/html/beads/DataGridView.as  |  3 ++
 .../HTML/js/src/org/apache/flex/html/List.js    |  7 +++-
 .../org/apache/flex/html/beads/ContainerView.js | 36 +++++++++---------
 .../src/org/apache/flex/html/beads/ListView.js  | 19 +++++-----
 .../src/org/apache/flex/html/beads/PanelView.js | 14 +++----
 .../flex/html/beads/layouts/ButtonBarLayout.js  | 40 +++++++-------------
 8 files changed, 65 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d5797b8/frameworks/projects/Core/js/src/org/apache/flex/core/BeadViewBase.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/js/src/org/apache/flex/core/BeadViewBase.js b/frameworks/projects/Core/js/src/org/apache/flex/core/BeadViewBase.js
index f2efed2..2587162 100644
--- a/frameworks/projects/Core/js/src/org/apache/flex/core/BeadViewBase.js
+++ b/frameworks/projects/Core/js/src/org/apache/flex/core/BeadViewBase.js
@@ -44,9 +44,10 @@ org.apache.flex.core.BeadViewBase.prototype.FLEXJS_CLASS_INFO =
 
 
 /**
+ * @private
  * @type {Object}
  */
-org.apache.flex.core.BeadViewBase.prototype._strand = null;
+org.apache.flex.core.BeadViewBase.prototype.strand_ = null;
 
 
 Object.defineProperties(org.apache.flex.core.BeadViewBase.prototype, {
@@ -54,8 +55,8 @@ Object.defineProperties(org.apache.flex.core.BeadViewBase.prototype, {
     strand: {
         /** @this {org.apache.flex.core.BeadViewBase} */
         set: function(value) {
-            if (this._strand !== value) {
-              this._strand = value;
+            if (this.strand_ !== value) {
+              this.strand_ = value;
             }
         }
     },
@@ -63,7 +64,7 @@ Object.defineProperties(org.apache.flex.core.BeadViewBase.prototype, {
     host: {
         /** @this {org.apache.flex.core.BeadViewBase} */
         get: function() {
-            return this._strand;
+            return this.strand_;
         }
     }
 });

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d5797b8/frameworks/projects/HTML/asjs/src/org/apache/flex/html/MXMLBeadViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/MXMLBeadViewBase.as b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/MXMLBeadViewBase.as
index 5a15183..e270058 100644
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/MXMLBeadViewBase.as
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/MXMLBeadViewBase.as
@@ -59,6 +59,8 @@ package org.apache.flex.html
 			super();
 		}
 		
+		private var _strand:IStrand;
+		
         [Bindable("strandChanged")]
         /**
          *  An MXMLBeadViewBase doesn't create its children until it is added to

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d5797b8/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
index 11ff800..cfc6ef6 100644
--- a/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
+++ b/frameworks/projects/HTML/asjs/src/org/apache/flex/html/beads/DataGridView.as
@@ -80,6 +80,8 @@ package org.apache.flex.html.beads
 			return columns;
 		}
 		
+		private var _strand:IStrand;
+		
 		/**
 		 *  @copy org.apache.flex.core.IBead#strand
 		 *  
@@ -90,6 +92,7 @@ package org.apache.flex.html.beads
 		 */
 		override public function set strand(value:IStrand):void
 		{
+			_strand = value;
 			super.strand = value;
 			
 			// see if there is a presentation model already in place. if not, add one.

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d5797b8/frameworks/projects/HTML/js/src/org/apache/flex/html/List.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/List.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/List.js
index 49b844f..c2836a3 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/List.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/List.js
@@ -158,7 +158,12 @@ org.apache.flex.html.List.prototype.internalChildren =
   var dg = listView.dataGroup;
   var items = null;
   if (dg.renderers) {
-    items = dg.renderers;
+    items = [];
+    for (var i = 0; i < dg.renderers.length; i++) {
+      var r = dg.renderers[i];
+      var element = r.element;
+      items.push(element);
+    }
   }
   return items;
 };

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d5797b8/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ContainerView.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ContainerView.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ContainerView.js
index 0208659..8c9a500 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ContainerView.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ContainerView.js
@@ -48,13 +48,13 @@ org.apache.flex.html.beads.ContainerView.prototype.FLEXJS_CLASS_INFO =
 
 
 /**
- * @protected
+ * @private
  * @type {Object}
  * This is also defined as protected on BeadViewBase, but GCC
  * doesn't seem to allow the Object.defineProperties to use it
  * without re-declaring it here.
  */
-org.apache.flex.html.beads.ContainerView.prototype._strand = null;
+org.apache.flex.html.beads.ContainerView.prototype.strand_ = null;
 
 
 /**
@@ -62,11 +62,11 @@ org.apache.flex.html.beads.ContainerView.prototype._strand = null;
  */
 org.apache.flex.html.beads.ContainerView.
     prototype.addOtherListeners = function() {
-  this._strand.addEventListener('childrenAdded',
+  this.strand_.addEventListener('childrenAdded',
       goog.bind(this.changeHandler, this));
-  this._strand.addEventListener('layoutNeeded',
+  this.strand_.addEventListener('layoutNeeded',
      goog.bind(this.changeHandler, this));
-  this._strand.addEventListener('itemsCreated',
+  this.strand_.addEventListener('itemsCreated',
      goog.bind(this.changeHandler, this));
 };
 
@@ -77,11 +77,11 @@ org.apache.flex.html.beads.ContainerView.
 org.apache.flex.html.beads.ContainerView.
     prototype.changeHandler = function(event) {
   if (this.layout_ == null) {
-    this.layout_ = this._strand.getBeadByType(org.apache.flex.core.IBeadLayout);
+    this.layout_ = this.strand_.getBeadByType(org.apache.flex.core.IBeadLayout);
     if (this.layout_ == null) {
-      var m3 = org.apache.flex.core.ValuesManager.valuesImpl.getValue(this._strand, 'iBeadLayout');
+      var m3 = org.apache.flex.core.ValuesManager.valuesImpl.getValue(this.strand_, 'iBeadLayout');
       this.layout_ = new m3();
-      this._strand.addBead(this.layout_);
+      this.strand_.addBead(this.layout_);
       //this.layout_.strand = this.strand_;
     }
   }
@@ -110,14 +110,16 @@ Object.defineProperties(org.apache.flex.html.beads.ContainerView.prototype,
{
     contentView: {
         /** @this {org.apache.flex.html.beads.ContainerView} */
         get: function() {
-            return this._strand;
+            return this.strand_;
         }
     },
     /** @export */
     resizableView: {
         /** @this {org.apache.flex.html.beads.ContainerView} */
         get: function() {
-            return this._strand;
+            return this.strand_;
+        },
+        set: function(value) {
         }
     },
     /** @export */
@@ -125,18 +127,18 @@ Object.defineProperties(org.apache.flex.html.beads.ContainerView.prototype,
{
         /** @this {org.apache.flex.html.beads.ContainerView} */
         set: function(value) {
             org.apache.flex.utils.Language.superSetter(org.apache.flex.html.beads.ContainerView,
this, 'strand', value);
-            if (this._strand.isWidthSizedToContent() &&
-                this._strand.isHeightSizedToContent())
+            if (this.strand_.isWidthSizedToContent() &&
+                this.strand_.isHeightSizedToContent())
               this.addOtherListeners();
             else {
-              this._strand.addEventListener('heightChanged',
+              this.strand_.addEventListener('heightChanged',
                   goog.bind(this.changeHandler, this));
-              this._strand.addEventListener('widthChanged',
+              this.strand_.addEventListener('widthChanged',
                   goog.bind(this.changeHandler, this));
-              this._strand.addEventListener('sizeChanged',
+              this.strand_.addEventListener('sizeChanged',
                   goog.bind(this.sizeChangeHandler, this));
-              if (!isNaN(this._strand.explicitWidth) &&
-                  !isNaN(this._strand.explicitHeight))
+              if (!isNaN(this.strand_.explicitWidth) &&
+                  !isNaN(this.strand_.explicitHeight))
                 this.addOtherListeners();
             }
          }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d5797b8/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ListView.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ListView.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ListView.js
index e2a674c..23a70b8 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ListView.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/ListView.js
@@ -19,6 +19,7 @@ goog.require('org.apache.flex.core.IBeadView');
 goog.require('org.apache.flex.core.IItemRendererParent');
 goog.require('org.apache.flex.core.ILayoutParent');
 goog.require('org.apache.flex.core.ValuesManager');
+goog.require('org.apache.flex.html.beads.ContainerView');
 goog.require('org.apache.flex.html.beads.IListView');
 goog.require('org.apache.flex.html.beads.TextItemRendererFactoryForArrayData');
 goog.require('org.apache.flex.html.beads.models.ArraySelectionModel');
@@ -28,6 +29,7 @@ goog.require('org.apache.flex.html.supportClasses.DataGroup');
 
 /**
  * @constructor
+ * @extends {org.apache.flex.html.beads.ContainerView}
  * @implements {org.apache.flex.core.ILayoutParent}
  * @implements {org.apache.flex.html.beads.IListView}
  */
@@ -35,7 +37,11 @@ org.apache.flex.html.beads.ListView = function() {
   this.lastSelectedIndex = -1;
 
   this.className = 'ListView';
+  org.apache.flex.html.beads.ListView.base(this, 'constructor');
 };
+goog.inherits(
+    org.apache.flex.html.beads.ListView,
+    org.apache.flex.html.beads.ContainerView);
 
 
 /**
@@ -56,13 +62,8 @@ Object.defineProperties(org.apache.flex.html.beads.ListView.prototype,
{
         /** @this {org.apache.flex.html.beads.ListView} */
         set: function(value) {
             this.strand_ = value;
-
-            this.strand_.addEventListener('sizeChanged',
-                goog.bind(this.handleSizeChange, this));
-            this.strand_.addEventListener('widthChanged',
-                goog.bind(this.handleSizeChange, this));
-            this.strand_.addEventListener('heightChanged',
-                goog.bind(this.handleSizeChange, this));
+            org.apache.flex.utils.Language.superSetter(
+                org.apache.flex.html.beads.ListView, this, 'strand', value);
 
             this.model = this.strand_.model;
             this.model.addEventListener('selectedIndexChanged',
@@ -82,10 +83,7 @@ Object.defineProperties(org.apache.flex.html.beads.ListView.prototype,
{
               var m3 = org.apache.flex.core.ValuesManager.valuesImpl.getValue(this.strand_,
'iBeadLayout');
               this.layout_ = new m3();
               this.strand_.addBead(this.layout_);
-              //this.layout_.strand = this.strand_;
             }
-
-            this.handleSizeChange(null);
         }
     },
     /** @export */
@@ -129,6 +127,7 @@ org.apache.flex.html.beads.ListView.prototype.
 org.apache.flex.html.beads.ListView.prototype.
     dataProviderChangeHandler = function(value) {
     // override in subclass
+    this.changeHandler(value);
 };
 
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d5797b8/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/PanelView.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/PanelView.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/PanelView.js
index dccb179..e0c6d56 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/PanelView.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/PanelView.js
@@ -56,7 +56,7 @@ Object.defineProperties(org.apache.flex.html.beads.PanelView.prototype,
{
     contentView: {
         /** @this {org.apache.flex.html.beads.ContainerView} */
         get: function() {
-            return this._strand.contentArea;
+            return this.strand_.contentArea;
         }
     },
     /** @export */
@@ -68,16 +68,16 @@ Object.defineProperties(org.apache.flex.html.beads.PanelView.prototype,
{
             if (!this.titleBar_)
               this.titleBar_ = new org.apache.flex.html.TitleBar();
 
-            this._strand.titleBar = this.titleBar_;
+            this.strand_.titleBar = this.titleBar_;
             this.titleBar_.id = 'titleBar';
-            this.titleBar_.model = this._strand.model;
+            this.titleBar_.model = this.strand_.model;
 
-            this._strand.controlBar =
+            this.strand_.controlBar =
                 new org.apache.flex.html.ControlBar();
 
             // listen for changes to the strand's model so items can be changed
             // in the view
-            this._strand.model.addEventListener('titleChange',
+            this.strand_.model.addEventListener('titleChange',
                 goog.bind(this.changeHandler, this));
         }
     },
@@ -101,7 +101,7 @@ Object.defineProperties(org.apache.flex.html.beads.PanelView.prototype,
{
  */
 org.apache.flex.html.beads.PanelView.prototype.changeHandler =
     function(event) {
-  var strand = this._strand;
+  var strand = this.strand_;
   if (!this.titleBarAdded_)
   {
     this.titleBarAdded_ = true;
@@ -114,7 +114,7 @@ org.apache.flex.html.beads.PanelView.prototype.changeHandler =
     this.titleBar_.title = strand.model.title;
   }
 
-  var p = this._strand.positioner;
+  var p = this.strand_.positioner;
   if (!strand.isWidthSizedToContent()) {
     var w = strand.width;
     w -= p.offsetWidth - p.clientWidth;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2d5797b8/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
index 652fc75..23636e1 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/ButtonBarLayout.js
@@ -50,16 +50,6 @@ Object.defineProperties(org.apache.flex.html.beads.layouts.ButtonBarLayout.proto
         set: function(value) {
             if (this.strand_ !== value) {
               this.strand_ = value;
-              this.strand_.addEventListener('childrenAdded',
-                  goog.bind(this.changeHandler, this));
-              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));
-              this.strand_.addEventListener('sizeChanged',
-                  goog.bind(this.changeHandler, this));
               this.strand_.element.style.display = 'block';
             }
         }
@@ -79,10 +69,10 @@ Object.defineProperties(org.apache.flex.html.beads.layouts.ButtonBarLayout.proto
 
 
 /**
- * @param {org.apache.flex.events.Event} event The text getter.
+ * Performs the layout.
  */
 org.apache.flex.html.beads.layouts.ButtonBarLayout.
-    prototype.changeHandler = function(event) {
+    prototype.layout = function() {
 
   var layoutParent = this.strand_.getBeadByType(org.apache.flex.core.ILayoutParent);
   var contentView = layoutParent.contentView;
@@ -96,22 +86,20 @@ org.apache.flex.html.beads.layouts.ButtonBarLayout.
   for (var i = 0; i < n; i++)
   {
     var ir = itemRendererParent.getElementAt(i);
-    ir.y = 0;
     ir.height = useHeight;
-    ir.x = xpos;
-    ir.element.internalDisplay = 'inline-block';
-    ir.element.style['vertical-align'] = 'middle';
-    ir.element.style['text-align'] = 'center';
-    ir.element.style['left-margin'] = 'auto';
-    ir.element.style['right-margin'] = 'auto';
-
-    if (this.buttonWidths_ && !isNaN(this.buttonWidths_[i])) ir.width = this.buttonWidths_[i];
-    else ir.width = useWidth;
-
-    if (ir.element.style.display == 'none')
-      ir.lastDisplay_ = 'inline-block';
+    ir.positioner.internalDisplay = 'inline-block';
+    ir.positioner.style['vertical-align'] = 'middle';
+    ir.positioner.style['text-align'] = 'center';
+    ir.positioner.style['left-margin'] = 'auto';
+    ir.positioner.style['right-margin'] = 'auto';
+
+    if (this.buttonWidths_ && !isNaN(this.buttonWidths_[i])) ir.width = this.buttonWidths_[i]
- 2;
+    else ir.width = useWidth - 2;
+
+    if (ir.positioner.style.display == 'none')
+      ir.positioner.lastDisplay_ = 'inline-block';
     else
-      ir.element.style.display = 'inline-block';
+      ir.positioner.style.display = 'inline-block';
 
     xpos += ir.width;
   }


Mime
View raw message