javax.print.attribute.PrintServiceAttributeSet Java Examples
The following examples show how to use
javax.print.attribute.PrintServiceAttributeSet.
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: UnixPrintService.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getUpdatedAttributes() { PrintServiceAttributeSet currSet = getDynamicAttributes(); if (lastSet == null) { lastSet = currSet; return AttributeSetUtilities.unmodifiableView(currSet); } else { PrintServiceAttributeSet updates = new HashPrintServiceAttributeSet(); Attribute []attrs = currSet.toArray(); Attribute attr; for (int i=0; i<attrs.length; i++) { attr = attrs[i]; if (!lastSet.containsValue(attr)) { updates.add(attr); } } lastSet = currSet; return AttributeSetUtilities.unmodifiableView(updates); } }
Example #2
Source File: Win32PrintService.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getUpdatedAttributes() { PrintServiceAttributeSet currSet = getDynamicAttributes(); if (lastSet == null) { lastSet = currSet; return AttributeSetUtilities.unmodifiableView(currSet); } else { PrintServiceAttributeSet updates = new HashPrintServiceAttributeSet(); Attribute []attrs = currSet.toArray(); for (int i=0; i<attrs.length; i++) { Attribute attr = attrs[i]; if (!lastSet.containsValue(attr)) { updates.add(attr); } } lastSet = currSet; return AttributeSetUtilities.unmodifiableView(updates); } }
Example #3
Source File: PrintServiceApp.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ public void print() throws JRException { long start = System.currentTimeMillis(); PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet(); printRequestAttributeSet.add(MediaSizeName.ISO_A4); PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet(); //printServiceAttributeSet.add(new PrinterName("Epson Stylus 820 ESC/P 2", null)); //printServiceAttributeSet.add(new PrinterName("hp LaserJet 1320 PCL 6", null)); //printServiceAttributeSet.add(new PrinterName("PDFCreator", null)); JRPrintServiceExporter exporter = new JRPrintServiceExporter(); exporter.setExporterInput(new SimpleExporterInput("build/reports/PrintServiceReport.jrprint")); SimplePrintServiceExporterConfiguration configuration = new SimplePrintServiceExporterConfiguration(); configuration.setPrintRequestAttributeSet(printRequestAttributeSet); configuration.setPrintServiceAttributeSet(printServiceAttributeSet); configuration.setDisplayPageDialog(false); configuration.setDisplayPrintDialog(true); exporter.setConfiguration(configuration); exporter.exportReport(); System.err.println("Printing time : " + (System.currentTimeMillis() - start)); }
Example #4
Source File: UnixPrintService.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getUpdatedAttributes() { PrintServiceAttributeSet currSet = getDynamicAttributes(); if (lastSet == null) { lastSet = currSet; return AttributeSetUtilities.unmodifiableView(currSet); } else { PrintServiceAttributeSet updates = new HashPrintServiceAttributeSet(); Attribute []attrs = currSet.toArray(); Attribute attr; for (int i=0; i<attrs.length; i++) { attr = attrs[i]; if (!lastSet.containsValue(attr)) { updates.add(attr); } } lastSet = currSet; return AttributeSetUtilities.unmodifiableView(updates); } }
Example #5
Source File: Win32PrintService.java From hottub with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getUpdatedAttributes() { PrintServiceAttributeSet currSet = getDynamicAttributes(); if (lastSet == null) { lastSet = currSet; return AttributeSetUtilities.unmodifiableView(currSet); } else { PrintServiceAttributeSet updates = new HashPrintServiceAttributeSet(); Attribute []attrs = currSet.toArray(); for (int i=0; i<attrs.length; i++) { Attribute attr = attrs[i]; if (!lastSet.containsValue(attr)) { updates.add(attr); } } lastSet = currSet; return AttributeSetUtilities.unmodifiableView(updates); } }
Example #6
Source File: Win32PrintService.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getAttributes() { PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet(); attrs.add(getPrinterName()); attrs.add(getPrinterIsAcceptingJobs()); PrinterState prnState = getPrinterState(); if (prnState != null) { attrs.add(prnState); } PrinterStateReasons prnStateReasons = getPrinterStateReasons(); if (prnStateReasons != null) { attrs.add(prnStateReasons); } attrs.add(getQueuedJobCount()); int caps = getPrinterCapabilities(); if ((caps & DEVCAP_COLOR) != 0) { attrs.add(ColorSupported.SUPPORTED); } else { attrs.add(ColorSupported.NOT_SUPPORTED); } return AttributeSetUtilities.unmodifiableView(attrs); }
Example #7
Source File: Win32PrintService.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getUpdatedAttributes() { PrintServiceAttributeSet currSet = getDynamicAttributes(); if (lastSet == null) { lastSet = currSet; return AttributeSetUtilities.unmodifiableView(currSet); } else { PrintServiceAttributeSet updates = new HashPrintServiceAttributeSet(); Attribute []attrs = currSet.toArray(); for (int i=0; i<attrs.length; i++) { Attribute attr = attrs[i]; if (!lastSet.containsValue(attr)) { updates.add(attr); } } lastSet = currSet; return AttributeSetUtilities.unmodifiableView(updates); } }
Example #8
Source File: Win32PrintService.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getAttributes() { PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet(); attrs.add(getPrinterName()); attrs.add(getPrinterIsAcceptingJobs()); PrinterState prnState = getPrinterState(); if (prnState != null) { attrs.add(prnState); } PrinterStateReasons prnStateReasons = getPrinterStateReasons(); if (prnStateReasons != null) { attrs.add(prnStateReasons); } attrs.add(getQueuedJobCount()); int caps = getPrinterCapabilities(); if ((caps & DEVCAP_COLOR) != 0) { attrs.add(ColorSupported.SUPPORTED); } else { attrs.add(ColorSupported.NOT_SUPPORTED); } return AttributeSetUtilities.unmodifiableView(attrs); }
Example #9
Source File: Win32PrintService.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getUpdatedAttributes() { PrintServiceAttributeSet currSet = getDynamicAttributes(); if (lastSet == null) { lastSet = currSet; return AttributeSetUtilities.unmodifiableView(currSet); } else { PrintServiceAttributeSet updates = new HashPrintServiceAttributeSet(); Attribute []attrs = currSet.toArray(); for (int i=0; i<attrs.length; i++) { Attribute attr = attrs[i]; if (!lastSet.containsValue(attr)) { updates.add(attr); } } lastSet = currSet; return AttributeSetUtilities.unmodifiableView(updates); } }
Example #10
Source File: PSPrinterJob.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Invoked by the RasterPrintJob super class * this method is called after that last page * has been imaged. */ protected void endDoc() throws PrinterException { if (mPSStream != null) { mPSStream.println(EOF_COMMENT); mPSStream.flush(); if (mDestType != RasterPrinterJob.STREAM) { mPSStream.close(); } } if (mDestType == RasterPrinterJob.PRINTER) { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); if (isMac) { PrintServiceAttributeSet psaSet = pServ.getAttributes(); if (psaSet != null) { mDestination = psaSet.get(PrinterName.class).toString() ; } } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); if (spooler.pex != null) { throw spooler.pex; } } }
Example #11
Source File: UnixPrintService.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public PrintServiceAttributeSet getAttributes() { PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet(); attrs.add(getPrinterName()); attrs.add(getPrinterIsAcceptingJobs()); PrinterState prnState = getPrinterState(); if (prnState != null) { attrs.add(prnState); } PrinterStateReasons prnStateReasons = getPrinterStateReasons(); if (prnStateReasons != null) { attrs.add(prnStateReasons); } attrs.add(getQueuedJobCount()); return AttributeSetUtilities.unmodifiableView(attrs); }
Example #12
Source File: UnixPrintService.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private PrintServiceAttributeSet getDynamicAttributes() { if (PrintServiceLookupProvider.isSysV()) { return getSysVServiceAttributes(); } else if (PrintServiceLookupProvider.isAIX()) { return getAIXServiceAttributes(); } else { return getBSDServiceAttributes(); } }
Example #13
Source File: PSPrinterJob.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Invoked by the RasterPrintJob super class * this method is called after that last page * has been imaged. */ protected void endDoc() throws PrinterException { if (mPSStream != null) { mPSStream.println(EOF_COMMENT); mPSStream.flush(); if (mDestType != RasterPrinterJob.STREAM) { mPSStream.close(); } } if (mDestType == RasterPrinterJob.PRINTER) { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); if (isMac) { PrintServiceAttributeSet psaSet = pServ.getAttributes(); if (psaSet != null) { mDestination = psaSet.get(PrinterName.class).toString() ; } } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); if (spooler.pex != null) { throw spooler.pex; } } }
Example #14
Source File: Win32PrintServiceLookup.java From hottub with GNU General Public License v2.0 | 5 votes |
boolean matchingService(PrintService service, PrintServiceAttributeSet serviceSet) { if (serviceSet != null) { Attribute [] attrs = serviceSet.toArray(); Attribute serviceAttr; for (int i=0; i<attrs.length; i++) { serviceAttr = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; } } } return true; }
Example #15
Source File: PrintServiceLookupProvider.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private boolean matchesAttributes(PrintService service, PrintServiceAttributeSet attributes) { Attribute [] attrs = attributes.toArray(); Attribute serviceAttr; for (int i=0; i<attrs.length; i++) { serviceAttr = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; } } return true; }
Example #16
Source File: PrintServiceLookupProvider.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
boolean matchingService(PrintService service, PrintServiceAttributeSet serviceSet) { if (serviceSet != null) { Attribute [] attrs = serviceSet.toArray(); Attribute serviceAttr; for (int i=0; i<attrs.length; i++) { serviceAttr = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; } } } return true; }
Example #17
Source File: UnixPrintServiceLookup.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private boolean matchesAttributes(PrintService service, PrintServiceAttributeSet attributes) { Attribute [] attrs = attributes.toArray(); Attribute serviceAttr; for (int i=0; i<attrs.length; i++) { serviceAttr = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; } } return true; }
Example #18
Source File: PSPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Invoked by the RasterPrintJob super class * this method is called after that last page * has been imaged. */ protected void endDoc() throws PrinterException { if (mPSStream != null) { mPSStream.println(EOF_COMMENT); mPSStream.flush(); if (mDestType != RasterPrinterJob.STREAM) { mPSStream.close(); } } if (mDestType == RasterPrinterJob.PRINTER) { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); if (isMac) { PrintServiceAttributeSet psaSet = pServ.getAttributes(); if (psaSet != null) { mDestination = psaSet.get(PrinterName.class).toString() ; } } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); if (spooler.pex != null) { throw spooler.pex; } } }
Example #19
Source File: PSPrinterJob.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Invoked by the RasterPrintJob super class * this method is called after that last page * has been imaged. */ protected void endDoc() throws PrinterException { if (mPSStream != null) { mPSStream.println(EOF_COMMENT); mPSStream.flush(); if (mPSStream.checkError()) { abortDoc(); throw new PrinterException("Error while writing to file"); } if (mDestType != RasterPrinterJob.STREAM) { mPSStream.close(); } } if (mDestType == RasterPrinterJob.PRINTER) { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); if (isMac) { PrintServiceAttributeSet psaSet = pServ.getAttributes(); if (psaSet != null) { mDestination = psaSet.get(PrinterName.class).toString() ; } } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); if (spooler.pex != null) { throw spooler.pex; } } }
Example #20
Source File: UnixPrintServiceLookup.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private boolean matchesAttributes(PrintService service, PrintServiceAttributeSet attributes) { Attribute [] attrs = attributes.toArray(); Attribute serviceAttr; for (int i=0; i<attrs.length; i++) { serviceAttr = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; } } return true; }
Example #21
Source File: PSPrinterJob.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Invoked by the RasterPrintJob super class * this method is called after that last page * has been imaged. */ protected void endDoc() throws PrinterException { if (mPSStream != null) { mPSStream.println(EOF_COMMENT); mPSStream.flush(); if (mDestType != RasterPrinterJob.STREAM) { mPSStream.close(); } } if (mDestType == RasterPrinterJob.PRINTER) { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); if (isMac) { PrintServiceAttributeSet psaSet = pServ.getAttributes(); if (psaSet != null) { mDestination = psaSet.get(PrinterName.class).toString() ; } } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); if (spooler.pex != null) { throw spooler.pex; } } }
Example #22
Source File: PSPrinterJob.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Invoked by the RasterPrintJob super class * this method is called after that last page * has been imaged. */ protected void endDoc() throws PrinterException { if (mPSStream != null) { mPSStream.println(EOF_COMMENT); mPSStream.flush(); if (mDestType != RasterPrinterJob.STREAM) { mPSStream.close(); } } if (mDestType == RasterPrinterJob.PRINTER) { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); if (isMac) { PrintServiceAttributeSet psaSet = pServ.getAttributes(); if (psaSet != null) { mDestination = psaSet.get(PrinterName.class).toString() ; } } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); if (spooler.pex != null) { throw spooler.pex; } } }
Example #23
Source File: PSPrinterJob.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Invoked by the RasterPrintJob super class * this method is called after that last page * has been imaged. */ protected void endDoc() throws PrinterException { if (mPSStream != null) { mPSStream.println(EOF_COMMENT); mPSStream.flush(); if (mDestType != RasterPrinterJob.STREAM) { mPSStream.close(); } } if (mDestType == RasterPrinterJob.PRINTER) { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); if (isMac) { PrintServiceAttributeSet psaSet = pServ.getAttributes(); if (psaSet != null) { mDestination = psaSet.get(PrinterName.class).toString() ; } } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); if (spooler.pex != null) { throw spooler.pex; } } }
Example #24
Source File: UnixPrintServiceLookup.java From hottub with GNU General Public License v2.0 | 5 votes |
private boolean matchesAttributes(PrintService service, PrintServiceAttributeSet attributes) { Attribute [] attrs = attributes.toArray(); Attribute serviceAttr; for (int i=0; i<attrs.length; i++) { serviceAttr = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; } } return true; }
Example #25
Source File: PSPrinterJob.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Invoked by the RasterPrintJob super class * this method is called after that last page * has been imaged. */ protected void endDoc() throws PrinterException { if (mPSStream != null) { mPSStream.println(EOF_COMMENT); mPSStream.flush(); if (mDestType != RasterPrinterJob.STREAM) { mPSStream.close(); } } if (mDestType == RasterPrinterJob.PRINTER) { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); if (isMac) { PrintServiceAttributeSet psaSet = pServ.getAttributes(); if (psaSet != null) { mDestination = psaSet.get(PrinterName.class).toString() ; } } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); if (spooler.pex != null) { throw spooler.pex; } } }
Example #26
Source File: PSPrinterJob.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Invoked by the RasterPrintJob super class * this method is called after that last page * has been imaged. */ protected void endDoc() throws PrinterException { if (mPSStream != null) { mPSStream.println(EOF_COMMENT); mPSStream.flush(); if (mDestType != RasterPrinterJob.STREAM) { mPSStream.close(); } } if (mDestType == RasterPrinterJob.PRINTER) { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); if (isMac) { PrintServiceAttributeSet psaSet = pServ.getAttributes(); if (psaSet != null) { mDestination = psaSet.get(PrinterName.class).toString() ; } } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); if (spooler.pex != null) { throw spooler.pex; } } }
Example #27
Source File: Win32PrintServiceLookup.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
boolean matchingService(PrintService service, PrintServiceAttributeSet serviceSet) { if (serviceSet != null) { Attribute [] attrs = serviceSet.toArray(); Attribute serviceAttr; for (int i=0; i<attrs.length; i++) { serviceAttr = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; } } } return true; }
Example #28
Source File: UnixPrintServiceLookup.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private boolean matchesAttributes(PrintService service, PrintServiceAttributeSet attributes) { Attribute [] attrs = attributes.toArray(); Attribute serviceAttr; for (int i=0; i<attrs.length; i++) { serviceAttr = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; } } return true; }
Example #29
Source File: UnixPrintService.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private PrintServiceAttributeSet getDynamicAttributes() { if (UnixPrintServiceLookup.isSysV()) { return getSysVServiceAttributes(); } else if (UnixPrintServiceLookup.isAIX()) { return getAIXServiceAttributes(); } else { return getBSDServiceAttributes(); } }
Example #30
Source File: UnixPrintService.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private PrintServiceAttributeSet getBSDServiceAttributes() { PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet(); attrs.add(getQueuedJobCountBSD()); attrs.add(getPrinterIsAcceptingJobsBSD()); return attrs; }