Package javax.print.attribute

Examples of javax.print.attribute.Attribute


        jobAttrSet = AttributeSetUtilities.unmodifiableView(jobAttrSet);
    }

    private void getAttributeValues(DocFlavor flavor) throws PrintException {

        Attribute attr;
        Class category;

        if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) {
            fidelity = true;
        } else {
            fidelity = false;
        }

        Attribute []attrs = reqAttrSet.toArray();
        for (int i=0; i<attrs.length; i++) {
            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

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

        }

        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

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

        if (attributes == null) {
            return; // now always use attributes, so this shouldn't happen.
        }
        Attribute[] attrs = attributes.toArray();
        for (int i=0; i< attrs.length; i++) {
            Attribute attr = attrs[i];
            try {
                 if (attr.getCategory() == Sides.class) {
                    setSidesAttrib(attr);
                }
                else if (attr.getCategory() == Chromaticity.class) {
                    setColorAttrib(attr);
                }
                else if (attr.getCategory() == PrinterResolution.class) {
                    setResolutionAttrib(attr);
                }
                else if (attr.getCategory() == PrintQuality.class) {
                    setQualityAttrib(attr);
                }
                else if (attr.getCategory() == SheetCollate.class) {
                    setCollateAttrib(attr);
                else if (attr.getCategory() == Media.class ||
                            attr.getCategory() == SunAlternateMedia.class) {
                    /* SunAlternateMedia is used if its a tray, and
                     * any Media that is specified is not a tray.
                     */
                    if (attr.getCategory() == SunAlternateMedia.class) {
                        Media media = (Media)attributes.get(Media.class);
                        if (media == null ||
                            !(media instanceof MediaTray)) {
                            attr = ((SunAlternateMedia)attr).getMedia();
                        }
View Full Code Here

    void fillCollateBox() {
        boolean isSupported =
            myService.isAttributeCategorySupported(SheetCollate.class);
        SheetCollate [] supported = (SheetCollate []) (myService
                .getSupportedAttributeValues(SheetCollate.class, flavor, attrs));
        Attribute attr = attrs.get(SheetCollate.class);
        int spinnerValue = ((Integer) cpSpinner.getValue()).intValue();
       
        if ((supported == null) || !isSupported) {
            if (attrs.containsKey(SheetCollate.class)) {
                collateBox.setSelected(attr.equals(SheetCollate.COLLATED));
            }
        } else {
            boolean isValueSupported = myService.isAttributeValueSupported(
                    SheetCollate.COLLATED, flavor, attrs);
            if (attrs.containsKey(SheetCollate.class) && isValueSupported) {
                collateBox.setSelected(attr.equals(SheetCollate.COLLATED));
            } else {
                Object defaul =
                        myService.getDefaultAttributeValue(SheetCollate.class);
                collateBox.setSelected(defaul != null
                        ? defaul.equals(SheetCollate.COLLATED)
View Full Code Here

     * get last selected Chromaticity button
     */
    private boolean getLastColor() {
        if (firstUse) {
            if (attrs.containsKey(Chromaticity.class)) {
                Attribute value = attrs.get(Chromaticity.class);
                return value.equals(Chromaticity.MONOCHROME);
            }
           
            Object defaul = myService.getDefaultAttributeValue(Chromaticity.class);
            return (myService.isAttributeCategorySupported(Chromaticity.class)
                        && (defaul != null))
View Full Code Here

        JobSheets [] supported =
                (myService.isAttributeCategorySupported(JobSheets.class)
                ? (JobSheets[]) (myService.getSupportedAttributeValues(
                        JobSheets.class, flavor, attrs))
                : null);
        Attribute value = attrs.get(JobSheets.class);
   
        if ((supported != null) && (supported.length == 0)) {
            supported = null;
        }
   
        if (supported == null) {
            /* if PrintService does not supported any JobSheets, set current
               meaning from attribute set (if present) and disable checkbox */
            if (firstUse && attrs.containsKey(JobSheets.class)) {
                bannerBox.setSelected(value.equals(JobSheets.STANDARD));
            }
        } else {
            if (supported.length == 1) {
                bannerBox.setSelected(supported[0] == JobSheets.STANDARD);
            } else if (attrs.containsKey(JobSheets.class)) {
                bannerBox.setSelected(value.equals(JobSheets.STANDARD));
            else {
                Object def = myService.getDefaultAttributeValue(JobSheets.class);
                bannerBox.setSelected(def == null
                        ? false
                        : def.equals(JobSheets.STANDARD));
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.