public boolean isAttributeValueSupported()

in modules/print/src/main/java/windows/org/apache/harmony/x/print/GDIClient.java [216:302]


    public boolean isAttributeValueSupported(Attribute attribute,
            DocFlavor flavor, AttributeSet attributes) {
        Class category = attribute.getCategory();
        if (category.equals(JobName.class) ||
            category.equals(RequestingUserName.class)) {
            return true;
        } else  if (category.equals(Destination.class)) {
            Destination destination = (Destination)attribute;
            if (destination.getURI().getScheme().equals("file")) {
                return true;
            }
        }
        if (flavor != null) {
            if (flavor.equals(DocFlavor.INPUT_STREAM.AUTOSENSE) ||
                flavor.equals(DocFlavor.BYTE_ARRAY.AUTOSENSE) ||
                flavor.equals(DocFlavor.URL.AUTOSENSE) ||
                flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
                flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT) ||
                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);
            if (sides != null) {
                for (int i = 0; i < sides.length; i++) {
                    if (sides[i].equals(attribute)) {
                        return true;
                    }
                }
            }
        } else if (category.equals(Media.class)) {
            Media[] medias = (Media[])getSupportedAttributeValues(category,
                    flavor, attributes);
            if (medias != null) {
                for (int i = 0; i < medias.length; i++) {
                    if (medias[i].equals(attribute)) {
                        return true;
                    }
                }
            }
        } else if (category.equals(Chromaticity.class)) {
            if (attribute.equals(Chromaticity.COLOR)) {
                if (!getColorSupported(serviceName)) {
                    return false;
                }
            }
            return true;
        } else if (category.equals(OrientationRequested.class)) {
            if (getOrientationSupported(serviceName)) {
                if (attribute.equals(OrientationRequested.PORTRAIT) ||
                    attribute.equals(OrientationRequested.LANDSCAPE))
                return true;
            }
        } else if (category.equals(PrinterResolution.class)) {
            int[] resolutions = getResolutionsSupported(serviceName);
            if (resolutions != null && resolutions.length > 1) {
                PrinterResolution resolution = (PrinterResolution)attribute;
                int xres = resolution.getCrossFeedResolution(
                        PrinterResolution.DPI);
                int yres = resolution.getFeedResolution(PrinterResolution.DPI);
                for (int i = 0; i < resolutions.length / 2; i++) {
                    if (xres == resolutions[i * 2] &&
                        yres == resolutions[i * 2 + 1]) {
                        return true;
                    }
                }
            }
        } else if (category.equals(SheetCollate.class)) {
            if (getCollateSupported(serviceName)) {
                if (attribute == SheetCollate.COLLATED ||
                    attribute == SheetCollate.UNCOLLATED) {
                    return true;
                }
            }
        }
        return false;
    }