Index: tracing/tracing/value/ui/value_set_view.html |
diff --git a/tracing/tracing/value/ui/value_set_view.html b/tracing/tracing/value/ui/value_set_view.html |
index 0deec4dd304305493aa2796ad557e94dc9d38535..9941179ec1bada70311dfe0deb39abb68f7448db 100644 |
--- a/tracing/tracing/value/ui/value_set_view.html |
+++ b/tracing/tracing/value/ui/value_set_view.html |
@@ -6,17 +6,177 @@ found in the LICENSE file. |
--> |
<link rel="import" href="/tracing/ui/base/tab_view.html"> |
-<link rel="import" href="/tracing/ui/base/utils.html"> |
+<link rel="import" href="/tracing/ui/brushing_state_controller.html"> |
<dom-module id="tr-v-ui-value-set-view"> |
<template> |
- <tr-ui-a-tab-view id="container"></tr-ui-a-tab-view> |
+ <tr-ui-a-tab-view id="tabView"></tr-ui-a-tab-view> |
</template> |
</dom-module> |
<script> |
'use strict'; |
-tr.exportTo('tr.ui', function() { |
+tr.exportTo('tr.v.ui', function() { |
+ function NullBrushingStateController() { |
+ this.parentController = undefined; |
+ } |
+ |
+ NullBrushingStateController.prototype = { |
+ __proto__: tr.c.BrushingStateController.prototype, |
+ |
+ dispatchChangeEvent_: function() { |
+ if (this.parentController) |
+ this.parentController.dispatchChangeEvent_(); |
+ }, |
+ |
+ get model() { |
+ if (!this.parentController) |
+ return undefined; |
+ return this.parentController.model; |
+ }, |
+ |
+ get trackView() { |
+ if (!this.parentController) |
+ return undefined; |
+ return this.parentController.trackView; |
+ }, |
+ |
+ get viewport() { |
+ if (!this.parentController) |
+ return undefined; |
+ return this.parentController.viewport; |
+ }, |
+ |
+ get historyEnabled() { |
+ if (!this.parentController) |
+ return undefined; |
+ return this.parentController.historyEnabled; |
+ }, |
+ |
+ set historyEnabled(historyEnabled) { |
+ if (this.parentController) |
+ this.parentController.historyEnabled = historyEnabled; |
+ }, |
+ |
+ modelWillChange: function() { |
+ if (this.parentController) |
+ this.parentController.modelWillChange(); |
+ }, |
+ |
+ modelDidChange: function() { |
+ if (this.parentController) |
+ this.parentController.modelDidChange(); |
+ }, |
+ |
+ onUserInitiatedSelectionChange_: function() { |
+ if (this.parentController) |
+ this.parentController.onUserInitiatedSelectionChange_(); |
+ }, |
+ |
+ onPopState_: function(e) { |
+ if (this.parentController) |
+ this.parentController.onPopState_(e); |
+ }, |
+ |
+ get selection() { |
+ if (!this.parentController) |
+ return undefined; |
+ return this.parentController.selection; |
+ }, |
+ |
+ get findMatches() { |
+ if (!this.parentController) |
+ return undefined; |
+ return this.parentController.findMatches; |
+ }, |
+ |
+ get selectionOfInterest() { |
+ if (!this.parentController) |
+ return undefined; |
+ return this.parentController.selectionOfInterest; |
+ }, |
+ |
+ get currentBrushingState() { |
+ if (!this.parentController) |
+ return undefined; |
+ return this.parentController.currentBrushingState; |
+ }, |
+ |
+ set currentBrushingState(newBrushingState) { |
+ if (this.parentController) |
+ this.parentController.currentBrushingState = newBrushingState; |
+ }, |
+ |
+ addAllEventsMatchingFilterToSelectionAsTask: function(filter, selection) { |
+ if (this.parentController) { |
+ this.parentController.addAllEventsMatchingFilterToSelectionAsTask( |
+ filter, selection); |
+ } |
+ }, |
+ |
+ findTextChangedTo: function(allPossibleMatches) { |
+ if (this.parentController) |
+ this.parentController.findTextChangedTo(allPossibleMatches); |
+ }, |
+ |
+ findFocusChangedTo: function(currentFocus) { |
+ if (this.parentController) |
+ this.parentController.findFocusChangedTo(currentFocus); |
+ }, |
+ |
+ findTextCleared: function() { |
+ if (this.parentController) |
+ this.parentController.findTextCleared(); |
+ }, |
+ |
+ uiStateFromString: function(string) { |
+ if (this.parentController) |
+ this.parentController.uiStateFromString(string); |
+ }, |
+ |
+ navToPosition: function(uiState, showNavLine) { |
+ if (this.parentController) |
+ this.parentController.navToPosition(uiState, showNavLine); |
+ }, |
+ |
+ changeSelectionFromTimeline: function(selection) { |
+ if (this.parentController) |
+ this.parentController.changeSelectionFromTimeline(selection); |
+ }, |
+ |
+ showScriptControlSelection: function(selection) { |
+ if (this.parentController) |
+ this.parentController.showScriptControlSelection(selection); |
+ }, |
+ |
+ changeSelectionFromRequestSelectionChangeEvent: function(selection) { |
+ if (this.parentController) { |
+ this.parentController.changeSelectionFromRequestSelectionChangeEvent( |
+ selection); |
+ } |
+ }, |
+ |
+ changeAnalysisViewRelatedEvents: function(eventSet) { |
+ if (this.parentController && (eventSet instanceof tr.model.EventSet)) |
+ this.parentController.changeAnalysisViewRelatedEvents(eventSet); |
+ }, |
+ |
+ changeAnalysisLinkHoveredEvents: function(eventSet) { |
+ if (this.parentController && (eventSet instanceof tr.model.EventSet)) |
+ this.parentController.changeAnalysisLinkHoveredEvents(eventSet); |
+ }, |
+ |
+ getViewSpecificBrushingState: function(viewId) { |
+ if (this.parentController) |
+ this.parentController.getViewSpecificBrushingState(viewId); |
+ }, |
+ |
+ changeViewSpecificBrushingState: function(viewId, newState) { |
+ if (this.parentController) |
+ this.parentController.changeViewSpecificBrushingState(viewId, newState); |
+ } |
+ }; |
+ |
var VALUE_SET_VIEW_ELEMENT_NAMES = []; |
var SELECTED_TAB_SETTINGS_KEY = 'tr-v-ui-value-set-view-element-name'; |
@@ -24,25 +184,33 @@ tr.exportTo('tr.ui', function() { |
Polymer({ |
is: 'tr-v-ui-value-set-view', |
+ listeners: { |
+ 'tabView.selected-tab-change': 'onSelectedTabChange_' |
+ }, |
+ |
ready: function() { |
- this.$.container.addEventListener( |
- 'selected-tab-change', this.onSelectedTabChange_.bind(this)); |
+ this.brushingStateController = new NullBrushingStateController(); |
+ }, |
+ |
+ attached: function() { |
+ this.brushingStateController.parentController = |
+ tr.c.BrushingStateController.getControllerForElement(this.parentNode); |
}, |
onSelectedTabChange_: function() { |
- if (!this.$.container.selectedTab) |
+ if (!this.$.tabView.selectedSubView) |
return; |
tr.b.Settings.set( |
SELECTED_TAB_SETTINGS_KEY, |
- this.$.container.selectedTab.tagName); |
+ this.$.tabView.selectedSubView.tagName.toLowerCase()); |
}, |
/** |
* @param {!tr.v.ValueSet} values |
*/ |
set values(values) { |
- this.$.container.textContent = ''; |
+ this.$.tabView.clearSubViews(); |
var initialTabElementName = tr.b.Settings.get( |
SELECTED_TAB_SETTINGS_KEY, undefined); |
@@ -54,17 +222,15 @@ tr.exportTo('tr.ui', function() { |
view.values = values; |
- if ((elementName === initialTabElementName) || |
- (index === 0)) |
- Polymer.dom(view).setAttribute('selected', true); |
- |
- Polymer.dom(view).setAttribute('tab-label', view.tabLabel); |
+ this.$.tabView.addSubView(view); |
- Polymer.dom(this.$.container).appendChild(view); |
+ if (elementName.toLowerCase() === initialTabElementName) |
+ this.$.tabView.selectedSubView = view; |
}, this); |
- if (this.$.container.children.length === 1) |
- this.$.container.tabsHidden = true; |
+ // TODO(charliea): If TabView were structured correctly, this could almost |
+ // certainly be done with attribute binding in the HTML template. |
+ this.$.tabView.set('tabsHidden', this$.tabView.tabs.length === 1); |
} |
}); |
@@ -81,7 +247,8 @@ tr.exportTo('tr.ui', function() { |
} |
return { |
- registerValueSetView: registerValueSetView |
+ registerValueSetView: registerValueSetView, |
+ SELECTED_TAB_SETTINGS_KEY: SELECTED_TAB_SETTINGS_KEY |
}; |
}); |
</script> |