本文整理汇总了Java中javax.print.attribute.standard.PrinterIsAcceptingJobs.ACCEPTING_JOBS属性的典型用法代码示例。如果您正苦于以下问题:Java PrinterIsAcceptingJobs.ACCEPTING_JOBS属性的具体用法?Java PrinterIsAcceptingJobs.ACCEPTING_JOBS怎么用?Java PrinterIsAcceptingJobs.ACCEPTING_JOBS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.print.attribute.standard.PrinterIsAcceptingJobs
的用法示例。
在下文中一共展示了PrinterIsAcceptingJobs.ACCEPTING_JOBS属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPrinterIsAcceptingJobsSysV
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsSysV() {
String command = "/usr/bin/lpstat -a " + printer;
String results[]= UnixPrintServiceLookup.execCmd(command);
if (results != null && results.length > 0) {
if (results[0].startsWith(printer + " accepting requests")) {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
else if (results[0].startsWith(printer)) {
/* As well as "myprinter accepting requests", look for
* "[email protected] accepting requests".
*/
int index = printer.length();
String str = results[0];
if (str.length() > index &&
str.charAt(index) == '@' &&
str.indexOf(" accepting requests", index) > 0 &&
str.indexOf(" not accepting requests", index) == -1) {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
}
}
return PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS ;
}
示例2: getPrinterIsAcceptingJobsAIX
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsAIX() {
// 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);
if (results != null && results.length > 0) {
for (int i = 0; i < results.length; i++) {
if (results[i].contains("READY") ||
results[i].contains("RUNNING")) {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
}
}
return PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS;
}
示例3: getPrinterIsAcceptingJobsSysV
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsSysV() {
String command = "/usr/bin/lpstat -a " + printer;
String results[]= PrintServiceLookupProvider.execCmd(command);
if (results != null && results.length > 0) {
if (results[0].startsWith(printer + " accepting requests")) {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
else if (results[0].startsWith(printer)) {
/* As well as "myprinter accepting requests", look for
* "[email protected] accepting requests".
*/
int index = printer.length();
String str = results[0];
if (str.length() > index &&
str.charAt(index) == '@' &&
str.indexOf(" accepting requests", index) > 0 &&
str.indexOf(" not accepting requests", index) == -1) {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
}
}
return PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS ;
}
示例4: getPrinterIsAcceptingJobsAIX
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsAIX() {
// 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);
if (results != null && results.length > 0) {
for (int i = 0; i < results.length; i++) {
if (results[i].contains("READY") ||
results[i].contains("RUNNING")) {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
}
}
return PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS;
}
示例5: getPrinterIsAcceptingJobs
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobs() {
if (getJobStatus(printer, 2) != 1) {
return PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS;
}
else {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
}
示例6: getPrinterIsAcceptingJobsBSD
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsBSD() {
if (UnixPrintServiceLookup.cmdIndex ==
UnixPrintServiceLookup.UNINITIALIZED) {
UnixPrintServiceLookup.cmdIndex =
UnixPrintServiceLookup.getBSDCommandIndex();
}
String command = "/usr/sbin/lpc status " + printer
+ lpcStatusCom[UnixPrintServiceLookup.cmdIndex];
String results[]= UnixPrintServiceLookup.execCmd(command);
if (results != null && results.length > 0) {
if (UnixPrintServiceLookup.cmdIndex ==
UnixPrintServiceLookup.BSD_LPD_NG) {
if (results[0].startsWith("enabled enabled")) {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS ;
}
} else {
if ((results[1].trim().startsWith("queuing is enabled") &&
results[2].trim().startsWith("printing is enabled")) ||
(results.length >= 4 &&
results[2].trim().startsWith("queuing is enabled") &&
results[3].trim().startsWith("printing is enabled"))) {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS ;
}
}
}
return PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS ;
}
示例7: getPrinterIsAcceptingJobs
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobs() {
if (UnixPrintServiceLookup.isSysV()) {
return getPrinterIsAcceptingJobsSysV();
} else if (UnixPrintServiceLookup.isBSD()) {
return getPrinterIsAcceptingJobsBSD();
} else if (UnixPrintServiceLookup.isAIX()) {
return getPrinterIsAcceptingJobsAIX();
} else {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
}
示例8: getPrinterIsAcceptingJobsBSD
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsBSD() {
if (PrintServiceLookupProvider.cmdIndex ==
PrintServiceLookupProvider.UNINITIALIZED) {
PrintServiceLookupProvider.cmdIndex =
PrintServiceLookupProvider.getBSDCommandIndex();
}
String command = "/usr/sbin/lpc status " + printer
+ lpcStatusCom[PrintServiceLookupProvider.cmdIndex];
String results[]= PrintServiceLookupProvider.execCmd(command);
if (results != null && results.length > 0) {
if (PrintServiceLookupProvider.cmdIndex ==
PrintServiceLookupProvider.BSD_LPD_NG) {
if (results[0].startsWith("enabled enabled")) {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS ;
}
} else {
if ((results[1].trim().startsWith("queuing is enabled") &&
results[2].trim().startsWith("printing is enabled")) ||
(results.length >= 4 &&
results[2].trim().startsWith("queuing is enabled") &&
results[3].trim().startsWith("printing is enabled"))) {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS ;
}
}
}
return PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS ;
}
示例9: getPrinterIsAcceptingJobs
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobs() {
if (PrintServiceLookupProvider.isSysV()) {
return getPrinterIsAcceptingJobsSysV();
} else if (PrintServiceLookupProvider.isBSD()) {
return getPrinterIsAcceptingJobsBSD();
} else if (PrintServiceLookupProvider.isAIX()) {
return getPrinterIsAcceptingJobsAIX();
} else {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
}
示例10: updateForSelectedService
/**
* Called to update for new selected
* print service. Tests if currently
* selected attributes are supported.
*/
void updateForSelectedService()
{
PrinterMakeAndModel att1 =
getSelectedPrintService().getAttribute(PrinterMakeAndModel.class);
typValue.setText(att1 == null ? "" : att1.getValue());
PrinterInfo att2 =
getSelectedPrintService().getAttribute(PrinterInfo.class);
infoValue.setText(att2 == null ? "" : att2.getValue());
PrinterIsAcceptingJobs att3 =
getSelectedPrintService().getAttribute(PrinterIsAcceptingJobs.class);
PrinterState att4 =
getSelectedPrintService().getAttribute(PrinterState.class);
String status = att4.toString();
if (att3 == PrinterIsAcceptingJobs.ACCEPTING_JOBS)
status += " - " + getLocalizedString("lb.acceptingjobs");
else if (att3 == PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS)
status += " - " + getLocalizedString("lb.notacceptingjobs");
statusValue.setText(status);
if (categorySupported(Destination.class))
{
fileRedirection_cb.setEnabled(false);
}
}
示例11: updateForSelectedService
/**
* Called to update for new selected
* print service. Tests if currently
* selected attributes are supported.
*/
void updateForSelectedService()
{
PrinterMakeAndModel att1 =
getSelectedPrintService().getAttribute(PrinterMakeAndModel.class);
typValue.setText(att1 == null ? "" : att1.getValue());
PrinterInfo att2 =
getSelectedPrintService().getAttribute(PrinterInfo.class);
infoValue.setText(att2 == null ? "" : att2.getValue());
PrinterIsAcceptingJobs att3 =
getSelectedPrintService().getAttribute(PrinterIsAcceptingJobs.class);
PrinterState att4 =
getSelectedPrintService().getAttribute(PrinterState.class);
String status = att4.toString();
if (att3 == PrinterIsAcceptingJobs.ACCEPTING_JOBS)
status += " - " + getLocalizedString("lb.acceptingjobs");
else if (att3 == PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS)
status += " - " + getLocalizedString("lb.notacceptingjobs");
statusValue.setText(status);
if (categorySupported(Destination.class))
{
fileRedirection_cb.setEnabled(false);
}
}
示例12: getPrinterIsAcceptingJobs
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobs() {
if (UnixPrintServiceLookup.isSysV()) {
return getPrinterIsAcceptingJobsSysV();
} else if (UnixPrintServiceLookup.isBSD()) {
return getPrinterIsAcceptingJobsBSD();
} else {
return PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
}