| 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 * Creates a PageSettings object. This object encapsulates all settings and | 9 * Creates a PageSettings object. This object encapsulates all settings and |
| 10 * logic related to page selection. | 10 * logic related to page selection. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 this.printTicketStore_.updatePageRange(this.customInput_.value); | 211 this.printTicketStore_.updatePageRange(this.customInput_.value); |
| 212 } | 212 } |
| 213 }, | 213 }, |
| 214 | 214 |
| 215 /** | 215 /** |
| 216 * Called when the print ticket changes. Updates the state of the component. | 216 * Called when the print ticket changes. Updates the state of the component. |
| 217 * @private | 217 * @private |
| 218 */ | 218 */ |
| 219 onPrintTicketStoreChange_: function() { | 219 onPrintTicketStoreChange_: function() { |
| 220 if (this.printTicketStore_.hasPageRangeCapability()) { | 220 if (this.printTicketStore_.hasPageRangeCapability()) { |
| 221 var pageRangeStr = this.printTicketStore_.getPageRangeStr(); | 221 var pageRangeStr = this.printTicketStore_.getPageRange().getValue(); |
| 222 if (pageRangeStr || this.customRadio_.checked) { | 222 if (pageRangeStr || this.customRadio_.checked) { |
| 223 if (!document.hasFocus() || | 223 if (!document.hasFocus() || |
| 224 document.activeElement != this.customInput_) { | 224 document.activeElement != this.customInput_) { |
| 225 this.customInput_.value = pageRangeStr; | 225 this.customInput_.value = pageRangeStr; |
| 226 } | 226 } |
| 227 this.customRadio_.checked = true; | 227 this.customRadio_.checked = true; |
| 228 this.allRadio_.checked = false; | 228 this.allRadio_.checked = false; |
| 229 this.setInvalidStateVisible_( | 229 this.setInvalidStateVisible_( |
| 230 !this.printTicketStore_.isPageRangeValid()); | 230 !this.printTicketStore_.isPageRangeValid()); |
| 231 } else { | 231 } else { |
| 232 this.allRadio_.checked = true; | 232 this.allRadio_.checked = true; |
| 233 this.customRadio_.checked = false; | 233 this.customRadio_.checked = false; |
| 234 this.setInvalidStateVisible_(false); | 234 this.setInvalidStateVisible_(false); |
| 235 } | 235 } |
| 236 fadeInOption(this.getElement()); | 236 fadeInOption(this.getElement()); |
| 237 } else { | 237 } else { |
| 238 fadeOutOption(this.getElement()); | 238 fadeOutOption(this.getElement()); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 }; | 241 }; |
| 242 | 242 |
| 243 // Export | 243 // Export |
| 244 return { | 244 return { |
| 245 PageSettings: PageSettings | 245 PageSettings: PageSettings |
| 246 }; | 246 }; |
| 247 }); | 247 }); |
| OLD | NEW |