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
7 Author: Oliver Kopp <oliver.kopp@gmail.com>
8 Reviewed-by: gregor herrmann <gregoa@debian.org>
9 Last-Update: 2013-03-29
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">
21 <accessrule kind="accessible" pattern="**"/>
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"/>
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"/>
45 --- a/src/java/net/sf/jabref/ImportSettingsTab.java
46 +++ b/src/java/net/sf/jabref/ImportSettingsTab.java
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;
57 private JTextField fileNamePattern;
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")
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);
74 useDefaultPDFImportStyle = new JCheckBox(Globals.lang("Always use this PDF import style (and do not ask for each import)"));
77 builder.append(radioButtonPDFcontent);
80 - builder.append(radioButtonMrDlib);
82 - builder.append(pan);
83 builder.append(radioButtononlyAttachPDF);
86 - builder.append(radioButtonUpdateEmptyFields);
88 - builder.append(pan);
89 builder.append(useDefaultPDFImportStyle);
93 case ImportDialog.CONTENT:
94 radioButtonPDFcontent.setSelected(true);
96 - case ImportDialog.MRDLIB:
97 - radioButtonMrDlib.setSelected(true);
99 case ImportDialog.ONLYATTACH:
100 radioButtononlyAttachPDF.setSelected(true);
102 - case ImportDialog.UPDATEEMPTYFIELDS:
103 - radioButtonUpdateEmptyFields.setSelected(true);
107 radioButtonPDFcontent.setSelected(true);
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());
122 --- a/src/java/net/sf/jabref/JabRefFrame.java
123 +++ b/src/java/net/sf/jabref/JabRefFrame.java
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
131 import javax.swing.event.ChangeEvent;
132 import javax.swing.event.ChangeListener;
134 -import org.java.ayatana.ApplicationMenu;
136 import net.sf.jabref.export.*;
137 import net.sf.jabref.external.ExternalFileTypeEditor;
138 import net.sf.jabref.external.PushToApplicationButton;
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);
152 public void setWindowTitle() {
153 --- a/src/java/spl/DocumentWrapper.java
158 -import java.util.List;
\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
168 - * Created by IntelliJ IDEA.
\r
169 - * User: Christoph Arbeit
\r
170 - * Date: 10.09.2010
\r
172 - * To change this template use File | Settings | File Templates.
\r
174 -public class DocumentWrapper {
\r
176 - Document xmlDocument;
\r
178 - public DocumentWrapper(Document xmlDocument) {
\r
179 - this.xmlDocument = xmlDocument;
\r
182 - public Document getXmlDocument() {
\r
183 - return xmlDocument;
\r
186 - public void setXmlDocument(Document xmlDocument) {
\r
187 - this.xmlDocument = xmlDocument;
\r
190 - public String getTitle(){
\r
191 - if(this.hasTitle()){
\r
192 - return xmlDocument.getTitle().getValue();
\r
199 - public boolean hasTitle(){
\r
200 - return (xmlDocument.getTitle() != null && xmlDocument.getTitle().getValue() != null && !xmlDocument.getTitle().getValue().isEmpty());
\r
203 - public String getAbstract(){
\r
204 - if(this.hasAbstract()){
\r
205 - return ((Abstract)xmlDocument.getAbstract()).getValue();
\r
212 - public boolean hasAbstract(){
\r
213 - return (xmlDocument.getAbstract() != null && ((Abstract)xmlDocument.getAbstract()).getValue() != null && !((Abstract)xmlDocument.getAbstract()).getValue().isEmpty());
\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
222 - for(Bean author : authors){
\r
223 - if(i < authors.size()){
\r
224 - value = value + getNameComplete((Author)author);
\r
225 - value = value + " " + seperator + " ";
\r
228 - value = value + getNameComplete((Author)author);
\r
239 - public boolean hasAuthors(){
\r
240 - return (xmlDocument.getAuthors() != null && xmlDocument.getAuthors().getCollection() != null && !xmlDocument.getAuthors().getCollection().isEmpty());
\r
243 - /* public String getKeyWords(){
\r
244 - if(this.hasKeyWords()){
\r
245 - List<XmlKeyword> keywords = xmlDocument.getKeywords().getKeywords();
\r
246 - String value = "";
\r
248 - for(XmlKeyword keyword : keywords){
\r
249 - if(i < keywords.size()){
\r
250 - value = value + keyword.getValue();
\r
251 - value = value + ", ";
\r
254 - value = value + keyword.getValue();
\r
265 - public boolean hasKeyWords(){
\r
266 - return (xmlDocument.getKeywords() != null && xmlDocument.getKeywords().getKeywords() != null && !xmlDocument.getKeywords().getKeywords().isEmpty());
\r
270 - public String getDoi(){
\r
271 - if(this.hasDoi()){
\r
272 - return this.getSimpleTypeValue(xmlDocument.getDoi());
\r
279 - public boolean hasDoi(){
\r
280 - return (xmlDocument.getDoi() != null && this.getSimpleTypeValue(xmlDocument.getDoi()) != null && !this.getSimpleTypeValue(xmlDocument.getDoi()).isEmpty());
\r
283 - public String getPages(){
\r
284 - if(this.hasPages()){
\r
285 - return xmlDocument.getPages().getValue();
\r
292 - public boolean hasPages(){
\r
293 - return (xmlDocument.getPages() != null && xmlDocument.getPages().getValue() != null && !xmlDocument.getPages().getValue().isEmpty());
\r
296 - public String getVolume(){
\r
297 - if(this.hasVolume()){
\r
298 - return xmlDocument.getVolume().getValue();
\r
305 - public boolean hasVolume(){
\r
306 - return (xmlDocument.getVolume() != null && xmlDocument.getVolume().getValue() != null && !xmlDocument.getVolume().getValue().isEmpty());
\r
309 - public String getNumber(){
\r
310 - if(this.hasNumber()){
\r
311 - return xmlDocument.getNumber().getValue();
\r
318 - public boolean hasNumber(){
\r
319 - return (xmlDocument.getNumber() != null && xmlDocument.getNumber().getValue() != null && !xmlDocument.getNumber().getValue().isEmpty());
\r
323 - public String getYear(){
\r
324 - if(this.hasYear()){
\r
325 - return this.getSimpleTypeValue(xmlDocument.getYear());
\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
337 - public String getMonth(){
\r
338 - if(this.hasMonth()){
\r
339 - return xmlDocument.getPublishdate().getMonth();
\r
346 - public boolean hasMonth(){
\r
347 - return (xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getMonth() != null && !xmlDocument.getPublishdate().getMonth().isEmpty());
\r
350 - public String getDay(){
\r
351 - if(this.hasDay()){
\r
352 - return xmlDocument.getPublishdate().getDay();
\r
359 - public boolean hasDay(){
\r
360 - return (xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getDay() != null && !xmlDocument.getPublishdate().getDay().isEmpty());
\r
364 - public String getVenue() {
\r
365 - if(this.hasVenue()){
\r
366 - return xmlDocument.getVenue().getValue();
\r
373 - public boolean hasVenue(){
\r
374 - return (xmlDocument.getVenue() != null && xmlDocument.getVenue().getValue() != null && !xmlDocument.getVenue().getValue().isEmpty());
\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
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
400 - private List<Bean> sortAuthors(List<Bean> authors){
\r
401 - boolean unsorted = true;
\r
404 - while (unsorted){
\r
405 - unsorted = false;
\r
406 - for (int i = 0; i < authors.size() - 1; i++){
\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
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
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
428 --- a/src/java/spl/DocumentsWrapper.java
433 -import java.util.ArrayList;
\r
434 -import java.util.List;
\r
435 -import java.util.Vector;
\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
444 - * Created by IntelliJ IDEA.
\r
445 - * User: Christoph Arbeit
\r
446 - * Date: 09.09.2010
\r
448 - * To change this template use File | Settings | File Templates.
\r
450 -public class DocumentsWrapper {
\r
452 - Document xmlDocuments;
\r
454 - public DocumentsWrapper(Document documents) {
\r
455 - this.xmlDocuments = documents;
\r
458 - public Document getXmlDocuments() {
\r
459 - return xmlDocuments;
\r
462 - public void setXmlDocuments(Document xmlDocuments) {
\r
463 - this.xmlDocuments = xmlDocuments;
\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
478 - if(xmlDocument.getAuthors() != null){
\r
479 - List<Bean> authors = xmlDocument.getAuthors().getCollection();
\r
480 - authors = this.sortAuthors(authors);
\r
481 - String value = "";
\r
483 - for(Bean author : authors){
\r
484 - if(i < authors.size()){
\r
485 - value = value + getNameComplete(((Author)author));
\r
486 - value = value + ", ";
\r
489 - value = value + getNameComplete(((Author)author));
\r
493 - vector.add(value);
\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
501 - /*if(xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getYear() != null && !xmlDocument.getPublishdate().getYear().equalsIgnoreCase("null")){
\r
502 - vector.add(xmlDocument.getPublishdate().getYear());
\r
507 - documents.add(vector);
\r
509 - return documents;
\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
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
535 - private List<Bean> sortAuthors(List<Bean> authors){
\r
536 - boolean unsorted = true;
\r
539 - while (unsorted){
\r
540 - unsorted = false;
\r
541 - for (int i = 0; i < authors.size() - 1; i++){
\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
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
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
563 --- a/src/java/spl/PdfImporter.java
564 +++ b/src/java/spl/PdfImporter.java
566 import net.sf.jabref.undo.UndoableInsertEntry;
\r
567 import net.sf.jabref.util.XMPUtil;
\r
569 -import org.sciplore.beans.Document;
\r
571 import spl.filter.PdfFileFilter;
\r
572 import spl.gui.ImportDialog;
\r
573 -import spl.gui.MetaDataListDialog;
\r
578 BibtexEntryType type;
\r
579 InputStream in = null;
\r
580 List<BibtexEntry> res = null;
\r
581 - MetaDataListDialog metaDataListDialog;
\r
583 case ImportDialog.XMP:
\r
584 //SplDatabaseChangeListener dataListener = new SplDatabaseChangeListener(frame, panel, entryTable, fileName);
\r
586 panel.adjustSplitter();
\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
605 - entry.setType(type);
\r
608 - entry.setType(BibtexEntryType.ARTICLE);
\r
610 - ArrayList<BibtexEntry> list = new ArrayList<BibtexEntry>();
\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
622 - createNewBlankEntry(fileName);
\r
625 - else if(metaDataListDialog.getResult() == JOptionPane.CANCEL_OPTION ){
\r
628 - else if(metaDataListDialog.getResult() == JOptionPane.NO_OPTION ){
\r
629 - createNewBlankEntry(fileName);
\r
631 - else if(document == null /*|| document.getDocuments() == null || document.getDocuments().size() <= 0*/ && metaDataListDialog.getResult() == JOptionPane.OK_OPTION){
\r
632 - createNewBlankEntry(fileName);
\r
635 case ImportDialog.NOMETA:
\r
636 createNewBlankEntry(fileName);
\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
654 - //insertFields(entry.getRequiredFields(), entry, document);
\r
655 - insertFields(BibtexFields.getAllFieldNames(), entry, document);
\r
656 - //insertFields(entry.getOptionalFields(), entry, document);
\r
658 - dfh = new DroppedFileHandler(frame, panel);
\r
659 - dfh.linkPdfToEntry(fileName, entryTable, dropRow);
\r
663 - case ImportDialog.ONLYATTACH:
\r
664 - dfh = new DroppedFileHandler(frame, panel);
\r
665 - dfh.linkPdfToEntry(fileName, entryTable, dropRow);
\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
680 - if(field.equalsIgnoreCase("author")){
\r
681 - entry.setField(field, document.getAuthors("and"));
\r
683 - if(field.equalsIgnoreCase("title")){
\r
684 - entry.setField(field, document.getTitle());
\r
686 - if(field.equalsIgnoreCase("abstract")){
\r
687 - entry.setField(field, document.getAbstract());
\r
689 - /*if(field.equalsIgnoreCase("keywords")){
\r
690 - entry.setField(field, document.getKeyWords());
\r
692 - if(field.equalsIgnoreCase("doi")){
\r
693 - entry.setField(field, document.getDoi());
\r
695 - /*if(field.equalsIgnoreCase("pages")){
\r
696 - entry.setField(field, document.getPages());
\r
698 - if(field.equalsIgnoreCase("volume")){
\r
699 - entry.setField(field, document.getVolume());
\r
701 - if(field.equalsIgnoreCase("number")){
\r
702 - entry.setField(field, document.getNumber());
\r
704 - if(field.equalsIgnoreCase("year")){
\r
705 - entry.setField(field, document.getYear());
\r
707 - /*if(field.equalsIgnoreCase("month")){
\r
708 - entry.setField(field, document.getMonth());
\r
710 - if(field.equalsIgnoreCase("day")){
\r
711 - entry.setField(field, document.getDay());
\r
713 - if(field.equalsIgnoreCase("booktitle")){
\r
714 - entry.setField(field, document.getVenue());
\r
716 - if(field.equalsIgnoreCase("journal")){
\r
717 - entry.setField(field, document.getVenue());
\r
722 - private boolean fieldExists(String string) {
\r
723 - return string != null && !string.isEmpty();
\r
726 private BibtexEntry createNewEntry() {
\r
728 // Find out what type is wanted.
\r
729 --- a/src/java/spl/SplWebClient.java
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
740 -import javax.ws.rs.core.MediaType;
\r
741 -import javax.xml.bind.JAXB;
\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
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
764 - * Created by IntelliJ IDEA.
\r
765 - * User: Christoph Arbeit
\r
766 - * Date: 09.09.2010
\r
768 - * To change this template use File | Settings | File Templates.
\r
770 -public class SplWebClient {
\r
772 - private static Client CLIENT = Client.create();
\r
774 - CLIENT.setConnectTimeout(1000);
\r
775 - CLIENT.setReadTimeout(70000);
\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
781 - public static Document metadata;
\r
783 - public static WebServiceStatus getMetaData(File file){
\r
785 - if(isWebServiceAvailable() == false){
\r
786 - if(isInternetAvailable()){
\r
787 - return WebServiceStatus.WEBSERVICE_DOWN;
\r
790 - return WebServiceStatus.NO_INTERNET;
\r
793 - if(isWebServiceOutDated()){
\r
794 - return WebServiceStatus.OUTDATED;
\r
796 - if(isMetaDataServiceAvailable() == false){
\r
797 - return WebServiceStatus.UNAVAILABLE;
\r
799 - FileInputStream fin = new FileInputStream(file);
\r
800 - byte[] data = new byte[(int)file.length()];
\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
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
815 - bytes = entity.getBytes("UTF-8");
\r
816 - } catch (UnsupportedEncodingException e) {
\r
819 - InputStream is = new ByteArrayInputStream(bytes);
\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
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
837 - // initialize xml reader
\r
838 - XmlResourceReader<?> reader = new XmlResourceReader(resourceMapper);
\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
846 - // XmlDocuments documents = JAXB.unmarshal(is, XmlDocuments.class);
\r
847 - SplWebClient.metadata = docs;
\r
848 - return WebServiceStatus.OK;
\r
851 - return WebServiceStatus.NO_METADATA;
\r
854 - if(response.getClientResponseStatus() == ClientResponse.Status.SERVICE_UNAVAILABLE){
\r
855 - return WebServiceStatus.UNAVAILABLE;
\r
857 - }catch(Exception e){
\r
858 - System.out.println(Tools.getStackTraceAsString(e));
\r
861 - return WebServiceStatus.NO_METADATA;
\r
864 - public static boolean isWebServiceOutDated(){
\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
872 - /*XmlApplication app = JAXB.unmarshal(is, XmlApplication.class);
\r
874 - if(app.getVersion() != null && !app.getVersion().equalsIgnoreCase(Tools.WEBSERVICE_VERSION_SHORT)){
\r
880 - }catch(Exception e){
\r
886 - public static boolean isMetaDataServiceAvailable(){
\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
895 - }catch(Exception e){
\r
901 - public static boolean isWebServiceAvailable(){
\r
903 - ClientResponse response = WEBRESOURCE.path("service/metadata/available").get(ClientResponse.class);
\r
904 - }catch(Exception e){
\r
910 - public static boolean isInternetAvailable(){
\r
912 - ClientResponse response = INTERNETRESOURCE.get(ClientResponse.class);
\r
913 - }catch(Exception e){
\r
919 - public enum WebServiceStatus {
\r
928 --- a/src/java/spl/gui/ImportDialog.java
929 +++ b/src/java/spl/gui/ImportDialog.java
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
938 private JPanel contentPane;
\r
939 private JLabel labelSubHeadline;
\r
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
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
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
982 b.append(checkBoxDoNotShowAgain);
\r
983 b.append(useDefaultPDFImportStyle);
\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
991 this.fileName = fileName;
\r
992 String name = new File(this.fileName).getName();
\r
995 this.labelFileName.setText(new File(this.fileName).getName().substring(0, 33) + "...");
\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
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
1010 buttonOK.addActionListener(new ActionListener() {
\r
1011 public void actionPerformed(ActionEvent e) {
\r
1012 @@ -175,15 +151,9 @@
1014 radioButtonPDFcontent.setSelected(true);
\r
1017 - radioButtonMrDlib.setSelected(true);
\r
1020 radioButtononlyAttachPDF.setSelected(true);
\r
1022 - case UPDATEEMPTYFIELDS:
\r
1023 - radioButtonUpdateEmptyFields.setSelected(true);
\r
1027 radioButtonPDFcontent.setSelected(true);
\r
1028 @@ -218,14 +188,10 @@
1030 else if (radioButtonPDFcontent.isSelected())
\r
1032 - else if (radioButtonMrDlib.isSelected())
\r
1034 else if (radioButtonNoMeta.isSelected())
\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
1043 --- a/src/java/spl/gui/MetaDataListDialog.java
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
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
1080 -import net.sf.jabref.Globals;
\r
1081 -import net.sf.jabref.MetaData;
\r
1082 -import net.sf.jabref.Util;
\r
1084 -import org.sciplore.beans.Document;
\r
1086 -import spl.DocumentsWrapper;
\r
1087 -import spl.SplWebClient;
\r
1088 -import spl.listener.LabelLinkListener;
\r
1089 -import spl.localization.LocalizationSupport;
\r
1091 -import com.jgoodies.forms.builder.ButtonBarBuilder;
\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
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
1126 - getRootPane().setDefaultButton(buttonOK);
\r
1128 - buttonOK.addActionListener(new ActionListener() {
\r
1129 - public void actionPerformed(ActionEvent e) {
\r
1134 - buttonCancel.addActionListener(new ActionListener() {
\r
1135 - public void actionPerformed(ActionEvent e) {
\r
1140 - blankButton.addActionListener(new ActionListener() {
\r
1141 - public void actionPerformed(ActionEvent e) {
\r
1146 - moreInformationButton.addActionListener(new ActionListener() {
\r
1147 - public void actionPerformed(ActionEvent e) {
\r
1152 - setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
\r
1153 - addWindowListener(new WindowAdapter() {
\r
1154 - public void windowClosing(WindowEvent e) {
\r
1159 - contentPane.registerKeyboardAction(new ActionListener() {
\r
1160 - public void actionPerformed(ActionEvent e) {
\r
1163 - }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
\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
1172 - private void onInfo() {
\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
1180 - private void onBlank() {
\r
1181 - this.result = JOptionPane.NO_OPTION;
\r
1185 - private void onOK() {
\r
1186 - this.result = JOptionPane.OK_OPTION;
\r
1190 - private void onCancel() {
\r
1191 - this.result = JOptionPane.CANCEL_OPTION;
\r
1195 - public void showDialog() {
\r
1196 - SwingWorker worker = new SwingWorker<Void, Void>() {
\r
1198 - public Void doInBackground() {
\r
1199 - System.out.println("Starting Webclient...");
\r
1200 - webserviceStatus = SplWebClient.getMetaData(new File(fileName));
\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
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
1221 - iconLabel.setVisible(false);
\r
1222 - labelFetch.setText(LocalizationSupport.message("No_metadata_found."));
\r
1223 - blankButton.setVisible(showBlankButton);
\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
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
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
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
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
1255 - worker.execute();
\r
1257 - this.setVisible(true);
\r
1260 - public Document getXmlDocuments() {
\r
1261 - return xmlDocuments;
\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
1272 - public JTable getTableMetadata() {
\r
1273 - return tableMetadata;
\r
1276 - public int getResult() {
\r
1280 - public JButton getBlankButton() {
\r
1281 - return blankButton;
\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
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
1323 - cardLayou.show(panelMetadata, "panelWait");
\r
1324 - panelMetadata.setPreferredSize(new Dimension(400, 200));
\r
1325 - contentPane.add(panelMetadata, BorderLayout.CENTER);
\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
1332 - bb.addButton(moreInformationButton);
\r
1333 - bb.addButton(buttonOK);
\r
1334 - bb.addButton(buttonCancel);
\r
1336 - blankButton = new JButton();
\r
1337 - blankButton.setText("");
\r
1338 - contentPane.add(bb.getPanel(), BorderLayout.SOUTH);
\r
1339 - iconLabel.setLabelFor(scrollPane);
\r
1345 - * @noinspection ALL
\r
1347 - public JComponent $$$getRootComponent$$$() {
\r
1348 - return contentPane;
\r
1351 - public class MyTableModel extends DefaultTableModel {
\r
1354 - public boolean isCellEditable(int row, int column) {
\r