本文整理汇总了Java中javax.print.attribute.AttributeSet.remove方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeSet.remove方法的具体用法?Java AttributeSet.remove怎么用?Java AttributeSet.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.print.attribute.AttributeSet
的用法示例。
在下文中一共展示了AttributeSet.remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeUnsupportedAttributes
import javax.print.attribute.AttributeSet; //导入方法依赖的package包/类
/**
* Removes any attributes from the given AttributeSet that are
* unsupported by the given PrintService/DocFlavor combination.
*/
private static 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);
}
}
}
}
示例2: removeUnsupportedAttributes
import javax.print.attribute.AttributeSet; //导入方法依赖的package包/类
/**
* Removes any attributes from the given {@code AttributeSet} that are
* unsupported by the given {@code PrintService/DocFlavor} combination.
*/
private static 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<? extends Attribute> 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);
}
}
}
}
示例3: removeUnsupportedAttributes
import javax.print.attribute.AttributeSet; //导入方法依赖的package包/类
/**
* Removes any attributes from the given AttributeSet that are
* unsupported by the given PrintService/DocFlavor combination.
*/
private static 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<? extends Attribute> 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);
}
}
}
}
示例4: writeOperationAttributes
import javax.print.attribute.AttributeSet; //导入方法依赖的package包/类
/**
* Writes the given operation attribute group of the given map instance
* (key=group, values=set of attributes) into the supplied data
* output stream.
*
* @param attributes the set with the attributes.
*
* @throws IOException if thrown by the used DataOutputStream.
* @throws IppException if unknown attributes occur.
*/
public void writeOperationAttributes(AttributeSet attributes)
throws IOException, IppException
{
out.write(IppDelimiterTag.OPERATION_ATTRIBUTES_TAG);
// its essential to write these two in this order and as first ones
Attribute att = attributes.get(AttributesCharset.class);
write((CharsetSyntax) att);
logger.log(Component.IPP, "Attribute: Name: <"
+ att.getCategory().getName() + "> Value: <" + att.toString() + ">");
attributes.remove(AttributesCharset.class);
att = attributes.get(AttributesNaturalLanguage.class);
write((NaturalLanguageSyntax) att);
attributes.remove(AttributesNaturalLanguage.class);
logger.log(Component.IPP, "Attribute: Name: <"
+ att.getCategory().getName() + "> Value: <" + att.toString() + ">");
// furthermore its essential to now write out the target attribute
PrinterURI printerUri = (PrinterURI) attributes.get(PrinterURI.class);
JobUri jobUri = (JobUri) attributes.get(JobUri.class);
JobId jobId = (JobId) attributes.get(JobId.class);
if (printerUri != null && jobId == null && jobUri == null)
{
write(printerUri);
attributes.remove(PrinterURI.class);
logger.log(Component.IPP, "Attribute: Name: <" + printerUri
.getCategory().getName() + "> Value: <" + printerUri.toString() + ">");
}
else if (jobUri != null && jobId == null && printerUri == null)
{
write(jobUri);
attributes.remove(JobUri.class);
logger.log(Component.IPP, "Attribute: Name: <" + jobUri
.getCategory().getName() + "> Value: <" + jobUri.toString() + ">");
}
else if (printerUri != null && jobId != null && jobUri == null)
{
write(printerUri); // must be third
write(jobId);
attributes.remove(PrinterURI.class);
attributes.remove(JobId.class);
logger.log(Component.IPP, "Attribute: Name: <" + printerUri
.getCategory().getName() + "> Value: <" + printerUri.toString() + ">");
logger.log(Component.IPP, "Attribute: Name: <" + jobId.getCategory()
.getName() + "> Value: <" + jobId.toString() + ">");
}
else if (jobUri != null && jobId != null)
{
write(jobUri);
attributes.remove(JobUri.class);
attributes.remove(JobId.class); // MUST NOT redundant
logger.log(Component.IPP, "Attribute: Name: <" + jobUri.getCategory()
.getName() + "> Value: <" + jobUri.toString() + ">");
}
else
{
throw new IppException("Unknown target operation attribute combination.");
}
writeAttributes(attributes);
}