281 } 282 283 /** 284 * Constructs a <code>JobAttributes</code> instance which is a copy 285 * of the supplied <code>JobAttributes</code>. 286 * 287 * @param obj the <code>JobAttributes</code> to copy 288 */ 289 public JobAttributes(JobAttributes obj) { 290 set(obj); 291 } 292 293 /** 294 * Constructs a <code>JobAttributes</code> instance with the 295 * specified values for every attribute. 296 * 297 * @param copies an integer greater than 0 298 * @param defaultSelection <code>DefaultSelectionType.ALL</code>, 299 * <code>DefaultSelectionType.RANGE</code>, or 300 * <code>DefaultSelectionType.SELECTION</code> 301 * @param destination <code>DesintationType.FILE</code> or 302 * <code>DesintationType.PRINTER</code> 303 * @param dialog <code>DialogType.COMMON</code>, 304 * <code>DialogType.NATIVE</code>, or 305 * <code>DialogType.NONE</code> 306 * @param fileName the possibly <code>null</code> file name 307 * @param maxPage an integer greater than zero and greater than or equal 308 * to <i>minPage</i> 309 * @param minPage an integer greater than zero and less than or equal 310 * to <i>maxPage</i> 311 * @param multipleDocumentHandling 312 * <code>MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES</code> or 313 * <code>MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</code> 314 * @param pageRanges an array of integer arrays of two elements; an array 315 * is interpreted as a range spanning all pages including and 316 * between the specified pages; ranges must be in ascending 317 * order and must not overlap; specified page numbers cannot be 318 * less than <i>minPage</i> nor greater than <i>maxPage</i>; 319 * for example: 320 * <pre> 321 * (new int[][] { new int[] { 1, 3 }, new int[] { 5, 5 }, 322 * new int[] { 15, 19 } }), 445 * <code>getPageRanges</code>, or the current selection. Not specifying 446 * this attribute is equivalent to specifying DefaultSelectionType.ALL. 447 * 448 * @param defaultSelection DefaultSelectionType.ALL, 449 * DefaultSelectionType.RANGE, or DefaultSelectionType.SELECTION. 450 * @throws IllegalArgumentException if defaultSelection is <code>null</code> 451 */ 452 public void setDefaultSelection(DefaultSelectionType defaultSelection) { 453 if (defaultSelection == null) { 454 throw new IllegalArgumentException("Invalid value for attribute "+ 455 "defaultSelection"); 456 } 457 this.defaultSelection = defaultSelection; 458 } 459 460 /** 461 * Specifies whether output will be to a printer or a file for jobs using 462 * these attributes. This attribute is updated to the value chosen by the 463 * user. 464 * 465 * @return DesintationType.FILE or DesintationType.PRINTER 466 */ 467 public DestinationType getDestination() { 468 return destination; 469 } 470 471 /** 472 * Specifies whether output will be to a printer or a file for jobs using 473 * these attributes. Not specifying this attribute is equivalent to 474 * specifying DesintationType.PRINTER. 475 * 476 * @param destination DesintationType.FILE or DesintationType.PRINTER. 477 * @throws IllegalArgumentException if destination is null. 478 */ 479 public void setDestination(DestinationType destination) { 480 if (destination == null) { 481 throw new IllegalArgumentException("Invalid value for attribute "+ 482 "destination"); 483 } 484 this.destination = destination; 485 } 486 487 /** 488 * Returns whether, for jobs using these attributes, the user should see 489 * a print dialog in which to modify the print settings, and which type of 490 * print dialog should be displayed. DialogType.COMMON denotes a cross- 491 * platform, pure Java print dialog. DialogType.NATIVE denotes the 492 * platform's native print dialog. If a platform does not support a native 493 * print dialog, the pure Java print dialog is displayed instead. 494 * DialogType.NONE specifies no print dialog (i.e., background printing). 495 * This attribute cannot be modified by, and is not subject to any 496 * limitations of, the implementation or the target printer. | 281 } 282 283 /** 284 * Constructs a <code>JobAttributes</code> instance which is a copy 285 * of the supplied <code>JobAttributes</code>. 286 * 287 * @param obj the <code>JobAttributes</code> to copy 288 */ 289 public JobAttributes(JobAttributes obj) { 290 set(obj); 291 } 292 293 /** 294 * Constructs a <code>JobAttributes</code> instance with the 295 * specified values for every attribute. 296 * 297 * @param copies an integer greater than 0 298 * @param defaultSelection <code>DefaultSelectionType.ALL</code>, 299 * <code>DefaultSelectionType.RANGE</code>, or 300 * <code>DefaultSelectionType.SELECTION</code> 301 * @param destination <code>DestinationType.FILE</code> or 302 * <code>DestinationType.PRINTER</code> 303 * @param dialog <code>DialogType.COMMON</code>, 304 * <code>DialogType.NATIVE</code>, or 305 * <code>DialogType.NONE</code> 306 * @param fileName the possibly <code>null</code> file name 307 * @param maxPage an integer greater than zero and greater than or equal 308 * to <i>minPage</i> 309 * @param minPage an integer greater than zero and less than or equal 310 * to <i>maxPage</i> 311 * @param multipleDocumentHandling 312 * <code>MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES</code> or 313 * <code>MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</code> 314 * @param pageRanges an array of integer arrays of two elements; an array 315 * is interpreted as a range spanning all pages including and 316 * between the specified pages; ranges must be in ascending 317 * order and must not overlap; specified page numbers cannot be 318 * less than <i>minPage</i> nor greater than <i>maxPage</i>; 319 * for example: 320 * <pre> 321 * (new int[][] { new int[] { 1, 3 }, new int[] { 5, 5 }, 322 * new int[] { 15, 19 } }), 445 * <code>getPageRanges</code>, or the current selection. Not specifying 446 * this attribute is equivalent to specifying DefaultSelectionType.ALL. 447 * 448 * @param defaultSelection DefaultSelectionType.ALL, 449 * DefaultSelectionType.RANGE, or DefaultSelectionType.SELECTION. 450 * @throws IllegalArgumentException if defaultSelection is <code>null</code> 451 */ 452 public void setDefaultSelection(DefaultSelectionType defaultSelection) { 453 if (defaultSelection == null) { 454 throw new IllegalArgumentException("Invalid value for attribute "+ 455 "defaultSelection"); 456 } 457 this.defaultSelection = defaultSelection; 458 } 459 460 /** 461 * Specifies whether output will be to a printer or a file for jobs using 462 * these attributes. This attribute is updated to the value chosen by the 463 * user. 464 * 465 * @return DestinationType.FILE or DestinationType.PRINTER 466 */ 467 public DestinationType getDestination() { 468 return destination; 469 } 470 471 /** 472 * Specifies whether output will be to a printer or a file for jobs using 473 * these attributes. Not specifying this attribute is equivalent to 474 * specifying DestinationType.PRINTER. 475 * 476 * @param destination DestinationType.FILE or DestinationType.PRINTER. 477 * @throws IllegalArgumentException if destination is null. 478 */ 479 public void setDestination(DestinationType destination) { 480 if (destination == null) { 481 throw new IllegalArgumentException("Invalid value for attribute "+ 482 "destination"); 483 } 484 this.destination = destination; 485 } 486 487 /** 488 * Returns whether, for jobs using these attributes, the user should see 489 * a print dialog in which to modify the print settings, and which type of 490 * print dialog should be displayed. DialogType.COMMON denotes a cross- 491 * platform, pure Java print dialog. DialogType.NATIVE denotes the 492 * platform's native print dialog. If a platform does not support a native 493 * print dialog, the pure Java print dialog is displayed instead. 494 * DialogType.NONE specifies no print dialog (i.e., background printing). 495 * This attribute cannot be modified by, and is not subject to any 496 * limitations of, the implementation or the target printer. |