Package javax.print.attribute

Examples of javax.print.attribute.Attribute


        if( jobName != null ){
          printDocument.set_DocumentName( jobName );
        }
        printDocument.get_DefaultPageSettings().set_Color(printColor);
       
        Attribute destination = reqAttrSet.get(Destination.class);
        if(destination instanceof Destination){
          File destFile = new File(((Destination)destination).getURI());
            settings.set_PrintFileName(destFile.getAbsolutePath());
        }
       
        settings.set_Copies((short)copies);
        boolean collated = false;
        if(copies > 1){
            Object collate = reqAttrSet.get(SheetCollate.class);
            if( collate == null ){
              collate = service.getDefaultAttributeValue(SheetCollate.class);
            }
            collated = collate == SheetCollate.COLLATED;
            settings.set_Collate( collated );
        }
        Attribute pageRangeObj = reqAttrSet.get(PageRanges.class);
        if( pageRangeObj != null ){
          int[][] ranges = ((PageRanges)pageRangeObj).getMembers();
          if( ranges.length > 1 ){
          settings.set_PrintRange( PrintRange.wrap( PrintRange.Selection ) );
          } else {
View Full Code Here


            fidelity = true;
        } else {
            fidelity = false;
        }
       
        Attribute chroma = reqAttrSet.get( Chromaticity.class );
        // TODO check whether supported by the print service
        printColor = chroma == Chromaticity.COLOR;

        Attribute newTray = reqAttrSet.get( Media.class );
        if( newTray instanceof MediaTray ){
          mediaTray = (MediaTray)newTray;
        }
        // TODO check whether supported by the print service
       
        Class category;
        Attribute [] attrs = reqAttrSet.toArray();
        for (int i=0; i<attrs.length; i++) {
            Attribute attr = attrs[i];
            category = attr.getCategory();
            if (fidelity == true) {
                if (!service.isAttributeCategorySupported(category)) {
                    notifyEvent(PrintJobEvent.JOB_FAILED);
                    throw new PrintJobAttributeException(
                        "unsupported category: " + category, category, null);
View Full Code Here

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

TOP

Related Classes of javax.print.attribute.Attribute

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.