You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/01/23 21:24:21 UTC

[11/14] git commit: [flex-asjs] [refs/heads/develop] - fix titlebar handling

fix titlebar handling


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

Branch: refs/heads/develop
Commit: 44ca43d1a85d953b237cac4d1226fc4de2ad9b35
Parents: d10475a
Author: Alex Harui <ah...@apache.org>
Authored: Fri Jan 23 12:23:18 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Jan 23 12:24:05 2015 -0800

----------------------------------------------------------------------
 .../src/org/apache/flex/html/beads/PanelView.js | 47 +++++++++++++++-----
 1 file changed, 36 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/44ca43d1/frameworks/js/FlexJS/src/org/apache/flex/html/beads/PanelView.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/PanelView.js b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/PanelView.js
index 633b1db..13d608f 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/PanelView.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/PanelView.js
@@ -28,6 +28,11 @@ org.apache.flex.html.beads.PanelView = function() {
   */
   this.titleBarAdded_ = false;
 
+  /**
+   * @private
+   * @type {Object}
+  */
+  this.titleBar_ = false;
 };
 
 
@@ -52,13 +57,12 @@ org.apache.flex.html.beads.PanelView.prototype.set_strand =
 
   this.strand_ = value;
 
-  if (!this.titleBar)
-    this.strand_.titleBar = new org.apache.flex.html.TitleBar();
-  else
-    this.strand_.titleBar = this.titleBar;
+  if (!this.titleBar_)
+    this.titleBar_ = new org.apache.flex.html.TitleBar();
 
-  this.strand_.titleBar.set_id('titleBar');
-  this.strand_.titleBar.set_model(this.strand_.get_model());
+  this.strand_.titleBar = this.titleBar_;
+  this.titleBar_.set_id('titleBar');
+  this.titleBar_.set_model(this.strand_.get_model());
 
   this.strand_.controlBar =
       new org.apache.flex.html.ControlBar();
@@ -83,25 +87,26 @@ org.apache.flex.html.beads.PanelView.prototype.changeHandler =
   if (!this.titleBarAdded_)
   {
     this.titleBarAdded_ = true;
-    strand.addElement(strand.titleBar);
-    strand.addElement(strand.controlBar);
+    strand.addElement(this.titleBar_);
+	if (strand.controlBar != null)
+      strand.addElement(strand.controlBar);
   }
 
   if (event.type == 'titleChange') {
-    strand.titleBar.set_title(strand.model.get_title());
+    this.titleBar_.set_title(strand.model.get_title());
   }
 
   var p = this.strand_.positioner;
   if (!strand.isWidthSizedToContent()) {
     var w = strand.get_width();
     w -= p.offsetWidth - p.clientWidth;
-    strand.titleBar.setWidth(w);
+    this.titleBar_.setWidth(w);
     strand.contentArea.style.width = w.toString() + 'px';
     if (strand.controlBar)
       strand.controlBar.setWidth(w);
   }
   if (!strand.isHeightSizedToContent()) {
-    var t = strand.titleBar.get_height();
+    var t = this.titleBar_.get_height();
     var b = 0;
     if (strand.controlBar)
       b = strand.controlBar.get_height();
@@ -112,3 +117,23 @@ org.apache.flex.html.beads.PanelView.prototype.changeHandler =
   }
   this.strand_.dispatchEvent('layoutNeeded');
 };
+
+
+/**
+ * @expose
+ * @return {Object} The titleBar getter.
+ */
+org.apache.flex.html.beads.PanelView.prototype.get_titleBar =
+    function() {
+  return this.titleBar_;
+};
+
+
+/**
+ * @expose
+ * @param {Object} value The titleBar setter.
+ */
+org.apache.flex.html.beads.PanelView.prototype.set_titleBar =
+    function(value) {
+  this.titleBar_ = value;
+};