| 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 /** |
| 5 * @typedef {Object|number|boolean|string} |
| 6 */ |
| 7 print_preview.ValueType; |
| 4 | 8 |
| 5 cr.define('print_preview.ticket_items', function() { | 9 cr.define('print_preview.ticket_items', function() { |
| 6 'use strict'; | 10 'use strict'; |
| 7 | 11 |
| 8 /** | 12 /** |
| 9 * An object that represents a user modifiable item in a print ticket. Each | 13 * An object that represents a user modifiable item in a print ticket. Each |
| 10 * ticket item has a value which can be set by the user. Ticket items can also | 14 * ticket item has a value which can be set by the user. Ticket items can also |
| 11 * be unavailable for modifying if the print destination doesn't support it or | 15 * be unavailable for modifying if the print destination doesn't support it or |
| 12 * if other ticket item constraints are not met. | 16 * if other ticket item constraints are not met. |
| 13 * @param {?print_preview.AppState} appState Application state model to update | 17 * @param {?print_preview.AppState} appState Application state model to update |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 throw Error('Abstract method not overridden'); | 97 throw Error('Abstract method not overridden'); |
| 94 }, | 98 }, |
| 95 | 99 |
| 96 /** | 100 /** |
| 97 * @return {boolean} Whether the print destination capability is available. | 101 * @return {boolean} Whether the print destination capability is available. |
| 98 */ | 102 */ |
| 99 isCapabilityAvailable: function() { | 103 isCapabilityAvailable: function() { |
| 100 throw Error('Abstract method not overridden'); | 104 throw Error('Abstract method not overridden'); |
| 101 }, | 105 }, |
| 102 | 106 |
| 103 /** @return {!Object} The value of the ticket item. */ | 107 /** @return {print_preview.ValueType} The value of the ticket item. */ |
| 104 getValue: function() { | 108 getValue: function() { |
| 105 if (this.isCapabilityAvailable()) { | 109 if (this.isCapabilityAvailable()) { |
| 106 if (this.value_ == null) { | 110 if (this.value_ == null) { |
| 107 return this.getDefaultValueInternal(); | 111 return this.getDefaultValueInternal(); |
| 108 } else { | 112 } else { |
| 109 return this.value_; | 113 return this.value_; |
| 110 } | 114 } |
| 111 } else { | 115 } else { |
| 112 return this.getCapabilityNotAvailableValueInternal(); | 116 return this.getCapabilityNotAvailableValueInternal(); |
| 113 } | 117 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 this.dispatchChangeEventInternal.bind(this)); | 236 this.dispatchChangeEventInternal.bind(this)); |
| 233 } | 237 } |
| 234 }, | 238 }, |
| 235 }; | 239 }; |
| 236 | 240 |
| 237 // Export | 241 // Export |
| 238 return { | 242 return { |
| 239 TicketItem: TicketItem | 243 TicketItem: TicketItem |
| 240 }; | 244 }; |
| 241 }); | 245 }); |
| OLD | NEW |