OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Class that represents a UI component. | 9 * Class that represents a UI component. |
10 * @constructor | 10 * @constructor |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 /** | 25 /** |
26 * Component's event tracker. | 26 * Component's event tracker. |
27 * @type {EventTracker} | 27 * @type {EventTracker} |
28 * @private | 28 * @private |
29 */ | 29 */ |
30 this.tracker_ = new EventTracker(); | 30 this.tracker_ = new EventTracker(); |
31 | 31 |
32 /** | 32 /** |
33 * Child components of the component. | 33 * Child components of the component. |
34 * @type {!Array.<!print_preview.Component>} | 34 * @type {!Array<!print_preview.Component>} |
35 * @private | 35 * @private |
36 */ | 36 */ |
37 this.children_ = []; | 37 this.children_ = []; |
38 }; | 38 }; |
39 | 39 |
40 Component.prototype = { | 40 Component.prototype = { |
41 __proto__: cr.EventTarget.prototype, | 41 __proto__: cr.EventTarget.prototype, |
42 | 42 |
43 /** Gets the component's element. */ | 43 /** Gets the component's element. */ |
44 getElement: function() { | 44 getElement: function() { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 * @param {Element} element Element to decorate. | 112 * @param {Element} element Element to decorate. |
113 */ | 113 */ |
114 decorate: function(element) { | 114 decorate: function(element) { |
115 assert(!this.isInDocument, 'Component is already in the document'); | 115 assert(!this.isInDocument, 'Component is already in the document'); |
116 this.setElementInternal(element); | 116 this.setElementInternal(element); |
117 this.decorateInternal(); | 117 this.decorateInternal(); |
118 this.enterDocument(); | 118 this.enterDocument(); |
119 }, | 119 }, |
120 | 120 |
121 /** | 121 /** |
122 * @return {!Array.<!print_preview.Component>} Child components of this | 122 * @return {!Array<!print_preview.Component>} Child components of this |
123 * component. | 123 * component. |
124 */ | 124 */ |
125 get children() { | 125 get children() { |
126 return this.children_; | 126 return this.children_; |
127 }, | 127 }, |
128 | 128 |
129 /** | 129 /** |
130 * @param {!print_preview.Component} child Component to add as a child of | 130 * @param {!print_preview.Component} child Component to add as a child of |
131 * this component. | 131 * this component. |
132 */ | 132 */ |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 setIsVisible(el, true); | 203 setIsVisible(el, true); |
204 } | 204 } |
205 return el; | 205 return el; |
206 } | 206 } |
207 }; | 207 }; |
208 | 208 |
209 return { | 209 return { |
210 Component: Component | 210 Component: Component |
211 }; | 211 }; |
212 }); | 212 }); |
OLD | NEW |