patch so DocumentPrinter.java can be removed
[debian/jabref.git] / debian / patches / 07_PreviewPanel.patch
1 Author: tony mancill <tmancill@debian.org>
2 Description: remove dependency on DocumentPrinter.java (requires Java 1.5 or later)
3 --- a/src/java/net/sf/jabref/PreviewPanel.java
4 +++ b/src/java/net/sf/jabref/PreviewPanel.java
5 @@ -9,6 +9,9 @@
6  import java.io.IOException;
7  import java.io.StringReader;
8  
9 +import javax.print.attribute.HashPrintRequestAttributeSet;
10 +import javax.print.attribute.PrintRequestAttributeSet;
11 +import javax.print.attribute.standard.JobName;
12  import javax.swing.*;
13  import javax.swing.event.HyperlinkEvent;
14  import javax.swing.event.HyperlinkListener;
15 @@ -16,7 +19,6 @@
16  import net.sf.jabref.export.layout.Layout;
17  import net.sf.jabref.export.layout.LayoutHelper;
18  import net.sf.jabref.export.ExportFormats;
19 -import net.sf.jabref.util.DocumentPrinter;
20  
21  /**
22   * Displays an BibtexEntry using the given layout format.
23 @@ -116,17 +118,18 @@
24                         putValue(SHORT_DESCRIPTION, Globals.lang("Print Preview"));
25                 }
26  
27 -               DocumentPrinter printerService;
28 +               //DocumentPrinter printerService;
29  
30                 public void actionPerformed(ActionEvent arg0) {
31 -                       if (printerService == null)
32 -                               printerService = new DocumentPrinter();
33 -
34 +
35                         // Background this, as it takes a while.
36                         new Thread() {
37                                 public void run() {
38                                         try {
39 -                                               printerService.print(entry.getCiteKey(), previewPane);
40 +                                               PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
41 +                                               pras.add(new JobName(entry.getCiteKey(), null));
42 +                                               previewPane.print(null, null, true, null, pras, false);
43 +
44                                         } catch (PrinterException e) {
45  
46                                                 // Inform the user... we don't know what to do.