OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """ | 3 """ |
4 Copyright 2014 Google Inc. | 4 Copyright 2014 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 | 8 |
9 ColumnHeaderFactory class (see class docstring for details) | 9 ColumnHeaderFactory class (see class docstring for details) |
10 """ | 10 """ |
11 | 11 |
12 # Keys used within dictionary representation of each column header. | 12 # Keys used within dictionary representation of each column header. |
| 13 # NOTE: Keep these in sync with static/constants.js |
13 KEY__HEADER_TEXT = 'headerText' | 14 KEY__HEADER_TEXT = 'headerText' |
14 KEY__HEADER_URL = 'headerUrl' | 15 KEY__HEADER_URL = 'headerUrl' |
15 KEY__IS_FILTERABLE = 'isFilterable' | 16 KEY__IS_FILTERABLE = 'isFilterable' |
16 KEY__IS_SORTABLE = 'isSortable' | 17 KEY__IS_SORTABLE = 'isSortable' |
17 KEY__VALUES_AND_COUNTS = 'valuesAndCounts' | 18 KEY__VALUES_AND_COUNTS = 'valuesAndCounts' |
18 | 19 |
19 | 20 |
20 class ColumnHeaderFactory(object): | 21 class ColumnHeaderFactory(object): |
21 """Factory which assembles the header for a single column of data.""" | 22 """Factory which assembles the header for a single column of data.""" |
22 | 23 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 asdict = { | 56 asdict = { |
56 KEY__HEADER_TEXT: self._header_text, | 57 KEY__HEADER_TEXT: self._header_text, |
57 KEY__IS_FILTERABLE: self._is_filterable, | 58 KEY__IS_FILTERABLE: self._is_filterable, |
58 KEY__IS_SORTABLE: self._is_sortable, | 59 KEY__IS_SORTABLE: self._is_sortable, |
59 } | 60 } |
60 if self._header_url: | 61 if self._header_url: |
61 asdict[KEY__HEADER_URL] = self._header_url | 62 asdict[KEY__HEADER_URL] = self._header_url |
62 if self._include_values_and_counts and values_and_counts_dict: | 63 if self._include_values_and_counts and values_and_counts_dict: |
63 asdict[KEY__VALUES_AND_COUNTS] = values_and_counts_dict | 64 asdict[KEY__VALUES_AND_COUNTS] = values_and_counts_dict |
64 return asdict | 65 return asdict |
OLD | NEW |