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


Java QueuedJobCount类代码示例

本文整理汇总了Java中javax.print.attribute.standard.QueuedJobCount的典型用法代码示例。如果您正苦于以下问题:Java QueuedJobCount类的具体用法?Java QueuedJobCount怎么用?Java QueuedJobCount使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getQueuedJobCountAIX

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
private QueuedJobCount getQueuedJobCountAIX() {
    // On AIX there should not be a blank after '-a'.
    String command = "/usr/bin/lpstat -a" + printer;
    String results[]=  UnixPrintServiceLookup.execCmd(command);

    // Remove headers and bogus entries added by remote printers.
    results = filterPrinterNamesAIX(results);

    int qlen = 0;
    if (results != null && results.length > 0){
        for (int i = 0; i < results.length; i++) {
            if (results[i].contains("QUEUED")){
                qlen ++;
            }
        }
    }
    return new QueuedJobCount(qlen);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:UnixPrintService.java

示例2: getAttribute

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
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;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:UnixPrintService.java

示例3: getQueuedJobCountAIX

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
private QueuedJobCount getQueuedJobCountAIX() {
    // On AIX there should not be a blank after '-a'.
    String command = "/usr/bin/lpstat -a" + printer;
    String results[]=  PrintServiceLookupProvider.execCmd(command);

    // Remove headers and bogus entries added by remote printers.
    results = filterPrinterNamesAIX(results);

    int qlen = 0;
    if (results != null && results.length > 0){
        for (int i = 0; i < results.length; i++) {
            if (results[i].contains("QUEUED")){
                qlen ++;
            }
        }
    }
    return new QueuedJobCount(qlen);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:UnixPrintService.java

示例4: getAttribute

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
@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;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:UnixPrintService.java

示例5: getQueuedJobCount

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
private QueuedJobCount getQueuedJobCount() {

        int count = getJobStatus(printer, 1);
        if (count != -1) {
            return new QueuedJobCount(count);
        }
        else {
            return new QueuedJobCount(0);
        }
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:Win32PrintService.java

示例6: getAttribute

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
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;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:Win32PrintService.java

示例7: getQueuedJobCountSysV

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
private QueuedJobCount getQueuedJobCountSysV() {
    String command = "/usr/bin/lpstat -R " + printer;
    String results[]= UnixPrintServiceLookup.execCmd(command);
    int qlen = (results == null) ? 0 : results.length;

    return new QueuedJobCount(qlen);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:UnixPrintService.java

示例8: getQueuedJobCountBSD

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
private QueuedJobCount getQueuedJobCountBSD() {
    if (UnixPrintServiceLookup.cmdIndex ==
        UnixPrintServiceLookup.UNINITIALIZED) {

        UnixPrintServiceLookup.cmdIndex =
            UnixPrintServiceLookup.getBSDCommandIndex();
    }

    int qlen = 0;
    String command = "/usr/sbin/lpc status " + printer
        + lpcQueueCom[UnixPrintServiceLookup.cmdIndex];
    String results[] = UnixPrintServiceLookup.execCmd(command);

    if (results != null && results.length > 0) {
        String queued;
        if (UnixPrintServiceLookup.cmdIndex ==
            UnixPrintServiceLookup.BSD_LPD_NG) {
            queued = results[0];
        } else {
            queued = results[3].trim();
            if (queued.startsWith("no")) {
                return new QueuedJobCount(0);
            } else {
                queued = queued.substring(0, queued.indexOf(' '));
            }
        }

        try {
            qlen = Integer.parseInt(queued);
        } catch (NumberFormatException e) {
        }
    }

    return new QueuedJobCount(qlen);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:UnixPrintService.java

示例9: getQueuedJobCount

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
private QueuedJobCount getQueuedJobCount() {
    if (UnixPrintServiceLookup.isSysV()) {
        return getQueuedJobCountSysV();
    } else if (UnixPrintServiceLookup.isBSD()) {
        return getQueuedJobCountBSD();
    } else if (UnixPrintServiceLookup.isAIX()) {
        return getQueuedJobCountAIX();
    } else {
        return new QueuedJobCount(0);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:UnixPrintService.java

示例10: getAttributes

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
@Override
public PrintServiceAttributeSet getAttributes(){
    PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
    attrs.add(getPrinterName());
    PrinterIsAcceptingJobs acptJobs = getAttribute(PrinterIsAcceptingJobs.class);
    if(acptJobs != null){
        attrs.add(acptJobs);
    }
    PrinterState prnState = getAttribute(PrinterState.class);
    if(prnState != null){
        attrs.add(prnState);
    }
    PrinterStateReasons prnStateReasons = getAttribute(PrinterStateReasons.class);
    if(prnStateReasons != null){
        attrs.add(prnStateReasons);
    }
    QueuedJobCount jobCount = getAttribute(QueuedJobCount.class);
    if(jobCount != null){
        attrs.add(jobCount);
    }
    // TODO: Seems to be more accurate than settings.get_SupportsColor(), which doesn't work for CutePDF
    if(settings.get_DefaultPageSettings().get_Color()){
        attrs.add(ColorSupported.SUPPORTED);
    }else{
        attrs.add(ColorSupported.NOT_SUPPORTED);
    }

    return AttributeSetUtilities.unmodifiableView(attrs);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:Win32PrintService.java

示例11: getQueuedJobCountSysV

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
private QueuedJobCount getQueuedJobCountSysV() {
    String command = "/usr/bin/lpstat -R " + printer;
    String results[]= PrintServiceLookupProvider.execCmd(command);
    int qlen = (results == null) ? 0 : results.length;

    return new QueuedJobCount(qlen);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:UnixPrintService.java

示例12: getQueuedJobCountBSD

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
private QueuedJobCount getQueuedJobCountBSD() {
    if (PrintServiceLookupProvider.cmdIndex ==
        PrintServiceLookupProvider.UNINITIALIZED) {

        PrintServiceLookupProvider.cmdIndex =
            PrintServiceLookupProvider.getBSDCommandIndex();
    }

    int qlen = 0;
    String command = "/usr/sbin/lpc status " + printer
        + lpcQueueCom[PrintServiceLookupProvider.cmdIndex];
    String results[] = PrintServiceLookupProvider.execCmd(command);

    if (results != null && results.length > 0) {
        String queued;
        if (PrintServiceLookupProvider.cmdIndex ==
            PrintServiceLookupProvider.BSD_LPD_NG) {
            queued = results[0];
        } else {
            queued = results[3].trim();
            if (queued.startsWith("no")) {
                return new QueuedJobCount(0);
            } else {
                queued = queued.substring(0, queued.indexOf(' '));
            }
        }

        try {
            qlen = Integer.parseInt(queued);
        } catch (NumberFormatException e) {
        }
    }

    return new QueuedJobCount(qlen);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:UnixPrintService.java

示例13: getQueuedJobCount

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
private QueuedJobCount getQueuedJobCount() {
    if (PrintServiceLookupProvider.isSysV()) {
        return getQueuedJobCountSysV();
    } else if (PrintServiceLookupProvider.isBSD()) {
        return getQueuedJobCountBSD();
    } else if (PrintServiceLookupProvider.isAIX()) {
        return getQueuedJobCountAIX();
    } else {
        return new QueuedJobCount(0);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:UnixPrintService.java

示例14: getAttribute

import javax.print.attribute.standard.QueuedJobCount; //导入依赖的package包/类
@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 == 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;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:Win32PrintService.java


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