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


Java AttributeSet.remove方法代码示例

本文整理汇总了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);
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:ServiceUI.java

示例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);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:ServiceUI.java

示例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);
            }
        }
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:33,代码来源:ServiceUI.java

示例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);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:76,代码来源:IppRequest.java


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