OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 cr.define('print_preview.ticket_items', function() { |
| 6 'use strict'; |
| 7 |
| 8 /** |
| 9 * Collate ticket item whose value is a {@code boolean} that indicates whether |
| 10 * collation is enabled. |
| 11 * @param {!print_preview.CapabilitiesHolder} capabilitiesHolder Capabilities |
| 12 * holder used to determine the default collate value and if the collate |
| 13 * capability is available. |
| 14 * @constructor |
| 15 * @extends {print_preview.ticket_items.TicketItem} |
| 16 */ |
| 17 function Collate(capabilitiesHolder) { |
| 18 print_preview.ticket_items.TicketItem.call(this); |
| 19 |
| 20 /** |
| 21 * Capabilities holder used to determine the default collate value and if |
| 22 * the collate capability is available. |
| 23 * @type {!print_preview.CapabilitiesHolder} |
| 24 * @private |
| 25 */ |
| 26 this.capabilitiesHolder_ = capabilitiesHolder; |
| 27 }; |
| 28 |
| 29 Collate.prototype = { |
| 30 __proto__: print_preview.ticket_items.TicketItem.prototype, |
| 31 |
| 32 /** @override */ |
| 33 wouldValueBeValid: function(value) { |
| 34 return true; |
| 35 }, |
| 36 |
| 37 /** @override */ |
| 38 isCapabilityAvailable: function() { |
| 39 return this.capabilitiesHolder_.get().hasCollateCapability; |
| 40 }, |
| 41 |
| 42 /** @override */ |
| 43 getDefaultValueInternal: function() { |
| 44 return this.capabilitiesHolder_.get().defaultIsCollateEnabled; |
| 45 }, |
| 46 |
| 47 /** @override */ |
| 48 getCapabilityNotAvailableValueInternal: function() { |
| 49 return false; |
| 50 } |
| 51 }; |
| 52 |
| 53 // Export |
| 54 return { |
| 55 Collate: Collate |
| 56 }; |
| 57 }); |
OLD | NEW |