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


Java AttributeSet.isEmpty方法代码示例

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


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

示例1: getUnsupportedAttributes

import javax.print.attribute.AttributeSet; //导入方法依赖的package包/类
public AttributeSet getUnsupportedAttributes(DocFlavor flavor,
                                             AttributeSet attributes) {

    if (flavor != null && !isDocFlavorSupported(flavor)) {
        throw new IllegalArgumentException("flavor " + flavor +
                                           "is not supported");
    }

    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);
            }
        } catch (ClassCastException e) {
        }
    }
    if (unsupp.isEmpty()) {
        return null;
    } else {
        return unsupp;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:PSStreamPrintService.java

示例2: getUnsupportedAttributes

import javax.print.attribute.AttributeSet; //导入方法依赖的package包/类
public AttributeSet getUnsupportedAttributes(DocFlavor flavor,
                                             AttributeSet attributes) {

    if (flavor != null && !isDocFlavorSupported(flavor)) {
        throw new IllegalArgumentException("flavor " + flavor +
                                           "is not supported");
    }

    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);
            }
        } catch (ClassCastException e) {
        }
    }
    if (unsupp.isEmpty()) {
        return null;
    } else {
        return unsupp;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:Win32PrintService.java

示例3: getUnsupportedAttributes

import javax.print.attribute.AttributeSet; //导入方法依赖的package包/类
public AttributeSet getUnsupportedAttributes(DocFlavor flavor,
                                             AttributeSet attributes) {

    if (flavor != null && !isDocFlavorSupported(flavor)) {
        throw new IllegalArgumentException("flavor " + flavor +
                                           "is not supported");
    }

    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);
            }
        } catch (ClassCastException e) {
        }
    }
    if (unsupp.isEmpty()) {
        return null;
    } else {
        return unsupp;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:UnixPrintService.java

示例4: getUnsupportedAttributes

import javax.print.attribute.AttributeSet; //导入方法依赖的package包/类
public AttributeSet getUnsupportedAttributes(DocFlavor flavor,
                                             AttributeSet attributes) {

    if (flavor != null && !isDocFlavorSupported(flavor)) {
        throw new IllegalArgumentException("flavor " + flavor +
                                           " is not supported");
    }

    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);
            }
        } catch (ClassCastException e) {
        }
    }
    if (unsupp.isEmpty()) {
        return null;
    } else {
        return unsupp;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:Win32PrintService.java

示例5: isAttributeValueSupported

import javax.print.attribute.AttributeSet; //导入方法依赖的package包/类
public boolean isAttributeValueSupported(Attribute attribute,
        DocFlavor flavor, AttributeSet attributes) {

    // verify parameters
    if (attribute == null) {
        throw new NullPointerException("Argument is null");
    }
    if (flavor != null && !isDocFlavorSupported(flavor)) {
        throw new IllegalArgumentException("DocFlavor '" + flavor
                + "' is not supported by the print service");
    }

    // SPECIAL attributes processing
    boolean[] supportedEx = isAttributeValueSupportedEx(attribute, flavor);
    if (supportedEx != null) {
        return supportedEx[0];
    }

    boolean supported = false;
    try {
        IppDocument document;
        IppResponse response;
        IppAttributeGroup agroup;
        IppAttributeGroupSet agroupset;
        Attribute[] attrs;
        String mime = null;
        String aname;

        aname = Ipp2Java.getIppAttributeNameByClass(attribute.getClass(),
                -1);
        if (aname == null) {
            return false;
        }
        if (flavor == null) {
            mime = "application/octet-stream";
        } else {
            mime = java2ipp(flavor).getMimeType();
        }
        if (attributes == null || attributes.isEmpty()) {
            document = new IppDocument("Qwerty", mime, "");
            agroupset = new IppAttributeGroupSet();
            agroupset.setAttribute(aname, Ipp2Java.getIppByJava(attribute));
            response = printer.requestValidateJob(aname, document,
                    agroupset);
            agroup = response
                    .getGroup(IppAttributeGroup.TAG_UNSUPPORTED_ATTRIBUTES);

            if (agroup == null) {
                supported = true;
            } else if (agroup != null && agroup.findAttribute(aname) < 0) {
                supported = true;
            }
        } else {
            document = new IppDocument("Qwerty", mime, "");
            agroupset = new IppAttributeGroupSet();
            agroupset.setAttribute(aname, Ipp2Java.getIppByJava(attribute));
            attrs = attributes.toArray();
            for (int i = 0, ii = attrs.length; i < ii; i++) {
                agroupset.setAttribute(Ipp2Java.getIppAttributeNameByClass(
                        attrs[i].getClass(), -1), Ipp2Java
                        .getIppByJava(attrs[i]));
            }

            response = printer.requestValidateJob(aname, document,
                    agroupset);
            agroup = response
                    .getGroup(IppAttributeGroup.TAG_UNSUPPORTED_ATTRIBUTES);

            if (agroup == null) {
                supported = true;
            } else if (agroup != null && agroup.findAttribute(aname) < 0) {
                supported = true;
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }

    return supported;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:82,代码来源:CUPSClient.java


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