| 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 * UI component that renders checkboxes for various print options. | 9 * UI component that renders checkboxes for various print options. |
| 10 * @param {!print_preview.ticket_items.Duplex} duplex Duplex ticket item. | 10 * @param {!print_preview.ticket_items.Duplex} duplex Duplex ticket item. |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 /** | 228 /** |
| 229 * Updates the state of the entire other options settings area. | 229 * Updates the state of the entire other options settings area. |
| 230 * @private | 230 * @private |
| 231 */ | 231 */ |
| 232 updateContainerState_: function() { | 232 updateContainerState_: function() { |
| 233 if (this.headerFooterTicketItem_.isCapabilityAvailable() || | 233 if (this.headerFooterTicketItem_.isCapabilityAvailable() || |
| 234 this.fitToPageTicketItem_.isCapabilityAvailable() || | 234 this.fitToPageTicketItem_.isCapabilityAvailable() || |
| 235 this.duplexTicketItem_.isCapabilityAvailable() || | 235 this.duplexTicketItem_.isCapabilityAvailable() || |
| 236 this.cssBackgroundTicketItem_.isCapabilityAvailable() || | 236 this.cssBackgroundTicketItem_.isCapabilityAvailable() || |
| 237 this.selectionOnlyTicketItem_.isCapabilityAvailable()) { | 237 this.selectionOnlyTicketItem_.isCapabilityAvailable()) { |
| 238 setIsVisible(this.headerFooterContainer_, |
| 239 this.headerFooterTicketItem_.isCapabilityAvailable()); |
| 240 setIsVisible(this.fitToPageContainer_, |
| 241 this.fitToPageTicketItem_.isCapabilityAvailable()); |
| 242 setIsVisible(this.duplexContainer_, |
| 243 this.duplexTicketItem_.isCapabilityAvailable()); |
| 244 setIsVisible(this.cssBackgroundContainer_, |
| 245 this.cssBackgroundTicketItem_.isCapabilityAvailable()); |
| 246 setIsVisible(this.selectionOnlyContainer_, |
| 247 this.selectionOnlyTicketItem_.isCapabilityAvailable()); |
| 238 fadeInOption(this.getElement()); | 248 fadeInOption(this.getElement()); |
| 239 } else { | 249 } else { |
| 240 fadeOutOption(this.getElement()); | 250 fadeOutOption(this.getElement()); |
| 241 } | 251 } |
| 242 }, | 252 }, |
| 243 | 253 |
| 244 /** | 254 /** |
| 245 * Called when the header-footer checkbox is clicked. Updates the print | 255 * Called when the header-footer checkbox is clicked. Updates the print |
| 246 * ticket. | 256 * ticket. |
| 247 * @private | 257 * @private |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 this.selectionOnlyTicketItem_.updateValue( | 297 this.selectionOnlyTicketItem_.updateValue( |
| 288 this.selectionOnlyCheckbox_.checked); | 298 this.selectionOnlyCheckbox_.checked); |
| 289 }, | 299 }, |
| 290 | 300 |
| 291 /** | 301 /** |
| 292 * Called when the duplex ticket item has changed. Updates the duplex | 302 * Called when the duplex ticket item has changed. Updates the duplex |
| 293 * checkbox. | 303 * checkbox. |
| 294 * @private | 304 * @private |
| 295 */ | 305 */ |
| 296 onDuplexChange_: function() { | 306 onDuplexChange_: function() { |
| 297 setIsVisible(this.duplexContainer_, | |
| 298 this.duplexTicketItem_.isCapabilityAvailable()); | |
| 299 this.duplexCheckbox_.checked = this.duplexTicketItem_.getValue(); | 307 this.duplexCheckbox_.checked = this.duplexTicketItem_.getValue(); |
| 300 this.updateContainerState_(); | 308 this.updateContainerState_(); |
| 301 }, | 309 }, |
| 302 | 310 |
| 303 /** | 311 /** |
| 304 * Called when the fit-to-page ticket item has changed. Updates the | 312 * Called when the fit-to-page ticket item has changed. Updates the |
| 305 * fit-to-page checkbox. | 313 * fit-to-page checkbox. |
| 306 * @private | 314 * @private |
| 307 */ | 315 */ |
| 308 onFitToPageChange_: function() { | 316 onFitToPageChange_: function() { |
| 309 setIsVisible(this.fitToPageContainer_, | |
| 310 this.fitToPageTicketItem_.isCapabilityAvailable()); | |
| 311 this.fitToPageCheckbox_.checked = this.fitToPageTicketItem_.getValue(); | 317 this.fitToPageCheckbox_.checked = this.fitToPageTicketItem_.getValue(); |
| 312 this.updateContainerState_(); | 318 this.updateContainerState_(); |
| 313 }, | 319 }, |
| 314 | 320 |
| 315 /** | 321 /** |
| 316 * Called when the CSS background ticket item has changed. Updates the | 322 * Called when the CSS background ticket item has changed. Updates the |
| 317 * CSS background checkbox. | 323 * CSS background checkbox. |
| 318 * @private | 324 * @private |
| 319 */ | 325 */ |
| 320 onCssBackgroundChange_: function() { | 326 onCssBackgroundChange_: function() { |
| 321 setIsVisible(this.cssBackgroundContainer_, | |
| 322 this.cssBackgroundTicketItem_.isCapabilityAvailable()); | |
| 323 this.cssBackgroundCheckbox_.checked = | 327 this.cssBackgroundCheckbox_.checked = |
| 324 this.cssBackgroundTicketItem_.getValue(); | 328 this.cssBackgroundTicketItem_.getValue(); |
| 325 this.updateContainerState_(); | 329 this.updateContainerState_(); |
| 326 }, | 330 }, |
| 327 | 331 |
| 328 /** | 332 /** |
| 329 * Called when the print selection only ticket item has changed. Updates the | 333 * Called when the print selection only ticket item has changed. Updates the |
| 330 * CSS background checkbox. | 334 * CSS background checkbox. |
| 331 * @private | 335 * @private |
| 332 */ | 336 */ |
| 333 onSelectionOnlyChange_: function() { | 337 onSelectionOnlyChange_: function() { |
| 334 setIsVisible(this.selectionOnlyContainer_, | |
| 335 this.selectionOnlyTicketItem_.isCapabilityAvailable()); | |
| 336 this.selectionOnlyCheckbox_.checked = | 338 this.selectionOnlyCheckbox_.checked = |
| 337 this.selectionOnlyTicketItem_.getValue(); | 339 this.selectionOnlyTicketItem_.getValue(); |
| 338 this.updateContainerState_(); | 340 this.updateContainerState_(); |
| 339 }, | 341 }, |
| 340 | 342 |
| 341 /** | 343 /** |
| 342 * Called when the header-footer ticket item has changed. Updates the | 344 * Called when the header-footer ticket item has changed. Updates the |
| 343 * header-footer checkbox. | 345 * header-footer checkbox. |
| 344 * @private | 346 * @private |
| 345 */ | 347 */ |
| 346 onHeaderFooterChange_: function() { | 348 onHeaderFooterChange_: function() { |
| 347 setIsVisible(this.headerFooterContainer_, | |
| 348 this.headerFooterTicketItem_.isCapabilityAvailable()); | |
| 349 this.headerFooterCheckbox_.checked = | 349 this.headerFooterCheckbox_.checked = |
| 350 this.headerFooterTicketItem_.getValue(); | 350 this.headerFooterTicketItem_.getValue(); |
| 351 this.updateContainerState_(); | 351 this.updateContainerState_(); |
| 352 } | 352 } |
| 353 }; | 353 }; |
| 354 | 354 |
| 355 // Export | 355 // Export |
| 356 return { | 356 return { |
| 357 OtherOptionsSettings: OtherOptionsSettings | 357 OtherOptionsSettings: OtherOptionsSettings |
| 358 }; | 358 }; |
| 359 }); | 359 }); |
| OLD | NEW |