Java Code Examples for javax.print.attribute.standard.Copies#getValue()

The following examples show how to use javax.print.attribute.standard.Copies#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Win32PrintJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new sun.awt.windows.WPrinterJob();
            }
        }
        PrintService svc = getPrintService();
        job.setPrintService(svc);
        if (copies == 0) {
            Copies c = (Copies)svc.getDefaultAttributeValue(Copies.class);
            copies = c.getValue();
        }
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
 
Example 2
Source File: Win32PrintJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new sun.awt.windows.WPrinterJob();
            }
        }
        PrintService svc = getPrintService();
        job.setPrintService(svc);
        if (copies == 0) {
            Copies c = (Copies)svc.getDefaultAttributeValue(Copies.class);
            copies = c.getValue();
        }
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
 
Example 3
Source File: Win32PrintService.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    synchronized (this) {
        if (gotCopies == false) {
            nCopies = getCopiesSupported(printer, getPort());
            gotCopies = true;
        }
    }
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies <= nCopies);
}
 
Example 4
Source File: Win32PrintJob.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new sun.awt.windows.WPrinterJob();
            }
        }
        PrintService svc = getPrintService();
        job.setPrintService(svc);
        if (copies == 0) {
            Copies c = (Copies)svc.getDefaultAttributeValue(Copies.class);
            copies = c.getValue();
        }
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
 
Example 5
Source File: Win32PrintService.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    synchronized (this) {
        if (gotCopies == false) {
            nCopies = getCopiesSupported(printer, getPort());
            gotCopies = true;
        }
    }
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies <= nCopies);
}
 
Example 6
Source File: Win32PrintJob.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new sun.awt.windows.WPrinterJob();
            }
        }
        PrintService svc = getPrintService();
        job.setPrintService(svc);
        if (copies == 0) {
            Copies c = (Copies)svc.getDefaultAttributeValue(Copies.class);
            copies = c.getValue();
        }
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
 
Example 7
Source File: Win32PrintService.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    synchronized (this) {
        if (gotCopies == false) {
            nCopies = getCopiesSupported(printer, getPort());
            gotCopies = true;
        }
    }
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies <= nCopies);
}
 
Example 8
Source File: Win32PrintJob.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new sun.awt.windows.WPrinterJob();
            }
        }
        PrintService svc = getPrintService();
        job.setPrintService(svc);
        if (copies == 0) {
            Copies c = (Copies)svc.getDefaultAttributeValue(Copies.class);
            copies = c.getValue();
        }
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
 
Example 9
Source File: Win32PrintService.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    synchronized (this) {
        if (gotCopies == false) {
            nCopies = getCopiesSupported(printer, getPort());
            gotCopies = true;
        }
    }
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies <= nCopies);
}
 
Example 10
Source File: Win32PrintJob.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new sun.awt.windows.WPrinterJob();
            }
        }
        PrintService svc = getPrintService();
        job.setPrintService(svc);
        if (copies == 0) {
            Copies c = (Copies)svc.getDefaultAttributeValue(Copies.class);
            copies = c.getValue();
        }
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
 
Example 11
Source File: Win32PrintJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void pageableJob(Pageable pageable) throws PrintException {
    try {
        synchronized(this) {
            if (job != null) { // shouldn't happen
                throw new PrintException("already printing");
            } else {
                job = new sun.awt.windows.WPrinterJob();
            }
        }
        PrintService svc = getPrintService();
        job.setPrintService(svc);
        if (copies == 0) {
            Copies c = (Copies)svc.getDefaultAttributeValue(Copies.class);
            copies = c.getValue();
        }
        job.setCopies(copies);
        job.setJobName(jobName);
        job.setPageable(pageable);
        job.print(reqAttrSet);
        notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE);
        return;
    } catch (PrinterException pe) {
        notifyEvent(PrintJobEvent.JOB_FAILED);
        throw new PrintException(pe);
    } finally {
        printReturned = true;
        notifyEvent(PrintJobEvent.NO_MORE_EVENTS);
    }
}
 
Example 12
Source File: UnixPrintService.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies < MAXCOPIES);
}
 
Example 13
Source File: PSStreamPrintService.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies < MAXCOPIES);
}
 
Example 14
Source File: PSStreamPrintService.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies < MAXCOPIES);
}
 
Example 15
Source File: PSStreamPrintService.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies < MAXCOPIES);
}
 
Example 16
Source File: PSStreamPrintService.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies < MAXCOPIES);
}
 
Example 17
Source File: UnixPrintService.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies < MAXCOPIES);
}
 
Example 18
Source File: UnixPrintService.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies < MAXCOPIES);
}
 
Example 19
Source File: PSStreamPrintService.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies < MAXCOPIES);
}
 
Example 20
Source File: UnixPrintService.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private boolean isSupportedCopies(Copies copies) {
    int numCopies = copies.getValue();
    return (numCopies > 0 && numCopies < MAXCOPIES);
}