use of javax.print.attribute.HashAttributeSet in project jdk8u_jdk by JetBrains.
the class Win32MediaSize method getUnsupportedAttributes.
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;
}
}
use of javax.print.attribute.HashAttributeSet in project jdk8u_jdk by JetBrains.
the class PSStreamPrintService method getUnsupportedAttributes.
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;
}
}
use of javax.print.attribute.HashAttributeSet in project jdk8u_jdk by JetBrains.
the class UnixPrintService method getUnsupportedAttributes.
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;
}
}
use of javax.print.attribute.HashAttributeSet in project jdk8u_jdk by JetBrains.
the class GetPrintServices method lookupByName.
private static PrintService lookupByName(String name) {
AttributeSet attributes = new HashAttributeSet();
attributes.add(new PrinterName(name, null));
for (PrintService service : PrintServiceLookup.lookupPrintServices(null, attributes)) {
return service;
}
return null;
}
Aggregations