Revert "Add a temporary patch (revert an upstream commit) to build with the old JGood...
[debian/jabref.git] / debian / patches / mrDlib_jayatana.patch
1 Description: This is the diff between the debian branch and the v_2.9b2 tag
2  in upstream git; the debian branch was created for us with the purpose to
3  disable the mrDlib functionality which needs libraries not packaged in
4  Debian yet.
5 Origin: upstream git
6 Author: Oliver Kopp <oliver.kopp@gmail.com>
7 Reviewed-by: gregor herrmann <gregoa@debian.org>
8 Last-Update: 2012-11-19
9
10 --- a/.classpath
11 +++ b/.classpath
12 @@ -11,8 +11,6 @@
13         <classpathentry exported="true" kind="lib" path="lib/plugin/JPFCodeGenerator-rt.jar" sourcepath="/JPFCodeGenerator/src"/>
14         <classpathentry exported="true" kind="lib" path="lib/glazedlists-1.8.0_java15.jar"/>
15         <classpathentry kind="lib" path="lib/mysql-connector-java-5.0.7-bin.jar"/>
16 -       <classpathentry kind="lib" path="lib/spl/sciplore/xstream-1.4.1.jar"/>
17 -       <classpathentry kind="lib" path="lib/spl/sciplore/mrDlib-serialization-api.jar" sourcepath="/Serialization API"/>
18         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
19                 <accessrules>
20                         <accessrule kind="accessible" pattern="**"/>
21 @@ -21,14 +19,10 @@
22         <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
23         <classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/resources"/>
24         <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/sciplore"/>
25 -       <classpathentry kind="lib" path="lib/spl/jersey/mimepull-1.3.jar"/>
26         <classpathentry kind="lib" path="lib/oo/juh.jar"/>
27         <classpathentry kind="lib" path="lib/oo/jurt.jar"/>
28         <classpathentry kind="lib" path="lib/oo/ridl.jar"/>
29         <classpathentry kind="lib" path="lib/oo/unoil.jar"/>
30 -       <classpathentry kind="lib" path="lib/spl/jersey/jersey-client-1.14.jar"/>
31 -       <classpathentry kind="lib" path="lib/spl/jersey/jersey-core-1.14.jar"/>
32 -       <classpathentry kind="lib" path="lib/spl/jersey/jersey-multipart-1.14.jar"/>
33         <classpathentry kind="lib" path="lib/antlr-3.4-complete.jar"/>
34         <classpathentry kind="lib" path="lib/jgoodies-common-1.4.0.jar"/>
35         <classpathentry kind="lib" path="lib/jgoodies-forms-1.6.0.jar"/>
36 @@ -36,7 +30,6 @@
37         <classpathentry kind="lib" path="lib/fontbox-1.7.1.jar"/>
38         <classpathentry kind="lib" path="lib/jempbox-1.7.1.jar"/>
39         <classpathentry kind="lib" path="lib/pdfbox-1.7.1.jar"/>
40 -       <classpathentry kind="lib" path="lib/jayatana-1.2.4.jar"/>
41         <classpathentry kind="lib" path="lib/postgresql-9.2-1002.jdbc4.jar"/>
42         <classpathentry kind="output" path="bin"/>
43  </classpath>
44 --- a/src/java/net/sf/jabref/ImportSettingsTab.java
45 +++ b/src/java/net/sf/jabref/ImportSettingsTab.java
46 @@ -44,10 +44,8 @@
47         
48      private JRadioButton radioButtonXmp;
49         private JRadioButton radioButtonPDFcontent;
50 -    private JRadioButton radioButtonMrDlib;
51      private JRadioButton radioButtonNoMeta;
52         private JRadioButton radioButtononlyAttachPDF;
53 -       private JRadioButton radioButtonUpdateEmptyFields;
54         private JCheckBox useDefaultPDFImportStyle;
55         
56         private JTextField fileNamePattern;
57 @@ -59,17 +57,12 @@
58          radioButtonNoMeta = new JRadioButton(Globals.lang("Create_blank_entry_linking_the_PDF"));
59          radioButtonXmp = new JRadioButton(Globals.lang("Create_entry_based_on_XMP_data"));
60          radioButtonPDFcontent = new JRadioButton(Globals.lang("Create_entry_based_on_content"));
61 -        radioButtonMrDlib = new JRadioButton(Globals.lang("Create_entry_based_on_data_fetched_from")+" Mr.DLib");
62          radioButtononlyAttachPDF = new JRadioButton(Globals.lang("Only_attach_PDF"));
63 -        radioButtonUpdateEmptyFields = new JRadioButton(Globals.lang("Update_empty_fields_with_data_fetched_from")
64 -            +" Mr.DLib");
65          ButtonGroup bg = new ButtonGroup();
66          bg.add(radioButtonNoMeta);
67          bg.add(radioButtonXmp);
68          bg.add(radioButtonPDFcontent);
69 -        bg.add(radioButtonMrDlib);
70          bg.add(radioButtononlyAttachPDF);
71 -        bg.add(radioButtonUpdateEmptyFields);
72  
73          useDefaultPDFImportStyle = new JCheckBox(Globals.lang("Always use this PDF import style (and do not ask for each import)"));
74                 
75 @@ -96,15 +89,9 @@
76                 builder.append(radioButtonPDFcontent);
77          builder.nextLine();
78          builder.append(pan);
79 -               builder.append(radioButtonMrDlib);
80 -        builder.nextLine();
81 -        builder.append(pan);
82                 builder.append(radioButtononlyAttachPDF);
83          builder.nextLine();
84          builder.append(pan);
85 -               builder.append(radioButtonUpdateEmptyFields);
86 -        builder.nextLine();
87 -        builder.append(pan);
88                 builder.append(useDefaultPDFImportStyle);
89          builder.nextLine();
90                 
91 @@ -136,15 +123,9 @@
92                 case ImportDialog.CONTENT:
93                         radioButtonPDFcontent.setSelected(true);
94                         break;
95 -               case ImportDialog.MRDLIB:
96 -                       radioButtonMrDlib.setSelected(true);
97 -                       break;
98                 case ImportDialog.ONLYATTACH:
99                         radioButtononlyAttachPDF.setSelected(true);
100                         break;
101 -               case ImportDialog.UPDATEEMPTYFIELDS:
102 -                       radioButtonUpdateEmptyFields.setSelected(true);
103 -                       break;
104                 default:
105                         // fallback
106                         radioButtonPDFcontent.setSelected(true);
107 @@ -162,12 +143,9 @@
108                         style = ImportDialog.XMP;
109                 else if (radioButtonPDFcontent.isSelected())
110                         style = ImportDialog.CONTENT;
111 -               else if (radioButtonMrDlib.isSelected())
112 -                       style = ImportDialog.MRDLIB;
113                 else if (radioButtononlyAttachPDF.isSelected())
114                         style = ImportDialog.ONLYATTACH;
115 -               else if (radioButtonUpdateEmptyFields.isSelected())
116 -                       style = ImportDialog.UPDATEEMPTYFIELDS;
117 +               else throw new IllegalStateException();
118                 Globals.prefs.putInt(PREF_IMPORT_DEFAULT_PDF_IMPORT_STYLE, style);
119                 Globals.prefs.put(PREF_IMPORT_FILENAMEPATTERN, fileNamePattern.getText());
120         }
121 --- a/src/java/net/sf/jabref/JabRefFrame.java
122 +++ b/src/java/net/sf/jabref/JabRefFrame.java
123 @@ -1,4 +1,4 @@
124 -/*  Copyright (C) 2003-2012 JabRef contributors.
125 +/*  Copyright (C) 2003-2011 JabRef contributors.
126      This program is free software; you can redistribute it and/or modify
127      it under the terms of the GNU General Public License as published by
128      the Free Software Foundation; either version 2 of the License, or
129 @@ -40,8 +40,6 @@
130  import javax.swing.event.ChangeEvent;
131  import javax.swing.event.ChangeListener;
132  
133 -import org.java.ayatana.ApplicationMenu;
134 -
135  import net.sf.jabref.export.*;
136  import net.sf.jabref.external.ExternalFileTypeEditor;
137  import net.sf.jabref.external.PushToApplicationButton;
138 @@ -550,13 +548,6 @@
139                  }
140              }
141          });
142 -
143 -        // The following sets up integration with Unity's global menu, but currently (Nov 18, 2012)
144 -        // this doesn't work with OpenJDK 6 (leads to crash), only with 7.
145 -        String javaVersion = System.getProperty("java.version", null);
146 -        if (javaVersion.compareTo("1.7") >= 0)
147 -            ApplicationMenu.tryInstall(this);
148 -
149      }
150  
151      public void setWindowTitle() {
152 --- a/src/java/spl/DocumentWrapper.java
153 +++ /dev/null
154 @@ -1,272 +0,0 @@
155 -package spl;\r
156 -\r
157 -import java.util.List;\r
158 -\r
159 -import org.sciplore.beans.Abstract;\r
160 -import org.sciplore.beans.Author;\r
161 -import org.sciplore.beans.Authors;\r
162 -import org.sciplore.beans.Document;\r
163 -import org.sciplore.formatter.Bean;\r
164 -import org.sciplore.formatter.SimpleTypeElementBean;\r
165 -\r
166 -/**\r
167 - * Created by IntelliJ IDEA.\r
168 - * User: Christoph Arbeit\r
169 - * Date: 10.09.2010\r
170 - * Time: 20:02:51\r
171 - * To change this template use File | Settings | File Templates.\r
172 - */\r
173 -public class DocumentWrapper {\r
174 -\r
175 -    Document xmlDocument;\r
176 -\r
177 -    public DocumentWrapper(Document xmlDocument) {\r
178 -        this.xmlDocument = xmlDocument;\r
179 -    }\r
180 -\r
181 -    public Document getXmlDocument() {\r
182 -        return xmlDocument;\r
183 -    }\r
184 -\r
185 -    public void setXmlDocument(Document xmlDocument) {\r
186 -        this.xmlDocument = xmlDocument;\r
187 -    }\r
188 -\r
189 -    public String getTitle(){\r
190 -        if(this.hasTitle()){\r
191 -            return xmlDocument.getTitle().getValue();\r
192 -        }\r
193 -        else{\r
194 -            return "";\r
195 -        }\r
196 -    }\r
197 -\r
198 -    public boolean hasTitle(){\r
199 -        return (xmlDocument.getTitle() != null && xmlDocument.getTitle().getValue() != null && !xmlDocument.getTitle().getValue().isEmpty());\r
200 -    }\r
201 -\r
202 -    public String getAbstract(){\r
203 -        if(this.hasAbstract()){\r
204 -            return ((Abstract)xmlDocument.getAbstract()).getValue();\r
205 -        }\r
206 -        else{\r
207 -            return "";\r
208 -        }\r
209 -    }\r
210 -\r
211 -    public boolean hasAbstract(){\r
212 -        return (xmlDocument.getAbstract() != null && ((Abstract)xmlDocument.getAbstract()).getValue() != null && !((Abstract)xmlDocument.getAbstract()).getValue().isEmpty());\r
213 -    }\r
214 -\r
215 -   public String getAuthors(String seperator){\r
216 -        if(this.hasAuthors()){\r
217 -               List<Bean> authors = xmlDocument.getAuthors().getCollection();\r
218 -            authors = this.sortAuthors(authors);\r
219 -            String value = "";\r
220 -            int i = 1;\r
221 -            for(Bean author : authors){\r
222 -                if(i < authors.size()){\r
223 -                    value = value + getNameComplete((Author)author);\r
224 -                    value = value + " " + seperator + " ";\r
225 -                }\r
226 -                else{\r
227 -                    value = value + getNameComplete((Author)author);\r
228 -                }\r
229 -                i++;\r
230 -            }\r
231 -            return value;\r
232 -        }\r
233 -        else{\r
234 -            return "";\r
235 -        }\r
236 -    }\r
237 -\r
238 -    public boolean hasAuthors(){\r
239 -        return (xmlDocument.getAuthors() != null && xmlDocument.getAuthors().getCollection() != null && !xmlDocument.getAuthors().getCollection().isEmpty());\r
240 -    }\r
241 -\r
242 -    /* public String getKeyWords(){\r
243 -        if(this.hasKeyWords()){\r
244 -            List<XmlKeyword> keywords = xmlDocument.getKeywords().getKeywords();\r
245 -            String value = "";\r
246 -            int i = 1;\r
247 -            for(XmlKeyword keyword : keywords){\r
248 -                if(i < keywords.size()){\r
249 -                    value = value + keyword.getValue();\r
250 -                    value = value + ", ";\r
251 -                }\r
252 -                else{\r
253 -                    value = value + keyword.getValue();\r
254 -                }\r
255 -                i++;\r
256 -            }\r
257 -            return value;\r
258 -        }\r
259 -        else{\r
260 -            return "";\r
261 -        }\r
262 -    }\r
263 -\r
264 -    public boolean hasKeyWords(){\r
265 -        return (xmlDocument.getKeywords() != null && xmlDocument.getKeywords().getKeywords() != null && !xmlDocument.getKeywords().getKeywords().isEmpty());\r
266 -    }\r
267 -*/\r
268 -\r
269 -    public String getDoi(){\r
270 -        if(this.hasDoi()){\r
271 -            return this.getSimpleTypeValue(xmlDocument.getDoi());\r
272 -        }\r
273 -        else{\r
274 -            return "";\r
275 -        }\r
276 -    }\r
277 -\r
278 -    public boolean hasDoi(){\r
279 -        return (xmlDocument.getDoi() != null && this.getSimpleTypeValue(xmlDocument.getDoi()) != null && !this.getSimpleTypeValue(xmlDocument.getDoi()).isEmpty());\r
280 -    }\r
281 -/*\r
282 -    public String getPages(){\r
283 -        if(this.hasPages()){\r
284 -            return xmlDocument.getPages().getValue();\r
285 -        }\r
286 -        else{\r
287 -            return "";\r
288 -        }\r
289 -    }\r
290 -\r
291 -    public boolean hasPages(){\r
292 -        return (xmlDocument.getPages() != null && xmlDocument.getPages().getValue() != null && !xmlDocument.getPages().getValue().isEmpty());\r
293 -    }\r
294 -\r
295 -    public String getVolume(){\r
296 -        if(this.hasVolume()){\r
297 -            return xmlDocument.getVolume().getValue();\r
298 -        }\r
299 -        else{\r
300 -            return "";\r
301 -        }\r
302 -    }\r
303 -\r
304 -    public boolean hasVolume(){\r
305 -        return (xmlDocument.getVolume() != null && xmlDocument.getVolume().getValue() != null && !xmlDocument.getVolume().getValue().isEmpty());\r
306 -    }\r
307 -\r
308 -    public String getNumber(){\r
309 -        if(this.hasNumber()){\r
310 -            return xmlDocument.getNumber().getValue();\r
311 -        }\r
312 -        else{\r
313 -            return "";\r
314 -        }\r
315 -    }\r
316 -\r
317 -    public boolean hasNumber(){\r
318 -        return (xmlDocument.getNumber() != null && xmlDocument.getNumber().getValue() != null && !xmlDocument.getNumber().getValue().isEmpty());\r
319 -    }\r
320 -*/\r
321 -    \r
322 -    public String getYear(){\r
323 -        if(this.hasYear()){\r
324 -            return this.getSimpleTypeValue(xmlDocument.getYear());\r
325 -        }\r
326 -        else{\r
327 -            return "";\r
328 -        }\r
329 -    }\r
330 -\r
331 -    public boolean hasYear(){\r
332 -        return (this.getSimpleTypeValue(xmlDocument.getYear()) != null && !this.getSimpleTypeValue(xmlDocument.getYear()).isEmpty() && !this.getSimpleTypeValue(xmlDocument.getYear()).equalsIgnoreCase("null"));\r
333 -    }\r
334 -    \r
335 -/*\r
336 -     public String getMonth(){\r
337 -        if(this.hasMonth()){\r
338 -            return xmlDocument.getPublishdate().getMonth();\r
339 -        }\r
340 -        else{\r
341 -            return "";\r
342 -        }\r
343 -    }\r
344 -\r
345 -    public boolean hasMonth(){\r
346 -        return (xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getMonth() != null && !xmlDocument.getPublishdate().getMonth().isEmpty());\r
347 -    }\r
348 -\r
349 -    public String getDay(){\r
350 -        if(this.hasDay()){\r
351 -            return xmlDocument.getPublishdate().getDay();\r
352 -        }\r
353 -        else{\r
354 -            return "";\r
355 -        }\r
356 -    }\r
357 -\r
358 -    public boolean hasDay(){\r
359 -        return (xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getDay() != null && !xmlDocument.getPublishdate().getDay().isEmpty());\r
360 -    }\r
361 -    \r
362 -       /*\r
363 -    public String getVenue() {\r
364 -        if(this.hasVenue()){\r
365 -            return xmlDocument.getVenue().getValue();\r
366 -        }\r
367 -        else{\r
368 -            return "";\r
369 -        }\r
370 -    }\r
371 -\r
372 -    public boolean hasVenue(){\r
373 -        return (xmlDocument.getVenue() != null && xmlDocument.getVenue().getValue() != null && !xmlDocument.getVenue().getValue().isEmpty());\r
374 -    }*/\r
375 -    \r
376 -    private String getNameComplete(Author author){\r
377 -       if(author == null) return "";\r
378 -       String result = "";\r
379 -       if(getSimpleTypeValue(author.getName_First()) != null)\r
380 -               result = result + getSimpleTypeValue(author.getName_First()).trim() + " ";\r
381 -       if(getSimpleTypeValue(author.getName_Middle()) != null)\r
382 -               result = result + getSimpleTypeValue(author.getName_Middle()).trim() + " ";\r
383 -       if(getSimpleTypeValue(author.getName_Last_Prefix()) != null)\r
384 -               result = result + getSimpleTypeValue(author.getName_Last_Prefix()).trim() + " ";\r
385 -       if(getSimpleTypeValue(author.getName_Last()) != null)\r
386 -               result = result + getSimpleTypeValue(author.getName_Last()).trim() + " ";\r
387 -       if(getSimpleTypeValue(author.getName_Last_Suffix()) != null)\r
388 -               result = result + getSimpleTypeValue(author.getName_Last_Suffix()).trim() + " ";\r
389 -       return result.trim();\r
390 -    }\r
391 -    \r
392 -    private String getSimpleTypeValue(Bean bean){\r
393 -       if(bean == null || !(bean instanceof SimpleTypeElementBean)) return null;\r
394 -       SimpleTypeElementBean simpleTypeElementBean = (SimpleTypeElementBean)bean;\r
395 -       if(simpleTypeElementBean.getValue() == null || simpleTypeElementBean.getValue().equalsIgnoreCase("null") || simpleTypeElementBean.getValue().length() <= 0) return null;\r
396 -       return simpleTypeElementBean.getValue();\r
397 -    }\r
398 -    \r
399 -    private List<Bean> sortAuthors(List<Bean> authors){\r
400 -        boolean unsorted = true;\r
401 -        Bean temp;\r
402 -        \r
403 -        while (unsorted){\r
404 -                unsorted = false;\r
405 -                for (int i = 0; i < authors.size() - 1; i++){\r
406 -                        int rank = 99;\r
407 -                        int otherRank = 99;\r
408 -                        if(((Author)authors.get(i)).getRank() != null && !((Author)authors.get(i)).getRank().equalsIgnoreCase("null")){\r
409 -                                rank = Integer.parseInt(((Author)authors.get(i)).getRank());\r
410 -                        }                       \r
411 -                        if(((Author)authors.get(i + 1)).getRank() != null && !((Author)authors.get(i + 1)).getRank().equalsIgnoreCase("null")){\r
412 -                                otherRank = Integer.parseInt(((Author)authors.get(i + 1)).getRank());\r
413 -                        }                       \r
414 -                        \r
415 -                        if (rank > otherRank) {                      \r
416 -                 temp       = authors.get(i);\r
417 -                 authors.set(i, authors.get(i + 1));\r
418 -                 authors.set(i + 1, temp);                 \r
419 -                 unsorted = true;\r
420 -              }          \r
421 -               }        \r
422 -       } \r
423 -       \r
424 -       return authors;\r
425 -   }\r
426 -}\r
427 --- a/src/java/spl/DocumentsWrapper.java
428 +++ /dev/null
429 @@ -1,132 +0,0 @@
430 -package spl;\r
431 -\r
432 -import java.util.ArrayList;\r
433 -import java.util.List;\r
434 -import java.util.Vector;\r
435 -\r
436 -import org.sciplore.beans.Author;\r
437 -import org.sciplore.beans.Document;\r
438 -import org.sciplore.beans.Year;\r
439 -import org.sciplore.formatter.Bean;\r
440 -import org.sciplore.formatter.SimpleTypeElementBean;\r
441 -\r
442 -/**\r
443 - * Created by IntelliJ IDEA.\r
444 - * User: Christoph Arbeit\r
445 - * Date: 09.09.2010\r
446 - * Time: 10:56:50\r
447 - * To change this template use File | Settings | File Templates.\r
448 - */\r
449 -public class DocumentsWrapper {\r
450 -\r
451 -    Document xmlDocuments;\r
452 -\r
453 -    public DocumentsWrapper(Document documents) {\r
454 -        this.xmlDocuments = documents;\r
455 -    }\r
456 -\r
457 -    public Document getXmlDocuments() {\r
458 -        return xmlDocuments;\r
459 -    }\r
460 -\r
461 -    public void setXmlDocuments(Document xmlDocuments) {\r
462 -        this.xmlDocuments = xmlDocuments;\r
463 -    }\r
464 -\r
465 -    public List<Vector> getDocuments(){\r
466 -        List<Vector> documents = new ArrayList<Vector>();\r
467 -        //List<XmlDocument> xmlDocuments = this.xmlDocuments.getDocuments();\r
468 -        //for(XmlDocument xmlDocument : xmlDocuments){\r
469 -               Document xmlDocument = xmlDocuments;\r
470 -            Vector<String> vector = new Vector<String>();\r
471 -            if(xmlDocument.getTitle() != null){\r
472 -                vector.add(xmlDocument.getTitle().getValue());\r
473 -            }\r
474 -            else{\r
475 -                vector.add("");\r
476 -            }\r
477 -            if(xmlDocument.getAuthors() != null){\r
478 -                List<Bean> authors = xmlDocument.getAuthors().getCollection();\r
479 -                authors = this.sortAuthors(authors);\r
480 -                String value = "";\r
481 -                int i = 1;\r
482 -                for(Bean author : authors){\r
483 -                    if(i < authors.size()){\r
484 -                        value = value + getNameComplete(((Author)author));\r
485 -                        value = value + ", ";\r
486 -                    }\r
487 -                    else{\r
488 -                        value = value + getNameComplete(((Author)author));\r
489 -                    }\r
490 -                    i++;\r
491 -                }\r
492 -                vector.add(value);\r
493 -            }\r
494 -            else{\r
495 -                vector.add("");\r
496 -            }\r
497 -            if(xmlDocument.getYear() != null && ((Year)xmlDocument.getYear()).getValue() != null && !((Year)xmlDocument.getYear()).getValue().equalsIgnoreCase("null")){\r
498 -                vector.add(((Year)xmlDocument.getYear()).getValue());\r
499 -            }\r
500 -            /*if(xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getYear() != null && !xmlDocument.getPublishdate().getYear().equalsIgnoreCase("null")){\r
501 -                vector.add(xmlDocument.getPublishdate().getYear());\r
502 -            }*/\r
503 -            else{\r
504 -                vector.add("");\r
505 -            }\r
506 -            documents.add(vector);\r
507 -        //}\r
508 -        return documents;\r
509 -    }\r
510 -    \r
511 -    private String getNameComplete(Author author){\r
512 -       if(author == null) return "";\r
513 -       String result = "";\r
514 -       if(getSimpleTypeValue(author.getName_First()) != null)\r
515 -               result = result + getSimpleTypeValue(author.getName_First()).trim() + " ";\r
516 -       if(getSimpleTypeValue(author.getName_Middle()) != null)\r
517 -               result = result + getSimpleTypeValue(author.getName_Middle()).trim() + " ";\r
518 -       if(getSimpleTypeValue(author.getName_Last_Prefix()) != null)\r
519 -               result = result + getSimpleTypeValue(author.getName_Last_Prefix()).trim() + " ";\r
520 -       if(getSimpleTypeValue(author.getName_Last()) != null)\r
521 -               result = result + getSimpleTypeValue(author.getName_Last()).trim() + " ";\r
522 -       if(getSimpleTypeValue(author.getName_Last_Suffix()) != null)\r
523 -               result = result + getSimpleTypeValue(author.getName_Last_Suffix()).trim() + " ";\r
524 -       return result.trim();\r
525 -    }\r
526 -    \r
527 -    private String getSimpleTypeValue(Bean bean){\r
528 -       if(bean == null || !(bean instanceof SimpleTypeElementBean)) return null;\r
529 -       SimpleTypeElementBean simpleTypeElementBean = (SimpleTypeElementBean)bean;\r
530 -       if(simpleTypeElementBean.getValue() == null || simpleTypeElementBean.getValue().equalsIgnoreCase("null") || simpleTypeElementBean.getValue().length() <= 0) return null;\r
531 -       return simpleTypeElementBean.getValue();\r
532 -    }\r
533 -    \r
534 -    private List<Bean> sortAuthors(List<Bean> authors){\r
535 -        boolean unsorted = true;\r
536 -         Bean temp;\r
537 -         \r
538 -         while (unsorted){\r
539 -                unsorted = false;\r
540 -                for (int i = 0; i < authors.size() - 1; i++){\r
541 -                        int rank = 99;\r
542 -                        int otherRank = 99;\r
543 -                        if(((Author)authors.get(i)).getRank() != null && !((Author)authors.get(i)).getRank().equalsIgnoreCase("null")){\r
544 -                                rank = Integer.parseInt(((Author)authors.get(i)).getRank());\r
545 -                        }                       \r
546 -                        if(((Author)authors.get(i + 1)).getRank() != null && !((Author)authors.get(i + 1)).getRank().equalsIgnoreCase("null")){\r
547 -                                otherRank = Integer.parseInt(((Author)authors.get(i + 1)).getRank());\r
548 -                        }                       \r
549 -                        \r
550 -                        if (rank > otherRank) {                      \r
551 -                  temp       = authors.get(i);\r
552 -                  authors.set(i, authors.get(i + 1));\r
553 -                  authors.set(i + 1, temp);                 \r
554 -                  unsorted = true;\r
555 -               }          \r
556 -               }        \r
557 -        } \r
558 -       \r
559 -       return authors;\r
560 -    }\r
561 -}\r
562 --- a/src/java/spl/PdfImporter.java
563 +++ b/src/java/spl/PdfImporter.java
564 @@ -21,15 +21,9 @@
565  import net.sf.jabref.undo.UndoableInsertEntry;\r
566  import net.sf.jabref.util.XMPUtil;\r
567  \r
568 -import org.sciplore.beans.Document;\r
569 -\r
570  import spl.filter.PdfFileFilter;\r
571  import spl.gui.ImportDialog;\r
572 -import spl.gui.MetaDataListDialog;\r
573  \r
574 -import java.util.ArrayList;\r
575 -import java.util.Arrays;\r
576 -import java.util.List;\r
577  import java.util.Set;\r
578  \r
579  \r
580 @@ -113,7 +107,6 @@
581                 BibtexEntryType type;\r
582                  InputStream in = null;\r
583                  List<BibtexEntry> res = null;\r
584 -               MetaDataListDialog metaDataListDialog;\r
585                  switch (choice) {\r
586                         case ImportDialog.XMP:\r
587                      //SplDatabaseChangeListener dataListener = new SplDatabaseChangeListener(frame, panel, entryTable, fileName);\r
588 @@ -200,84 +193,9 @@
589                          panel.adjustSplitter();\r
590                      }\r
591                      break;\r
592 -                       case ImportDialog.MRDLIB:\r
593 -                    metaDataListDialog = new MetaDataListDialog(fileName, true);\r
594 -                    Tools.centerRelativeToWindow(metaDataListDialog, frame);\r
595 -                    metaDataListDialog.showDialog();\r
596 -                    Document document = metaDataListDialog.getXmlDocuments();\r
597 -                    if(document != null /*&& documents.getDocuments() != null && documents.getDocuments().size() > 0*/ && metaDataListDialog.getResult() == JOptionPane.OK_OPTION){\r
598 -                        int selected = metaDataListDialog.getTableMetadata().getSelectedRow();\r
599 -                        if(selected > -1 /*&& selected < documents.getDocuments().size()*/){\r
600 -                            //Document document = documents/*.getDocuments().get(selected)*/;\r
601 -                            String id = Util.createNeutralId();\r
602 -                            entry = new BibtexEntry(id);\r
603 -                            if(fieldExists(document.getType())){\r
604 -                                type = BibtexEntryType.getStandardType(document.getType());\r
605 -                                if(type == null){\r
606 -                                    type = BibtexEntryType.ARTICLE;\r
607 -                                }\r
608 -                                entry.setType(type);\r
609 -                            }\r
610 -                            else{\r
611 -                                entry.setType(BibtexEntryType.ARTICLE);\r
612 -                            }\r
613 -                            ArrayList<BibtexEntry> list = new ArrayList<BibtexEntry>();\r
614 -                            list.add(entry);\r
615 -                            Util.setAutomaticFields(list, true, true, false);\r
616 -                            //insertFields(entry.getRequiredFields(), entry, document);\r
617 -                            insertFields(BibtexFields.getAllFieldNames(), entry, document);\r
618 -                            //insertFields(entry.getOptionalFields(), entry, document);\r
619 -                            panel.database().insertEntry(entry);\r
620 -                            dfh = new DroppedFileHandler(frame, panel);\r
621 -                            dfh.linkPdfToEntry(fileName, entryTable, entry);\r
622 -                            LabelPatternUtil.makeLabel(panel.metaData(), panel.database(), entry);\r
623 -                        }\r
624 -                        else{\r
625 -                            createNewBlankEntry(fileName);\r
626 -                        }\r
627 -                    }\r
628 -                    else if(metaDataListDialog.getResult() == JOptionPane.CANCEL_OPTION ){\r
629 -                        continue;\r
630 -                    }\r
631 -                    else if(metaDataListDialog.getResult() == JOptionPane.NO_OPTION ){\r
632 -                        createNewBlankEntry(fileName);\r
633 -                    }\r
634 -                    else if(document == null /*|| document.getDocuments() == null || document.getDocuments().size() <= 0*/ && metaDataListDialog.getResult() == JOptionPane.OK_OPTION){\r
635 -                        createNewBlankEntry(fileName);\r
636 -                    }\r
637 -                    break;\r
638                         case ImportDialog.NOMETA:\r
639                      createNewBlankEntry(fileName);\r
640                      break;\r
641 -                       case ImportDialog.UPDATEEMPTYFIELDS:\r
642 -                    metaDataListDialog = new MetaDataListDialog(fileName, false);                   \r
643 -                    Tools.centerRelativeToWindow(metaDataListDialog, frame);\r
644 -                    metaDataListDialog.showDialog();\r
645 -                    document = metaDataListDialog.getXmlDocuments();\r
646 -                    if(document != null /*&& document.getDocuments() != null && document.getDocuments().size() > 0*/ && metaDataListDialog.getResult() == JOptionPane.OK_OPTION){\r
647 -                        int selected = metaDataListDialog.getTableMetadata().getSelectedRow();\r
648 -                        if(selected > -1 /*&& selected < document.getDocuments().size()*/){\r
649 -                            //XmlDocument document = documents.getDocuments().get(selected);\r
650 -                            entry = entryTable.getEntryAt(dropRow);\r
651 -                            if(fieldExists(document.getType())){\r
652 -                                type = BibtexEntryType.getStandardType(document.getType());\r
653 -                                if(type != null){\r
654 -                                    entry.setType(type);\r
655 -                                }\r
656 -                            }\r
657 -                            //insertFields(entry.getRequiredFields(), entry, document);\r
658 -                            insertFields(BibtexFields.getAllFieldNames(), entry, document);\r
659 -                            //insertFields(entry.getOptionalFields(), entry, document);\r
660 -\r
661 -                            dfh = new DroppedFileHandler(frame, panel);\r
662 -                            dfh.linkPdfToEntry(fileName, entryTable, dropRow);\r
663 -                        }\r
664 -                    }\r
665 -                    break;\r
666 -                       case ImportDialog.ONLYATTACH:\r
667 -                    dfh = new DroppedFileHandler(frame, panel);\r
668 -                    dfh.linkPdfToEntry(fileName, entryTable, dropRow);\r
669 -                    break;\r
670                  }\r
671              }\r
672  \r
673 @@ -295,58 +213,6 @@
674          }\r
675      }\r
676  \r
677 -    private void insertFields(String[] fields, BibtexEntry entry, Document xmlDocument) {\r
678 -        DocumentWrapper document = new DocumentWrapper(xmlDocument);\r
679 -        for(String field : fields){\r
680 -            if(entry.getField(field) != null){\r
681 -                continue;\r
682 -            }\r
683 -            if(field.equalsIgnoreCase("author")){\r
684 -                entry.setField(field, document.getAuthors("and"));\r
685 -            }\r
686 -            if(field.equalsIgnoreCase("title")){\r
687 -                entry.setField(field, document.getTitle());\r
688 -            }\r
689 -            if(field.equalsIgnoreCase("abstract")){\r
690 -                entry.setField(field, document.getAbstract());\r
691 -            }\r
692 -            /*if(field.equalsIgnoreCase("keywords")){\r
693 -                entry.setField(field, document.getKeyWords());\r
694 -            }*/\r
695 -            if(field.equalsIgnoreCase("doi")){\r
696 -                entry.setField(field, document.getDoi());\r
697 -            }\r
698 -            /*if(field.equalsIgnoreCase("pages")){\r
699 -                entry.setField(field, document.getPages());\r
700 -            }\r
701 -            if(field.equalsIgnoreCase("volume")){\r
702 -                entry.setField(field, document.getVolume());\r
703 -            }\r
704 -            if(field.equalsIgnoreCase("number")){\r
705 -                entry.setField(field, document.getNumber());\r
706 -            }*/\r
707 -            if(field.equalsIgnoreCase("year")){\r
708 -                entry.setField(field, document.getYear());\r
709 -            }\r
710 -            /*if(field.equalsIgnoreCase("month")){\r
711 -                entry.setField(field, document.getMonth());\r
712 -            }\r
713 -            if(field.equalsIgnoreCase("day")){\r
714 -                entry.setField(field, document.getDay());\r
715 -            }\r
716 -            if(field.equalsIgnoreCase("booktitle")){\r
717 -                entry.setField(field, document.getVenue());\r
718 -            }\r
719 -            if(field.equalsIgnoreCase("journal")){\r
720 -                entry.setField(field, document.getVenue());\r
721 -            }*/\r
722 -        }\r
723 -    }\r
724 -\r
725 -    private boolean fieldExists(String string) {\r
726 -        return string != null && !string.isEmpty();\r
727 -    }\r
728 -\r
729      private BibtexEntry createNewEntry() {\r
730  \r
731          // Find out what type is wanted.\r
732 --- a/src/java/spl/SplWebClient.java
733 +++ /dev/null
734 @@ -1,196 +0,0 @@
735 -package spl;\r
736 -\r
737 -import java.io.ByteArrayInputStream;\r
738 -import java.io.File;\r
739 -import java.io.FileInputStream;\r
740 -import java.io.InputStream;\r
741 -import java.io.UnsupportedEncodingException;\r
742 -\r
743 -import javax.ws.rs.core.MediaType;\r
744 -import javax.xml.bind.JAXB;\r
745 -\r
746 -import org.sciplore.beans.Author;\r
747 -import org.sciplore.beans.Document;\r
748 -import org.sciplore.deserialize.creator.AuthorBeanCreator;\r
749 -import org.sciplore.deserialize.creator.AuthorsBeanCreator;\r
750 -import org.sciplore.deserialize.creator.DefaultStringCreator;\r
751 -import org.sciplore.deserialize.creator.DocumentBeanCreator;\r
752 -import org.sciplore.deserialize.creator.DocumentsBeanCreator;\r
753 -import org.sciplore.deserialize.creator.ObjectCreator;\r
754 -import org.sciplore.deserialize.creator.TitleBeanCreator;\r
755 -import org.sciplore.deserialize.creator.YearBeanCreator;\r
756 -import org.sciplore.deserialize.reader.ObjectCreatorMapper;\r
757 -import org.sciplore.deserialize.reader.XmlResourceReader;\r
758 -import org.sciplore.formatter.Bean;\r
759 -import org.sciplore.formatter.SimpleTypeElementBean;\r
760 -\r
761 -import com.sun.jersey.api.client.Client;\r
762 -import com.sun.jersey.api.client.ClientResponse;\r
763 -import com.sun.jersey.api.client.WebResource;\r
764 -import com.sun.jersey.multipart.FormDataMultiPart;\r
765 -\r
766 -/**\r
767 - * Created by IntelliJ IDEA.\r
768 - * User: Christoph Arbeit\r
769 - * Date: 09.09.2010\r
770 - * Time: 10:35:20\r
771 - * To change this template use File | Settings | File Templates.\r
772 - */\r
773 -public class SplWebClient {\r
774 -\r
775 -    private static Client CLIENT = Client.create();\r
776 -    static{\r
777 -        CLIENT.setConnectTimeout(1000);\r
778 -        CLIENT.setReadTimeout(70000);\r
779 -    }\r
780 -    private static WebResource WEBRESOURCE = CLIENT.resource( "http://api.mr-dlib.org/" );\r
781 -    private static WebResource INTERNETRESOURCE = CLIENT.resource( "http://www.google.com" );\r
782 -    //private static WebResource WEBRESOURCE = CLIENT.resource( "http://localhost:8080/rest/" );\r
783 -\r
784 -    public static Document metadata;\r
785 -\r
786 -    public static WebServiceStatus getMetaData(File file){\r
787 -        try{\r
788 -            if(isWebServiceAvailable() == false){\r
789 -                if(isInternetAvailable()){\r
790 -                    return  WebServiceStatus.WEBSERVICE_DOWN;\r
791 -                }\r
792 -                else{\r
793 -                    return  WebServiceStatus.NO_INTERNET;\r
794 -                }\r
795 -            }\r
796 -            if(isWebServiceOutDated()){\r
797 -                return  WebServiceStatus.OUTDATED;\r
798 -            }\r
799 -            if(isMetaDataServiceAvailable() == false){\r
800 -                return  WebServiceStatus.UNAVAILABLE;\r
801 -            }\r
802 -            FileInputStream fin = new FileInputStream(file);      \r
803 -            byte[] data = new byte[(int)file.length()];          \r
804 -            fin.read(data);           \r
805 -            \r
806 -            FormDataMultiPart formDataMultiPart = new FormDataMultiPart();            \r
807 -            formDataMultiPart.field("file", data,  MediaType.APPLICATION_OCTET_STREAM_TYPE);            \r
808 -            formDataMultiPart.field("source", "jabref",  MediaType.TEXT_PLAIN_TYPE);\r
809 -            formDataMultiPart.field("filename", file.getName(), MediaType.TEXT_PLAIN_TYPE);\r
810 -           \r
811 -           \r
812 -            ClientResponse response = WEBRESOURCE.path("documents").type(MediaType.MULTIPART_FORM_DATA_TYPE).post(ClientResponse.class, formDataMultiPart);\r
813 -            //System.out.println(response.getEntity(String.class));\r
814 -            if(response.getClientResponseStatus() == ClientResponse.Status.OK && response.hasEntity()){\r
815 -                String entity = response.getEntity(String.class);\r
816 -                byte[] bytes = new byte[0];\r
817 -                try {\r
818 -                    bytes = entity.getBytes("UTF-8");\r
819 -                } catch (UnsupportedEncodingException e) {\r
820 -                    return null;\r
821 -                }\r
822 -                InputStream is = new ByteArrayInputStream(bytes);\r
823 -                if(is != null){\r
824 -                       ObjectCreatorMapper resourceMapper = new ObjectCreatorMapper();\r
825 -                       ObjectCreator stringCreator = new DefaultStringCreator();\r
826 -                       // initialize Mapper    \r
827 -                         resourceMapper.addCreator("documents", new DocumentsBeanCreator());\r
828 -                         resourceMapper.addCreator("authors", new AuthorsBeanCreator());\r
829 -                         resourceMapper.addCreator("document", new DocumentBeanCreator());\r
830 -                         resourceMapper.addCreator("title", new TitleBeanCreator());\r
831 -                         resourceMapper.addCreator("year", new YearBeanCreator());\r
832 -                         resourceMapper.addCreator("author", new AuthorBeanCreator());\r
833 -                         \r
834 -                         resourceMapper.addCreator("name_first", stringCreator);\r
835 -                         resourceMapper.addCreator("name_middle", stringCreator);\r
836 -                         resourceMapper.addCreator("name_last", stringCreator);\r
837 -                         resourceMapper.addCreator("name_last_prefix", stringCreator);\r
838 -                         resourceMapper.addCreator("name_last_suffix", stringCreator);\r
839 -                         \r
840 -                         // initialize xml reader\r
841 -                         XmlResourceReader<?> reader = new XmlResourceReader(resourceMapper);\r
842 -                         \r
843 -                         // parse given file -> create object tree\r
844 -                         Document docs =  (Document)reader.parse(is);\r
845 -                         for(Bean author : docs.getAuthors().getCollection()){\r
846 -                                 Author temp = (Author)author;\r
847 -                                 System.out.println(((SimpleTypeElementBean)temp.getName_Last()).getValue() + " " + temp.getRank());\r
848 -                         }\r
849 -                   // XmlDocuments documents = JAXB.unmarshal(is, XmlDocuments.class);\r
850 -                    SplWebClient.metadata = docs;\r
851 -                    return WebServiceStatus.OK;\r
852 -                }\r
853 -                else{\r
854 -                    return WebServiceStatus.NO_METADATA;\r
855 -                }\r
856 -            }\r
857 -            if(response.getClientResponseStatus() == ClientResponse.Status.SERVICE_UNAVAILABLE){\r
858 -                return  WebServiceStatus.UNAVAILABLE;\r
859 -            }\r
860 -        }catch(Exception e){\r
861 -            System.out.println(Tools.getStackTraceAsString(e));\r
862 -            //Todo logging\r
863 -        }\r
864 -        return WebServiceStatus.NO_METADATA;\r
865 -    }\r
866 -\r
867 -    public static boolean isWebServiceOutDated(){\r
868 -        try{\r
869 -            ClientResponse response =  WEBRESOURCE.path("service/versioncheck/" + Tools.WEBSERVICE_APP_ID + "/current").get(ClientResponse.class);\r
870 -            if(response.getClientResponseStatus() == ClientResponse.Status.OK && response.hasEntity()){\r
871 -                String entity = response.getEntity(String.class);\r
872 -                byte[] bytes = entity.getBytes();\r
873 -                InputStream is = new ByteArrayInputStream(bytes);\r
874 -                if(is != null){\r
875 -                    /*XmlApplication app = JAXB.unmarshal(is, XmlApplication.class);\r
876 -                    if(app != null){\r
877 -                        if(app.getVersion() != null && !app.getVersion().equalsIgnoreCase(Tools.WEBSERVICE_VERSION_SHORT)){\r
878 -                            return true;\r
879 -                        }\r
880 -                    }*/\r
881 -                }\r
882 -            }\r
883 -        }catch(Exception e){\r
884 -            //Todo logging\r
885 -        }\r
886 -        return false;\r
887 -    }\r
888 -\r
889 -    public static boolean isMetaDataServiceAvailable(){\r
890 -        try{\r
891 -            ClientResponse response =  WEBRESOURCE.path("service/metadata/available").get(ClientResponse.class);\r
892 -            if(response.getClientResponseStatus() == ClientResponse.Status.OK && response.hasEntity()){\r
893 -                String entity = response.getEntity(String.class);\r
894 -                if(entity != null && entity.equalsIgnoreCase("false")){\r
895 -                    return false;\r
896 -                }\r
897 -            }\r
898 -        }catch(Exception e){\r
899 -            //Todo logging\r
900 -        }\r
901 -        return true;\r
902 -    }\r
903 -\r
904 -    public static boolean isWebServiceAvailable(){\r
905 -        try{\r
906 -            ClientResponse response =  WEBRESOURCE.path("service/metadata/available").get(ClientResponse.class);\r
907 -        }catch(Exception e){\r
908 -            return false;\r
909 -        }\r
910 -        return true;\r
911 -    }\r
912 -\r
913 -    public static boolean isInternetAvailable(){\r
914 -        try{\r
915 -            ClientResponse response =  INTERNETRESOURCE.get(ClientResponse.class);\r
916 -        }catch(Exception e){\r
917 -            return false;\r
918 -        }\r
919 -        return true;\r
920 -    }\r
921 -\r
922 -    public enum WebServiceStatus {\r
923 -        OK,\r
924 -        NO_METADATA,\r
925 -        UNAVAILABLE,\r
926 -        OUTDATED,\r
927 -        WEBSERVICE_DOWN,\r
928 -        NO_INTERNET\r
929 -    }\r
930 -}\r
931 --- a/src/java/spl/gui/ImportDialog.java
932 +++ b/src/java/spl/gui/ImportDialog.java
933 @@ -20,9 +20,7 @@
934         public final static int NOMETA = 0;\r
935         public final static int XMP = 1;\r
936         public final static int CONTENT = 2;\r
937 -       public final static int MRDLIB = 3;\r
938         public final static int ONLYATTACH = 4;\r
939 -       public final static int UPDATEEMPTYFIELDS = 5;\r
940         \r
941      private JPanel contentPane;\r
942      private JLabel labelSubHeadline;\r
943 @@ -32,14 +30,10 @@
944         private JCheckBox useDefaultPDFImportStyle;\r
945      private JRadioButton radioButtonXmp;\r
946         private JRadioButton radioButtonPDFcontent;\r
947 -    private JRadioButton radioButtonMrDlib;\r
948      private JRadioButton radioButtonNoMeta;\r
949      private JLabel labelHeadline;\r
950      private JLabel labelFileName;\r
951      private JRadioButton radioButtononlyAttachPDF;\r
952 -    private JRadioButton radioButtonUpdateEmptyFields;\r
953 -    private JLabel labelMrDlib1;\r
954 -    private JLabel labelMrDlib2;\r
955      private int result;\r
956      private int dropRow;\r
957      private String fileName;\r
958 @@ -71,15 +65,7 @@
959          radioButtonNoMeta = new JRadioButton(Globals.lang("Create_blank_entry_linking_the_PDF"));\r
960          radioButtonXmp = new JRadioButton(Globals.lang("Create_entry_based_on_XMP_data"));\r
961          radioButtonPDFcontent = new JRadioButton(Globals.lang("Create_entry_based_on_content"));\r
962 -        radioButtonMrDlib = new JRadioButton(Globals.lang("Create_entry_based_on_data_fetched_from"));\r
963          radioButtononlyAttachPDF = new JRadioButton(Globals.lang("Only_attach_PDF"));\r
964 -        radioButtonUpdateEmptyFields = new JRadioButton(Globals.lang("Update_empty_fields_with_data_fetched_from"));\r
965 -        labelMrDlib1 = new JLabel("Mr._dLib");\r
966 -        labelMrDlib1.setFont(new Font(labelMrDlib1.getFont().getName(), Font.BOLD, 13));\r
967 -        labelMrDlib1.setForeground(new Color(-16776961));\r
968 -        labelMrDlib2 = new JLabel("Mr._dLib");\r
969 -        labelMrDlib2.setFont(new Font(labelMrDlib1.getFont().getName(), Font.BOLD, 13));\r
970 -        labelMrDlib2.setForeground(new Color(-16776961));\r
971          buttonOK = new JButton(Globals.lang("Ok"));\r
972          buttonCancel = new JButton(Globals.lang("Cancel"));\r
973          checkBoxDoNotShowAgain = new JCheckBox(Globals.lang("Do not show this box again for this import"));\r
974 @@ -89,12 +75,8 @@
975          b.append(radioButtonNoMeta, 3);\r
976          b.append(radioButtonXmp, 3);\r
977          b.append(radioButtonPDFcontent, 3);\r
978 -        b.append(radioButtonMrDlib);\r
979 -        b.append(labelMrDlib1);\r
980          b.appendSeparator(Globals.lang("Update_Existing_Entry"));\r
981          b.append(radioButtononlyAttachPDF, 3);\r
982 -        b.append(radioButtonUpdateEmptyFields);\r
983 -        b.append(labelMrDlib2);\r
984          b.nextLine();\r
985          b.append(checkBoxDoNotShowAgain);\r
986          b.append(useDefaultPDFImportStyle);\r
987 @@ -114,8 +96,6 @@
988          //this.setText();\r
989          if (this.dropRow < 0) {\r
990              this.radioButtononlyAttachPDF.setEnabled(false);\r
991 -            this.radioButtonUpdateEmptyFields.setEnabled(false);\r
992 -            this.labelMrDlib2.setEnabled(false);\r
993          }\r
994          this.fileName = fileName;\r
995          String name = new File(this.fileName).getName();\r
996 @@ -124,8 +104,6 @@
997          } else {\r
998              this.labelFileName.setText(new File(this.fileName).getName().substring(0, 33) + "...");\r
999          }\r
1000 -        this.labelMrDlib1.addMouseListener(new LabelLinkListener(this.labelMrDlib1, "www.mr-dlib.org/docs/pdf_metadata_extraction.php"));\r
1001 -        this.labelMrDlib2.addMouseListener(new LabelLinkListener(this.labelMrDlib2, "www.mr-dlib.org/docs/pdf_metadata_extraction.php"));\r
1002          this.setTitle(LocalizationSupport.message("Import_Metadata_From_PDF"));\r
1003  \r
1004          setModal(true);\r
1005 @@ -136,9 +114,7 @@
1006          bg.add(radioButtonNoMeta);\r
1007          bg.add(radioButtonXmp);\r
1008          bg.add(radioButtonPDFcontent);\r
1009 -        bg.add(radioButtonMrDlib);\r
1010          bg.add(radioButtononlyAttachPDF);\r
1011 -        bg.add(radioButtonUpdateEmptyFields);\r
1012  \r
1013          buttonOK.addActionListener(new ActionListener() {\r
1014              public void actionPerformed(ActionEvent e) {\r
1015 @@ -175,15 +151,9 @@
1016                 case CONTENT:\r
1017                         radioButtonPDFcontent.setSelected(true);\r
1018                         break;\r
1019 -               case MRDLIB:\r
1020 -                       radioButtonMrDlib.setSelected(true);\r
1021 -                       break;\r
1022                 case ONLYATTACH:\r
1023                         radioButtononlyAttachPDF.setSelected(true);\r
1024                         break;\r
1025 -               case UPDATEEMPTYFIELDS:\r
1026 -                       radioButtonUpdateEmptyFields.setSelected(true);\r
1027 -                       break;\r
1028                 default:\r
1029                         // fallback\r
1030                         radioButtonPDFcontent.setSelected(true);\r
1031 @@ -218,14 +188,10 @@
1032                 return XMP;\r
1033         else if (radioButtonPDFcontent.isSelected())\r
1034                 return CONTENT;\r
1035 -       else if (radioButtonMrDlib.isSelected())\r
1036 -               return MRDLIB;\r
1037         else if (radioButtonNoMeta.isSelected())\r
1038                 return NOMETA;\r
1039         else if (radioButtononlyAttachPDF.isSelected())\r
1040                 return ONLYATTACH;\r
1041 -       else if (radioButtonUpdateEmptyFields.isSelected())\r
1042 -               return UPDATEEMPTYFIELDS;\r
1043         else throw new IllegalStateException();\r
1044      }\r
1045  \r
1046 --- a/src/java/spl/gui/MetaDataListDialog.java
1047 +++ /dev/null
1048 @@ -1,314 +0,0 @@
1049 -package spl.gui;\r
1050 -\r
1051 -\r
1052 -import java.awt.BorderLayout;\r
1053 -import java.awt.CardLayout;\r
1054 -import java.awt.Color;\r
1055 -import java.awt.Component;\r
1056 -import java.awt.Dimension;\r
1057 -import java.awt.Font;\r
1058 -import java.awt.event.ActionEvent;\r
1059 -import java.awt.event.ActionListener;\r
1060 -import java.awt.event.KeyEvent;\r
1061 -import java.awt.event.WindowAdapter;\r
1062 -import java.awt.event.WindowEvent;\r
1063 -import java.io.File;\r
1064 -import java.io.IOException;\r
1065 -import java.util.List;\r
1066 -import java.util.Vector;\r
1067 -\r
1068 -import javax.swing.BorderFactory;\r
1069 -import javax.swing.ImageIcon;\r
1070 -import javax.swing.JButton;\r
1071 -import javax.swing.JComponent;\r
1072 -import javax.swing.JDialog;\r
1073 -import javax.swing.JLabel;\r
1074 -import javax.swing.JOptionPane;\r
1075 -import javax.swing.JPanel;\r
1076 -import javax.swing.JScrollPane;\r
1077 -import javax.swing.JTable;\r
1078 -import javax.swing.KeyStroke;\r
1079 -import javax.swing.ListSelectionModel;\r
1080 -import javax.swing.SwingWorker;\r
1081 -import javax.swing.table.DefaultTableModel;\r
1082 -\r
1083 -import net.sf.jabref.Globals;\r
1084 -import net.sf.jabref.MetaData;\r
1085 -import net.sf.jabref.Util;\r
1086 -\r
1087 -import org.sciplore.beans.Document;\r
1088 -\r
1089 -import spl.DocumentsWrapper;\r
1090 -import spl.SplWebClient;\r
1091 -import spl.listener.LabelLinkListener;\r
1092 -import spl.localization.LocalizationSupport;\r
1093 -\r
1094 -import com.jgoodies.forms.builder.ButtonBarBuilder;\r
1095 -\r
1096 -public class MetaDataListDialog extends JDialog {\r
1097 -    private JPanel contentPane;\r
1098 -    private JTable tableMetadata;\r
1099 -    private JButton buttonOK;\r
1100 -    private JButton buttonCancel;\r
1101 -    private JScrollPane scrollPane;\r
1102 -    private JPanel panelWait;\r
1103 -    private JLabel labelFetch;\r
1104 -    private JLabel iconLabel;\r
1105 -    private JButton blankButton;\r
1106 -    private JLabel labelLogo;\r
1107 -    private JButton moreInformationButton;\r
1108 -    private JPanel panelMetadata;\r
1109 -    private DefaultTableModel tableModel;\r
1110 -    private int result;\r
1111 -    private Document xmlDocuments;\r
1112 -    private String fileName;\r
1113 -    private SplWebClient.WebServiceStatus webserviceStatus;\r
1114 -    private Component thisDialog;\r
1115 -    private boolean showBlankButton;\r
1116 -    private CardLayout cardLayou = new CardLayout();\r
1117 -\r
1118 -    public MetaDataListDialog(String fileName, boolean showBlankButton) {\r
1119 -        $$$setupUI$$$();\r
1120 -        this.showBlankButton = showBlankButton;\r
1121 -        this.thisDialog = this;\r
1122 -        this.fileName = fileName;\r
1123 -        this.labelLogo.addMouseListener(new LabelLinkListener(this.labelLogo, "www.mr-dlib.org"));\r
1124 -        this.setTitle(LocalizationSupport.message("Mr._dLib_Metadata_Entries_Associated_With_PDF_File"));\r
1125 -        this.tableMetadata.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
1126 -        setContentPane(contentPane);\r
1127 -        pack();\r
1128 -        setModal(true);\r
1129 -        getRootPane().setDefaultButton(buttonOK);\r
1130 -\r
1131 -        buttonOK.addActionListener(new ActionListener() {\r
1132 -            public void actionPerformed(ActionEvent e) {\r
1133 -                onOK();\r
1134 -            }\r
1135 -        });\r
1136 -\r
1137 -        buttonCancel.addActionListener(new ActionListener() {\r
1138 -            public void actionPerformed(ActionEvent e) {\r
1139 -                onCancel();\r
1140 -            }\r
1141 -        });\r
1142 -\r
1143 -        blankButton.addActionListener(new ActionListener() {\r
1144 -            public void actionPerformed(ActionEvent e) {\r
1145 -                onBlank();\r
1146 -            }\r
1147 -        });\r
1148 -\r
1149 -        moreInformationButton.addActionListener(new ActionListener() {\r
1150 -            public void actionPerformed(ActionEvent e) {\r
1151 -                onInfo();\r
1152 -            }\r
1153 -        });\r
1154 -\r
1155 -        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);\r
1156 -        addWindowListener(new WindowAdapter() {\r
1157 -            public void windowClosing(WindowEvent e) {\r
1158 -                onCancel();\r
1159 -            }\r
1160 -        });\r
1161 -\r
1162 -        contentPane.registerKeyboardAction(new ActionListener() {\r
1163 -            public void actionPerformed(ActionEvent e) {\r
1164 -                onCancel();\r
1165 -            }\r
1166 -        }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);\r
1167 -\r
1168 -        cardLayou.show(panelMetadata, "panelWait");\r
1169 -        //this.scrollPane.setVisible(false);\r
1170 -        //this.blankButton.setVisible(false);\r
1171 -        this.moreInformationButton.setVisible(true);\r
1172 -        this.setSize(616, 366);\r
1173 -    }\r
1174 -\r
1175 -    private void onInfo() {\r
1176 -        try {\r
1177 -            Util.openExternalViewer(new MetaData(), "http://www.mr-dlib.org/docs/jabref_metadata_extraction_alpha.php", "url");\r
1178 -        } catch (IOException exc) {\r
1179 -            exc.printStackTrace();\r
1180 -        }\r
1181 -    }\r
1182 -\r
1183 -    private void onBlank() {\r
1184 -        this.result = JOptionPane.NO_OPTION;\r
1185 -        dispose();\r
1186 -    }\r
1187 -\r
1188 -    private void onOK() {\r
1189 -        this.result = JOptionPane.OK_OPTION;\r
1190 -        dispose();\r
1191 -    }\r
1192 -\r
1193 -    private void onCancel() {\r
1194 -        this.result = JOptionPane.CANCEL_OPTION;\r
1195 -        dispose();\r
1196 -    }\r
1197 -\r
1198 -    public void showDialog() {\r
1199 -        SwingWorker worker = new SwingWorker<Void, Void>() {\r
1200 -            @Override\r
1201 -            public Void doInBackground() {\r
1202 -                System.out.println("Starting Webclient...");\r
1203 -                webserviceStatus = SplWebClient.getMetaData(new File(fileName));\r
1204 -                return null;\r
1205 -            }\r
1206 -\r
1207 -            @Override\r
1208 -            public void done() {\r
1209 -                if (webserviceStatus == SplWebClient.WebServiceStatus.OK) {\r
1210 -                    xmlDocuments = SplWebClient.metadata;\r
1211 -                    if (xmlDocuments != null /*&& xmlDocuments.getDocuments() != null && xmlDocuments.getDocuments().size() > 0*/) {\r
1212 -                        DocumentsWrapper documents = new DocumentsWrapper(xmlDocuments);\r
1213 -                        List<Vector> vectorList = documents.getDocuments();\r
1214 -                        for (Vector vector : vectorList) {\r
1215 -                            tableModel.addRow(vector);\r
1216 -                        }\r
1217 -\r
1218 -                        tableMetadata.getSelectionModel().setSelectionInterval(0, 0);\r
1219 -                        cardLayou.show(panelMetadata, "scrollPane");\r
1220 -                        //panelWait.setVisible(false);\r
1221 -                        //scrollPane.setVisible(true);\r
1222 -                        moreInformationButton.setVisible(true);\r
1223 -                    } else {\r
1224 -                        iconLabel.setVisible(false);\r
1225 -                        labelFetch.setText(LocalizationSupport.message("No_metadata_found."));\r
1226 -                        blankButton.setVisible(showBlankButton);\r
1227 -                    }\r
1228 -                }\r
1229 -                if (webserviceStatus == SplWebClient.WebServiceStatus.NO_METADATA) {\r
1230 -                    iconLabel.setVisible(false);\r
1231 -                    labelFetch.setText(LocalizationSupport.message("No_metadata_found."));\r
1232 -                    blankButton.setVisible(showBlankButton);\r
1233 -                }\r
1234 -                if (webserviceStatus == SplWebClient.WebServiceStatus.UNAVAILABLE) {\r
1235 -                    iconLabel.setVisible(false);\r
1236 -                    labelFetch.setText(LocalizationSupport.message("Mr._dLib_web_service_is_temporarily_unavailable."));\r
1237 -                    blankButton.setVisible(showBlankButton);\r
1238 -                }\r
1239 -                if (webserviceStatus == SplWebClient.WebServiceStatus.OUTDATED) {\r
1240 -                    iconLabel.setVisible(false);\r
1241 -                    labelFetch.setText(LocalizationSupport.message("The_Mr._dLib_web_service_version_you_trying_to_access_is_outdated."));\r
1242 -                    blankButton.setVisible(showBlankButton);\r
1243 -                    JOptionPane.showMessageDialog(thisDialog, LocalizationSupport.message("This_JabRef_version_is_trying_to_access_an_old_version_of_Mr._dLib's_webservice_that_is_not_working_any_more.\nPlease_visit_http://jabref.sourceforge.net_or_http://www.mr-dlib.org_for_more_information_and_updates."), LocalizationSupport.message("Web_Service_Version_Outdated"), JOptionPane.INFORMATION_MESSAGE);\r
1244 -                }\r
1245 -                if (webserviceStatus == SplWebClient.WebServiceStatus.WEBSERVICE_DOWN) {\r
1246 -                    iconLabel.setVisible(false);\r
1247 -                    labelFetch.setText(LocalizationSupport.message("Mr._dLib_web_service_is_temporarily_down._Please_try_again_later."));\r
1248 -                    blankButton.setVisible(showBlankButton);\r
1249 -                }\r
1250 -                if (webserviceStatus == SplWebClient.WebServiceStatus.NO_INTERNET) {\r
1251 -                    iconLabel.setVisible(false);\r
1252 -                    labelFetch.setText(LocalizationSupport.message("No_Internet_Connection."));\r
1253 -                    blankButton.setVisible(showBlankButton);\r
1254 -                    JOptionPane.showMessageDialog(thisDialog, LocalizationSupport.message("You_are_not_connected_to_the_Internet._To_access_Mr._dLib_web_service_an_internet_connection_is_needed."), LocalizationSupport.message("No_Internet_Connection."), JOptionPane.INFORMATION_MESSAGE);\r
1255 -                }\r
1256 -            }\r
1257 -        };\r
1258 -        worker.execute();\r
1259 -        this.pack();\r
1260 -        this.setVisible(true);\r
1261 -    }\r
1262 -\r
1263 -    public Document getXmlDocuments() {\r
1264 -        return xmlDocuments;\r
1265 -    }\r
1266 -\r
1267 -    private void createUIComponents() {\r
1268 -        this.tableModel = new MyTableModel();\r
1269 -        this.tableModel.addColumn(LocalizationSupport.message("Title"));\r
1270 -        this.tableModel.addColumn(LocalizationSupport.message("Author(s)"));\r
1271 -        this.tableModel.addColumn(LocalizationSupport.message("Published_Year"));\r
1272 -        this.tableMetadata = new JTable(this.tableModel);\r
1273 -    }\r
1274 -\r
1275 -    public JTable getTableMetadata() {\r
1276 -        return tableMetadata;\r
1277 -    }\r
1278 -\r
1279 -    public int getResult() {\r
1280 -        return result;\r
1281 -    }\r
1282 -\r
1283 -    public JButton getBlankButton() {\r
1284 -        return blankButton;\r
1285 -    }\r
1286 -\r
1287 -    private void $$$setupUI$$$() {\r
1288 -        createUIComponents();\r
1289 -        contentPane = new JPanel();\r
1290 -        contentPane.setLayout(new BorderLayout());\r
1291 -        labelLogo = new JLabel();\r
1292 -        labelLogo.setIcon(new ImageIcon(getClass().getResource("/spl/gui/mrdlib header.png")));\r
1293 -        labelLogo.setText("");\r
1294 -        contentPane.add(labelLogo, BorderLayout.NORTH);\r
1295 -        panelMetadata = new JPanel();\r
1296 -        panelMetadata.setLayout(cardLayou);\r
1297 -\r
1298 -\r
1299 -        panelMetadata.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null));\r
1300 -        scrollPane = new JScrollPane();\r
1301 -        scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), null));\r
1302 -        tableMetadata.setAutoCreateRowSorter(false);\r
1303 -        tableMetadata.setEnabled(true);\r
1304 -        tableMetadata.setFillsViewportHeight(true);\r
1305 -        tableMetadata.setShowVerticalLines(true);\r
1306 -        scrollPane.setViewportView(tableMetadata);\r
1307 -        panelMetadata.add(scrollPane, "scrollPane");\r
1308 -        panelWait = new JPanel();\r
1309 -        panelWait.setLayout(new BorderLayout());\r
1310 -        panelWait.setBackground(new Color(-1));\r
1311 -        panelMetadata.add(panelWait, "panelWait");\r
1312 -        panelWait.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), null));\r
1313 -        iconLabel = new JLabel();\r
1314 -        iconLabel.setBackground(new Color(-1));\r
1315 -        iconLabel.setHorizontalAlignment(0);\r
1316 -        iconLabel.setHorizontalTextPosition(11);\r
1317 -        iconLabel.setIcon(new ImageIcon(getClass().getResource("/spl/gui/ajax-loader.gif")));\r
1318 -        iconLabel.setText("");\r
1319 -        panelWait.add(iconLabel, BorderLayout.CENTER);\r
1320 -        labelFetch = new JLabel();\r
1321 -        labelFetch.setHorizontalAlignment(JLabel.CENTER);\r
1322 -        labelFetch.setFont(new Font(labelFetch.getFont().getName(), labelFetch.getFont().getStyle(), 13));\r
1323 -        labelFetch.setText(Globals.lang("Fetching Metadata..."));\r
1324 -        panelWait.add(labelFetch, BorderLayout.SOUTH);\r
1325 -\r
1326 -        cardLayou.show(panelMetadata, "panelWait");\r
1327 -        panelMetadata.setPreferredSize(new Dimension(400, 200));\r
1328 -        contentPane.add(panelMetadata, BorderLayout.CENTER);\r
1329 -\r
1330 -        buttonOK = new JButton(Globals.lang("Ok"));\r
1331 -        buttonCancel = new JButton(Globals.lang("Cancel"));\r
1332 -        moreInformationButton = new JButton(Globals.lang("More information"));\r
1333 -        ButtonBarBuilder bb = new ButtonBarBuilder();\r
1334 -        bb.addGlue();\r
1335 -        bb.addButton(moreInformationButton);\r
1336 -        bb.addButton(buttonOK);\r
1337 -        bb.addButton(buttonCancel);\r
1338 -        bb.addGlue();\r
1339 -        blankButton = new JButton();\r
1340 -        blankButton.setText("");\r
1341 -        contentPane.add(bb.getPanel(), BorderLayout.SOUTH);\r
1342 -        iconLabel.setLabelFor(scrollPane);\r
1343 -\r
1344 -\r
1345 -    }\r
1346 -\r
1347 -    /**\r
1348 -     * @noinspection ALL\r
1349 -     */\r
1350 -    public JComponent $$$getRootComponent$$$() {\r
1351 -        return contentPane;\r
1352 -    }\r
1353 -\r
1354 -    public class MyTableModel extends DefaultTableModel {\r
1355 -\r
1356 -        @Override\r
1357 -        public boolean isCellEditable(int row, int column) {\r
1358 -            return false;\r
1359 -        }\r
1360 -    }\r
1361 -\r
1362 -}\r