Package javax.print.attribute

Examples of javax.print.attribute.HashPrintServiceAttributeSet


          PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
          printRequestAttributeSet.add(new Copies(mod.getPrintCopies()));


          PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
          printServiceAttributeSet.add(new PrinterName(JPrint.getPrinterServicebyName(printQueue).getName(), Locale.getDefault()));

          SimplePrintServiceExporterConfiguration configuration = new SimplePrintServiceExporterConfiguration();
          configuration.setPrintRequestAttributeSet(printRequestAttributeSet);
          configuration.setPrintServiceAttributeSet(printServiceAttributeSet);
          configuration.setDisplayPageDialog(false);
View Full Code Here


        }
        else
        {
          exporter = new JRPrintServiceExporter();
          exporter.setParameter(JRPrintServiceExporterParameter.JASPER_PRINT, jasperPrint);
          serviceAttributeSet = new HashPrintServiceAttributeSet();
          serviceAttributeSet.add(new PrinterName(JPrint.getPrinterShortName(JPrint.getPreferredPrinterQueueName()), null));
          exporter.setParameter(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET, serviceAttributeSet);
          exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG, Boolean.FALSE);
          exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG, mod.isPrintDialog());
          PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
View Full Code Here

        PrintServiceAttributeSet serviceSet = null;

        if (attributes != null && !attributes.isEmpty()) {

            requestSet = new HashPrintRequestAttributeSet();
            serviceSet = new HashPrintServiceAttributeSet();

            Attribute[] attrs = attributes.toArray();
            for (int i=0; i<attrs.length; i++) {
                if (attrs[i] instanceof PrintRequestAttribute) {
                    requestSet.add(attrs[i]);
View Full Code Here

      }
        return new Win32PrintJob(this);
    }

    private PrintServiceAttributeSet getDynamicAttributes() {
        PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
        attrs.add(getPrinterIsAcceptingJobs());
        attrs.add(getQueuedJobCount());
        return attrs;
    }
View Full Code Here

        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);
        }
View Full Code Here

        }
    }

    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);
    }
View Full Code Here

     */
    public void run() {

       long minSleepTime = 15000;
       long sleepTime = 2000;
       HashPrintServiceAttributeSet attrs;
       PrintServiceAttributeEvent attrEvent;
       PrintServiceAttributeListener listener;
       PrintServiceAttributeSet psa;

       while (!stop) {
           try {
                Thread.sleep(sleepTime);
           } catch (InterruptedException e) {
           }
           synchronized (this) {
               if (listeners == null) {
                   continue;
               }
               long startTime = System.currentTimeMillis();
               if (listeners != null) {
                    if (service instanceof AttributeUpdater) {
                       psa =
                          ((AttributeUpdater)service).getUpdatedAttributes();
                    } else {
                       psa = service.getAttributes();
                    }
                    if (psa != null && !psa.isEmpty()) {
                        for (int i = 0; i < listeners.size() ; i++) {
                            listener = (PrintServiceAttributeListener)
                                listeners.elementAt(i);
                            attrs =
                                new HashPrintServiceAttributeSet(psa);
                            attrEvent =
                                new PrintServiceAttributeEvent(service, attrs);
                            listener.attributeUpdate(attrEvent);
                        }
                    }
View Full Code Here

        } else {
            return null;
        }
    }
    public PrintServiceAttributeSet getAttributes() {
        PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
        attrs.add(ColorSupported.SUPPORTED);

        return AttributeSetUtilities.unmodifiableView(attrs);
    }
View Full Code Here

            throw new RuntimeException(ex);
        }
    }

    public PrintServiceAttributeSet getAttributes() {
        final PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();

        attrs.add(new PrinterName(printerName, null));
        try {
            attrs.add(WinPrinterFactory.getPrinterState(getPrinterHandle()));
            attrs.add(WinPrinterFactory.getQueuedJobCount(getPrinterHandle()));
        } catch (final PrintException ex) {
            throw new RuntimeException(ex);
        }

        return AttributeSetUtilities.unmodifiableView(attrs);
View Full Code Here

        });
    }

    private void notifyListeners(final PrintServiceAttribute... attrs) {
        final PrintServiceAttributeEvent event = new PrintServiceAttributeEvent(
                        this, new HashPrintServiceAttributeSet(attrs));
        for (PrintServiceAttributeListener listener : attrListeners.keySet()) {
            listener.attributeUpdate(event);
        }
    }
View Full Code Here

TOP

Related Classes of javax.print.attribute.HashPrintServiceAttributeSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.