| 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 MarginSettings object. This object encapsulates all settings and | 9 * Creates a MarginSettings object. This object encapsulates all settings and |
| 10 * logic related to the margins mode. | 10 * logic related to the margins mode. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 }, | 70 }, |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * Called when the select element is changed. Updates the print ticket | 73 * Called when the select element is changed. Updates the print ticket |
| 74 * margin type. | 74 * margin type. |
| 75 * @private | 75 * @private |
| 76 */ | 76 */ |
| 77 onSelectChange_: function() { | 77 onSelectChange_: function() { |
| 78 var select = this.select_; | 78 var select = this.select_; |
| 79 var marginsType = | 79 var marginsType = |
| 80 /** @type {print_preview.ticket_items.MarginsType.Value} */ ( | 80 /** @type {!print_preview.ticket_items.MarginsType.Value} */ ( |
| 81 select.selectedIndex); | 81 select.selectedIndex); |
| 82 this.printTicketStore_.updateMarginsType(marginsType); | 82 this.printTicketStore_.updateMarginsType(marginsType); |
| 83 }, | 83 }, |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * Called when the print ticket store changes. Selects the corresponding | 86 * Called when the print ticket store changes. Selects the corresponding |
| 87 * select option. | 87 * select option. |
| 88 * @private | 88 * @private |
| 89 */ | 89 */ |
| 90 onPrintTicketStoreChange_: function() { | 90 onPrintTicketStoreChange_: function() { |
| 91 if (this.printTicketStore_.hasMarginsCapability()) { | 91 if (this.printTicketStore_.hasMarginsCapability()) { |
| 92 var select = this.select_; | 92 var select = this.select_; |
| 93 var marginsType = this.printTicketStore_.getMarginsType(); | 93 var marginsType = this.printTicketStore_.getMarginsType(); |
| 94 var selectedMarginsType = | 94 var selectedMarginsType = |
| 95 /** @type {print_preview.ticket_items.MarginsType.Value} */ ( | 95 /** @type {!print_preview.ticket_items.MarginsType.Value} */ ( |
| 96 select.selectedIndex); | 96 select.selectedIndex); |
| 97 if (marginsType != selectedMarginsType) { | 97 if (marginsType != selectedMarginsType) { |
| 98 select.options[selectedMarginsType].selected = false; | 98 select.options[selectedMarginsType].selected = false; |
| 99 select.options[marginsType].selected = true; | 99 select.options[marginsType].selected = true; |
| 100 } | 100 } |
| 101 fadeInOption(this.getElement()); | 101 fadeInOption(this.getElement()); |
| 102 } else { | 102 } else { |
| 103 fadeOutOption(this.getElement()); | 103 fadeOutOption(this.getElement()); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 // Export | 108 // Export |
| 109 return { | 109 return { |
| 110 MarginSettings: MarginSettings | 110 MarginSettings: MarginSettings |
| 111 }; | 111 }; |
| 112 }); | 112 }); |
| OLD | NEW |