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


Java AttributeSetUtilities.unmodifiableView方法代码示例

本文整理汇总了Java中javax.print.attribute.AttributeSetUtilities.unmodifiableView方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeSetUtilities.unmodifiableView方法的具体用法?Java AttributeSetUtilities.unmodifiableView怎么用?Java AttributeSetUtilities.unmodifiableView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.print.attribute.AttributeSetUtilities的用法示例。


在下文中一共展示了AttributeSetUtilities.unmodifiableView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUpdatedAttributes

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
public PrintServiceAttributeSet getUpdatedAttributes() {
    PrintServiceAttributeSet currSet = getDynamicAttributes();
    if (lastSet == null) {
        lastSet = currSet;
        return AttributeSetUtilities.unmodifiableView(currSet);
    } else {
        PrintServiceAttributeSet updates =
            new HashPrintServiceAttributeSet();
        Attribute []attrs =  currSet.toArray();
        for (int i=0; i<attrs.length; i++) {
            Attribute attr = attrs[i];
            if (!lastSet.containsValue(attr)) {
                updates.add(attr);
            }
        }
        lastSet = currSet;
        return AttributeSetUtilities.unmodifiableView(updates);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:Win32PrintService.java

示例2: getUpdatedAttributes

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
public PrintServiceAttributeSet getUpdatedAttributes() {
    PrintServiceAttributeSet currSet = getDynamicAttributes();
    if (lastSet == null) {
        lastSet = currSet;
        return AttributeSetUtilities.unmodifiableView(currSet);
    } else {
        PrintServiceAttributeSet updates =
            new HashPrintServiceAttributeSet();
        Attribute []attrs = currSet.toArray();
        Attribute attr;
        for (int i=0; i<attrs.length; i++) {
            attr = attrs[i];
            if (!lastSet.containsValue(attr)) {
                updates.add(attr);
            }
        }
        lastSet = currSet;
        return AttributeSetUtilities.unmodifiableView(updates);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:UnixPrintService.java

示例3: getAttributes

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
public PrintServiceAttributeSet getAttributes() {

        PrintServiceAttributeSet attrs = new  HashPrintServiceAttributeSet();
        attrs.add(getPrinterName());
        attrs.add(getPrinterIsAcceptingJobs());
        PrinterState prnState = getPrinterState();
        if (prnState != null) {
            attrs.add(prnState);
        }
        PrinterStateReasons prnStateReasons = getPrinterStateReasons();
        if (prnStateReasons != null) {
            attrs.add(prnStateReasons);
        }
        attrs.add(getQueuedJobCount());
        int caps = getPrinterCapabilities();
        if ((caps & DEVCAP_COLOR) != 0) {
            attrs.add(ColorSupported.SUPPORTED);
        } else {
            attrs.add(ColorSupported.NOT_SUPPORTED);
        }

        return AttributeSetUtilities.unmodifiableView(attrs);
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:Win32PrintService.java

示例4: getAttributes

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
/**
 * @see javax.print.PrintService#getAttributes()
 */
public PrintServiceAttributeSet getAttributes()
{
  PrintServiceAttributeSet set = new HashPrintServiceAttributeSet();
  
  Iterator it = printerAttr.values().iterator();
  while (it.hasNext())
    {        
      Iterator it2 = ((Set) it.next()).iterator();
      while (it2.hasNext())
        {
          Attribute attr = (Attribute) it2.next();
          if (attr instanceof PrintServiceAttribute)
            set.add(attr);
        }
    }
  
  return AttributeSetUtilities.unmodifiableView(set);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:22,代码来源:IppPrintService.java

示例5: SimpleDoc

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
/**
 * Constructs a <code>SimpleDoc</code> with the specified
 * print data, doc flavor and doc attribute set.
 * @param printData the print data object
 * @param flavor the <code>DocFlavor</code> object
 * @param attributes a <code>DocAttributeSet</code>, which can
 *                   be <code>null</code>
 * @throws IllegalArgumentException if <code>flavor</code> or
 *         <code>printData</code> is <code>null</code>, or the
 *         <code>printData</code> does not correspond
 *         to the specified doc flavor--for example, the data is
 *         not of the type specified as the representation in the
 *         <code>DocFlavor</code>.
 */
public SimpleDoc(Object printData,
                 DocFlavor flavor, DocAttributeSet attributes) {

   if (flavor == null || printData == null) {
       throw new IllegalArgumentException("null argument(s)");
   }

   Class repClass = null;
   try {
        repClass = Class.forName(flavor.getRepresentationClassName());
   } catch (Throwable e) {
       throw new IllegalArgumentException("unknown representation class");
   }

   if (!repClass.isInstance(printData)) {
       throw new IllegalArgumentException("data is not of declared type");
   }

   this.flavor = flavor;
   if (attributes != null) {
       this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
   }
   this.printData = printData;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:39,代码来源:SimpleDoc.java

示例6: getAttributes

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
/**
 * @see javax.print.PrintService#getAttributes()
 */
public PrintServiceAttributeSet getAttributes()
{
  PrintServiceAttributeSet set = new HashPrintServiceAttributeSet();

  for (Set<Attribute> attrSet : printerAttr.values())
    {
      for (Attribute attr : attrSet)
        {
          if (attr instanceof PrintServiceAttribute)
            set.add(attr);
        }
    }

  return AttributeSetUtilities.unmodifiableView(set);
}
 
开发者ID:cfriedt,项目名称:classpath,代码行数:19,代码来源:IppPrintService.java

示例7: getAttributes

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
public PrintJobAttributeSet getAttributes() {
    synchronized (this) {
        if (jobAttrSet == null) {
            /* just return an empty set until the job is submitted */
            PrintJobAttributeSet jobSet = new HashPrintJobAttributeSet();
            return AttributeSetUtilities.unmodifiableView(jobSet);
        } else {
          return jobAttrSet;
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:Win32PrintJob.java

示例8: SimpleDoc

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
/**
 * Constructs a {@code SimpleDoc} with the specified print data, doc flavor
 * and doc attribute set.
 *
 * @param  printData the print data object
 * @param  flavor the {@code DocFlavor} object
 * @param  attributes a {@code DocAttributeSet}, which can be {@code null}
 * @throws IllegalArgumentException if {@code flavor} or {@code printData}
 *         is {@code null}, or the {@code printData} does not correspond to
 *         the specified doc flavor--for example, the data is not of the
 *         type specified as the representation in the {@code DocFlavor}
 */
public SimpleDoc(Object printData,
                 DocFlavor flavor, DocAttributeSet attributes) {

   if (flavor == null || printData == null) {
       throw new IllegalArgumentException("null argument(s)");
   }

   Class<?> repClass = null;
   try {
        String className = flavor.getRepresentationClassName();
        sun.reflect.misc.ReflectUtil.checkPackageAccess(className);
        repClass = Class.forName(className, false,
                          Thread.currentThread().getContextClassLoader());
   } catch (Throwable e) {
       throw new IllegalArgumentException("unknown representation class");
   }

   if (!repClass.isInstance(printData)) {
       throw new IllegalArgumentException("data is not of declared type");
   }

   this.flavor = flavor;
   if (attributes != null) {
       this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
   }
   this.printData = printData;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:SimpleDoc.java

示例9: getAttributes

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
public PrintJobAttributeSet getAttributes() {
    synchronized (this) {
        if (jobAttrSet == null) {
            /* just return an empty set until the job is submitted */
            PrintJobAttributeSet jobSet = new HashPrintJobAttributeSet();
            return AttributeSetUtilities.unmodifiableView(jobSet);
        } else {
            return jobAttrSet;
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:PSStreamPrintJob.java

示例10: SimpleDoc

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
/**
 * Constructs a <code>SimpleDoc</code> with the specified
 * print data, doc flavor and doc attribute set.
 * @param printData the print data object
 * @param flavor the <code>DocFlavor</code> object
 * @param attributes a <code>DocAttributeSet</code>, which can
 *                   be <code>null</code>
 * @throws IllegalArgumentException if <code>flavor</code> or
 *         <code>printData</code> is <code>null</code>, or the
 *         <code>printData</code> does not correspond
 *         to the specified doc flavor--for example, the data is
 *         not of the type specified as the representation in the
 *         <code>DocFlavor</code>.
 */
public SimpleDoc(Object printData,
                 DocFlavor flavor, DocAttributeSet attributes) {

   if (flavor == null || printData == null) {
       throw new IllegalArgumentException("null argument(s)");
   }

   Class repClass = null;
   try {
        String className = flavor.getRepresentationClassName();
        sun.reflect.misc.ReflectUtil.checkPackageAccess(className);
        repClass = Class.forName(className, false,
                          Thread.currentThread().getContextClassLoader());
   } catch (Throwable e) {
       throw new IllegalArgumentException("unknown representation class");
   }

   if (!repClass.isInstance(printData)) {
       throw new IllegalArgumentException("data is not of declared type");
   }

   this.flavor = flavor;
   if (attributes != null) {
       this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
   }
   this.printData = printData;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:42,代码来源:SimpleDoc.java

示例11: getAttributes

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
public PrintServiceAttributeSet getAttributes() {
    PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
    attrs.add(getPrinterName());
    attrs.add(getPrinterIsAcceptingJobs());
    PrinterState prnState = getPrinterState();
    if (prnState != null) {
        attrs.add(prnState);
    }
    PrinterStateReasons prnStateReasons = getPrinterStateReasons();
    if (prnStateReasons != null) {
        attrs.add(prnStateReasons);
    }
    attrs.add(getQueuedJobCount());
    return AttributeSetUtilities.unmodifiableView(attrs);
}
 
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:16,代码来源:UnixPrintService.java

示例12: SimpleDoc

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
/**
 * Constructs a {@code SimpleDoc} with the specified
 * print data, doc flavor and doc attribute set.
 * @param printData the print data object
 * @param flavor the {@code DocFlavor} object
 * @param attributes a {@code DocAttributeSet}, which can
 *                   be {@code null}
 * @throws IllegalArgumentException if {@code flavor} or
 *         {@code printData} is {@code null}, or the
 *         {@code printData} does not correspond
 *         to the specified doc flavor--for example, the data is
 *         not of the type specified as the representation in the
 *         {@code DocFlavor}.
 */
public SimpleDoc(Object printData,
                 DocFlavor flavor, DocAttributeSet attributes) {

   if (flavor == null || printData == null) {
       throw new IllegalArgumentException("null argument(s)");
   }

   Class<?> repClass = null;
   try {
        String className = flavor.getRepresentationClassName();
        sun.reflect.misc.ReflectUtil.checkPackageAccess(className);
        repClass = Class.forName(className, false,
                          Thread.currentThread().getContextClassLoader());
   } catch (Throwable e) {
       throw new IllegalArgumentException("unknown representation class");
   }

   if (!repClass.isInstance(printData)) {
       throw new IllegalArgumentException("data is not of declared type");
   }

   this.flavor = flavor;
   if (attributes != null) {
       this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
   }
   this.printData = printData;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:42,代码来源:SimpleDoc.java

示例13: SimpleDoc

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
/**
 * Constructs a SimpleDoc with the specified print data, doc flavor and doc attribute set.
 * @param printData the object with the data to print.
 * @param flavor the document flavor of the print data.
 * @param attributes the attributes of the doc (may be <code>null</code>).
 * 
 * @throws IllegalArgumentException if either <code>printData</code> or
 *   <code>flavor</code> are <code>null</code>, or the print data is not
 *   supplied in the document format specified by the given flavor object.
 */
public SimpleDoc(Object printData, DocFlavor flavor, 
    DocAttributeSet attributes)
{
  if (printData == null || flavor == null)
    throw new IllegalArgumentException("printData/flavor may not be null");
  
  if (! (printData.getClass().getName().equals(
         flavor.getRepresentationClassName())
      || flavor.getRepresentationClassName().equals("java.io.Reader")
         && printData instanceof Reader
      || flavor.getRepresentationClassName().equals("java.io.InputStream")
         && printData instanceof InputStream))
    {
      throw new IllegalArgumentException("data is not of declared flavor type");
    }          
  
  this.printData = printData;
  this.flavor = flavor;
  
  if (attributes != null)
    this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
  else
    this.attributes = null;
  
  stream = null;
  reader = null;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:38,代码来源:SimpleDoc.java

示例14: getAttributes

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
public PrintJobAttributeSet getAttributes() {
    final PrintJobAttributeSet attrs = service.getPrinterProps()
                    .getAttributes(new HashPrintJobAttributeSet());

    for (Attribute attr : attrs.toArray()) {
        if (!(attr instanceof PrintJobAttribute)) {
            attrs.remove(attr);
        }
    }

    return AttributeSetUtilities.unmodifiableView(attrs);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:13,代码来源:WinPrintJob.java

示例15: getAttributes

import javax.print.attribute.AttributeSetUtilities; //导入方法依赖的package包/类
public PrintServiceAttributeSet getAttributes() {
    synchronized (this) {
        try {
            IppResponse response;
            IppAttributeGroup agroup;
            IppAttribute attr;
            Object[] attrx = new Object[0];

            response = printer.requestPrinterDescriptionAttributes();
            agroup = response
                    .getGroup(IppAttributeGroup.TAG_GET_PRINTER_ATTRIBUTES);
            if (agroup != null) {
                attributeset.clear();
                for (int i = 0, ii = agroup.size(); i < ii; i++) {
                    attr = (IppAttribute) agroup.get(i);
                    attrx = Ipp2Java.getJavaByIpp(attr);
                    for (int j = 0, jj = attrx.length; j < jj; j++) {
                        if (attrx[j] instanceof PrintServiceAttribute) {
                            attributeset.add((Attribute) attrx[j]);
                        }
                    }
                }
            }
        } catch (Exception e) {
            // IGNORE exception
            e.printStackTrace();
        }
    }

    return AttributeSetUtilities.unmodifiableView(attributeset);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:32,代码来源:CUPSClient.java


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