Package javax.print.attribute.standard

Examples of javax.print.attribute.standard.Copies


        for (int i = 0; i < requestAttrs.length; i++) {
            Class category = requestAttrs[i].getCategory();
            if (!isAttributeValueSupported(requestAttrs[i], flavor, attrs)) {
                // Do nothing or throw PrintException if Fidelity supported.
            } else if (category.equals(Copies.class)) {
                Copies copies = (Copies)requestAttrs[i];
                printAttributes[COPIES_INDEX] = copies.getValue();
            } else if (category.equals(Sides.class)) {
                Sides sides = (Sides)requestAttrs[i];
                printAttributes[SIDES_INDEX] = 1;
                if (sides.equals(Sides.DUPLEX) ||
                    sides.equals(Sides.TWO_SIDED_LONG_EDGE)) {
View Full Code Here


        */

        DocFlavor docFlavor = DocFlavor.BYTE_ARRAY.PDF;
        Doc myDoc = new SimpleDoc(out.toByteArray(), docFlavor, null);
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        aset.add(new Copies(1));
        //aset.add(MediaSize.A4);
        aset.add(Sides.ONE_SIDED);

        PrintService[] services = PrintServiceLookup.lookupPrintServices(docFlavor, aset);
        if (services.length > 0) {
View Full Code Here

                        // IGNORE exception
                        a = null;
                        e.printStackTrace();
                    }
                } else if (atag == IppAttribute.TAG_INTEGER) {
                    a = new Copies(((Integer) avalue.get(i)).intValue());
                }
                if (a != null) {
                    attrx.add(a);
                }
            }
View Full Code Here

        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(
                new SpinnerNumberModel(value, range[0][0], range[0][1], 1));
    }
View Full Code Here

*/
private void updateCopies() {
    if (cpSpinner.isEnabled()) {
        int copiesValue = ((SpinnerNumberModel)
                (cpSpinner.getModel())).getNumber().intValue();
        newAttrs.add(new Copies(copiesValue));
    } else {
        removeAttribute(Copies.class);
    }
}
View Full Code Here

    }   

    private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        if (config.getCopies() >= 1) {
            printRequestAttributeSet.add(new Copies(config.getCopies()));
        } else {
            throw new PrintException("Number of print copies should be greater than zero");
        }
        printRequestAttributeSet.add(config.getMediaSizeName());
        printRequestAttributeSet.add(config.getInternalSides());
View Full Code Here

    layer.setScale(scale);

    try
    {
      PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
      pras.add(new Copies(1));
      pras.add(new JobName(main.getOwlFileName(), Locale.getDefault()));

      PrintService ps = ServiceUI.printDialog(null, 100, 100,
        PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.JPEG, pras),
        PrintServiceLookup.lookupDefaultPrintService(),
View Full Code Here

    layer.setScale(scale);

    try
    {
      PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
      pras.add(new Copies(1));
      pras.add(new JobName(main.getOwlFileName(), Locale.getDefault()));

      final PrintService[] services =
        PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.JPEG, pras);
View Full Code Here

    }   

    private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        if (config.getCopies() >= 1) {
            printRequestAttributeSet.add(new Copies(config.getCopies()));
        } else {
            throw new PrintException("Number of print copies should be greater than zero");
        }
        printRequestAttributeSet.add(config.getMediaSizeName());
        printRequestAttributeSet.add(config.getInternalSides());
View Full Code Here

            throw new PrintException("Printer lookup failure. No default printer set up for this host");
        }
        job = printService.createPrintJob();
        flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        printRequestAttributeSet = new HashPrintRequestAttributeSet();
        printRequestAttributeSet.add(new Copies(1));
        printRequestAttributeSet.add(MediaSizeName.NA_LETTER);
        printRequestAttributeSet.add(Sides.ONE_SIDED);
    }
View Full Code Here

TOP

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

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.