Package javax.print.attribute.standard

Examples of javax.print.attribute.standard.CopiesSupported


                flavor.equals(DocFlavor.URL.POSTSCRIPT)) {
                return false;
            }
        }
        if (category.equals(Copies.class)) {
            CopiesSupported copies =
                (CopiesSupported)getSupportedAttributeValues(category, flavor,
                                                             attributes);
            int value = ((Copies)attribute).getValue();
            if (copies != null && copies.contains(value)) {
                return true;
            }
        } else if (category.equals(Sides.class)) {
            Sides[] sides = (Sides[])getSupportedAttributeValues(category,
                    flavor, attributes);
View Full Code Here


            return null;
        }
        if (category.equals(Copies.class)) {
            int copies = getCopiesSupported(serviceName);
            if (copies == 1) {
                return new CopiesSupported(1);
            } else if (copies > 1) {
                return new CopiesSupported(1, copies);
            }
        } else if (category.equals(Sides.class)) {
            if (getSidesSupported(serviceName)) {
                return new Sides[] {Sides.ONE_SIDED,
                                    Sides.TWO_SIDED_SHORT_EDGE,
View Full Code Here

            for (int i = 0, ii = avalue.size(); i < ii; i++) {
                if (atag == IppAttribute.TAG_RANGEOFINTEGER) {
                    DataInputStream di = new DataInputStream(
                            new ByteArrayInputStream((byte[]) avalue.get(i)));
                    try {
                        a = new CopiesSupported(di.readInt(), di.readInt());
                    } catch (IOException e) {
                        // IGNORE exception
                        a = null;
                        e.printStackTrace();
                    }
View Full Code Here

                if (gotCopies == false) {
                    nCopies = getCopiesSupported(printer, getPort());
                    gotCopies = true;
                }
            }
            return new CopiesSupported(1, nCopies);
        } else if (category == Media.class) {

            initMedia();

            int len = (mediaSizeNames == null) ? 0 : mediaSizeNames.length;
View Full Code Here

            } else {
                return null;
            }
        } else if ((category == Copies.class) ||
                   (category == CopiesSupported.class)) {
            return new CopiesSupported(1, MAXCOPIES);
        } else if (category == Media.class) {
            Media []arr = new Media[mediaSizes.length];
            System.arraycopy(mediaSizes, 0, arr, 0, mediaSizes.length);
            return arr;
        } else if (category == Fidelity.class) {
View Full Code Here

                return WinPrinterFactory
                                .getSupportedMediaSizes(getPrinterHandle());
            } else if (CopiesSupported.class.equals(category)) {
                final int max = WinPrinterFactory
                                .getMaxNumberOfCopies(getPrinterHandle());
                return max > 1 ? new CopiesSupported(1, max)
                                : new CopiesSupported(1);
            } else if (PrintQuality.class.equals(category)) {
                return new PrintQuality[] { PrintQuality.HIGH,
                                PrintQuality.NORMAL, PrintQuality.DRAFT };
            } else if (Sides.class.equals(category)) {
                return WinPrinterFactory.isDuplexSupported(getPrinterHandle())
View Full Code Here

                flavor.equals(DocFlavor.URL.POSTSCRIPT)) {
                return false;
            }
        }
        if (category.equals(Copies.class)) {
            CopiesSupported copies =
                (CopiesSupported)getSupportedAttributeValues(category, flavor,
                                                             attributes);
            int value = ((Copies)attribute).getValue();
            if (copies != null && copies.contains(value)) {
                return true;
            }
        } else if (category.equals(Sides.class)) {
            Sides[] sides = (Sides[])getSupportedAttributeValues(category,
                    flavor, attributes);
View Full Code Here

            return null;
        }
        if (category.equals(Copies.class)) {
            int copies = getCopiesSupported(serviceName);
            if (copies == 1) {
                return new CopiesSupported(1);
            } else if (copies > 1) {
                return new CopiesSupported(1, copies);
            }
        } else if (category.equals(Sides.class)) {
            if (getSidesSupported(serviceName)) {
                return new Sides[] {Sides.ONE_SIDED,
                                    Sides.TWO_SIDED_SHORT_EDGE,
View Full Code Here

   
        if (isEnabled) {
            int value = (firstUse && attrs.containsKey(Copies.class
                        ? ((Copies) (attrs.get(Copies.class))).getValue() 
                        : ((Integer) cpSpinner.getValue()).intValue());
            CopiesSupported supported = (CopiesSupported) myService
                    .getSupportedAttributeValues(Copies.class, flavor, attrs);
            Copies defaul = (Copies)
                    myService.getDefaultAttributeValue(Copies.class);
           
            if(supported == null) {
                /*
                 * It is incorrect situation, however it is possible: Copies
                 * category is supported, but there are no supported values. I
                 * suppose that only default Copies value is supported in this
                 * case. If default Copies value is null - I suppose that default
                 * and supported value is 1 Copy only.
                */
                supported = new CopiesSupported( (defaul == null)
                        ? defaul.getValue()
                        : 1);
            }
           
            int [][] range = supported.getMembers();
           
            if (!supported.contains(value)) {
                value = (((defaul == null)
                                || (!supported.contains(defaul.getValue())))
                        ? range[0][0]
                        : defaul.getValue());
            }
           
            cpSpinner.setModel(
View Full Code Here

   
        if (isEnabled) {
            int value = (firstUse && attrs.containsKey(Copies.class
                        ? ((Copies) (attrs.get(Copies.class))).getValue() 
                        : ((Integer) cpSpinner.getValue()).intValue());
            CopiesSupported supported = (CopiesSupported) myService
                    .getSupportedAttributeValues(Copies.class, flavor, attrs);
            Copies defaul = (Copies)
                    myService.getDefaultAttributeValue(Copies.class);
           
            if(supported == null) {
                /*
                 * It is incorrect situation, however it is possible: Copies
                 * category is supported, but there are no supported values. I
                 * suppose that only default Copies value is supported in this
                 * case. If default Copies value is null - I suppose that default
                 * and supported value is 1 Copy only.
                */
                supported = new CopiesSupported( (defaul == null)
                        ? defaul.getValue()
                        : 1);
            }
           
            int [][] range = supported.getMembers();
           
            if (!supported.contains(value)) {
                value = (((defaul == null)
                                || (!supported.contains(defaul.getValue())))
                        ? range[0][0]
                        : defaul.getValue());
            }
           
            cpSpinner.setModel(
View Full Code Here

TOP

Related Classes of javax.print.attribute.standard.CopiesSupported

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.