1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
<!DOCTYPE html>
<!--
Copyright (c) 2013 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="import" href="/tracing/base/base.html">
<link rel="import" href="/tracing/base/unit.html">
<link rel="import" href="/tracing/ui/base/table.html">
<link rel="import" href="/tracing/value/ui/scalar_span.html">
<dom-module id='tr-ui-a-selection-summary-table'>
<template>
<style>
:host {
display: flex;
}
#table {
flex: 1 1 auto;
align-self: stretch;
font-size: 12px;
}
</style>
<tr-ui-b-table id="table">
</tr-ui-b-table>
</div>
</template>
</dom-module>
<script>
'use strict';
Polymer({
is: 'tr-ui-a-selection-summary-table',
created: function() {
this.selection_ = new tr.b.Range();
},
ready: function() {
this.$.table.showHeader = false;
this.$.table.tableColumns = [
{
title: 'Name',
value: function(row) { return row.title; },
width: '350px'
},
{
title: 'Value',
width: '100%',
value: function(row) {
return row.value;
}
}
];
},
get selection() {
return this.selection_;
},
set selection(selection) {
this.selection_ = selection;
this.updateContents_();
},
updateContents_: function() {
var selection = this.selection_;
var rows = [];
var hasRange;
if (this.selection_ && (!selection.bounds.isEmpty))
hasRange = true;
else
hasRange = false;
rows.push({
title: 'Selection start',
value: hasRange ? tr.v.ui.createScalarSpan(
selection.bounds.min, {
unit: tr.b.Unit.byName.timeStampInMs,
ownerDocument: this.ownerDocument
}) : '<empty>'
});
rows.push({
title: 'Selection extent',
value: hasRange ? tr.v.ui.createScalarSpan(
selection.bounds.range, {
unit: tr.b.Unit.byName.timeDurationInMs,
ownerDocument: this.ownerDocument
}) : '<empty>'
});
this.$.table.tableRows = rows;
this.$.table.rebuild();
}
});
</script>
|