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