@SuppressWarnings({ "unchecked", "rawtypes" })
private void removeUnsupportedAttributes(PrintService ps,
DocFlavor flavor,
AttributeSet aset)
{
AttributeSet asUnsupported = ps.getUnsupportedAttributes(flavor,
aset);
if (asUnsupported != null) {
Attribute[] usAttrs = asUnsupported.toArray();
for (int i=0; i<usAttrs.length; i++) {
Class category = usAttrs[i].getCategory();
if (ps.isAttributeCategorySupported(category)) {
Attribute attr =
(Attribute)ps.getDefaultAttributeValue(category);
if (attr != null) {
aset.add(attr);
} else {
aset.remove(category);
}
} else {
aset.remove(category);
}
}
}
}