Package javax.print.attribute

Examples of javax.print.attribute.AttributeSet


        }

        ArrayList requestedServices = new ArrayList();
        for (int i = 0; i < cupsservices.length; i++) {
            try {
                AttributeSet unsupportedSet = cupsservices[i]
                        .getUnsupportedAttributes(flavor, attributes);
                if (unsupportedSet == null) {
                    requestedServices.add(cupsservices[i]);
                }
            } catch (IllegalArgumentException iae) {
View Full Code Here


                    //uri = File.createTempFile("xxx", null).toURI();
                } catch (URISyntaxException e) {
                    fail();
                }

                AttributeSet attrs = new HashAttributeSet();
                attrs.add(Finishings.EDGE_STITCH);
                attrs.add(MediaSizeName.JAPANESE_DOUBLE_POSTCARD);
                attrs.add(new Destination(uri));
                attrs.add(new DocumentName("Doc X", Locale.US));
                attrs.add(new JobName("Job Y", Locale.US));
                attrs.add(new RequestingUserName("User Z", Locale.US));

                for (int j = 0; j < flavors.length; j++) {
                    if (services[i].isDocFlavorSupported(flavors[j])) {
                        AttributeSet aset = services[i]
                                .getUnsupportedAttributes(flavors[j], attrs);
                        if (aset == null) {
                            fail("At least one attribute is unsupported");
                        }
                        if (aset != null) {
                            Attribute[] aarr = aset.toArray();
                            System.out
                                    .println("Usupported attributes fo DocFlavor "
                                            + flavors[j]);
                            for (int k = 0, kk = aarr.length; k < kk; k++) {
                                System.out.println("\t" + aarr[k]);
View Full Code Here

                        final PrintRequestAttributeSet attributes)
                        throws PrintException {
            final long pdc = WinPrinterFactory.getPrinterDC(
                            service.printerName, service.getPrinterProps()
                                            .getStructPtr());
            final AttributeSet docAttrs = doc.getAttributes();
            final Printable printable = castDoc(doc, Printable.class);
            final PageFormat format = getPageFormat(docAttrs, attributes);
            final PageRanges ranges = getAttribute(PageRanges.class, docAttrs,
                            attributes);
            int res = Printable.PAGE_EXISTS;
View Full Code Here

            final PageFormat defaultFormat = getPageFormat(doc.getAttributes(),
                            attributes);
            final long pdc = WinPrinterFactory.getPrinterDC(
                            service.printerName, service.getPrinterProps()
                                            .getStructPtr());
            final AttributeSet docAttrs = doc.getAttributes();
            int pages = pageable.getNumberOfPages();
            final PageRanges ranges = getAttribute(PageRanges.class, docAttrs,
                            attributes);

            if (pages == Pageable.UNKNOWN_NUMBER_OF_PAGES) {
View Full Code Here

        }
        ArrayList requestedServices = new ArrayList();
        for (int i = 0; i < services.length; i++) {
           
            try {
                AttributeSet unsupportedSet =
                    services[i].getUnsupportedAttributes(flavor, attributes);
                if (unsupportedSet == null && (flavor == null ||
                        services[i].isDocFlavorSupported(flavor))) {
                    requestedServices.add(services[i]);
                }
View Full Code Here

  public String getPrinterInfo() {
    StringBuilder sb = new StringBuilder();

    final SortedSet<DocFlavor> docFlavors = this.getDocFlavors();
    final AttributeSet attributes = this.printService.getAttributes();

    sb.append("\nPrinter Information\n");
    sb.append("==========================================================\n");
    sb.append("Name: " + this.printService.getName() + "\n");
    sb.append("Supported DocFlavors:\n");
View Full Code Here

  }

  public SortedSet<DocFlavor> getDocFlavorsSupportingAttribute(Attribute attribute) {

    final SortedSet<DocFlavor> docFlavors = this.getDocFlavors();
    final AttributeSet attributes = this.printService.getAttributes();

    final SortedSet<DocFlavor> matchedDocFlavors = new TreeSet<DocFlavor>(new DocFlavorComparator());

    for (DocFlavor docFlavor : docFlavors) {
View Full Code Here

        if (attrFidelity != null && attrFidelity == Fidelity.FIDELITY_TRUE) {
            fidelity = true;
        }

        if (fidelity == true) {
           AttributeSet unsupported =
               service.getUnsupportedAttributes(
                                         DocFlavor.SERVICE_FORMATTED.PAGEABLE,
                                         attributes);
           if (unsupported != null) {
               throw new PrinterException("Fidelity cannot be satisfied");
View Full Code Here

        if (attributes == null) {
            return null;
        }

        Attribute attr;
        AttributeSet unsupp = new HashAttributeSet();
        Attribute []attrs = attributes.toArray();
        for (int i=0; i<attrs.length; i++) {
            try {
                attr = attrs[i];
                if (!isAttributeCategorySupported(attr.getCategory())) {
                    unsupp.add(attr);
                }
                else if (!isAttributeValueSupported(attr, flavor, attributes)) {
                    unsupp.add(attr);
                }
            } catch (ClassCastException e) {
            }
        }
        if (unsupp.isEmpty()) {
            return null;
        } else {
            return unsupp;
        }
    }
View Full Code Here

        if (attributes == null) {
            return null;
        }

        Attribute attr;
        AttributeSet unsupp = new HashAttributeSet();
        Attribute []attrs = attributes.toArray();
        for (int i=0; i<attrs.length; i++) {
            try {
                attr = attrs[i];
                if (!isAttributeCategorySupported(attr.getCategory())) {
                    unsupp.add(attr);
                } else if (!isAttributeValueSupported(attr, flavor,
                                                      attributes)) {
                    unsupp.add(attr);
                }
            } catch (ClassCastException e) {
            }
        }
        if (unsupp.isEmpty()) {
            return null;
        } else {
            return unsupp;
        }
    }
View Full Code Here

TOP

Related Classes of javax.print.attribute.AttributeSet

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.