1 <!DOCTYPE html> 2 <!-- 3 Copyright 2016 The Chromium Authors. All rights reserved. 4 Use of this source code is governed by a BSD-style license that can be 5 found in the LICENSE file. 6 --> 7 8 <link rel="import" href="/tracing/ui/base/tab_view.html"> 9 <link rel="import" href="/tracing/ui/brushing_state_controller.html"> 10 <link rel="import" href="/tracing/value/ui/value_set_table.html"> 11 12 <dom-module id="tr-v-ui-value-set-view"> 13 <template> 14 <style> 15 :host { 16 font-family: sans-serif; 17 }; 18 </style> 19 20 <tr-v-ui-value-set-table id="valueSetTable"></tr-v-ui-value-set-table> 21 </template> 22 </dom-module> 23 24 <script> 25 'use strict'; 26 tr.exportTo('tr.v.ui', function() { 27 function NullBrushingStateController() { 28 this.parentController = undefined; 29 } 30 31 NullBrushingStateController.prototype = { 32 __proto__: tr.c.BrushingStateController.prototype, 33 34 dispatchChangeEvent_: function() { 35 if (this.parentController) 36 this.parentController.dispatchChangeEvent_(); 37 }, 38 39 get model() { 40 if (!this.parentController) 41 return undefined; 42 return this.parentController.model; 43 }, 44 45 get trackView() { 46 if (!this.parentController) 47 return undefined; 48 return this.parentController.trackView; 49 }, 50 51 get viewport() { 52 if (!this.parentController) 53 return undefined; 54 return this.parentController.viewport; 55 }, 56 57 get historyEnabled() { 58 if (!this.parentController) 59 return undefined; 60 return this.parentController.historyEnabled; 61 }, 62 63 set historyEnabled(historyEnabled) { 64 if (this.parentController) 65 this.parentController.historyEnabled = historyEnabled; 66 }, 67 68 modelWillChange: function() { 69 if (this.parentController) 70 this.parentController.modelWillChange(); 71 }, 72 73 modelDidChange: function() { 74 if (this.parentController) 75 this.parentController.modelDidChange(); 76 }, 77 78 onUserInitiatedSelectionChange_: function() { 79 if (this.parentController) 80 this.parentController.onUserInitiatedSelectionChange_(); 81 }, 82 83 onPopState_: function(e) { 84 if (this.parentController) 85 this.parentController.onPopState_(e); 86 }, 87 88 get selection() { 89 if (!this.parentController) 90 return undefined; 91 return this.parentController.selection; 92 }, 93 94 get findMatches() { 95 if (!this.parentController) 96 return undefined; 97 return this.parentController.findMatches; 98 }, 99 100 get selectionOfInterest() { 101 if (!this.parentController) 102 return undefined; 103 return this.parentController.selectionOfInterest; 104 }, 105 106 get currentBrushingState() { 107 if (!this.parentController) 108 return undefined; 109 return this.parentController.currentBrushingState; 110 }, 111 112 set currentBrushingState(newBrushingState) { 113 if (this.parentController) 114 this.parentController.currentBrushingState = newBrushingState; 115 }, 116 117 addAllEventsMatchingFilterToSelectionAsTask: function(filter, selection) { 118 if (this.parentController) { 119 this.parentController.addAllEventsMatchingFilterToSelectionAsTask( 120 filter, selection); 121 } 122 }, 123 124 findTextChangedTo: function(allPossibleMatches) { 125 if (this.parentController) 126 this.parentController.findTextChangedTo(allPossibleMatches); 127 }, 128 129 findFocusChangedTo: function(currentFocus) { 130 if (this.parentController) 131 this.parentController.findFocusChangedTo(currentFocus); 132 }, 133 134 findTextCleared: function() { 135 if (this.parentController) 136 this.parentController.findTextCleared(); 137 }, 138 139 uiStateFromString: function(string) { 140 if (this.parentController) 141 this.parentController.uiStateFromString(string); 142 }, 143 144 navToPosition: function(uiState, showNavLine) { 145 if (this.parentController) 146 this.parentController.navToPosition(uiState, showNavLine); 147 }, 148 149 changeSelectionFromTimeline: function(selection) { 150 if (this.parentController) 151 this.parentController.changeSelectionFromTimeline(selection); 152 }, 153 154 showScriptControlSelection: function(selection) { 155 if (this.parentController) 156 this.parentController.showScriptControlSelection(selection); 157 }, 158 159 changeSelectionFromRequestSelectionChangeEvent: function(selection) { 160 if (this.parentController) { 161 this.parentController.changeSelectionFromRequestSelectionChangeEvent( 162 selection); 163 } 164 }, 165 166 changeAnalysisViewRelatedEvents: function(eventSet) { 167 if (this.parentController && (eventSet instanceof tr.model.EventSet)) 168 this.parentController.changeAnalysisViewRelatedEvents(eventSet); 169 }, 170 171 changeAnalysisLinkHoveredEvents: function(eventSet) { 172 if (this.parentController && (eventSet instanceof tr.model.EventSet)) 173 this.parentController.changeAnalysisLinkHoveredEvents(eventSet); 174 }, 175 176 getViewSpecificBrushingState: function(viewId) { 177 if (this.parentController) 178 this.parentController.getViewSpecificBrushingState(viewId); 179 }, 180 181 changeViewSpecificBrushingState: function(viewId, newState) { 182 if (this.parentController) 183 this.parentController.changeViewSpecificBrushingState(viewId, newState); 184 } 185 }; 186 187 Polymer({ 188 is: 'tr-v-ui-value-set-view', 189 190 ready: function() { 191 this.brushingStateController = new NullBrushingStateController(); 192 }, 193 194 attached: function() { 195 this.brushingStateController.parentController = 196 tr.c.BrushingStateController.getControllerForElement(this.parentNode); 197 }, 198 199 /** 200 * @param {!tr.v.ValueSet} values 201 */ 202 set values(values) { 203 this.$.valueSetTable.values = values; 204 } 205 }); 206 207 return {}; 208 }); 209 </script> 210