Index: tracing/tracing/ui/base/list_and_associated_view.html |
diff --git a/tracing/tracing/ui/base/list_and_associated_view.html b/tracing/tracing/ui/base/list_and_associated_view.html |
deleted file mode 100644 |
index 69e88924b8fa2638eafa87cb3596965668b1b798..0000000000000000000000000000000000000000 |
--- a/tracing/tracing/ui/base/list_and_associated_view.html |
+++ /dev/null |
@@ -1,139 +0,0 @@ |
-<!DOCTYPE html> |
-<!-- |
-Copyright (c) 2014 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. |
---> |
- |
-<link rel="stylesheet" href="/tracing/ui/base/list_and_associated_view.css"> |
- |
-<link rel="import" href="/tracing/ui/base/list_view.html"> |
-<link rel="import" href="/tracing/ui/base/ui.html"> |
- |
-<script> |
-'use strict'; |
- |
-/** |
- * @fileoverview A list of things, and a viewer for the currently selected |
- * thing. |
- */ |
-tr.exportTo('tr.ui.b', function() { |
- /** |
- * @constructor |
- */ |
- const ListAndAssociatedView = tr.ui.b.define('x-list-and-associated-view'); |
- ListAndAssociatedView.prototype = { |
- __proto__: HTMLDivElement.prototype, |
- |
- decorate() { |
- this.list_ = undefined; |
- this.listProperty_ = undefined; |
- this.view_ = undefined; |
- this.viewProperty_ = undefined; |
- this.listView_ = new tr.ui.b.ListView(); |
- this.listView_.addEventListener('selection-changed', |
- this.onSelectionChanged_.bind(this)); |
- this.placeholder_ = document.createElement('div'); |
- Polymer.dom(this).appendChild(this.listView_); |
- Polymer.dom(this).appendChild(this.placeholder_); |
- }, |
- |
- get listView() { |
- return this.listView_; |
- }, |
- |
- get list() { |
- return this.list_; |
- }, |
- |
- set list(list) { |
- this.list_ = list; |
- this.updateChildren_(); |
- }, |
- |
- get listProperty() { |
- return this.listProperty_; |
- }, |
- |
- set listProperty(listProperty) { |
- this.listProperty_ = listProperty; |
- this.updateChildren_(); |
- }, |
- |
- get view() { |
- return this.view_; |
- }, |
- |
- set view(view) { |
- this.view_ = view; |
- this.updateChildren_(); |
- }, |
- |
- get viewProperty() { |
- return this.viewProperty_; |
- }, |
- |
- set viewProperty(viewProperty) { |
- this.viewProperty_ = viewProperty; |
- this.updateChildren_(); |
- }, |
- |
- updateChildren_() { |
- const complete = this.list_ && |
- this.listProperty_ && |
- this.view_ && |
- this.viewProperty_; |
- if (!complete) { |
- this.replaceChild(this.placeholder_, |
- this.children[1]); |
- return; |
- } |
- |
- for (let i = 0; i < this.list_.length; i++) { |
- let itemEl; |
- if (i >= this.listView_.children.length) { |
- itemEl = document.createElement('div'); |
- Polymer.dom(this.listView_).appendChild(itemEl); |
- } else { |
- itemEl = this.listView_.children[i]; |
- } |
- itemEl.item = this.list_[i]; |
- const getter = this.list_[i].__lookupGetter__(this.listProperty_); |
- if (getter) { |
- Polymer.dom(itemEl).textContent = getter.call(this.list_[i]); |
- } else { |
- Polymer.dom(itemEl).textContent = this.list_[i][this.listProperty_]; |
- } |
- } |
- |
- if (this.children[1] === this.placeholder_) { |
- this.replaceChild(this.view_, |
- this.children[1]); |
- } |
- if (this.listView_.children.length && |
- !this.listView_.selectedElement) { |
- this.listView_.selectedElement = this.listView_.children[0]; |
- } |
- }, |
- |
- onSelectionChanged_(e) { |
- let setter = this.view_.__lookupSetter__(this.viewProperty_); |
- if (!setter) { |
- const prop = this.viewProperty_; |
- setter = function(value) { this[prop] = value; }; |
- } |
- if (this.listView_.selectedElement) { |
- setter.call(this.view_, |
- this.listView_.selectedElement.item); |
- } else { |
- setter.call(this.view_, |
- undefined); |
- } |
- } |
- }; |
- |
- return { |
- ListAndAssociatedView, |
- }; |
-}); |
-</script> |