| 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 'network-list'. | |
| 13 * TODO(stevenjb): Update with iron-list(?) once implemented in Polymer 1.0. | |
| 14 * @element network-list | |
| 15 */ | |
| 16 Polymer({ | |
| 17 is: '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 * The list of network state properties for the items to display. | |
| 31 * | |
| 32 * @type {!Array<!CrOnc.NetworkStateProperties>} | |
| 33 */ | |
| 34 networks: { | |
| 35 type: Array, | |
| 36 value: function() { return []; } | |
| 37 }, | |
| 38 | |
| 39 /** | |
| 40 * True if the list is opened. | |
| 41 */ | |
| 42 opened: { | |
| 43 type: Boolean, | |
| 44 value: true | |
| 45 } | |
| 46 }, | |
| 47 | |
| 48 /** | |
| 49 * Polymer maxHeight changed method. | |
| 50 */ | |
| 51 maxHeightChanged_: function() { | |
| 52 this.$.container.style.maxHeight = this.maxHeight + 'px'; | |
| 53 }, | |
| 54 | |
| 55 /** | |
| 56 * Called when the cr-collapse element changes size (i.e. is opened). | |
| 57 * @private | |
| 58 */ | |
| 59 onResized_: function() { | |
| 60 if (this.opened) | |
| 61 this.$.networkList.updateSize(); | |
| 62 }, | |
| 63 | |
| 64 /** | |
| 65 * Event triggered when a list item is selected. | |
| 66 * @param {!{target: !NetworkListItem}} event | |
| 67 * @private | |
| 68 */ | |
| 69 onSelected_: function(event) { | |
| 70 this.fire('selected', event.model.item); | |
| 71 } | |
| 72 }); | |
| 73 })(); | |
| OLD | NEW |