| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="stylesheet" href="/tracing/ui/base/list_and_associated_view.css"> | 8 <link rel="stylesheet" href="/tracing/ui/base/list_and_associated_view.css"> |
| 9 | 9 |
| 10 <link rel="import" href="/tracing/ui/base/list_view.html"> | 10 <link rel="import" href="/tracing/ui/base/list_view.html"> |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 for (var i = 0; i < this.list_.length; i++) { | 92 for (var i = 0; i < this.list_.length; i++) { |
| 93 var itemEl; | 93 var itemEl; |
| 94 if (i >= this.listView_.children.length) { | 94 if (i >= this.listView_.children.length) { |
| 95 itemEl = document.createElement('div'); | 95 itemEl = document.createElement('div'); |
| 96 Polymer.dom(this.listView_).appendChild(itemEl); | 96 Polymer.dom(this.listView_).appendChild(itemEl); |
| 97 } else { | 97 } else { |
| 98 itemEl = this.listView_.children[i]; | 98 itemEl = this.listView_.children[i]; |
| 99 } | 99 } |
| 100 itemEl.item = this.list_[i]; | 100 itemEl.item = this.list_[i]; |
| 101 var getter = this.list_[i].__lookupGetter__(this.listProperty_); | 101 var getter = this.list_[i].__lookupGetter__(this.listProperty_); |
| 102 if (getter) | 102 if (getter) { |
| 103 Polymer.dom(itemEl).textContent = getter.call(this.list_[i]); | 103 Polymer.dom(itemEl).textContent = getter.call(this.list_[i]); |
| 104 else | 104 } else { |
| 105 Polymer.dom(itemEl).textContent = this.list_[i][this.listProperty_]; | 105 Polymer.dom(itemEl).textContent = this.list_[i][this.listProperty_]; |
| 106 } |
| 106 } | 107 } |
| 107 | 108 |
| 108 if (this.children[1] === this.placeholder_) { | 109 if (this.children[1] === this.placeholder_) { |
| 109 this.replaceChild(this.view_, | 110 this.replaceChild(this.view_, |
| 110 this.children[1]); | 111 this.children[1]); |
| 111 } | 112 } |
| 112 if (this.listView_.children.length && | 113 if (this.listView_.children.length && |
| 113 !this.listView_.selectedElement) | 114 !this.listView_.selectedElement) { |
| 114 this.listView_.selectedElement = this.listView_.children[0]; | 115 this.listView_.selectedElement = this.listView_.children[0]; |
| 116 } |
| 115 }, | 117 }, |
| 116 | 118 |
| 117 onSelectionChanged_: function(e) { | 119 onSelectionChanged_: function(e) { |
| 118 var setter = this.view_.__lookupSetter__(this.viewProperty_); | 120 var setter = this.view_.__lookupSetter__(this.viewProperty_); |
| 119 if (!setter) { | 121 if (!setter) { |
| 120 var prop = this.viewProperty_; | 122 var prop = this.viewProperty_; |
| 121 setter = function(value) { this[prop] = value; }; | 123 setter = function(value) { this[prop] = value; }; |
| 122 } | 124 } |
| 123 if (this.listView_.selectedElement) { | 125 if (this.listView_.selectedElement) { |
| 124 setter.call(this.view_, | 126 setter.call(this.view_, |
| 125 this.listView_.selectedElement.item); | 127 this.listView_.selectedElement.item); |
| 126 } else { | 128 } else { |
| 127 setter.call(this.view_, | 129 setter.call(this.view_, |
| 128 undefined); | 130 undefined); |
| 129 } | 131 } |
| 130 } | 132 } |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 return { | 135 return { |
| 134 ListAndAssociatedView, | 136 ListAndAssociatedView, |
| 135 }; | 137 }; |
| 136 }); | 138 }); |
| 137 </script> | 139 </script> |
| OLD | NEW |