< prev index next >
src/java.desktop/share/classes/java/awt/JobAttributes.java
Print this page
*** 70,92 ****
private static final String NAMES[] = {
"all", "range", "selection"
};
/**
! * The <code>DefaultSelectionType</code> instance to use for
* specifying that all pages of the job should be printed.
*/
public static final DefaultSelectionType ALL =
new DefaultSelectionType(I_ALL);
/**
! * The <code>DefaultSelectionType</code> instance to use for
* specifying that a range of pages of the job should be printed.
*/
public static final DefaultSelectionType RANGE =
new DefaultSelectionType(I_RANGE);
/**
! * The <code>DefaultSelectionType</code> instance to use for
* specifying that the current selection should be printed.
*/
public static final DefaultSelectionType SELECTION =
new DefaultSelectionType(I_SELECTION);
--- 70,92 ----
private static final String NAMES[] = {
"all", "range", "selection"
};
/**
! * The {@code DefaultSelectionType} instance to use for
* specifying that all pages of the job should be printed.
*/
public static final DefaultSelectionType ALL =
new DefaultSelectionType(I_ALL);
/**
! * The {@code DefaultSelectionType} instance to use for
* specifying that a range of pages of the job should be printed.
*/
public static final DefaultSelectionType RANGE =
new DefaultSelectionType(I_RANGE);
/**
! * The {@code DefaultSelectionType} instance to use for
* specifying that the current selection should be printed.
*/
public static final DefaultSelectionType SELECTION =
new DefaultSelectionType(I_SELECTION);
*** 106,122 ****
private static final String NAMES[] = {
"file", "printer"
};
/**
! * The <code>DestinationType</code> instance to use for
* specifying print to file.
*/
public static final DestinationType FILE =
new DestinationType(I_FILE);
/**
! * The <code>DestinationType</code> instance to use for
* specifying print to printer.
*/
public static final DestinationType PRINTER =
new DestinationType(I_PRINTER);
--- 106,122 ----
private static final String NAMES[] = {
"file", "printer"
};
/**
! * The {@code DestinationType} instance to use for
* specifying print to file.
*/
public static final DestinationType FILE =
new DestinationType(I_FILE);
/**
! * The {@code DestinationType} instance to use for
* specifying print to printer.
*/
public static final DestinationType PRINTER =
new DestinationType(I_PRINTER);
*** 137,157 ****
private static final String NAMES[] = {
"common", "native", "none"
};
/**
! * The <code>DialogType</code> instance to use for
* specifying the cross-platform, pure Java print dialog.
*/
public static final DialogType COMMON = new DialogType(I_COMMON);
/**
! * The <code>DialogType</code> instance to use for
* specifying the platform's native print dialog.
*/
public static final DialogType NATIVE = new DialogType(I_NATIVE);
/**
! * The <code>DialogType</code> instance to use for
* specifying no print dialog.
*/
public static final DialogType NONE = new DialogType(I_NONE);
private DialogType(int type) {
--- 137,157 ----
private static final String NAMES[] = {
"common", "native", "none"
};
/**
! * The {@code DialogType} instance to use for
* specifying the cross-platform, pure Java print dialog.
*/
public static final DialogType COMMON = new DialogType(I_COMMON);
/**
! * The {@code DialogType} instance to use for
* specifying the platform's native print dialog.
*/
public static final DialogType NATIVE = new DialogType(I_NATIVE);
/**
! * The {@code DialogType} instance to use for
* specifying no print dialog.
*/
public static final DialogType NONE = new DialogType(I_NONE);
private DialogType(int type) {
*** 174,192 ****
"separate-documents-collated-copies",
"separate-documents-uncollated-copies"
};
/**
! * The <code>MultipleDocumentHandlingType</code> instance to use for specifying
* that the job should be divided into separate, collated copies.
*/
public static final MultipleDocumentHandlingType
SEPARATE_DOCUMENTS_COLLATED_COPIES =
new MultipleDocumentHandlingType(
I_SEPARATE_DOCUMENTS_COLLATED_COPIES);
/**
! * The <code>MultipleDocumentHandlingType</code> instance to use for specifying
* that the job should be divided into separate, uncollated copies.
*/
public static final MultipleDocumentHandlingType
SEPARATE_DOCUMENTS_UNCOLLATED_COPIES =
new MultipleDocumentHandlingType(
--- 174,192 ----
"separate-documents-collated-copies",
"separate-documents-uncollated-copies"
};
/**
! * The {@code MultipleDocumentHandlingType} instance to use for specifying
* that the job should be divided into separate, collated copies.
*/
public static final MultipleDocumentHandlingType
SEPARATE_DOCUMENTS_COLLATED_COPIES =
new MultipleDocumentHandlingType(
I_SEPARATE_DOCUMENTS_COLLATED_COPIES);
/**
! * The {@code MultipleDocumentHandlingType} instance to use for specifying
* that the job should be divided into separate, uncollated copies.
*/
public static final MultipleDocumentHandlingType
SEPARATE_DOCUMENTS_UNCOLLATED_COPIES =
new MultipleDocumentHandlingType(
*** 210,235 ****
private static final String NAMES[] = {
"one-sided", "two-sided-long-edge", "two-sided-short-edge"
};
/**
! * The <code>SidesType</code> instance to use for specifying that
* consecutive job pages should be printed upon the same side of
* consecutive media sheets.
*/
public static final SidesType ONE_SIDED = new SidesType(I_ONE_SIDED);
/**
! * The <code>SidesType</code> instance to use for specifying that
* consecutive job pages should be printed upon front and back sides
* of consecutive media sheets, such that the orientation of each pair
* of pages on the medium would be correct for the reader as if for
* binding on the long edge.
*/
public static final SidesType TWO_SIDED_LONG_EDGE =
new SidesType(I_TWO_SIDED_LONG_EDGE);
/**
! * The <code>SidesType</code> instance to use for specifying that
* consecutive job pages should be printed upon front and back sides
* of consecutive media sheets, such that the orientation of each pair
* of pages on the medium would be correct for the reader as if for
* binding on the short edge.
*/
--- 210,235 ----
private static final String NAMES[] = {
"one-sided", "two-sided-long-edge", "two-sided-short-edge"
};
/**
! * The {@code SidesType} instance to use for specifying that
* consecutive job pages should be printed upon the same side of
* consecutive media sheets.
*/
public static final SidesType ONE_SIDED = new SidesType(I_ONE_SIDED);
/**
! * The {@code SidesType} instance to use for specifying that
* consecutive job pages should be printed upon front and back sides
* of consecutive media sheets, such that the orientation of each pair
* of pages on the medium would be correct for the reader as if for
* binding on the long edge.
*/
public static final SidesType TWO_SIDED_LONG_EDGE =
new SidesType(I_TWO_SIDED_LONG_EDGE);
/**
! * The {@code SidesType} instance to use for specifying that
* consecutive job pages should be printed upon front and back sides
* of consecutive media sheets, such that the orientation of each pair
* of pages on the medium would be correct for the reader as if for
* binding on the short edge.
*/
*** 256,275 ****
private String printer;
private SidesType sides;
private int toPage;
/**
! * Constructs a <code>JobAttributes</code> instance with default
* values for every attribute. The dialog defaults to
! * <code>DialogType.NATIVE</code>. Min page defaults to
! * <code>1</code>. Max page defaults to <code>Integer.MAX_VALUE</code>.
! * Destination defaults to <code>DestinationType.PRINTER</code>.
! * Selection defaults to <code>DefaultSelectionType.ALL</code>.
! * Number of copies defaults to <code>1</code>. Multiple document handling defaults
! * to <code>MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</code>.
! * Sides defaults to <code>SidesType.ONE_SIDED</code>. File name defaults
! * to <code>null</code>.
*/
public JobAttributes() {
setCopiesToDefault();
setDefaultSelection(DefaultSelectionType.ALL);
setDestination(DestinationType.PRINTER);
--- 256,275 ----
private String printer;
private SidesType sides;
private int toPage;
/**
! * Constructs a {@code JobAttributes} instance with default
* values for every attribute. The dialog defaults to
! * {@code DialogType.NATIVE}. Min page defaults to
! * {@code 1}. Max page defaults to {@code Integer.MAX_VALUE}.
! * Destination defaults to {@code DestinationType.PRINTER}.
! * Selection defaults to {@code DefaultSelectionType.ALL}.
! * Number of copies defaults to {@code 1}. Multiple document handling defaults
! * to {@code MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES}.
! * Sides defaults to {@code SidesType.ONE_SIDED}. File name defaults
! * to {@code null}.
*/
public JobAttributes() {
setCopiesToDefault();
setDefaultSelection(DefaultSelectionType.ALL);
setDestination(DestinationType.PRINTER);
*** 279,318 ****
setMultipleDocumentHandlingToDefault();
setSidesToDefault();
}
/**
! * Constructs a <code>JobAttributes</code> instance which is a copy
! * of the supplied <code>JobAttributes</code>.
*
! * @param obj the <code>JobAttributes</code> to copy
*/
public JobAttributes(JobAttributes obj) {
set(obj);
}
/**
! * Constructs a <code>JobAttributes</code> instance with the
* specified values for every attribute.
*
* @param copies an integer greater than 0
! * @param defaultSelection <code>DefaultSelectionType.ALL</code>,
! * <code>DefaultSelectionType.RANGE</code>, or
! * <code>DefaultSelectionType.SELECTION</code>
! * @param destination <code>DestinationType.FILE</code> or
! * <code>DestinationType.PRINTER</code>
! * @param dialog <code>DialogType.COMMON</code>,
! * <code>DialogType.NATIVE</code>, or
! * <code>DialogType.NONE</code>
! * @param fileName the possibly <code>null</code> file name
* @param maxPage an integer greater than zero and greater than or equal
* to <i>minPage</i>
* @param minPage an integer greater than zero and less than or equal
* to <i>maxPage</i>
* @param multipleDocumentHandling
! * <code>MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES</code> or
! * <code>MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</code>
* @param pageRanges an array of integer arrays of two elements; an array
* is interpreted as a range spanning all pages including and
* between the specified pages; ranges must be in ascending
* order and must not overlap; specified page numbers cannot be
* less than <i>minPage</i> nor greater than <i>maxPage</i>;
--- 279,318 ----
setMultipleDocumentHandlingToDefault();
setSidesToDefault();
}
/**
! * Constructs a {@code JobAttributes} instance which is a copy
! * of the supplied {@code JobAttributes}.
*
! * @param obj the {@code JobAttributes} to copy
*/
public JobAttributes(JobAttributes obj) {
set(obj);
}
/**
! * Constructs a {@code JobAttributes} instance with the
* specified values for every attribute.
*
* @param copies an integer greater than 0
! * @param defaultSelection {@code DefaultSelectionType.ALL},
! * {@code DefaultSelectionType.RANGE}, or
! * {@code DefaultSelectionType.SELECTION}
! * @param destination {@code DestinationType.FILE} or
! * {@code DestinationType.PRINTER}
! * @param dialog {@code DialogType.COMMON},
! * {@code DialogType.NATIVE}, or
! * {@code DialogType.NONE}
! * @param fileName the possibly {@code null} file name
* @param maxPage an integer greater than zero and greater than or equal
* to <i>minPage</i>
* @param minPage an integer greater than zero and less than or equal
* to <i>maxPage</i>
* @param multipleDocumentHandling
! * {@code MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES} or
! * {@code MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES}
* @param pageRanges an array of integer arrays of two elements; an array
* is interpreted as a range spanning all pages including and
* between the specified pages; ranges must be in ascending
* order and must not overlap; specified page numbers cannot be
* less than <i>minPage</i> nor greater than <i>maxPage</i>;
*** 320,336 ****
* <pre>
* (new int[][] { new int[] { 1, 3 }, new int[] { 5, 5 },
* new int[] { 15, 19 } }),
* </pre>
* specifies pages 1, 2, 3, 5, 15, 16, 17, 18, and 19. Note that
! * (<code>new int[][] { new int[] { 1, 1 }, new int[] { 1, 2 } }</code>),
* is an invalid set of page ranges because the two ranges
* overlap
! * @param printer the possibly <code>null</code> printer name
! * @param sides <code>SidesType.ONE_SIDED</code>,
! * <code>SidesType.TWO_SIDED_LONG_EDGE</code>, or
! * <code>SidesType.TWO_SIDED_SHORT_EDGE</code>
* @throws IllegalArgumentException if one or more of the above
* conditions is violated
*/
public JobAttributes(int copies, DefaultSelectionType defaultSelection,
DestinationType destination, DialogType dialog,
--- 320,336 ----
* <pre>
* (new int[][] { new int[] { 1, 3 }, new int[] { 5, 5 },
* new int[] { 15, 19 } }),
* </pre>
* specifies pages 1, 2, 3, 5, 15, 16, 17, 18, and 19. Note that
! * ({@code new int[][] { new int[] { 1, 1 }, new int[] { 1, 2 } }}),
* is an invalid set of page ranges because the two ranges
* overlap
! * @param printer the possibly {@code null} printer name
! * @param sides {@code SidesType.ONE_SIDED},
! * {@code SidesType.TWO_SIDED_LONG_EDGE}, or
! * {@code SidesType.TWO_SIDED_SHORT_EDGE}
* @throws IllegalArgumentException if one or more of the above
* conditions is violated
*/
public JobAttributes(int copies, DefaultSelectionType defaultSelection,
DestinationType destination, DialogType dialog,
*** 349,362 ****
setPrinter(printer);
setSides(sides);
}
/**
! * Creates and returns a copy of this <code>JobAttributes</code>.
*
* @return the newly created copy; it is safe to cast this Object into
! * a <code>JobAttributes</code>
*/
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
--- 349,362 ----
setPrinter(printer);
setSides(sides);
}
/**
! * Creates and returns a copy of this {@code JobAttributes}.
*
* @return the newly created copy; it is safe to cast this Object into
! * a {@code JobAttributes}
*/
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
*** 364,377 ****
throw new InternalError(e);
}
}
/**
! * Sets all of the attributes of this <code>JobAttributes</code> to
* the same values as the attributes of obj.
*
! * @param obj the <code>JobAttributes</code> to copy
*/
public void set(JobAttributes obj) {
copies = obj.copies;
defaultSelection = obj.defaultSelection;
destination = obj.destination;
--- 364,377 ----
throw new InternalError(e);
}
}
/**
! * Sets all of the attributes of this {@code JobAttributes} to
* the same values as the attributes of obj.
*
! * @param obj the {@code JobAttributes} to copy
*/
public void set(JobAttributes obj) {
copies = obj.copies;
defaultSelection = obj.defaultSelection;
destination = obj.destination;
*** 402,415 ****
}
/**
* Specifies the number of copies the application should render for jobs
* using these attributes. Not specifying this attribute is equivalent to
! * specifying <code>1</code>.
*
* @param copies an integer greater than 0
! * @throws IllegalArgumentException if <code>copies</code> is less than
* or equal to 0
*/
public void setCopies(int copies) {
if (copies <= 0) {
throw new IllegalArgumentException("Invalid value for attribute "+
--- 402,415 ----
}
/**
* Specifies the number of copies the application should render for jobs
* using these attributes. Not specifying this attribute is equivalent to
! * specifying {@code 1}.
*
* @param copies an integer greater than 0
! * @throws IllegalArgumentException if {@code copies} is less than
* or equal to 0
*/
public void setCopies(int copies) {
if (copies <= 0) {
throw new IllegalArgumentException("Invalid value for attribute "+
*** 427,437 ****
}
/**
* Specifies whether, for jobs using these attributes, the application
* should print all pages, the range specified by the return value of
! * <code>getPageRanges</code>, or the current selection. This attribute
* is updated to the value chosen by the user.
*
* @return DefaultSelectionType.ALL, DefaultSelectionType.RANGE, or
* DefaultSelectionType.SELECTION
*/
--- 427,437 ----
}
/**
* Specifies whether, for jobs using these attributes, the application
* should print all pages, the range specified by the return value of
! * {@code getPageRanges}, or the current selection. This attribute
* is updated to the value chosen by the user.
*
* @return DefaultSelectionType.ALL, DefaultSelectionType.RANGE, or
* DefaultSelectionType.SELECTION
*/
*** 440,455 ****
}
/**
* Specifies whether, for jobs using these attributes, the application
* should print all pages, the range specified by the return value of
! * <code>getPageRanges</code>, or the current selection. Not specifying
* this attribute is equivalent to specifying DefaultSelectionType.ALL.
*
* @param defaultSelection DefaultSelectionType.ALL,
* DefaultSelectionType.RANGE, or DefaultSelectionType.SELECTION.
! * @throws IllegalArgumentException if defaultSelection is <code>null</code>
*/
public void setDefaultSelection(DefaultSelectionType defaultSelection) {
if (defaultSelection == null) {
throw new IllegalArgumentException("Invalid value for attribute "+
"defaultSelection");
--- 440,455 ----
}
/**
* Specifies whether, for jobs using these attributes, the application
* should print all pages, the range specified by the return value of
! * {@code getPageRanges}, or the current selection. Not specifying
* this attribute is equivalent to specifying DefaultSelectionType.ALL.
*
* @param defaultSelection DefaultSelectionType.ALL,
* DefaultSelectionType.RANGE, or DefaultSelectionType.SELECTION.
! * @throws IllegalArgumentException if defaultSelection is {@code null}
*/
public void setDefaultSelection(DefaultSelectionType defaultSelection) {
if (defaultSelection == null) {
throw new IllegalArgumentException("Invalid value for attribute "+
"defaultSelection");
*** 493,504 ****
* print dialog, the pure Java print dialog is displayed instead.
* DialogType.NONE specifies no print dialog (i.e., background printing).
* This attribute cannot be modified by, and is not subject to any
* limitations of, the implementation or the target printer.
*
! * @return <code>DialogType.COMMON</code>, <code>DialogType.NATIVE</code>, or
! * <code>DialogType.NONE</code>
*/
public DialogType getDialog() {
return dialog;
}
--- 493,504 ----
* print dialog, the pure Java print dialog is displayed instead.
* DialogType.NONE specifies no print dialog (i.e., background printing).
* This attribute cannot be modified by, and is not subject to any
* limitations of, the implementation or the target printer.
*
! * @return {@code DialogType.COMMON}, {@code DialogType.NATIVE}, or
! * {@code DialogType.NONE}
*/
public DialogType getDialog() {
return dialog;
}
*** 527,537 ****
/**
* Specifies the file name for the output file for jobs using these
* attributes. This attribute is updated to the value chosen by the user.
*
! * @return the possibly <code>null</code> file name
*/
public String getFileName() {
return fileName;
}
--- 527,537 ----
/**
* Specifies the file name for the output file for jobs using these
* attributes. This attribute is updated to the value chosen by the user.
*
! * @return the possibly {@code null} file name
*/
public String getFileName() {
return fileName;
}
*** 547,559 ****
/**
* Returns, for jobs using these attributes, the first page to be
* printed, if a range of pages is to be printed. This attribute is
* updated to the value chosen by the user. An application should ignore
! * this attribute on output, unless the return value of the <code>
! * getDefaultSelection</code> method is DefaultSelectionType.RANGE. An
! * application should honor the return value of <code>getPageRanges</code>
* over the return value of this method, if possible.
*
* @return an integer greater than zero and less than or equal to
* <i>toPage</i> and greater than or equal to <i>minPage</i> and
* less than or equal to <i>maxPage</i>.
--- 547,559 ----
/**
* Returns, for jobs using these attributes, the first page to be
* printed, if a range of pages is to be printed. This attribute is
* updated to the value chosen by the user. An application should ignore
! * this attribute on output, unless the return value of the
! * {@code getDefaultSelection} method is DefaultSelectionType.RANGE. An
! * application should honor the return value of {@code getPageRanges}
* over the return value of this method, if possible.
*
* @return an integer greater than zero and less than or equal to
* <i>toPage</i> and greater than or equal to <i>minPage</i> and
* less than or equal to <i>maxPage</i>.
*** 610,620 ****
}
/**
* Specifies the maximum value the user can specify as the last page to
* be printed for jobs using these attributes. Not specifying this
! * attribute is equivalent to specifying <code>Integer.MAX_VALUE</code>.
*
* @param maxPage an integer greater than zero and greater than or equal
* to <i>minPage</i>
* @throws IllegalArgumentException if one or more of the above
* conditions is violated
--- 610,620 ----
}
/**
* Specifies the maximum value the user can specify as the last page to
* be printed for jobs using these attributes. Not specifying this
! * attribute is equivalent to specifying {@code Integer.MAX_VALUE}.
*
* @param maxPage an integer greater than zero and greater than or equal
* to <i>minPage</i>
* @throws IllegalArgumentException if one or more of the above
* conditions is violated
*** 641,651 ****
}
/**
* Specifies the minimum value the user can specify as the first page to
* be printed for jobs using these attributes. Not specifying this
! * attribute is equivalent to specifying <code>1</code>.
*
* @param minPage an integer greater than zero and less than or equal
* to <i>maxPage</i>.
* @throws IllegalArgumentException if one or more of the above
* conditions is violated.
--- 641,651 ----
}
/**
* Specifies the minimum value the user can specify as the first page to
* be printed for jobs using these attributes. Not specifying this
! * attribute is equivalent to specifying {@code 1}.
*
* @param minPage an integer greater than zero and less than or equal
* to <i>maxPage</i>.
* @throws IllegalArgumentException if one or more of the above
* conditions is violated.
*** 704,714 ****
/**
* Specifies, for jobs using these attributes, the ranges of pages to be
* printed, if a range of pages is to be printed. All range numbers are
* inclusive. This attribute is updated to the value chosen by the user.
* An application should ignore this attribute on output, unless the
! * return value of the <code>getDefaultSelection</code> method is
* DefaultSelectionType.RANGE.
*
* @return an array of integer arrays of 2 elements. An array
* is interpreted as a range spanning all pages including and
* between the specified pages. Ranges must be in ascending
--- 704,714 ----
/**
* Specifies, for jobs using these attributes, the ranges of pages to be
* printed, if a range of pages is to be printed. All range numbers are
* inclusive. This attribute is updated to the value chosen by the user.
* An application should ignore this attribute on output, unless the
! * return value of the {@code getDefaultSelection} method is
* DefaultSelectionType.RANGE.
*
* @return an array of integer arrays of 2 elements. An array
* is interpreted as a range spanning all pages including and
* between the specified pages. Ranges must be in ascending
*** 886,898 ****
/**
* Returns, for jobs using these attributes, the last page (inclusive)
* to be printed, if a range of pages is to be printed. This attribute is
* updated to the value chosen by the user. An application should ignore
! * this attribute on output, unless the return value of the <code>
! * getDefaultSelection</code> method is DefaultSelectionType.RANGE. An
! * application should honor the return value of <code>getPageRanges</code>
* over the return value of this method, if possible.
*
* @return an integer greater than zero and greater than or equal
* to <i>toPage</i> and greater than or equal to <i>minPage</i>
* and less than or equal to <i>maxPage</i>.
--- 886,898 ----
/**
* Returns, for jobs using these attributes, the last page (inclusive)
* to be printed, if a range of pages is to be printed. This attribute is
* updated to the value chosen by the user. An application should ignore
! * this attribute on output, unless the return value of the
! * {@code getDefaultSelection} method is DefaultSelectionType.RANGE. An
! * application should honor the return value of {@code getPageRanges}
* over the return value of this method, if possible.
*
* @return an integer greater than zero and greater than or equal
* to <i>toPage</i> and greater than or equal to <i>minPage</i>
* and less than or equal to <i>maxPage</i>.
< prev index next >