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.
5 cr.define('print_preview.ticket_items', function() {
9 * Collate ticket item whose value is a {@code boolean} that indicates whether
10 * collation is enabled.
11 * @param {!print_preview.AppState} appState App state used to persist collate
13 * @param {!print_preview.DestinationStore} destinationStore Destination store
14 * used determine if a destination has the collate capability.
16 * @extends {print_preview.ticket_items.TicketItem}
18 function Collate(appState, destinationStore) {
19 print_preview.ticket_items.TicketItem.call(
22 print_preview.AppState.Field.IS_COLLATE_ENABLED,
27 __proto__: print_preview.ticket_items.TicketItem.prototype,
30 wouldValueBeValid: function(value) {
35 isCapabilityAvailable: function() {
36 return !!this.getCollateCapability_();
40 getDefaultValueInternal: function() {
41 var capability = this.getCollateCapability_();
42 return capability.hasOwnProperty('default') ? capability.default : true;
46 getCapabilityNotAvailableValueInternal: function() {
51 * @return {Object} Collate capability of the selected destination.
54 getCollateCapability_: function() {
55 var dest = this.getSelectedDestInternal();
58 dest.capabilities.printer &&
59 dest.capabilities.printer.collate) ||