| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview Polymer element for displaying a collapsable list of networks. | |
| 7 */ | |
| 8 | |
| 9 (function() { | |
| 10 | |
| 11 /** | |
| 12 * Polymer class definition for 'cr-network-list'. | |
| 13 * TODO(stevenjb): Update with iron-list(?) once implemented in Polymer 1.0. | |
| 14 * @element cr-network-list | |
| 15 */ | |
| 16 Polymer({ | |
| 17 is: 'cr-network-list', | |
| 18 | |
| 19 properties: { | |
| 20 /** | |
| 21 * The maximum height in pixels for the list. | |
| 22 */ | |
| 23 maxHeight: { | |
| 24 type: Number, | |
| 25 value: 1000, | |
| 26 observer: 'maxHeightChanged_' | |
| 27 }, | |
| 28 | |
| 29 /** | |
| 30 * Determines how the list item will be displayed: | |
| 31 * 'visible' - displays the network icon (with strength) and name | |
| 32 * 'known' - displays the visible info along with a toggle icon for the | |
| 33 * preferred status and a remove button. | |
| 34 */ | |
| 35 listType: { | |
| 36 type: String, | |
| 37 value: 'visible' | |
| 38 }, | |
| 39 | |
| 40 /** | |
| 41 * The list of network state properties for the items to display. | |
| 42 * | |
| 43 * @type {!Array<!CrOnc.NetworkStateProperties>} | |
| 44 */ | |
| 45 networks: { | |
| 46 type: Array, | |
| 47 value: function() { return []; } | |
| 48 }, | |
| 49 | |
| 50 /** | |
| 51 * True if the list is opened. | |
| 52 */ | |
| 53 opened: { | |
| 54 type: Boolean, | |
| 55 value: true | |
| 56 } | |
| 57 }, | |
| 58 | |
| 59 /** | |
| 60 * Polymer maxHeight changed method. | |
| 61 */ | |
| 62 maxHeightChanged_: function() { | |
| 63 this.$.container.style.maxHeight = this.maxHeight + 'px'; | |
| 64 }, | |
| 65 | |
| 66 /** | |
| 67 * Event triggered when a list item is tapped. | |
| 68 * @param {!{model: {item: !CrOnc.NetworkStateProperties}}} event | |
| 69 * @private | |
| 70 */ | |
| 71 onTap_: function(event) { | |
| 72 this.fire('selected', event.model.item); | |
| 73 }, | |
| 74 }); | |
| 75 })(); | |
| OLD | NEW |