private void debugPrintService(PrintService printer) {
- if (printer == null) {
- printer = PrintServiceLookup.lookupDefaultPrintService();
- if (printer == null) {
- logger.warn("No print service found in debugPrintService()");
- return;
- }
+ PrintService[] printServices;
+ String defaultPrinter = "";
+
+ if (printer != null) {
+ printServices = new PrintService[] {printer};
+ } else {
+ printServices = PrintServiceLookup.lookupPrintServices(null, null);
+ PrintService def = PrintServiceLookup.lookupDefaultPrintService();
+ if (def != null) defaultPrinter = def.getName();
}
-
- AttributeSet attributes = printer.getAttributes();
- for (Attribute a : attributes.toArray()) {
- String name = a.getName();
- String value = attributes.get(a.getClass()).toString();
- logger.info("Printer Debug: " + name + " => " + value);
+
+ for (PrintService service : printServices) {
+ logger.info("Printer Debug: found printer " + service.getName());
+ if (service.getName().equals(defaultPrinter)) {
+ logger.info(" Printer Debug: Is Default");
+ }
+
+ AttributeSet attributes = service.getAttributes();
+ for (Attribute a : attributes.toArray()) {
+ String name = a.getName();
+ String value = attributes.get(a.getClass()).toString();
+ logger.info(" Printer Debug: " + name + " => " + value);
+ }
}
}