Java 类javax.print.attribute.standard.PrinterState 实例源码

项目:OpenJSharp    文件:Win32PrintService.java   
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);
    }
项目:OpenJSharp    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:jdk8u-jdk    文件:Win32PrintService.java   
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);
    }
项目:jdk8u-jdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:jdk8u-jdk    文件:PrintServiceStub.java   
public PrintServiceStub(String name) {
    _name = name;
    _flavors = new HashSet<DocFlavor>();
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE);
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE);
    _attributes = new HashMap<>();
    _attributes.put(PrinterName.class, new PrinterName(name, null));
    _attributes.put(PrinterState.class, PrinterState.IDLE);
    _attributes.put(PrinterInfo.class, new PrinterInfo("Custom location",
            null));
    _attributes.put(PrinterIsAcceptingJobs.class,
            PrinterIsAcceptingJobs.ACCEPTING_JOBS);
    _attributes.put(PrinterMakeAndModel.class, new PrinterMakeAndModel(
            "Custom printer", null));
    _attributes.put(Media.class, new Media[] { MediaSizeName.ISO_A4 });
}
项目:openjdk-jdk10    文件:UnixPrintService.java   
@SuppressWarnings("unchecked")
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:openjdk-jdk10    文件:Win32PrintService.java   
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);
    }
项目:openjdk-jdk10    文件:PrintServiceStub.java   
public PrintServiceStub(String name) {
    _name = name;
    _flavors = new HashSet<DocFlavor>();
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE);
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE);
    _attributes = new HashMap<>();
    _attributes.put(PrinterName.class, new PrinterName(name, null));
    _attributes.put(PrinterState.class, PrinterState.IDLE);
    _attributes.put(PrinterInfo.class, new PrinterInfo("Custom location",
            null));
    _attributes.put(PrinterIsAcceptingJobs.class,
            PrinterIsAcceptingJobs.ACCEPTING_JOBS);
    _attributes.put(PrinterMakeAndModel.class, new PrinterMakeAndModel(
            "Custom printer", null));
    _attributes.put(Media.class, new Media[] { MediaSizeName.ISO_A4 });
}
项目:openjdk9    文件:UnixPrintService.java   
@SuppressWarnings("unchecked")
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:openjdk9    文件:Win32PrintService.java   
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);
    }
项目:openjdk9    文件:PrintServiceStub.java   
public PrintServiceStub(String name) {
    _name = name;
    _flavors = new HashSet<DocFlavor>();
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE);
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE);
    _attributes = new HashMap<>();
    _attributes.put(PrinterName.class, new PrinterName(name, null));
    _attributes.put(PrinterState.class, PrinterState.IDLE);
    _attributes.put(PrinterInfo.class, new PrinterInfo("Custom location",
            null));
    _attributes.put(PrinterIsAcceptingJobs.class,
            PrinterIsAcceptingJobs.ACCEPTING_JOBS);
    _attributes.put(PrinterMakeAndModel.class, new PrinterMakeAndModel(
            "Custom printer", null));
    _attributes.put(Media.class, new Media[] { MediaSizeName.ISO_A4 });
}
项目:jdk8u_jdk    文件:Win32PrintService.java   
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);
    }
项目:jdk8u_jdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:jdk8u_jdk    文件:PrintServiceStub.java   
public PrintServiceStub(String name) {
    _name = name;
    _flavors = new HashSet<DocFlavor>();
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE);
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE);
    _attributes = new HashMap<>();
    _attributes.put(PrinterName.class, new PrinterName(name, null));
    _attributes.put(PrinterState.class, PrinterState.IDLE);
    _attributes.put(PrinterInfo.class, new PrinterInfo("Custom location",
            null));
    _attributes.put(PrinterIsAcceptingJobs.class,
            PrinterIsAcceptingJobs.ACCEPTING_JOBS);
    _attributes.put(PrinterMakeAndModel.class, new PrinterMakeAndModel(
            "Custom printer", null));
    _attributes.put(Media.class, new Media[] { MediaSizeName.ISO_A4 });
}
项目:lookaside_java-1.8.0-openjdk    文件:Win32PrintService.java   
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);
    }
项目:lookaside_java-1.8.0-openjdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:PrintServiceStub.java   
public PrintServiceStub(String name) {
    _name = name;
    _flavors = new HashSet<DocFlavor>();
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE);
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE);
    _attributes = new HashMap<>();
    _attributes.put(PrinterName.class, new PrinterName(name, null));
    _attributes.put(PrinterState.class, PrinterState.IDLE);
    _attributes.put(PrinterInfo.class, new PrinterInfo("Custom location",
            null));
    _attributes.put(PrinterIsAcceptingJobs.class,
            PrinterIsAcceptingJobs.ACCEPTING_JOBS);
    _attributes.put(PrinterMakeAndModel.class, new PrinterMakeAndModel(
            "Custom printer", null));
    _attributes.put(Media.class, new Media[] { MediaSizeName.ISO_A4 });
}
项目:infobip-open-jdk-8    文件:Win32PrintService.java   
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);
    }
项目:infobip-open-jdk-8    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:infobip-open-jdk-8    文件:PrintServiceStub.java   
public PrintServiceStub(String name) {
    _name = name;
    _flavors = new HashSet<DocFlavor>();
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE);
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE);
    _attributes = new HashMap<>();
    _attributes.put(PrinterName.class, new PrinterName(name, null));
    _attributes.put(PrinterState.class, PrinterState.IDLE);
    _attributes.put(PrinterInfo.class, new PrinterInfo("Custom location",
            null));
    _attributes.put(PrinterIsAcceptingJobs.class,
            PrinterIsAcceptingJobs.ACCEPTING_JOBS);
    _attributes.put(PrinterMakeAndModel.class, new PrinterMakeAndModel(
            "Custom printer", null));
    _attributes.put(Media.class, new Media[] { MediaSizeName.ISO_A4 });
}
项目:jdk8u-dev-jdk    文件:Win32PrintService.java   
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);
    }
项目:jdk8u-dev-jdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:jdk8u-dev-jdk    文件:PrintServiceStub.java   
public PrintServiceStub(String name) {
    _name = name;
    _flavors = new HashSet<DocFlavor>();
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE);
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE);
    _attributes = new HashMap<>();
    _attributes.put(PrinterName.class, new PrinterName(name, null));
    _attributes.put(PrinterState.class, PrinterState.IDLE);
    _attributes.put(PrinterInfo.class, new PrinterInfo("Custom location",
            null));
    _attributes.put(PrinterIsAcceptingJobs.class,
            PrinterIsAcceptingJobs.ACCEPTING_JOBS);
    _attributes.put(PrinterMakeAndModel.class, new PrinterMakeAndModel(
            "Custom printer", null));
    _attributes.put(Media.class, new Media[] { MediaSizeName.ISO_A4 });
}
项目:jdk7-jdk    文件:Win32PrintService.java   
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);
    }
项目:jdk7-jdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:openjdk-source-code-learn    文件:Win32PrintService.java   
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);
    }
项目:openjdk-source-code-learn    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:OLD-OpenJDK8    文件:Win32PrintService.java   
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);
    }
项目:OLD-OpenJDK8    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:OLD-OpenJDK8    文件:PrintServiceStub.java   
public PrintServiceStub(String name) {
    _name = name;
    _flavors = new HashSet<DocFlavor>();
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE);
    _flavors.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE);
    _attributes = new HashMap<>();
    _attributes.put(PrinterName.class, new PrinterName(name, null));
    _attributes.put(PrinterState.class, PrinterState.IDLE);
    _attributes.put(PrinterInfo.class, new PrinterInfo("Custom location",
            null));
    _attributes.put(PrinterIsAcceptingJobs.class,
            PrinterIsAcceptingJobs.ACCEPTING_JOBS);
    _attributes.put(PrinterMakeAndModel.class, new PrinterMakeAndModel(
            "Custom printer", null));
    _attributes.put(Media.class, new Media[] { MediaSizeName.ISO_A4 });
}
项目:cn1    文件:WinPrinterFactory.java   
public static PrinterState getPrinterState(final long handle)
                throws PrintException {
    final long status = getPrinterStatus(handle);

    if ((status & (PRINTER_STATUS_PRINTING | PRINTER_STATUS_PROCESSING)) != 0) {
        return PrinterState.PROCESSING;
    } else if ((status & (PRINTER_STATUS_DOOR_OPEN | PRINTER_STATUS_ERROR
                    | PRINTER_STATUS_NO_TONER
                    | PRINTER_STATUS_NOT_AVAILABLE | PRINTER_STATUS_OFFLINE
                    | PRINTER_STATUS_OUT_OF_MEMORY
                    | PRINTER_STATUS_OUTPUT_BIN_FULL
                    | PRINTER_STATUS_PAPER_JAM | PRINTER_STATUS_PAPER_OUT
                    | PRINTER_STATUS_PAPER_PROBLEM | PRINTER_STATUS_USER_INTERVENTION)) != 0) {
        return PrinterState.STOPPED;
    } else if ((status & PRINTER_STATUS_SERVER_UNKNOWN) != 0) {
        return PrinterState.UNKNOWN;
    } else {
        return PrinterState.IDLE;
    }
}
项目:openjdk-jdk7u-jdk    文件:Win32PrintService.java   
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);
    }
项目:openjdk-jdk7u-jdk    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:freeVM    文件:WinPrinterFactory.java   
public static PrinterState getPrinterState(final long handle)
                throws PrintException {
    final long status = getPrinterStatus(handle);

    if ((status & (PRINTER_STATUS_PRINTING | PRINTER_STATUS_PROCESSING)) != 0) {
        return PrinterState.PROCESSING;
    } else if ((status & (PRINTER_STATUS_DOOR_OPEN | PRINTER_STATUS_ERROR
                    | PRINTER_STATUS_NO_TONER
                    | PRINTER_STATUS_NOT_AVAILABLE | PRINTER_STATUS_OFFLINE
                    | PRINTER_STATUS_OUT_OF_MEMORY
                    | PRINTER_STATUS_OUTPUT_BIN_FULL
                    | PRINTER_STATUS_PAPER_JAM | PRINTER_STATUS_PAPER_OUT
                    | PRINTER_STATUS_PAPER_PROBLEM | PRINTER_STATUS_USER_INTERVENTION)) != 0) {
        return PrinterState.STOPPED;
    } else if ((status & PRINTER_STATUS_SERVER_UNKNOWN) != 0) {
        return PrinterState.UNKNOWN;
    } else {
        return PrinterState.IDLE;
    }
}
项目:openjdk-icedtea7    文件:Win32PrintService.java   
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);
    }
项目:openjdk-icedtea7    文件:UnixPrintService.java   
public <T extends PrintServiceAttribute>
    T getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }

    if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:OpenJSharp    文件:RasterPrinterJob.java   
/**
 * Associate this PrinterJob with a new PrintService.
 *
 * Throws <code>PrinterException</code> if the specified service
 * cannot support the <code>Pageable</code> and
 * <code>Printable</code> interfaces necessary to support 2D printing.
 * @param a print service which supports 2D printing.
 *
 * @throws PrinterException if the specified service does not support
 * 2D printing or no longer available.
 */
public void setPrintService(PrintService service)
    throws PrinterException {
    if (service == null) {
        throw new PrinterException("Service cannot be null");
    } else if (!(service instanceof StreamPrintService) &&
               service.getName() == null) {
        throw new PrinterException("Null PrintService name.");
    } else {
        // Check the list of services.  This service may have been
        // deleted already
        PrinterState prnState = (PrinterState)service.getAttribute(
                                              PrinterState.class);
        if (prnState == PrinterState.STOPPED) {
            PrinterStateReasons prnStateReasons =
                (PrinterStateReasons)service.getAttribute(
                                             PrinterStateReasons.class);
            if ((prnStateReasons != null) &&
                (prnStateReasons.containsKey(PrinterStateReason.SHUTDOWN)))
            {
                throw new PrinterException("PrintService is no longer available.");
            }
        }


        if (service.isDocFlavorSupported(
                                         DocFlavor.SERVICE_FORMATTED.PAGEABLE) &&
            service.isDocFlavorSupported(
                                         DocFlavor.SERVICE_FORMATTED.PRINTABLE)) {
            myService = service;
        } else {
            throw new PrinterException("Not a 2D print service: " + service);
        }
    }
}
项目:OpenJSharp    文件:Win32PrintService.java   
private PrinterState getPrinterState() {
    if (isInvalid) {
        return PrinterState.STOPPED;
    } else {
        return null;
    }
}
项目:OpenJSharp    文件:Win32PrintService.java   
public <T extends PrintServiceAttribute> T
    getAttribute(Class<T> category)
{
    if (category == null) {
        throw new NullPointerException("category");
    }
    if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
        throw new IllegalArgumentException("Not a PrintServiceAttribute");
    }
    if (category == ColorSupported.class) {
        int caps = getPrinterCapabilities();
        if ((caps & DEVCAP_COLOR) != 0) {
            return (T)ColorSupported.SUPPORTED;
        } else {
            return (T)ColorSupported.NOT_SUPPORTED;
        }
    } else if (category == PrinterName.class) {
        return (T)getPrinterName();
    } else if (category == PrinterState.class) {
        return (T)getPrinterState();
    } else if (category == PrinterStateReasons.class) {
        return (T)getPrinterStateReasons();
    } else if (category == QueuedJobCount.class) {
        return (T)getQueuedJobCount();
    } else if (category == PrinterIsAcceptingJobs.class) {
        return (T)getPrinterIsAcceptingJobs();
    } else {
        return null;
    }
}
项目:OpenJSharp    文件:UnixPrintService.java   
private PrinterState getPrinterState() {
    if (isInvalid) {
        return PrinterState.STOPPED;
    } else {
        return null;
    }
}