Java 类javax.print.attribute.HashAttributeSet 实例源码

项目:lixia-javardp    文件:Printer.java   
@Override
public void create(String filename) {
    // find the printing service
    //http://www.coderanch.com/t/385989/java/java/send-raw-data-printer
    AttributeSet attributeSet = new HashAttributeSet();  
    attributeSet.add(new PrinterName(filename, null));
    PrintService[] services = PrintServiceLookup.lookupPrintServices(null, attributeSet);
    if(services.length > 0){
        if(printFile != null){
            printFile.deleteOnExit();
            printFile = null;
        }
        try {
            printFile = File.createTempFile("printer_"+name,".redirect");
        } catch (IOException e) {
            e.printStackTrace();
        }
        printService = services[0];
    }

}
项目:cn1    文件:WinPrintService.java   
public AttributeSet getUnsupportedAttributes(final DocFlavor flavor,
                final AttributeSet attributes) {
    checkFlavor(flavor);

    if (attributes == null) {
        return null;
    }

    final AttributeSet result = new HashAttributeSet();

    for (Attribute attr : attributes.toArray()) {
        if (!isAttributeValueSupported(attr, flavor, attributes)) {
            result.add(attr);
        }
    }

    return result.size() > 0 ? result : null;
}
项目:cn1    文件:DefaultPrintService.java   
public AttributeSet getUnsupportedAttributes(DocFlavor flavor,
        AttributeSet attributes) {
    if (attributes == null) {
        return null;
    }
    if (flavor != null && !isDocFlavorSupported(flavor)) {
        throw new IllegalArgumentException("Flavor " + flavor.getMimeType()
                + " is not supported by print service");
    }

    Attribute[] attrs = attributes.toArray();
    HashAttributeSet unsupported = new HashAttributeSet();
    for (int i = 0; i < attrs.length; i++) {
        if (!isAttributeValueSupported(attrs[i], flavor, attributes)) {
            unsupported.add(attrs[i]);
        }
    }
    if (unsupported.size() > 0) {
        return unsupported;
    }
    return null;
}
项目:cn1    文件:MediaTest.java   
public final void testMediaCategory() {

        HashAttributeSet aset = new HashAttributeSet();

        MediaSizeName msn = MediaSizeName.ISO_A3;
        aset.add(msn);
        assertEquals(msn, aset.get(Media.class));
        assertNull(aset.get(MediaSizeName.class));

        MediaTray mt = MediaTray.BOTTOM;
        aset.add(mt);
        assertEquals(mt, aset.get(Media.class));
        assertNull(aset.get(MediaTray.class));

        MediaName mn = MediaName.ISO_A4_WHITE;
        aset.add(mn);
        assertEquals(mn, aset.get(Media.class));
        assertNull(aset.get(MediaName.class));
    }
项目:freeVM    文件:DefaultPrintService.java   
public AttributeSet getUnsupportedAttributes(DocFlavor flavor,
        AttributeSet attributes) {
    if (attributes == null) {
        return null;
    }
    if (flavor != null && !isDocFlavorSupported(flavor)) {
        throw new IllegalArgumentException("Flavor " + flavor.getMimeType()
                + " is not supported by print service");
    }

    Attribute[] attrs = attributes.toArray();
    HashAttributeSet unsupported = new HashAttributeSet();
    for (int i = 0; i < attrs.length; i++) {
        if (!isAttributeValueSupported(attrs[i], flavor, attributes)) {
            unsupported.add(attrs[i]);
        }
    }
    if (unsupported.size() > 0) {
        return unsupported;
    }
    return null;
}
项目:freeVM    文件:MediaTest.java   
public final void testMediaCategory() {

        HashAttributeSet aset = new HashAttributeSet();

        MediaSizeName msn = MediaSizeName.ISO_A3;
        aset.add(msn);
        assertEquals(msn, aset.get(Media.class));
        assertNull(aset.get(MediaSizeName.class));

        MediaTray mt = MediaTray.BOTTOM;
        aset.add(mt);
        assertEquals(mt, aset.get(Media.class));
        assertNull(aset.get(MediaTray.class));

        MediaName mn = MediaName.ISO_A4_WHITE;
        aset.add(mn);
        assertEquals(mn, aset.get(Media.class));
        assertNull(aset.get(MediaName.class));
    }
项目:freeVM    文件:WinPrintService.java   
public AttributeSet getUnsupportedAttributes(final DocFlavor flavor,
                final AttributeSet attributes) {
    checkFlavor(flavor);

    if (attributes == null) {
        return null;
    }

    final AttributeSet result = new HashAttributeSet();

    for (Attribute attr : attributes.toArray()) {
        if (!isAttributeValueSupported(attr, flavor, attributes)) {
            result.add(attr);
        }
    }

    return result.size() > 0 ? result : null;
}
项目:freeVM    文件:DefaultPrintService.java   
public AttributeSet getUnsupportedAttributes(DocFlavor flavor,
        AttributeSet attributes) {
    if (attributes == null) {
        return null;
    }
    if (flavor != null && !isDocFlavorSupported(flavor)) {
        throw new IllegalArgumentException("Flavor " + flavor.getMimeType()
                + " is not supported by print service");
    }

    Attribute[] attrs = attributes.toArray();
    HashAttributeSet unsupported = new HashAttributeSet();
    for (int i = 0; i < attrs.length; i++) {
        if (!isAttributeValueSupported(attrs[i], flavor, attributes)) {
            unsupported.add(attrs[i]);
        }
    }
    if (unsupported.size() > 0) {
        return unsupported;
    }
    return null;
}
项目:freeVM    文件:MediaTest.java   
public final void testMediaCategory() {

        HashAttributeSet aset = new HashAttributeSet();

        MediaSizeName msn = MediaSizeName.ISO_A3;
        aset.add(msn);
        assertEquals(msn, aset.get(Media.class));
        assertNull(aset.get(MediaSizeName.class));

        MediaTray mt = MediaTray.BOTTOM;
        aset.add(mt);
        assertEquals(mt, aset.get(Media.class));
        assertNull(aset.get(MediaTray.class));

        MediaName mn = MediaName.ISO_A4_WHITE;
        aset.add(mn);
        assertEquals(mn, aset.get(Media.class));
        assertNull(aset.get(MediaName.class));
    }
项目:OpenJSharp    文件:PSStreamPrintService.java   
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;
    }
}
项目:OpenJSharp    文件:Win32PrintService.java   
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;
    }
}
项目:OpenJSharp    文件:UnixPrintService.java   
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;
    }
}
项目:jdk8u-jdk    文件:PSStreamPrintService.java   
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;
    }
}
项目:jdk8u-jdk    文件:Win32PrintService.java   
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;
    }
}
项目:jdk8u-jdk    文件:UnixPrintService.java   
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;
    }
}
项目:jdk8u-jdk    文件:GetPrintServices.java   
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;
}
项目:openjdk-jdk10    文件:PSStreamPrintService.java   
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;
    }
}
项目:openjdk-jdk10    文件:UnixPrintService.java   
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;
    }
}
项目:openjdk-jdk10    文件:Win32PrintService.java   
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;
    }
}
项目:openjdk-jdk10    文件:GetPrintServices.java   
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;
}
项目:openjdk9    文件:PSStreamPrintService.java   
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;
    }
}
项目:openjdk9    文件:UnixPrintService.java   
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;
    }
}
项目:openjdk9    文件:Win32PrintService.java   
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;
    }
}
项目:openjdk9    文件:GetPrintServices.java   
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;
}
项目:jdk8u_jdk    文件:PSStreamPrintService.java   
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;
    }
}
项目:jdk8u_jdk    文件:Win32PrintService.java   
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;
    }
}
项目:jdk8u_jdk    文件:UnixPrintService.java   
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;
    }
}
项目:jdk8u_jdk    文件:GetPrintServices.java   
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;
}
项目:lookaside_java-1.8.0-openjdk    文件:PSStreamPrintService.java   
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;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Win32PrintService.java   
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;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:UnixPrintService.java   
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;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:GetPrintServices.java   
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;
}
项目:infobip-open-jdk-8    文件:PSStreamPrintService.java   
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;
    }
}
项目:infobip-open-jdk-8    文件:Win32PrintService.java   
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;
    }
}
项目:infobip-open-jdk-8    文件:UnixPrintService.java   
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;
    }
}
项目:infobip-open-jdk-8    文件:GetPrintServices.java   
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;
}
项目:jdk8u-dev-jdk    文件:PSStreamPrintService.java   
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;
    }
}
项目:jdk8u-dev-jdk    文件:Win32PrintService.java   
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;
    }
}
项目:jdk8u-dev-jdk    文件:UnixPrintService.java   
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;
    }
}
项目:jdk8u-dev-jdk    文件:GetPrintServices.java   
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;
}