类java.awt.JobAttributes源码实例Demo

下面列出了怎么用java.awt.JobAttributes的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk1.8-source-analysis   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码2 项目: dragonwell8_jdk   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码3 项目: openjdk-8   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码4 项目: Java8CN   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码5 项目: JDKSourceCode1.8   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码6 项目: jdk8u-jdk   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码7 项目: openjdk-jdk8u   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码8 项目: jdk-1.7-annotated   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码9 项目: Bytecoder   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码10 项目: openjdk-jdk9   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码11 项目: jdk8u-dev-jdk   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码12 项目: jdk8u-jdk   文件: JobAttributes.java
/**
 * 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;
    dialog = obj.dialog;
    fileName = obj.fileName;
    fromPage = obj.fromPage;
    maxPage = obj.maxPage;
    minPage = obj.minPage;
    multipleDocumentHandling = obj.multipleDocumentHandling;
    // okay because we never modify the contents of pageRanges
    pageRanges = obj.pageRanges;
    prFirst = obj.prFirst;
    prLast = obj.prLast;
    printer = obj.printer;
    sides = obj.sides;
    toPage = obj.toPage;
}
 
源代码13 项目: dragonwell8_jdk   文件: PrintJob2D.java
public PrintJob2D(Frame frame,  String doctitle,
                  final Properties props) {
    this.props = props;
    this.jobAttributes = new JobAttributes();
    this.pageAttributes = new PageAttributes();
    translateInputProps();
    initPrintJob2D(frame, doctitle,
                   this.jobAttributes, this.pageAttributes);
}
 
源代码14 项目: jdk8u60   文件: PrintJob2D.java
public PrintJob2D(Frame frame,  String doctitle,
                  final Properties props) {
    this.props = props;
    this.jobAttributes = new JobAttributes();
    this.pageAttributes = new PageAttributes();
    translateInputProps();
    initPrintJob2D(frame, doctitle,
                   this.jobAttributes, this.pageAttributes);
}
 
源代码15 项目: jdk8u-dev-jdk   文件: PrintJob2D.java
public PrintJob2D(Frame frame,  String doctitle,
                  final Properties props) {
    this.props = props;
    this.jobAttributes = new JobAttributes();
    this.pageAttributes = new PageAttributes();
    translateInputProps();
    initPrintJob2D(frame, doctitle,
                   this.jobAttributes, this.pageAttributes);
}
 
源代码16 项目: openjdk-jdk9   文件: PrintJob2D.java
public PrintJob2D(Frame frame,  String doctitle,
                  final Properties props) {
    this.props = props;
    this.jobAttributes = new JobAttributes();
    this.pageAttributes = new PageAttributes();
    translateInputProps();
    initPrintJob2D(frame, doctitle,
                   this.jobAttributes, this.pageAttributes);
}
 
源代码17 项目: openjdk-jdk9   文件: PrinterException.java
public static void main(String[] args) throws Exception {
    Robot robot = new Robot();
    Thread t = new Thread (() -> {
        robot.waitForIdle();
        robot.delay(2000);
        robot.keyPress(KeyEvent.VK_ESCAPE);
        robot.keyRelease(KeyEvent.VK_ESCAPE);
       });
    Toolkit tk = Toolkit.getDefaultToolkit();
    PrintJob pj = null;

    int[][] pageRange = new int[][]{new int[]{1,1}};
    JobAttributes ja = new JobAttributes(1,
            java.awt.JobAttributes.DefaultSelectionType.ALL,
            JobAttributes.DestinationType.FILE, JobAttributes.DialogType.NATIVE,
            "filename.ps", Integer.MAX_VALUE, 1,
            JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
             pageRange, "", JobAttributes.SidesType.ONE_SIDED);

    Frame testFrame = new Frame("print");
    try {
        if (tk != null) {
            t.start();
            pj = tk.getPrintJob(testFrame, null, ja, null);
        }
    } finally {
        testFrame.dispose();
    }
}
 
源代码18 项目: openjdk-jdk9   文件: NullFrameTest.java
public static void main(String[] args) {
    JobAttributes ja = new JobAttributes();
    ja.setDialog(JobAttributes.DialogType.COMMON);
    boolean npeThrown = false;
    try {
        Toolkit.getDefaultToolkit().getPrintJob(null,
                                           "test Printing", ja, null);
    } catch (NullPointerException ex) {
        npeThrown = true;
    }
    if (!npeThrown) {
        throw
        new RuntimeException("getPrintJob didn't throw NPE for null Frame");
    }
}
 
源代码19 项目: jdk8u-jdk   文件: PrintJob2D.java
public PrintJob2D(Frame frame,  String doctitle,
                  final Properties props) {
    this.props = props;
    this.jobAttributes = new JobAttributes();
    this.pageAttributes = new PageAttributes();
    translateInputProps();
    initPrintJob2D(frame, doctitle,
                   this.jobAttributes, this.pageAttributes);
}
 
源代码20 项目: jdk-1.7-annotated   文件: JobAttributes.java
/**
 * Determines whether two JobAttributes are equal to each other.
 * <p>
 * Two JobAttributes are equal if and only if each of their attributes are
 * equal. Attributes of enumeration type are equal if and only if the
 * fields refer to the same unique enumeration object. A set of page
 * ranges is equal if and only if the sets are of equal length, each range
 * enumerates the same pages, and the ranges are in the same order.
 *
 * @param   obj the object whose equality will be checked.
 * @return  whether obj is equal to this JobAttribute according to the
 *          above criteria.
 */
public boolean equals(Object obj) {
    if (!(obj instanceof JobAttributes)) {
        return false;
    }
    JobAttributes rhs = (JobAttributes)obj;

    if (fileName == null) {
        if (rhs.fileName != null) {
            return false;
        }
    } else {
        if (!fileName.equals(rhs.fileName)) {
            return false;
        }
    }

    if (pageRanges == null) {
        if (rhs.pageRanges != null) {
            return false;
        }
    } else {
        if (rhs.pageRanges == null ||
                pageRanges.length != rhs.pageRanges.length) {
            return false;
        }
        for (int i = 0; i < pageRanges.length; i++) {
            if (pageRanges[i][0] != rhs.pageRanges[i][0] ||
                pageRanges[i][1] != rhs.pageRanges[i][1]) {
                return false;
            }
        }
    }

    if (printer == null) {
        if (rhs.printer != null) {
            return false;
        }
    } else {
        if (!printer.equals(rhs.printer)) {
            return false;
        }
    }

    return (copies == rhs.copies &&
            defaultSelection == rhs.defaultSelection &&
            destination == rhs.destination &&
            dialog == rhs.dialog &&
            fromPage == rhs.fromPage &&
            maxPage == rhs.maxPage &&
            minPage == rhs.minPage &&
            multipleDocumentHandling == rhs.multipleDocumentHandling &&
            prFirst == rhs.prFirst &&
            prLast == rhs.prLast &&
            sides == rhs.sides &&
            toPage == rhs.toPage);
}
 
源代码21 项目: jdk8u-jdk   文件: JobAttributes.java
/**
 * Determines whether two JobAttributes are equal to each other.
 * <p>
 * Two JobAttributes are equal if and only if each of their attributes are
 * equal. Attributes of enumeration type are equal if and only if the
 * fields refer to the same unique enumeration object. A set of page
 * ranges is equal if and only if the sets are of equal length, each range
 * enumerates the same pages, and the ranges are in the same order.
 *
 * @param   obj the object whose equality will be checked.
 * @return  whether obj is equal to this JobAttribute according to the
 *          above criteria.
 */
public boolean equals(Object obj) {
    if (!(obj instanceof JobAttributes)) {
        return false;
    }
    JobAttributes rhs = (JobAttributes)obj;

    if (fileName == null) {
        if (rhs.fileName != null) {
            return false;
        }
    } else {
        if (!fileName.equals(rhs.fileName)) {
            return false;
        }
    }

    if (pageRanges == null) {
        if (rhs.pageRanges != null) {
            return false;
        }
    } else {
        if (rhs.pageRanges == null ||
                pageRanges.length != rhs.pageRanges.length) {
            return false;
        }
        for (int i = 0; i < pageRanges.length; i++) {
            if (pageRanges[i][0] != rhs.pageRanges[i][0] ||
                pageRanges[i][1] != rhs.pageRanges[i][1]) {
                return false;
            }
        }
    }

    if (printer == null) {
        if (rhs.printer != null) {
            return false;
        }
    } else {
        if (!printer.equals(rhs.printer)) {
            return false;
        }
    }

    return (copies == rhs.copies &&
            defaultSelection == rhs.defaultSelection &&
            destination == rhs.destination &&
            dialog == rhs.dialog &&
            fromPage == rhs.fromPage &&
            maxPage == rhs.maxPage &&
            minPage == rhs.minPage &&
            multipleDocumentHandling == rhs.multipleDocumentHandling &&
            prFirst == rhs.prFirst &&
            prLast == rhs.prLast &&
            sides == rhs.sides &&
            toPage == rhs.toPage);
}
 
源代码22 项目: jdk1.8-source-analysis   文件: JobAttributes.java
/**
 * Determines whether two JobAttributes are equal to each other.
 * <p>
 * Two JobAttributes are equal if and only if each of their attributes are
 * equal. Attributes of enumeration type are equal if and only if the
 * fields refer to the same unique enumeration object. A set of page
 * ranges is equal if and only if the sets are of equal length, each range
 * enumerates the same pages, and the ranges are in the same order.
 *
 * @param   obj the object whose equality will be checked.
 * @return  whether obj is equal to this JobAttribute according to the
 *          above criteria.
 */
public boolean equals(Object obj) {
    if (!(obj instanceof JobAttributes)) {
        return false;
    }
    JobAttributes rhs = (JobAttributes)obj;

    if (fileName == null) {
        if (rhs.fileName != null) {
            return false;
        }
    } else {
        if (!fileName.equals(rhs.fileName)) {
            return false;
        }
    }

    if (pageRanges == null) {
        if (rhs.pageRanges != null) {
            return false;
        }
    } else {
        if (rhs.pageRanges == null ||
                pageRanges.length != rhs.pageRanges.length) {
            return false;
        }
        for (int i = 0; i < pageRanges.length; i++) {
            if (pageRanges[i][0] != rhs.pageRanges[i][0] ||
                pageRanges[i][1] != rhs.pageRanges[i][1]) {
                return false;
            }
        }
    }

    if (printer == null) {
        if (rhs.printer != null) {
            return false;
        }
    } else {
        if (!printer.equals(rhs.printer)) {
            return false;
        }
    }

    return (copies == rhs.copies &&
            defaultSelection == rhs.defaultSelection &&
            destination == rhs.destination &&
            dialog == rhs.dialog &&
            fromPage == rhs.fromPage &&
            maxPage == rhs.maxPage &&
            minPage == rhs.minPage &&
            multipleDocumentHandling == rhs.multipleDocumentHandling &&
            prFirst == rhs.prFirst &&
            prLast == rhs.prLast &&
            sides == rhs.sides &&
            toPage == rhs.toPage);
}
 
源代码23 项目: dragonwell8_jdk   文件: JobAttributes.java
/**
 * 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>DesintationType.FILE</code> or
 *          <code>DesintationType.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>;
 *          for example:
 *          <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,
                     String fileName, int maxPage, int minPage,
                     MultipleDocumentHandlingType multipleDocumentHandling,
                     int[][] pageRanges, String printer, SidesType sides) {
    setCopies(copies);
    setDefaultSelection(defaultSelection);
    setDestination(destination);
    setDialog(dialog);
    setFileName(fileName);
    setMaxPage(maxPage);
    setMinPage(minPage);
    setMultipleDocumentHandling(multipleDocumentHandling);
    setPageRanges(pageRanges);
    setPrinter(printer);
    setSides(sides);
}
 
源代码24 项目: dragonwell8_jdk   文件: JobAttributes.java
/**
 * Determines whether two JobAttributes are equal to each other.
 * <p>
 * Two JobAttributes are equal if and only if each of their attributes are
 * equal. Attributes of enumeration type are equal if and only if the
 * fields refer to the same unique enumeration object. A set of page
 * ranges is equal if and only if the sets are of equal length, each range
 * enumerates the same pages, and the ranges are in the same order.
 *
 * @param   obj the object whose equality will be checked.
 * @return  whether obj is equal to this JobAttribute according to the
 *          above criteria.
 */
public boolean equals(Object obj) {
    if (!(obj instanceof JobAttributes)) {
        return false;
    }
    JobAttributes rhs = (JobAttributes)obj;

    if (fileName == null) {
        if (rhs.fileName != null) {
            return false;
        }
    } else {
        if (!fileName.equals(rhs.fileName)) {
            return false;
        }
    }

    if (pageRanges == null) {
        if (rhs.pageRanges != null) {
            return false;
        }
    } else {
        if (rhs.pageRanges == null ||
                pageRanges.length != rhs.pageRanges.length) {
            return false;
        }
        for (int i = 0; i < pageRanges.length; i++) {
            if (pageRanges[i][0] != rhs.pageRanges[i][0] ||
                pageRanges[i][1] != rhs.pageRanges[i][1]) {
                return false;
            }
        }
    }

    if (printer == null) {
        if (rhs.printer != null) {
            return false;
        }
    } else {
        if (!printer.equals(rhs.printer)) {
            return false;
        }
    }

    return (copies == rhs.copies &&
            defaultSelection == rhs.defaultSelection &&
            destination == rhs.destination &&
            dialog == rhs.dialog &&
            fromPage == rhs.fromPage &&
            maxPage == rhs.maxPage &&
            minPage == rhs.minPage &&
            multipleDocumentHandling == rhs.multipleDocumentHandling &&
            prFirst == rhs.prFirst &&
            prLast == rhs.prLast &&
            sides == rhs.sides &&
            toPage == rhs.toPage);
}
 
源代码25 项目: jdk8u_jdk   文件: JobAttributes.java
/**
 * Determines whether two JobAttributes are equal to each other.
 * <p>
 * Two JobAttributes are equal if and only if each of their attributes are
 * equal. Attributes of enumeration type are equal if and only if the
 * fields refer to the same unique enumeration object. A set of page
 * ranges is equal if and only if the sets are of equal length, each range
 * enumerates the same pages, and the ranges are in the same order.
 *
 * @param   obj the object whose equality will be checked.
 * @return  whether obj is equal to this JobAttribute according to the
 *          above criteria.
 */
public boolean equals(Object obj) {
    if (!(obj instanceof JobAttributes)) {
        return false;
    }
    JobAttributes rhs = (JobAttributes)obj;

    if (fileName == null) {
        if (rhs.fileName != null) {
            return false;
        }
    } else {
        if (!fileName.equals(rhs.fileName)) {
            return false;
        }
    }

    if (pageRanges == null) {
        if (rhs.pageRanges != null) {
            return false;
        }
    } else {
        if (rhs.pageRanges == null ||
                pageRanges.length != rhs.pageRanges.length) {
            return false;
        }
        for (int i = 0; i < pageRanges.length; i++) {
            if (pageRanges[i][0] != rhs.pageRanges[i][0] ||
                pageRanges[i][1] != rhs.pageRanges[i][1]) {
                return false;
            }
        }
    }

    if (printer == null) {
        if (rhs.printer != null) {
            return false;
        }
    } else {
        if (!printer.equals(rhs.printer)) {
            return false;
        }
    }

    return (copies == rhs.copies &&
            defaultSelection == rhs.defaultSelection &&
            destination == rhs.destination &&
            dialog == rhs.dialog &&
            fromPage == rhs.fromPage &&
            maxPage == rhs.maxPage &&
            minPage == rhs.minPage &&
            multipleDocumentHandling == rhs.multipleDocumentHandling &&
            prFirst == rhs.prFirst &&
            prLast == rhs.prLast &&
            sides == rhs.sides &&
            toPage == rhs.toPage);
}
 
源代码26 项目: jdk8u-jdk   文件: PrintJob2D.java
private void initPrintJob2D(Frame frame,  String doctitle,
                            JobAttributes jobAttributes,
                            PageAttributes pageAttributes) {

    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkPrintJobAccess();
    }

    if (frame == null &&
        (jobAttributes == null ||
         jobAttributes.getDialog() == DialogType.NATIVE)) {
        throw new NullPointerException("Frame must not be null");
    }
    this.frame = frame;

    this.docTitle = (doctitle == null) ? "" : doctitle;
    this.jobAttributes = (jobAttributes != null)
        ? jobAttributes : new JobAttributes();
    this.pageAttributes = (pageAttributes != null)
        ? pageAttributes : new PageAttributes();

    // Currently, we always reduce page ranges to xxx or xxx-xxx
    int[][] pageRanges = this.jobAttributes.getPageRanges();
    int first = pageRanges[0][0];
    int last = pageRanges[pageRanges.length - 1][1];
    this.jobAttributes.setPageRanges(new int[][] {
        new int[] { first, last }
    });
    this.jobAttributes.setToPage(last);
    this.jobAttributes.setFromPage(first);


    // Verify that the cross feed and feed resolutions are the same
    int[] res = this.pageAttributes.getPrinterResolution();
    if (res[0] != res[1]) {
        throw new IllegalArgumentException("Differing cross feed and feed"+
                                           " resolutions not supported.");
    }

    // Verify that the app has access to the file system
    DestinationType dest= this.jobAttributes.getDestination();
    if (dest == DestinationType.FILE) {
        throwPrintToFile();

        // check if given filename is valid
        String destStr = jobAttributes.getFileName();
        if ((destStr != null) &&
            (jobAttributes.getDialog() == JobAttributes.DialogType.NONE)) {

            File f = new File(destStr);
            try {
                // check if this is a new file and if filename chars are valid
                // createNewFile returns false if file exists
                if (f.createNewFile()) {
                    f.delete();
                }
            } catch (IOException ioe) {
                throw new IllegalArgumentException("Cannot write to file:"+
                                                   destStr);
            } catch (SecurityException se) {
                //There is already file read/write access so at this point
                // only delete access is denied.  Just ignore it because in
                // most cases the file created in createNewFile gets overwritten
                // anyway.
            }

             File pFile = f.getParentFile();
             if ((f.exists() &&
                  (!f.isFile() || !f.canWrite())) ||
                 ((pFile != null) &&
                  (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
                 throw new IllegalArgumentException("Cannot write to file:"+
                                                    destStr);
             }
        }
    }
}
 
源代码27 项目: TencentKona-8   文件: JobAttributes.java
/**
 * Determines whether two JobAttributes are equal to each other.
 * <p>
 * Two JobAttributes are equal if and only if each of their attributes are
 * equal. Attributes of enumeration type are equal if and only if the
 * fields refer to the same unique enumeration object. A set of page
 * ranges is equal if and only if the sets are of equal length, each range
 * enumerates the same pages, and the ranges are in the same order.
 *
 * @param   obj the object whose equality will be checked.
 * @return  whether obj is equal to this JobAttribute according to the
 *          above criteria.
 */
public boolean equals(Object obj) {
    if (!(obj instanceof JobAttributes)) {
        return false;
    }
    JobAttributes rhs = (JobAttributes)obj;

    if (fileName == null) {
        if (rhs.fileName != null) {
            return false;
        }
    } else {
        if (!fileName.equals(rhs.fileName)) {
            return false;
        }
    }

    if (pageRanges == null) {
        if (rhs.pageRanges != null) {
            return false;
        }
    } else {
        if (rhs.pageRanges == null ||
                pageRanges.length != rhs.pageRanges.length) {
            return false;
        }
        for (int i = 0; i < pageRanges.length; i++) {
            if (pageRanges[i][0] != rhs.pageRanges[i][0] ||
                pageRanges[i][1] != rhs.pageRanges[i][1]) {
                return false;
            }
        }
    }

    if (printer == null) {
        if (rhs.printer != null) {
            return false;
        }
    } else {
        if (!printer.equals(rhs.printer)) {
            return false;
        }
    }

    return (copies == rhs.copies &&
            defaultSelection == rhs.defaultSelection &&
            destination == rhs.destination &&
            dialog == rhs.dialog &&
            fromPage == rhs.fromPage &&
            maxPage == rhs.maxPage &&
            minPage == rhs.minPage &&
            multipleDocumentHandling == rhs.multipleDocumentHandling &&
            prFirst == rhs.prFirst &&
            prLast == rhs.prLast &&
            sides == rhs.sides &&
            toPage == rhs.toPage);
}
 
源代码28 项目: jdk8u-dev-jdk   文件: JobAttributes.java
/**
 * 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>DesintationType.FILE</code> or
 *          <code>DesintationType.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>;
 *          for example:
 *          <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,
                     String fileName, int maxPage, int minPage,
                     MultipleDocumentHandlingType multipleDocumentHandling,
                     int[][] pageRanges, String printer, SidesType sides) {
    setCopies(copies);
    setDefaultSelection(defaultSelection);
    setDestination(destination);
    setDialog(dialog);
    setFileName(fileName);
    setMaxPage(maxPage);
    setMinPage(minPage);
    setMultipleDocumentHandling(multipleDocumentHandling);
    setPageRanges(pageRanges);
    setPrinter(printer);
    setSides(sides);
}
 
源代码29 项目: jdk8u_jdk   文件: PrintJob2D.java
private void initPrintJob2D(Frame frame,  String doctitle,
                            JobAttributes jobAttributes,
                            PageAttributes pageAttributes) {

    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkPrintJobAccess();
    }

    if (frame == null &&
        (jobAttributes == null ||
         jobAttributes.getDialog() == DialogType.NATIVE)) {
        throw new NullPointerException("Frame must not be null");
    }
    this.frame = frame;

    this.docTitle = (doctitle == null) ? "" : doctitle;
    this.jobAttributes = (jobAttributes != null)
        ? jobAttributes : new JobAttributes();
    this.pageAttributes = (pageAttributes != null)
        ? pageAttributes : new PageAttributes();

    // Currently, we always reduce page ranges to xxx or xxx-xxx
    int[][] pageRanges = this.jobAttributes.getPageRanges();
    int first = pageRanges[0][0];
    int last = pageRanges[pageRanges.length - 1][1];
    this.jobAttributes.setPageRanges(new int[][] {
        new int[] { first, last }
    });
    this.jobAttributes.setToPage(last);
    this.jobAttributes.setFromPage(first);


    // Verify that the cross feed and feed resolutions are the same
    int[] res = this.pageAttributes.getPrinterResolution();
    if (res[0] != res[1]) {
        throw new IllegalArgumentException("Differing cross feed and feed"+
                                           " resolutions not supported.");
    }

    // Verify that the app has access to the file system
    DestinationType dest= this.jobAttributes.getDestination();
    if (dest == DestinationType.FILE) {
        throwPrintToFile();

        // check if given filename is valid
        String destStr = jobAttributes.getFileName();
        if ((destStr != null) &&
            (jobAttributes.getDialog() == JobAttributes.DialogType.NONE)) {

            File f = new File(destStr);
            try {
                // check if this is a new file and if filename chars are valid
                // createNewFile returns false if file exists
                if (f.createNewFile()) {
                    f.delete();
                }
            } catch (IOException ioe) {
                throw new IllegalArgumentException("Cannot write to file:"+
                                                   destStr);
            } catch (SecurityException se) {
                //There is already file read/write access so at this point
                // only delete access is denied.  Just ignore it because in
                // most cases the file created in createNewFile gets overwritten
                // anyway.
            }

             File pFile = f.getParentFile();
             if ((f.exists() &&
                  (!f.isFile() || !f.canWrite())) ||
                 ((pFile != null) &&
                  (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
                 throw new IllegalArgumentException("Cannot write to file:"+
                                                    destStr);
             }
        }
    }
}
 
源代码30 项目: TencentKona-8   文件: PrintJob2D.java
private void initPrintJob2D(Frame frame,  String doctitle,
                            JobAttributes jobAttributes,
                            PageAttributes pageAttributes) {

    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkPrintJobAccess();
    }

    if (frame == null &&
        (jobAttributes == null ||
         jobAttributes.getDialog() == DialogType.NATIVE)) {
        throw new NullPointerException("Frame must not be null");
    }
    this.frame = frame;

    this.docTitle = (doctitle == null) ? "" : doctitle;
    this.jobAttributes = (jobAttributes != null)
        ? jobAttributes : new JobAttributes();
    this.pageAttributes = (pageAttributes != null)
        ? pageAttributes : new PageAttributes();

    // Currently, we always reduce page ranges to xxx or xxx-xxx
    int[][] pageRanges = this.jobAttributes.getPageRanges();
    int first = pageRanges[0][0];
    int last = pageRanges[pageRanges.length - 1][1];
    this.jobAttributes.setPageRanges(new int[][] {
        new int[] { first, last }
    });
    this.jobAttributes.setToPage(last);
    this.jobAttributes.setFromPage(first);


    // Verify that the cross feed and feed resolutions are the same
    int[] res = this.pageAttributes.getPrinterResolution();
    if (res[0] != res[1]) {
        throw new IllegalArgumentException("Differing cross feed and feed"+
                                           " resolutions not supported.");
    }

    // Verify that the app has access to the file system
    DestinationType dest= this.jobAttributes.getDestination();
    if (dest == DestinationType.FILE) {
        throwPrintToFile();

        // check if given filename is valid
        String destStr = jobAttributes.getFileName();
        if ((destStr != null) &&
            (jobAttributes.getDialog() == JobAttributes.DialogType.NONE)) {

            File f = new File(destStr);
            try {
                // check if this is a new file and if filename chars are valid
                // createNewFile returns false if file exists
                if (f.createNewFile()) {
                    f.delete();
                }
            } catch (IOException ioe) {
                throw new IllegalArgumentException("Cannot write to file:"+
                                                   destStr);
            } catch (SecurityException se) {
                //There is already file read/write access so at this point
                // only delete access is denied.  Just ignore it because in
                // most cases the file created in createNewFile gets overwritten
                // anyway.
            }

             File pFile = f.getParentFile();
             if ((f.exists() &&
                  (!f.isFile() || !f.canWrite())) ||
                 ((pFile != null) &&
                  (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
                 throw new IllegalArgumentException("Cannot write to file:"+
                                                    destStr);
             }
        }
    }
}
 
 类所在包
 同包方法