| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 * @private | 44 * @private |
| 45 */ | 45 */ |
| 46 this.isEnabled_ = true; | 46 this.isEnabled_ = true; |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * The element for the user input value. | 49 * The element for the user input value. |
| 50 * @type {HTMLElement} | 50 * @type {HTMLElement} |
| 51 * @private | 51 * @private |
| 52 */ | 52 */ |
| 53 this.inputField_ = null; | 53 this.inputField_ = null; |
| 54 }; | 54 } |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * Delay in milliseconds before processing the textfield. | 57 * Delay in milliseconds before processing the textfield. |
| 58 * @type {number} | 58 * @type {number} |
| 59 * @private | 59 * @private |
| 60 */ | 60 */ |
| 61 CopiesSettings.TEXTFIELD_DELAY_MS_ = 250; | 61 CopiesSettings.TEXTFIELD_DELAY_MS_ = 250; |
| 62 | 62 |
| 63 CopiesSettings.prototype = { | 63 CopiesSettings.prototype = { |
| 64 __proto__: print_preview.SettingsSection.prototype, | 64 __proto__: print_preview.SettingsSection.prototype, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 78 this.inputField_.disabled = !isEnabled; | 78 this.inputField_.disabled = !isEnabled; |
| 79 this.getChildElement('input.collate').disabled = !isEnabled; | 79 this.getChildElement('input.collate').disabled = !isEnabled; |
| 80 this.isEnabled_ = isEnabled; | 80 this.isEnabled_ = isEnabled; |
| 81 if (isEnabled) { | 81 if (isEnabled) { |
| 82 this.updateState_(); | 82 this.updateState_(); |
| 83 } | 83 } |
| 84 }, | 84 }, |
| 85 | 85 |
| 86 /** @override */ | 86 /** @override */ |
| 87 enterDocument: function() { | 87 enterDocument: function() { |
| 88 this.inputField_ = this.getChildElement('input.user-value'); | 88 this.inputField_ = assert(this.getChildElement('input.user-value')); |
| 89 print_preview.SettingsSection.prototype.enterDocument.call(this); | 89 print_preview.SettingsSection.prototype.enterDocument.call(this); |
| 90 this.tracker.add( | 90 this.tracker.add( |
| 91 this.inputField_, | 91 this.inputField_, |
| 92 'keydown', | 92 'keydown', |
| 93 this.onTextfieldKeyDown_.bind(this)); | 93 this.onTextfieldKeyDown_.bind(this)); |
| 94 this.tracker.add( | 94 this.tracker.add( |
| 95 this.inputField_, | 95 this.inputField_, |
| 96 'input', | 96 'input', |
| 97 this.onTextfieldInput_.bind(this)); | 97 this.onTextfieldInput_.bind(this)); |
| 98 this.tracker.add( | 98 this.tracker.add( |
| 99 this.inputField_, | 99 this.inputField_, |
| 100 'blur', | 100 'blur', |
| 101 this.onTextfieldBlur_.bind(this)); | 101 this.onTextfieldBlur_.bind(this)); |
| 102 this.tracker.add( | 102 this.tracker.add( |
| 103 this.getChildElement('input.collate'), | 103 assert(this.getChildElement('input.collate')), |
| 104 'click', | 104 'click', |
| 105 this.onCollateCheckboxClick_.bind(this)); | 105 this.onCollateCheckboxClick_.bind(this)); |
| 106 this.tracker.add( | 106 this.tracker.add( |
| 107 this.copiesTicketItem_, | 107 this.copiesTicketItem_, |
| 108 print_preview.ticket_items.TicketItem.EventType.CHANGE, | 108 print_preview.ticket_items.TicketItem.EventType.CHANGE, |
| 109 this.updateState_.bind(this)); | 109 this.updateState_.bind(this)); |
| 110 this.tracker.add( | 110 this.tracker.add( |
| 111 this.collateTicketItem_, | 111 this.collateTicketItem_, |
| 112 print_preview.ticket_items.TicketItem.EventType.CHANGE, | 112 print_preview.ticket_items.TicketItem.EventType.CHANGE, |
| 113 this.updateState_.bind(this)); | 113 this.updateState_.bind(this)); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 this.collateTicketItem_.updateValue( | 210 this.collateTicketItem_.updateValue( |
| 211 this.getChildElement('input.collate').checked); | 211 this.getChildElement('input.collate').checked); |
| 212 } | 212 } |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 // Export | 215 // Export |
| 216 return { | 216 return { |
| 217 CopiesSettings: CopiesSettings | 217 CopiesSettings: CopiesSettings |
| 218 }; | 218 }; |
| 219 }); | 219 }); |
| OLD | NEW |