当前位置: 首页>>代码示例>>Java>>正文


Java Chromaticity.COLOR属性代码示例

本文整理汇总了Java中javax.print.attribute.standard.Chromaticity.COLOR属性的典型用法代码示例。如果您正苦于以下问题:Java Chromaticity.COLOR属性的具体用法?Java Chromaticity.COLOR怎么用?Java Chromaticity.COLOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.print.attribute.standard.Chromaticity的用法示例。


在下文中一共展示了Chromaticity.COLOR属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setColorAttrib

private void setColorAttrib(Attribute attr) {
    if (attr == Chromaticity.COLOR) {
        mAttChromaticity = 2; // DMCOLOR_COLOR
    } else {
        mAttChromaticity = 1; // DMCOLOR_MONOCHROME
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:WPrinterJob.java

示例2: isAttributeValueSupported

public boolean isAttributeValueSupported(Attribute attr,
                                         DocFlavor flavor,
                                         AttributeSet attributes) {
    if (attr == null) {
        throw new NullPointerException("null attribute");
    }
    if (flavor != null && !isDocFlavorSupported(flavor)) {
        throw new IllegalArgumentException(flavor +
                                           " is an unsupported flavor");
    }
    Class category = attr.getCategory();
    if (!isAttributeCategorySupported(category)) {
        return false;
    }
    else if (attr.getCategory() == Chromaticity.class) {
        return attr == Chromaticity.COLOR;
    }
    else if (attr.getCategory() == Copies.class) {
        return isSupportedCopies((Copies)attr);
    } else if (attr.getCategory() == Media.class &&
               attr instanceof MediaSizeName) {
        return isSupportedMedia((MediaSizeName)attr);
    } else if (attr.getCategory() == OrientationRequested.class) {
        if (attr == OrientationRequested.REVERSE_PORTRAIT ||
            (flavor != null) &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    } else if (attr.getCategory() == PageRanges.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    } else if (attr.getCategory() == SheetCollate.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    } else if (attr.getCategory() == Sides.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    }
    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:50,代码来源:PSStreamPrintService.java

示例3: isAttributeValueSupported

public boolean isAttributeValueSupported(Attribute attr,
                                         DocFlavor flavor,
                                         AttributeSet attributes) {
    if (attr == null) {
        throw new NullPointerException("null attribute");
    }
    if (flavor != null) {
        if (!isDocFlavorSupported(flavor)) {
            throw new IllegalArgumentException(flavor +
                                           " is an unsupported flavor");
        } else if (isAutoSense(flavor)) {
            return false;
        }
    }
    Class category = attr.getCategory();
    if (!isAttributeCategorySupported(category)) {
        return false;
    }
    else if (attr.getCategory() == Chromaticity.class) {
        if (flavor == null || isServiceFormattedFlavor(flavor)) {
            return attr == Chromaticity.COLOR;
        } else {
            return false;
        }
    }
    else if (attr.getCategory() == Copies.class) {
        return (flavor == null ||
               !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
                 flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
                 flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) &&
            isSupportedCopies((Copies)attr);
    } else if (attr.getCategory() == Destination.class) {
        URI uri = ((Destination)attr).getURI();
            if ("file".equals(uri.getScheme()) &&
                !(uri.getSchemeSpecificPart().equals(""))) {
            return true;
        } else {
        return false;
        }
    } else if (attr.getCategory() == Media.class) {
        if (attr instanceof MediaSizeName) {
            return isSupportedMedia((MediaSizeName)attr);
        } else {
            return false;
        }
    } else if (attr.getCategory() == OrientationRequested.class) {
        if (attr == OrientationRequested.REVERSE_PORTRAIT ||
            (flavor != null) &&
            !isServiceFormattedFlavor(flavor)) {
            return false;
        }
    } else if (attr.getCategory() == PageRanges.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    } else if (attr.getCategory() == SheetCollate.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    } else if (attr.getCategory() == Sides.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    }
    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:72,代码来源:UnixPrintService.java

示例4: getAttributeValues

private void getAttributeValues(DocFlavor flavor) throws PrintException {

        if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) {
            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);
                } else if
                    (!service.isAttributeValueSupported(attr, flavor, null)) {
                    notifyEvent(PrintJobEvent.JOB_FAILED);
                    throw new PrintJobAttributeException(
                        "unsupported attribute: " + attr, null, attr);
                }
            }
            if (category == Destination.class) {
              URI uri = ((Destination)attr).getURI();
              if (!"file".equals(uri.getScheme())) {
                notifyEvent(PrintJobEvent.JOB_FAILED);
                throw new PrintException("Not a file: URI");
              } else {
                try {
                  mDestination = (new File(uri)).getPath();
                } catch (Exception e) {
                  throw new PrintException(e);
                }
                // check write access
                SecurityManager security = System.getSecurityManager();
                if (security != null) {
                  try {
                    security.checkWrite(mDestination);
                  } catch (SecurityException se) {
                    notifyEvent(PrintJobEvent.JOB_FAILED);
                    throw new PrintException(se);
                  }
                }
              }
            } else if (category == JobName.class) {
                jobName = ((JobName)attr).getValue();
            } else if (category == Copies.class) {
                copies = ((Copies)attr).getValue();
            } else if (category == Media.class) {
              if (attr instanceof MediaSizeName) {
                    mediaName = (MediaSizeName)attr;
                    // If requested MediaSizeName is not supported,
                    // get the corresponding media size - this will
                    // be used to create a new PageFormat.
                    if (!service.isAttributeValueSupported(attr, flavor, null)) {
                        mediaSize = MediaSize.getMediaSizeForName(mediaName);
                    }
                }
            } else if (category == OrientationRequested.class) {
                orient = (OrientationRequested)attr;
            }
        }
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:76,代码来源:Win32PrintJob.java

示例5: isAttributeValueSupported

public boolean isAttributeValueSupported(Attribute attr,
                                         DocFlavor flavor,
                                         AttributeSet attributes) {
    if (attr == null) {
        throw new NullPointerException("null attribute");
    }
    if (flavor != null && !isDocFlavorSupported(flavor)) {
        throw new IllegalArgumentException(flavor +
                                           " is an unsupported flavor");
    }
    Class<? extends Attribute> category = attr.getCategory();
    if (!isAttributeCategorySupported(category)) {
        return false;
    }
    else if (attr.getCategory() == Chromaticity.class) {
        return attr == Chromaticity.COLOR;
    }
    else if (attr.getCategory() == Copies.class) {
        return isSupportedCopies((Copies)attr);
    } else if (attr.getCategory() == Media.class &&
               attr instanceof MediaSizeName) {
        return isSupportedMedia((MediaSizeName)attr);
    } else if (attr.getCategory() == OrientationRequested.class) {
        if (attr == OrientationRequested.REVERSE_PORTRAIT ||
            (flavor != null) &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    } else if (attr.getCategory() == PageRanges.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    } else if (attr.getCategory() == SheetCollate.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    } else if (attr.getCategory() == Sides.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:50,代码来源:PSStreamPrintService.java

示例6: isAttributeValueSupported

public boolean isAttributeValueSupported(Attribute attr,
                                         DocFlavor flavor,
                                         AttributeSet attributes) {
    if (attr == null) {
        throw new NullPointerException("null attribute");
    }
    if (flavor != null) {
        if (!isDocFlavorSupported(flavor)) {
            throw new IllegalArgumentException(flavor +
                                           " is an unsupported flavor");
        } else if (isAutoSense(flavor)) {
            return false;
        }
    }
    Class<? extends Attribute> category = attr.getCategory();
    if (!isAttributeCategorySupported(category)) {
        return false;
    }
    else if (attr.getCategory() == Chromaticity.class) {
        if (flavor == null || isServiceFormattedFlavor(flavor)) {
            return attr == Chromaticity.COLOR;
        } else {
            return false;
        }
    }
    else if (attr.getCategory() == Copies.class) {
        return (flavor == null ||
               !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
                 flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
                 flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) &&
            isSupportedCopies((Copies)attr);
    } else if (attr.getCategory() == Destination.class) {
        URI uri = ((Destination)attr).getURI();
            if ("file".equals(uri.getScheme()) &&
                !(uri.getSchemeSpecificPart().equals(""))) {
            return true;
        } else {
        return false;
        }
    } else if (attr.getCategory() == Media.class) {
        if (attr instanceof MediaSizeName) {
            return isSupportedMedia((MediaSizeName)attr);
        } else {
            return false;
        }
    } else if (attr.getCategory() == OrientationRequested.class) {
        if (attr == OrientationRequested.REVERSE_PORTRAIT ||
            (flavor != null) &&
            !isServiceFormattedFlavor(flavor)) {
            return false;
        }
    } else if (attr.getCategory() == PageRanges.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    } else if (attr.getCategory() == SheetCollate.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    } else if (attr.getCategory() == Sides.class) {
        if (flavor != null &&
            !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
            flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
            return false;
        }
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:72,代码来源:UnixPrintService.java

示例7: getSupportedAttributeValues

public Object getSupportedAttributeValues(
                final Class<? extends Attribute> category,
                final DocFlavor flavor, final AttributeSet attributes) {
    checkArgs(category, flavor);

    try {
        if (OrientationRequested.class.equals(category)) {
            return WinPrinterFactory
                            .getSupportedOrientations(getPrinterHandle());
        } else if (Media.class.equals(category)
                        || MediaSizeName.class.equals(category)) {
            return WinPrinterFactory
                            .getSupportedMediaSizeNames(getPrinterHandle());
        } else if (MediaSize.class.equals(category)) {
            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())
                            ? new Sides[] { Sides.ONE_SIDED,
                                            Sides.TWO_SIDED_SHORT_EDGE,
                                            Sides.TWO_SIDED_LONG_EDGE }
                            : new Sides[] { Sides.ONE_SIDED };
        } else if (SheetCollate.class.equals(category)) {
            return WinPrinterFactory.isDuplexSupported(getPrinterHandle())
                            ? new SheetCollate[] { SheetCollate.COLLATED,
                                            SheetCollate.UNCOLLATED }
                            : new SheetCollate[] { SheetCollate.UNCOLLATED };
        } else if (Chromaticity.class.equals(category)) {
            return WinPrinterFactory
                            .isColorPrintingSupported(getPrinterHandle())
                            ? new Chromaticity[] { Chromaticity.MONOCHROME,
                                            Chromaticity.COLOR }
                            : new Chromaticity[] { Chromaticity.MONOCHROME };
        } else if (PrinterResolution.class.equals(category)) {
            return WinPrinterFactory
                            .getSupportedPrinterResolutions(getPrinterHandle());
        } else if (PrintQuality.class.equals(category)) {
            return new PrintQuality[] { PrintQuality.HIGH,
                            PrintQuality.NORMAL, PrintQuality.DRAFT };
        }
    } catch (final PrintException ex) {
        throw new RuntimeException(ex);
    }

    return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:54,代码来源:WinPrintService.java

示例8: getChromaticity

public Chromaticity getChromaticity() {
    return getDmColor(structPtr) == DMCOLOR_COLOR ? Chromaticity.COLOR
                    : Chromaticity.MONOCHROME;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:DevmodeStructWrapper.java

示例9: getSupportedAttributeValues

public Object getSupportedAttributeValues(Class category, DocFlavor flavor,
        AttributeSet attributes) {
    if (flavor != null &&
        (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 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,
                                Sides.TWO_SIDED_LONG_EDGE,
                                Sides.DUPLEX,
                                Sides.TUMBLE};
        }
    } else if (category.equals(Media.class)) {
        return getSupportedMediaSizeNames();
    } else if (category.equals(MediaSizeName.class)) {
        return getSupportedMediaSizeNames();
    } else if (category.equals(Chromaticity.class)) {
        if (getColorSupported(serviceName)) {
            return new Chromaticity[] { Chromaticity.MONOCHROME,
                                        Chromaticity.COLOR };
        } else {
            return new Chromaticity[] { Chromaticity.MONOCHROME };
        }
    } else if (category.equals(OrientationRequested.class)) {
        if (getOrientationSupported(serviceName)) {
            return new OrientationRequested[]
                { OrientationRequested.PORTRAIT,
                  OrientationRequested.LANDSCAPE };
        }
    } else if (category.equals(PrinterResolution.class)) {
        int[] resolutions = getResolutionsSupported(serviceName);
        if (resolutions != null && resolutions.length > 1) {
            PrinterResolution[] res =
                new PrinterResolution[resolutions.length / 2];
            for (int i = 0; i < resolutions.length / 2; i++) {
                res[i] = new PrinterResolution(resolutions[i * 2],
                        resolutions[i * 2 + 1], PrinterResolution.DPI);
            }
            return res;
        }
    } else if (category.equals(SheetCollate.class)) {
        if (getCollateSupported(serviceName)) {
            return new SheetCollate[] { SheetCollate.COLLATED,
                                        SheetCollate.UNCOLLATED };
        }
    }
    return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:62,代码来源:GDIClient.java


注:本文中的javax.print.attribute.standard.Chromaticity.COLOR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。