本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}