Author: eckardjf
Date: Sat Oct 11 13:11:33 2008
New Revision: 703724
URL:
http://svn.apache.org/viewvc?rev=703724&view=revLog:
Fixed bug in OutputServices reformat; simplified getting printer names in groovy script
Modified:
ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java
ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy
Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java?rev=703724&r1=703723&r2=703724&view=diff==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/output/OutputServices.java Sat Oct 11 13:11:33 2008
@@ -154,7 +154,7 @@
}
}
}
- if (printer != null) {
+ if (printer == null) {
printer = services[0];
}
}
Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy?rev=703724&r1=703723&r2=703724&view=diff==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy Sat Oct 11 13:11:33 2008
@@ -17,17 +17,8 @@
* under the License.
*/
-import javax.print.PrintService
import javax.print.PrintServiceLookup
-import javax.print.attribute.PrintServiceAttribute
-import javax.print.attribute.standard.PrinterName
-printers = [];
-PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
-if (services.length > 0) {
- for (int i = 0; i < services.length; i++) {
- PrintServiceAttribute attr = services[i].getAttribute(PrinterName.class);
- printers.add(((PrinterName)attr).getValue());
- }
-}
-context.printers = printers;
\ No newline at end of file
+printServices = PrintServiceLookup.lookupPrintServices(null, null);
+printServiceNames = printServices.collect { it.getName() }
+context.printers = printServiceNames;
\ No newline at end of file