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 * Component that renders the copies settings UI. | 9 * Component that renders the copies settings UI. |
10 * @param {!print_preview.ticket_items.Copies} copiesTicketItem Used to read | 10 * @param {!print_preview.ticket_items.Copies} copiesTicketItem Used to read |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 this.getChildElement('button.decrement').disabled = true; | 68 this.getChildElement('button.decrement').disabled = true; |
69 } | 69 } |
70 }, | 70 }, |
71 | 71 |
72 /** @override */ | 72 /** @override */ |
73 enterDocument: function() { | 73 enterDocument: function() { |
74 print_preview.Component.prototype.enterDocument.call(this); | 74 print_preview.Component.prototype.enterDocument.call(this); |
75 | 75 |
76 this.tracker.add( | 76 this.tracker.add( |
77 this.getChildElement('input.copies'), | 77 this.getChildElement('input.copies'), |
78 'keyup', | 78 'input', |
79 this.onTextfieldKeyUp_.bind(this)); | 79 this.onTextfieldInput_.bind(this)); |
80 this.tracker.add( | 80 this.tracker.add( |
81 this.getChildElement('input.copies'), | 81 this.getChildElement('input.copies'), |
82 'blur', | 82 'blur', |
83 this.onTextfieldBlur_.bind(this)); | 83 this.onTextfieldBlur_.bind(this)); |
84 this.tracker.add( | 84 this.tracker.add( |
85 this.getChildElement('button.increment'), | 85 this.getChildElement('button.increment'), |
86 'click', | 86 'click', |
87 this.onButtonClicked_.bind(this, 1)); | 87 this.onButtonClicked_.bind(this, 1)); |
88 this.tracker.add( | 88 this.tracker.add( |
89 this.getChildElement('button.decrement'), | 89 this.getChildElement('button.decrement'), |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 * @private | 168 * @private |
169 */ | 169 */ |
170 onTextfieldTimeout_: function() { | 170 onTextfieldTimeout_: function() { |
171 var copiesVal = this.getChildElement('input.copies').value; | 171 var copiesVal = this.getChildElement('input.copies').value; |
172 if (copiesVal != '') { | 172 if (copiesVal != '') { |
173 this.copiesTicketItem_.updateValue(copiesVal); | 173 this.copiesTicketItem_.updateValue(copiesVal); |
174 } | 174 } |
175 }, | 175 }, |
176 | 176 |
177 /** | 177 /** |
178 * Called when a keyup event occurs on the textfield. Starts an input | 178 * Called when a input event occurs on the textfield. Starts an input |
179 * timeout. | 179 * timeout. |
180 * @param {Event} event Contains the pressed key. | |
181 * @private | 180 * @private |
182 */ | 181 */ |
183 onTextfieldKeyUp_: function(event) { | 182 onTextfieldInput_: function() { |
184 if (this.textfieldTimeout_) { | 183 if (this.textfieldTimeout_) { |
185 clearTimeout(this.textfieldTimeout_); | 184 clearTimeout(this.textfieldTimeout_); |
186 } | 185 } |
187 this.textfieldTimeout_ = setTimeout( | 186 this.textfieldTimeout_ = setTimeout( |
188 this.onTextfieldTimeout_.bind(this), CopiesSettings.TEXTFIELD_DELAY_); | 187 this.onTextfieldTimeout_.bind(this), CopiesSettings.TEXTFIELD_DELAY_); |
189 }, | 188 }, |
190 | 189 |
191 /** | 190 /** |
192 * Called when the focus leaves the textfield. If the textfield is empty, | 191 * Called when the focus leaves the textfield. If the textfield is empty, |
193 * its value is set to 1. | 192 * its value is set to 1. |
(...skipping 13 matching lines...) Expand all Loading... |
207 this.collateTicketItem_.updateValue( | 206 this.collateTicketItem_.updateValue( |
208 this.getChildElement('input.collate').checked); | 207 this.getChildElement('input.collate').checked); |
209 } | 208 } |
210 }; | 209 }; |
211 | 210 |
212 // Export | 211 // Export |
213 return { | 212 return { |
214 CopiesSettings: CopiesSettings | 213 CopiesSettings: CopiesSettings |
215 }; | 214 }; |
216 }); | 215 }); |
OLD | NEW |