| 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 11 matching lines...) Expand all Loading... |
| 22 * @private | 22 * @private |
| 23 */ | 23 */ |
| 24 this.marginsTypeTicketItem_ = marginsTypeTicketItem; | 24 this.marginsTypeTicketItem_ = marginsTypeTicketItem; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * CSS classes used by the margin settings component. | 28 * CSS classes used by the margin settings component. |
| 29 * @enum {string} | 29 * @enum {string} |
| 30 * @private | 30 * @private |
| 31 */ | 31 */ |
| 32 MarginSettings.Classes_ = { | 32 MarginSettings.Classes_ = {SELECT: 'margin-settings-select'}; |
| 33 SELECT: 'margin-settings-select' | |
| 34 }; | |
| 35 | 33 |
| 36 MarginSettings.prototype = { | 34 MarginSettings.prototype = { |
| 37 __proto__: print_preview.SettingsSection.prototype, | 35 __proto__: print_preview.SettingsSection.prototype, |
| 38 | 36 |
| 39 /** @override */ | 37 /** @override */ |
| 40 isAvailable: function() { | 38 isAvailable: function() { |
| 41 return this.marginsTypeTicketItem_.isCapabilityAvailable(); | 39 return this.marginsTypeTicketItem_.isCapabilityAvailable(); |
| 42 }, | 40 }, |
| 43 | 41 |
| 44 /** @override */ | 42 /** @override */ |
| 45 hasCollapsibleContent: function() { | 43 hasCollapsibleContent: function() { |
| 46 return this.isAvailable(); | 44 return this.isAvailable(); |
| 47 }, | 45 }, |
| 48 | 46 |
| 49 /** @override */ | 47 /** @override */ |
| 50 set isEnabled(isEnabled) { | 48 set isEnabled(isEnabled) { |
| 51 this.select_.disabled = !isEnabled; | 49 this.select_.disabled = !isEnabled; |
| 52 }, | 50 }, |
| 53 | 51 |
| 54 /** @override */ | 52 /** @override */ |
| 55 enterDocument: function() { | 53 enterDocument: function() { |
| 56 print_preview.SettingsSection.prototype.enterDocument.call(this); | 54 print_preview.SettingsSection.prototype.enterDocument.call(this); |
| 57 this.tracker.add( | 55 this.tracker.add(this.select_, 'change', this.onSelectChange_.bind(this)); |
| 58 this.select_, 'change', this.onSelectChange_.bind(this)); | |
| 59 this.tracker.add( | 56 this.tracker.add( |
| 60 this.marginsTypeTicketItem_, | 57 this.marginsTypeTicketItem_, |
| 61 print_preview.ticket_items.TicketItem.EventType.CHANGE, | 58 print_preview.ticket_items.TicketItem.EventType.CHANGE, |
| 62 this.onMarginsTypeTicketItemChange_.bind(this)); | 59 this.onMarginsTypeTicketItemChange_.bind(this)); |
| 63 }, | 60 }, |
| 64 | 61 |
| 65 /** | 62 /** |
| 66 * @return {HTMLSelectElement} Select element containing the margin options. | 63 * @return {HTMLSelectElement} Select element containing the margin options. |
| 67 * @private | 64 * @private |
| 68 */ | 65 */ |
| (...skipping 30 matching lines...) Expand all Loading... |
| 99 if (marginsType != selectedMarginsType) { | 96 if (marginsType != selectedMarginsType) { |
| 100 select.options[selectedMarginsType].selected = false; | 97 select.options[selectedMarginsType].selected = false; |
| 101 select.options[marginsType].selected = true; | 98 select.options[marginsType].selected = true; |
| 102 } | 99 } |
| 103 } | 100 } |
| 104 this.updateUiStateInternal(); | 101 this.updateUiStateInternal(); |
| 105 } | 102 } |
| 106 }; | 103 }; |
| 107 | 104 |
| 108 // Export | 105 // Export |
| 109 return { | 106 return {MarginSettings: MarginSettings}; |
| 110 MarginSettings: MarginSettings | |
| 111 }; | |
| 112 }); | 107 }); |
| OLD | NEW |