Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Unified Diff: netlog_viewer/top_mid_bottom_view.js

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « netlog_viewer/top_bar_view.js ('k') | netlog_viewer/ui_webui_resources_js_util.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: netlog_viewer/top_mid_bottom_view.js
diff --git a/netlog_viewer/top_mid_bottom_view.js b/netlog_viewer/top_mid_bottom_view.js
new file mode 100644
index 0000000000000000000000000000000000000000..04e97653592f2fb3446848198628fdda5a6cfabf
--- /dev/null
+++ b/netlog_viewer/top_mid_bottom_view.js
@@ -0,0 +1,84 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var TopMidBottomView = (function() {
+ 'use strict';
+
+ // We inherit from View.
+ var superClass = View;
+
+ /**
+ * This view stacks three boxes -- one at the top, one at the bottom, and
+ * one that fills the remaining space between those two. Either the top
+ * or the bottom bar may be null.
+ *
+ * +----------------------+
+ * | topbar |
+ * +----------------------+
+ * | |
+ * | |
+ * | |
+ * | |
+ * | middlebox |
+ * | |
+ * | |
+ * | |
+ * | |
+ * | |
+ * +----------------------+
+ * | bottombar |
+ * +----------------------+
+ *
+ * @constructor
+ */
+ function TopMidBottomView(topView, midView, bottomView) {
+ superClass.call(this);
+
+ this.topView_ = topView;
+ this.midView_ = midView;
+ this.bottomView_ = bottomView;
+ }
+
+ TopMidBottomView.prototype = {
+ // Inherit the superclass's methods.
+ __proto__: superClass.prototype,
+
+ setGeometry: function(left, top, width, height) {
+ superClass.prototype.setGeometry.call(this, left, top, width, height);
+
+ // Calculate the vertical split points.
+ var topbarHeight = 0;
+ if (this.topView_)
+ topbarHeight = this.topView_.getHeight();
+ var bottombarHeight = 0;
+ if (this.bottomView_)
+ bottombarHeight = this.bottomView_.getHeight();
+ var middleboxHeight = height - (topbarHeight + bottombarHeight);
+ if (middleboxHeight < 0)
+ middleboxHeight = 0;
+
+ // Position the boxes using calculated split points.
+ if (this.topView_)
+ this.topView_.setGeometry(left, top, width, topbarHeight);
+ this.midView_.setGeometry(left, top + topbarHeight, width,
+ middleboxHeight);
+ if (this.bottomView_) {
+ this.bottomView_.setGeometry(left, top + topbarHeight + middleboxHeight,
+ width, bottombarHeight);
+ }
+ },
+
+ show: function(isVisible) {
+ superClass.prototype.show.call(this, isVisible);
+ if (this.topView_)
+ this.topView_.show(isVisible);
+ this.midView_.show(isVisible);
+ if (this.bottomView_)
+ this.bottomView_.show(isVisible);
+ }
+ };
+
+ return TopMidBottomView;
+})();
+
« no previous file with comments | « netlog_viewer/top_bar_view.js ('k') | netlog_viewer/ui_webui_resources_js_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698