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] - For JS, have the Container run its layout whenever elements are added or removed. For now, see that all elements being handled by some layouts have style.position set to relative.
Date Thu, 06 Aug 2015 19:15:05 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop c023d4b87 -> 4d41525ea


For JS, have the Container run its layout whenever elements are added or removed. For now,
see that all elements being handled by some layouts have style.position set to relative.


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

Branch: refs/heads/develop
Commit: 4d41525ea398f53323075e4b586050e7f32ee9ee
Parents: c023d4b
Author: Peter Ent <pent@apache.org>
Authored: Thu Aug 6 15:14:59 2015 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Thu Aug 6 15:14:59 2015 -0400

----------------------------------------------------------------------
 .../js/src/org/apache/flex/html/Container.js    | 29 ++++++++++++++++++++
 .../flex/html/beads/layouts/ButtonBarLayout.js  |  1 +
 .../flex/html/beads/layouts/HorizontalLayout.js |  1 +
 .../flex/html/beads/layouts/VerticalLayout.js   |  5 ++++
 4 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d41525e/frameworks/projects/HTML/js/src/org/apache/flex/html/Container.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/Container.js b/frameworks/projects/HTML/js/src/org/apache/flex/html/Container.js
index 6df5e14..6bc255d 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/Container.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/Container.js
@@ -15,6 +15,7 @@
 goog.provide('org.apache.flex.html.Container');
 
 goog.require('org.apache.flex.core.ContainerBase');
+goog.require('org.apache.flex.core.IBeadLayout');
 goog.require('org.apache.flex.core.IContainer');
 
 
@@ -59,6 +60,11 @@ org.apache.flex.html.Container.prototype.createElement =
   this.positioner.style.position = 'relative';
   this.element.flexjs_wrapper = this;
 
+  this.addEventListener('elementAdded',
+              goog.bind(this.runLayoutHandler, this));
+  this.addEventListener('elementRemoved',
+              goog.bind(this.runLayoutHandler, this));
+
   return this.element;
 };
 
@@ -74,6 +80,16 @@ org.apache.flex.html.Container.prototype.addElement =
 
 
 /**
+ * @override
+ */
+org.apache.flex.html.Container.prototype.removeElement =
+    function(child) {
+  org.apache.flex.html.Container.base(this, 'removeElement', child);
+  this.dispatchEvent('elementRemoved');
+};
+
+
+/**
  * @export
  */
 org.apache.flex.html.Container.prototype.childrenAdded =
@@ -84,6 +100,19 @@ org.apache.flex.html.Container.prototype.childrenAdded =
 
 /**
  * @export
+ * @param {Object} event The event invoking the layout.
+ */
+org.apache.flex.html.Container.prototype.runLayoutHandler =
+  function(event) {
+  var layout = this.getBeadByType(org.apache.flex.core.IBeadLayout);
+  if (layout) {
+    layout.layout();
+  }
+};
+
+
+/**
+ * @export
  * @return {Array} the HTML DOM element children.
  */
 org.apache.flex.html.Container.prototype.internalChildren =

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d41525e/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 9d5d149..a57a255 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
@@ -88,6 +88,7 @@ org.apache.flex.html.beads.layouts.ButtonBarLayout.
     var ir = itemRendererParent.getElementAt(i);
     ir.height = useHeight;
     ir.positioner.internalDisplay = 'inline-block';
+    ir.positioner.style['position'] = 'relative';
     ir.positioner.style['vertical-align'] = 'middle';
     ir.positioner.style['text-align'] = 'center';
     ir.positioner.style['left-margin'] = 'auto';

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d41525e/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/HorizontalLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/HorizontalLayout.js
b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/HorizontalLayout.js
index f6c447c..2430f4a 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/HorizontalLayout.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/HorizontalLayout.js
@@ -67,6 +67,7 @@ org.apache.flex.html.beads.layouts.HorizontalLayout.
   {
     var child = children[i];
     child.internalDisplay = 'inline-block';
+    child.style.position = 'relative';
     if (child.style.display == 'none')
       child.lastDisplay_ = 'inline-block';
     else

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/4d41525e/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
index a9c408c..463af77 100644
--- a/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
+++ b/frameworks/projects/HTML/js/src/org/apache/flex/html/beads/layouts/VerticalLayout.js
@@ -15,6 +15,7 @@
 goog.provide('org.apache.flex.html.beads.layouts.VerticalLayout');
 
 goog.require('org.apache.flex.core.IBeadLayout');
+goog.require('org.apache.flex.utils.Language');
 
 
 
@@ -48,6 +49,9 @@ Object.defineProperties(org.apache.flex.html.beads.layouts.VerticalLayout.protot
             if (this.strand_ !== value) {
               this.strand_ = value;
             }
+        },
+        get: function() {
+            return this.strand_;
         }
     }
 });
@@ -65,6 +69,7 @@ org.apache.flex.html.beads.layouts.VerticalLayout.
   {
     var child = children[i];
     child.internalDisplay = 'block';
+    child.style.position = 'relative';
     if (child.style.display === 'none') {
       child.lastDisplay_ = 'block';
     } else {


Mime
View raw message