-Description: This is the diff between the debian branch and the beta_2.10 branch
+Description: This is the diff between the debian branch and the v_2.10 tag
in upstream git; the debian branch was created for us with the purpose to
disable the mrDlib functionality which needs libraries not packaged in
Debian yet.
Forwarded: not-needed
Author: Oliver Kopp <oliver.kopp@gmail.com>
Reviewed-by: gregor herrmann <gregoa@debian.org>
-Last-Update: 2013-03-29
+Last-Update: 2015-05-19
---- a/.classpath
-+++ b/.classpath
-@@ -11,8 +11,6 @@
- <classpathentry exported="true" kind="lib" path="lib/plugin/JPFCodeGenerator-rt.jar" sourcepath="/JPFCodeGenerator/src"/>
- <classpathentry exported="true" kind="lib" path="lib/glazedlists-1.8.0_java15.jar"/>
- <classpathentry kind="lib" path="lib/mysql-connector-java-5.0.7-bin.jar"/>
-- <classpathentry kind="lib" path="lib/spl/sciplore/xstream-1.4.1.jar"/>
-- <classpathentry kind="lib" path="lib/spl/sciplore/mrDlib-serialization-api.jar" sourcepath="/Serialization API"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
- <accessrules>
- <accessrule kind="accessible" pattern="**"/>
-@@ -21,14 +19,10 @@
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
- <classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/sciplore"/>
-- <classpathentry kind="lib" path="lib/spl/jersey/mimepull-1.3.jar"/>
- <classpathentry kind="lib" path="lib/oo/juh.jar"/>
- <classpathentry kind="lib" path="lib/oo/jurt.jar"/>
- <classpathentry kind="lib" path="lib/oo/ridl.jar"/>
- <classpathentry kind="lib" path="lib/oo/unoil.jar"/>
-- <classpathentry kind="lib" path="lib/spl/jersey/jersey-client-1.14.jar"/>
-- <classpathentry kind="lib" path="lib/spl/jersey/jersey-core-1.14.jar"/>
-- <classpathentry kind="lib" path="lib/spl/jersey/jersey-multipart-1.14.jar"/>
- <classpathentry kind="lib" path="lib/antlr-3.4-complete.jar"/>
- <classpathentry kind="lib" path="lib/jgoodies-common-1.4.0.jar"/>
- <classpathentry kind="lib" path="lib/jgoodies-forms-1.6.0.jar"/>
-@@ -36,7 +30,6 @@
- <classpathentry kind="lib" path="lib/fontbox-1.7.1.jar"/>
- <classpathentry kind="lib" path="lib/jempbox-1.7.1.jar"/>
- <classpathentry kind="lib" path="lib/pdfbox-1.7.1.jar"/>
-- <classpathentry kind="lib" path="lib/jayatana-1.2.4.jar"/>
- <classpathentry kind="lib" path="lib/postgresql-9.2-1002.jdbc4.jar"/>
- <classpathentry kind="output" path="bin"/>
- </classpath>
---- a/src/java/net/sf/jabref/ImportSettingsTab.java
-+++ b/src/java/net/sf/jabref/ImportSettingsTab.java
+--- a/src/main/java/net/sf/jabref/ImportSettingsTab.java
++++ b/src/main/java/net/sf/jabref/ImportSettingsTab.java
@@ -44,10 +44,8 @@
private JRadioButton radioButtonXmp;
Globals.prefs.putInt(PREF_IMPORT_DEFAULT_PDF_IMPORT_STYLE, style);
Globals.prefs.put(PREF_IMPORT_FILENAMEPATTERN, fileNamePattern.getText());
}
---- a/src/java/net/sf/jabref/JabRefFrame.java
-+++ b/src/java/net/sf/jabref/JabRefFrame.java
+--- a/src/main/java/net/sf/jabref/JabRefFrame.java
++++ b/src/main/java/net/sf/jabref/JabRefFrame.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2012 JabRef contributors.
+/* Copyright (C) 2003-2011 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
-@@ -40,8 +40,6 @@
+@@ -39,8 +39,6 @@
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import net.sf.jabref.export.*;
import net.sf.jabref.external.ExternalFileTypeEditor;
import net.sf.jabref.external.PushToApplicationButton;
-@@ -562,13 +560,6 @@
+@@ -574,13 +572,6 @@
}
}
});
}
public void setWindowTitle() {
---- a/src/java/spl/DocumentWrapper.java
-+++ /dev/null
-@@ -1,272 +0,0 @@
--package spl;\r
--\r
--import java.util.List;\r
--\r
--import org.sciplore.beans.Abstract;\r
--import org.sciplore.beans.Author;\r
--import org.sciplore.beans.Authors;\r
--import org.sciplore.beans.Document;\r
--import org.sciplore.formatter.Bean;\r
--import org.sciplore.formatter.SimpleTypeElementBean;\r
--\r
--/**\r
-- * Created by IntelliJ IDEA.\r
-- * User: Christoph Arbeit\r
-- * Date: 10.09.2010\r
-- * Time: 20:02:51\r
-- * To change this template use File | Settings | File Templates.\r
-- */\r
--public class DocumentWrapper {\r
--\r
-- Document xmlDocument;\r
--\r
-- public DocumentWrapper(Document xmlDocument) {\r
-- this.xmlDocument = xmlDocument;\r
-- }\r
--\r
-- public Document getXmlDocument() {\r
-- return xmlDocument;\r
-- }\r
--\r
-- public void setXmlDocument(Document xmlDocument) {\r
-- this.xmlDocument = xmlDocument;\r
-- }\r
--\r
-- public String getTitle(){\r
-- if(this.hasTitle()){\r
-- return xmlDocument.getTitle().getValue();\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasTitle(){\r
-- return (xmlDocument.getTitle() != null && xmlDocument.getTitle().getValue() != null && !xmlDocument.getTitle().getValue().isEmpty());\r
-- }\r
--\r
-- public String getAbstract(){\r
-- if(this.hasAbstract()){\r
-- return ((Abstract)xmlDocument.getAbstract()).getValue();\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasAbstract(){\r
-- return (xmlDocument.getAbstract() != null && ((Abstract)xmlDocument.getAbstract()).getValue() != null && !((Abstract)xmlDocument.getAbstract()).getValue().isEmpty());\r
-- }\r
--\r
-- public String getAuthors(String seperator){\r
-- if(this.hasAuthors()){\r
-- List<Bean> authors = xmlDocument.getAuthors().getCollection();\r
-- authors = this.sortAuthors(authors);\r
-- String value = "";\r
-- int i = 1;\r
-- for(Bean author : authors){\r
-- if(i < authors.size()){\r
-- value = value + getNameComplete((Author)author);\r
-- value = value + " " + seperator + " ";\r
-- }\r
-- else{\r
-- value = value + getNameComplete((Author)author);\r
-- }\r
-- i++;\r
-- }\r
-- return value;\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasAuthors(){\r
-- return (xmlDocument.getAuthors() != null && xmlDocument.getAuthors().getCollection() != null && !xmlDocument.getAuthors().getCollection().isEmpty());\r
-- }\r
--\r
-- /* public String getKeyWords(){\r
-- if(this.hasKeyWords()){\r
-- List<XmlKeyword> keywords = xmlDocument.getKeywords().getKeywords();\r
-- String value = "";\r
-- int i = 1;\r
-- for(XmlKeyword keyword : keywords){\r
-- if(i < keywords.size()){\r
-- value = value + keyword.getValue();\r
-- value = value + ", ";\r
-- }\r
-- else{\r
-- value = value + keyword.getValue();\r
-- }\r
-- i++;\r
-- }\r
-- return value;\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasKeyWords(){\r
-- return (xmlDocument.getKeywords() != null && xmlDocument.getKeywords().getKeywords() != null && !xmlDocument.getKeywords().getKeywords().isEmpty());\r
-- }\r
--*/\r
--\r
-- public String getDoi(){\r
-- if(this.hasDoi()){\r
-- return this.getSimpleTypeValue(xmlDocument.getDoi());\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasDoi(){\r
-- return (xmlDocument.getDoi() != null && this.getSimpleTypeValue(xmlDocument.getDoi()) != null && !this.getSimpleTypeValue(xmlDocument.getDoi()).isEmpty());\r
-- }\r
--/*\r
-- public String getPages(){\r
-- if(this.hasPages()){\r
-- return xmlDocument.getPages().getValue();\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasPages(){\r
-- return (xmlDocument.getPages() != null && xmlDocument.getPages().getValue() != null && !xmlDocument.getPages().getValue().isEmpty());\r
-- }\r
--\r
-- public String getVolume(){\r
-- if(this.hasVolume()){\r
-- return xmlDocument.getVolume().getValue();\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasVolume(){\r
-- return (xmlDocument.getVolume() != null && xmlDocument.getVolume().getValue() != null && !xmlDocument.getVolume().getValue().isEmpty());\r
-- }\r
--\r
-- public String getNumber(){\r
-- if(this.hasNumber()){\r
-- return xmlDocument.getNumber().getValue();\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasNumber(){\r
-- return (xmlDocument.getNumber() != null && xmlDocument.getNumber().getValue() != null && !xmlDocument.getNumber().getValue().isEmpty());\r
-- }\r
--*/\r
-- \r
-- public String getYear(){\r
-- if(this.hasYear()){\r
-- return this.getSimpleTypeValue(xmlDocument.getYear());\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasYear(){\r
-- return (this.getSimpleTypeValue(xmlDocument.getYear()) != null && !this.getSimpleTypeValue(xmlDocument.getYear()).isEmpty() && !this.getSimpleTypeValue(xmlDocument.getYear()).equalsIgnoreCase("null"));\r
-- }\r
-- \r
--/*\r
-- public String getMonth(){\r
-- if(this.hasMonth()){\r
-- return xmlDocument.getPublishdate().getMonth();\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasMonth(){\r
-- return (xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getMonth() != null && !xmlDocument.getPublishdate().getMonth().isEmpty());\r
-- }\r
--\r
-- public String getDay(){\r
-- if(this.hasDay()){\r
-- return xmlDocument.getPublishdate().getDay();\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasDay(){\r
-- return (xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getDay() != null && !xmlDocument.getPublishdate().getDay().isEmpty());\r
-- }\r
-- \r
-- /*\r
-- public String getVenue() {\r
-- if(this.hasVenue()){\r
-- return xmlDocument.getVenue().getValue();\r
-- }\r
-- else{\r
-- return "";\r
-- }\r
-- }\r
--\r
-- public boolean hasVenue(){\r
-- return (xmlDocument.getVenue() != null && xmlDocument.getVenue().getValue() != null && !xmlDocument.getVenue().getValue().isEmpty());\r
-- }*/\r
-- \r
-- private String getNameComplete(Author author){\r
-- if(author == null) return "";\r
-- String result = "";\r
-- if(getSimpleTypeValue(author.getName_First()) != null)\r
-- result = result + getSimpleTypeValue(author.getName_First()).trim() + " ";\r
-- if(getSimpleTypeValue(author.getName_Middle()) != null)\r
-- result = result + getSimpleTypeValue(author.getName_Middle()).trim() + " ";\r
-- if(getSimpleTypeValue(author.getName_Last_Prefix()) != null)\r
-- result = result + getSimpleTypeValue(author.getName_Last_Prefix()).trim() + " ";\r
-- if(getSimpleTypeValue(author.getName_Last()) != null)\r
-- result = result + getSimpleTypeValue(author.getName_Last()).trim() + " ";\r
-- if(getSimpleTypeValue(author.getName_Last_Suffix()) != null)\r
-- result = result + getSimpleTypeValue(author.getName_Last_Suffix()).trim() + " ";\r
-- return result.trim();\r
-- }\r
-- \r
-- private String getSimpleTypeValue(Bean bean){\r
-- if(bean == null || !(bean instanceof SimpleTypeElementBean)) return null;\r
-- SimpleTypeElementBean simpleTypeElementBean = (SimpleTypeElementBean)bean;\r
-- if(simpleTypeElementBean.getValue() == null || simpleTypeElementBean.getValue().equalsIgnoreCase("null") || simpleTypeElementBean.getValue().length() <= 0) return null;\r
-- return simpleTypeElementBean.getValue();\r
-- }\r
-- \r
-- private List<Bean> sortAuthors(List<Bean> authors){\r
-- boolean unsorted = true;\r
-- Bean temp;\r
-- \r
-- while (unsorted){\r
-- unsorted = false;\r
-- for (int i = 0; i < authors.size() - 1; i++){\r
-- int rank = 99;\r
-- int otherRank = 99;\r
-- if(((Author)authors.get(i)).getRank() != null && !((Author)authors.get(i)).getRank().equalsIgnoreCase("null")){\r
-- rank = Integer.parseInt(((Author)authors.get(i)).getRank());\r
-- } \r
-- if(((Author)authors.get(i + 1)).getRank() != null && !((Author)authors.get(i + 1)).getRank().equalsIgnoreCase("null")){\r
-- otherRank = Integer.parseInt(((Author)authors.get(i + 1)).getRank());\r
-- } \r
-- \r
-- if (rank > otherRank) { \r
-- temp = authors.get(i);\r
-- authors.set(i, authors.get(i + 1));\r
-- authors.set(i + 1, temp); \r
-- unsorted = true;\r
-- } \r
-- } \r
-- } \r
-- \r
-- return authors;\r
-- }\r
--}\r
---- a/src/java/spl/DocumentsWrapper.java
-+++ /dev/null
+--- a/src/main/java/spl/PdfImporter.java
++++ b/src/main/java/spl/PdfImporter.java
+@@ -19,12 +19,8 @@
+ import net.sf.jabref.undo.UndoableInsertEntry;
+ import net.sf.jabref.util.XMPUtil;
+
+-import org.sciplore.beans.Document;
+-
+ import spl.filter.PdfFileFilter;
+ import spl.gui.ImportDialog;
+-import spl.gui.MetaDataListDialog;
+-
+
+ /**
+ * Created by IntelliJ IDEA.
+@@ -129,7 +125,6 @@
+ BibtexEntryType type;
+ InputStream in = null;
+ List<BibtexEntry> localRes = null;
+- MetaDataListDialog metaDataListDialog;
+ switch (choice) {
+ case ImportDialog.XMP:
+ //SplDatabaseChangeListener dataListener = new SplDatabaseChangeListener(frame, panel, entryTable, fileName);
+@@ -222,88 +217,10 @@
+ }
+ res.add(entry);
+ break;
+- case ImportDialog.MRDLIB:
+- metaDataListDialog = new MetaDataListDialog(fileName, true);
+- Tools.centerRelativeToWindow(metaDataListDialog, frame);
+- metaDataListDialog.showDialog();
+- Document document = metaDataListDialog.getXmlDocuments();
+- entry = null; // to satisfy the Java compiler
+- if(document != null /*&& documents.getDocuments() != null && documents.getDocuments().size() > 0*/ && metaDataListDialog.getResult() == JOptionPane.OK_OPTION){
+- int selected = metaDataListDialog.getTableMetadata().getSelectedRow();
+- if(selected > -1 /*&& selected < documents.getDocuments().size()*/){
+- //Document document = documents/*.getDocuments().get(selected)*/;
+- String id = Util.createNeutralId();
+- entry = new BibtexEntry(id);
+- if(fieldExists(document.getType())){
+- type = BibtexEntryType.getStandardType(document.getType());
+- if(type == null){
+- type = BibtexEntryType.ARTICLE;
+- }
+- entry.setType(type);
+- }
+- else{
+- entry.setType(BibtexEntryType.ARTICLE);
+- }
+- ArrayList<BibtexEntry> list = new ArrayList<BibtexEntry>();
+- list.add(entry);
+- Util.setAutomaticFields(list, true, true, false);
+- //insertFields(entry.getRequiredFields(), entry, document);
+- insertFields(BibtexFields.getAllFieldNames(), entry, document);
+- //insertFields(entry.getOptionalFields(), entry, document);
+- panel.database().insertEntry(entry);
+- dfh = new DroppedFileHandler(frame, panel);
+- dfh.linkPdfToEntry(fileName, entryTable, entry);
+- LabelPatternUtil.makeLabel(panel.metaData(), panel.database(), entry);
+- }
+- else{
+- entry = createNewBlankEntry(fileName);
+- }
+- }
+- else if(metaDataListDialog.getResult() == JOptionPane.CANCEL_OPTION ){
+- continue;
+- }
+- else if(metaDataListDialog.getResult() == JOptionPane.NO_OPTION ){
+- entry = createNewBlankEntry(fileName);
+- }
+- else if(document == null /*|| document.getDocuments() == null || document.getDocuments().size() <= 0*/ && metaDataListDialog.getResult() == JOptionPane.OK_OPTION){
+- entry = createNewBlankEntry(fileName);
+- }
+- assert(entry != null);
+- res.add(entry);
+- break;
+ case ImportDialog.NOMETA:
+ entry = createNewBlankEntry(fileName);
+ res.add(entry);
+ break;
+- case ImportDialog.UPDATEEMPTYFIELDS:
+- metaDataListDialog = new MetaDataListDialog(fileName, false);
+- Tools.centerRelativeToWindow(metaDataListDialog, frame);
+- metaDataListDialog.showDialog();
+- document = metaDataListDialog.getXmlDocuments();
+- if(document != null /*&& document.getDocuments() != null && document.getDocuments().size() > 0*/ && metaDataListDialog.getResult() == JOptionPane.OK_OPTION){
+- int selected = metaDataListDialog.getTableMetadata().getSelectedRow();
+- if(selected > -1 /*&& selected < document.getDocuments().size()*/){
+- //XmlDocument document = documents.getDocuments().get(selected);
+- entry = entryTable.getEntryAt(dropRow);
+- if(fieldExists(document.getType())){
+- type = BibtexEntryType.getStandardType(document.getType());
+- if(type != null){
+- entry.setType(type);
+- }
+- }
+- //insertFields(entry.getRequiredFields(), entry, document);
+- insertFields(BibtexFields.getAllFieldNames(), entry, document);
+- //insertFields(entry.getOptionalFields(), entry, document);
+-
+- dfh = new DroppedFileHandler(frame, panel);
+- dfh.linkPdfToEntry(fileName, entryTable, dropRow);
+- }
+- }
+- break;
+- case ImportDialog.ONLYATTACH:
+- dfh = new DroppedFileHandler(frame, panel);
+- dfh.linkPdfToEntry(fileName, entryTable, dropRow);
+- break;
+ }
+ }
+
+@@ -322,58 +239,6 @@
+ return newEntry;
+ }
+
+- private void insertFields(String[] fields, BibtexEntry entry, Document xmlDocument) {
+- DocumentWrapper document = new DocumentWrapper(xmlDocument);
+- for(String field : fields){
+- if(entry.getField(field) != null){
+- continue;
+- }
+- if(field.equalsIgnoreCase("author")){
+- entry.setField(field, document.getAuthors("and"));
+- }
+- if(field.equalsIgnoreCase("title")){
+- entry.setField(field, document.getTitle());
+- }
+- if(field.equalsIgnoreCase("abstract")){
+- entry.setField(field, document.getAbstract());
+- }
+- /*if(field.equalsIgnoreCase("keywords")){
+- entry.setField(field, document.getKeyWords());
+- }*/
+- if(field.equalsIgnoreCase("doi")){
+- entry.setField(field, document.getDoi());
+- }
+- /*if(field.equalsIgnoreCase("pages")){
+- entry.setField(field, document.getPages());
+- }
+- if(field.equalsIgnoreCase("volume")){
+- entry.setField(field, document.getVolume());
+- }
+- if(field.equalsIgnoreCase("number")){
+- entry.setField(field, document.getNumber());
+- }*/
+- if(field.equalsIgnoreCase("year")){
+- entry.setField(field, document.getYear());
+- }
+- /*if(field.equalsIgnoreCase("month")){
+- entry.setField(field, document.getMonth());
+- }
+- if(field.equalsIgnoreCase("day")){
+- entry.setField(field, document.getDay());
+- }
+- if(field.equalsIgnoreCase("booktitle")){
+- entry.setField(field, document.getVenue());
+- }
+- if(field.equalsIgnoreCase("journal")){
+- entry.setField(field, document.getVenue());
+- }*/
+- }
+- }
+-
+- private boolean fieldExists(String string) {
+- return string != null && !string.isEmpty();
+- }
+-
+ private BibtexEntry createNewEntry() {
+
+ // Find out what type is wanted.
+--- a/src/main/java/spl/gui/ImportDialog.java
++++ b/src/main/java/spl/gui/ImportDialog.java
+@@ -17,19 +17,15 @@
+ public final static int NOMETA = 0;
+ public final static int XMP = 1;
+ public final static int CONTENT = 2;
+- public final static int MRDLIB = 3;
+ public final static int ONLYATTACH = 4;
+- public final static int UPDATEEMPTYFIELDS = 5;
+
+ private JPanel contentPane;
+ private JCheckBox checkBoxDoNotShowAgain;
+ private JCheckBox useDefaultPDFImportStyle;
+ private JRadioButton radioButtonXmp;
+ private JRadioButton radioButtonPDFcontent;
+- private JRadioButton radioButtonMrDlib;
+ private JRadioButton radioButtonNoMeta;
+ private JRadioButton radioButtononlyAttachPDF;
+- private JRadioButton radioButtonUpdateEmptyFields;
+ private int result;
+
+ public ImportDialog(boolean targetIsARow, String fileName) {
+@@ -59,15 +55,7 @@
+ radioButtonNoMeta = new JRadioButton(Globals.lang("Create_blank_entry_linking_the_PDF"));
+ radioButtonXmp = new JRadioButton(Globals.lang("Create_entry_based_on_XMP_data"));
+ radioButtonPDFcontent = new JRadioButton(Globals.lang("Create_entry_based_on_content"));
+- radioButtonMrDlib = new JRadioButton(Globals.lang("Create_entry_based_on_data_fetched_from"));
+ radioButtononlyAttachPDF = new JRadioButton(Globals.lang("Only_attach_PDF"));
+- radioButtonUpdateEmptyFields = new JRadioButton(Globals.lang("Update_empty_fields_with_data_fetched_from"));
+- JLabel labelMrDlib1 = new JLabel("Mr._dLib");
+- labelMrDlib1.setFont(new Font(labelMrDlib1.getFont().getName(), Font.BOLD, 13));
+- labelMrDlib1.setForeground(new Color(-16776961));
+- JLabel labelMrDlib2 = new JLabel("Mr._dLib");
+- labelMrDlib2.setFont(new Font(labelMrDlib1.getFont().getName(), Font.BOLD, 13));
+- labelMrDlib2.setForeground(new Color(-16776961));
+ JButton buttonOK = new JButton(Globals.lang("Ok"));
+ JButton buttonCancel = new JButton(Globals.lang("Cancel"));
+ checkBoxDoNotShowAgain = new JCheckBox(Globals.lang("Do not show this box again for this import"));
+@@ -77,12 +65,8 @@
+ b.append(radioButtonNoMeta, 3);
+ b.append(radioButtonXmp, 3);
+ b.append(radioButtonPDFcontent, 3);
+- b.append(radioButtonMrDlib);
+- b.append(labelMrDlib1);
+ b.appendSeparator(Globals.lang("Update_Existing_Entry"));
+ b.append(radioButtononlyAttachPDF, 3);
+- b.append(radioButtonUpdateEmptyFields);
+- b.append(labelMrDlib2);
+ b.nextLine();
+ b.append(checkBoxDoNotShowAgain);
+ b.append(useDefaultPDFImportStyle);
+@@ -100,8 +84,6 @@
+
+ if (!targetIsARow1) {
+ this.radioButtononlyAttachPDF.setEnabled(false);
+- this.radioButtonUpdateEmptyFields.setEnabled(false);
+- labelMrDlib2.setEnabled(false);
+ }
+ String fileName1 = fileName;
+ String name = new File(fileName1).getName();
+@@ -110,8 +92,6 @@
+ } else {
+ labelFileName.setText(new File(fileName1).getName().substring(0, 33) + "...");
+ }
+- labelMrDlib1.addMouseListener(new LabelLinkListener(labelMrDlib1, "www.mr-dlib.org/docs/pdf_metadata_extraction.php"));
+- labelMrDlib2.addMouseListener(new LabelLinkListener(labelMrDlib2, "www.mr-dlib.org/docs/pdf_metadata_extraction.php"));
+ this.setTitle(LocalizationSupport.message("Import_Metadata_From_PDF"));
+
+ setModal(true);
+@@ -122,9 +102,7 @@
+ bg.add(radioButtonNoMeta);
+ bg.add(radioButtonXmp);
+ bg.add(radioButtonPDFcontent);
+- bg.add(radioButtonMrDlib);
+ bg.add(radioButtononlyAttachPDF);
+- bg.add(radioButtonUpdateEmptyFields);
+
+ buttonOK.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+@@ -161,15 +139,9 @@
+ case CONTENT:
+ radioButtonPDFcontent.setSelected(true);
+ break;
+- case MRDLIB:
+- radioButtonMrDlib.setSelected(true);
+- break;
+ case ONLYATTACH:
+ radioButtononlyAttachPDF.setSelected(true);
+ break;
+- case UPDATEEMPTYFIELDS:
+- radioButtonUpdateEmptyFields.setSelected(true);
+- break;
+ default:
+ // fallback
+ radioButtonPDFcontent.setSelected(true);
+@@ -204,14 +176,10 @@
+ return XMP;
+ else if (radioButtonPDFcontent.isSelected())
+ return CONTENT;
+- else if (radioButtonMrDlib.isSelected())
+- return MRDLIB;
+ else if (radioButtonNoMeta.isSelected())
+ return NOMETA;
+ else if (radioButtononlyAttachPDF.isSelected())
+ return ONLYATTACH;
+- else if (radioButtonUpdateEmptyFields.isSelected())
+- return UPDATEEMPTYFIELDS;
+ else throw new IllegalStateException();
+ }
+
+--- a/src/main/java/spl/DocumentWrapper.java
++++ b/src/main/java/spl/DocumentWrapper.java
+@@ -1,244 +0,0 @@
+-package spl;
+-
+-import java.util.List;
+-
+-import org.sciplore.beans.Abstract;
+-import org.sciplore.beans.Author;
+-import org.sciplore.beans.Document;
+-import org.sciplore.formatter.Bean;
+-import org.sciplore.formatter.SimpleTypeElementBean;
+-
+-/**
+- * Created by IntelliJ IDEA.
+- * User: Christoph Arbeit
+- * Date: 10.09.2010
+- * Time: 20:02:51
+- * To change this template use File | Settings | File Templates.
+- */
+-public class DocumentWrapper {
+-
+- Document xmlDocument;
+-
+- public DocumentWrapper(Document xmlDocument) {
+- this.xmlDocument = xmlDocument;
+- }
+-
+- public Document getXmlDocument() {
+- return xmlDocument;
+- }
+-
+- public void setXmlDocument(Document xmlDocument) {
+- this.xmlDocument = xmlDocument;
+- }
+-
+- public String getTitle(){
+- if(this.hasTitle()){
+- return xmlDocument.getTitle().getValue();
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasTitle(){
+- return (xmlDocument.getTitle() != null && xmlDocument.getTitle().getValue() != null && !xmlDocument.getTitle().getValue().isEmpty());
+- }
+-
+- public String getAbstract(){
+- if(this.hasAbstract()){
+- return ((Abstract)xmlDocument.getAbstract()).getValue();
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasAbstract(){
+- return (xmlDocument.getAbstract() != null && ((Abstract)xmlDocument.getAbstract()).getValue() != null && !((Abstract)xmlDocument.getAbstract()).getValue().isEmpty());
+- }
+-
+- public String getAuthors(String seperator){
+- if(this.hasAuthors()){
+- List<Bean> authors = xmlDocument.getAuthors().getCollection();
+- authors = DocumentsWrapper.sortAuthors(authors);
+- String value = "";
+- int i = 1;
+- for(Bean author : authors){
+- if(i < authors.size()){
+- value = value + getNameComplete((Author)author);
+- value = value + " " + seperator + " ";
+- }
+- else{
+- value = value + getNameComplete((Author)author);
+- }
+- i++;
+- }
+- return value;
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasAuthors(){
+- return (xmlDocument.getAuthors() != null && xmlDocument.getAuthors().getCollection() != null && !xmlDocument.getAuthors().getCollection().isEmpty());
+- }
+-
+- /* public String getKeyWords(){
+- if(this.hasKeyWords()){
+- List<XmlKeyword> keywords = xmlDocument.getKeywords().getKeywords();
+- String value = "";
+- int i = 1;
+- for(XmlKeyword keyword : keywords){
+- if(i < keywords.size()){
+- value = value + keyword.getValue();
+- value = value + ", ";
+- }
+- else{
+- value = value + keyword.getValue();
+- }
+- i++;
+- }
+- return value;
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasKeyWords(){
+- return (xmlDocument.getKeywords() != null && xmlDocument.getKeywords().getKeywords() != null && !xmlDocument.getKeywords().getKeywords().isEmpty());
+- }
+-*/
+-
+- public String getDoi(){
+- if(this.hasDoi()){
+- return this.getSimpleTypeValue(xmlDocument.getDoi());
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasDoi(){
+- return (xmlDocument.getDoi() != null && this.getSimpleTypeValue(xmlDocument.getDoi()) != null && !this.getSimpleTypeValue(xmlDocument.getDoi()).isEmpty());
+- }
+-/*
+- public String getPages(){
+- if(this.hasPages()){
+- return xmlDocument.getPages().getValue();
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasPages(){
+- return (xmlDocument.getPages() != null && xmlDocument.getPages().getValue() != null && !xmlDocument.getPages().getValue().isEmpty());
+- }
+-
+- public String getVolume(){
+- if(this.hasVolume()){
+- return xmlDocument.getVolume().getValue();
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasVolume(){
+- return (xmlDocument.getVolume() != null && xmlDocument.getVolume().getValue() != null && !xmlDocument.getVolume().getValue().isEmpty());
+- }
+-
+- public String getNumber(){
+- if(this.hasNumber()){
+- return xmlDocument.getNumber().getValue();
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasNumber(){
+- return (xmlDocument.getNumber() != null && xmlDocument.getNumber().getValue() != null && !xmlDocument.getNumber().getValue().isEmpty());
+- }
+-*/
+-
+- public String getYear(){
+- if(this.hasYear()){
+- return this.getSimpleTypeValue(xmlDocument.getYear());
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasYear(){
+- return (this.getSimpleTypeValue(xmlDocument.getYear()) != null && !this.getSimpleTypeValue(xmlDocument.getYear()).isEmpty() && !this.getSimpleTypeValue(xmlDocument.getYear()).equalsIgnoreCase("null"));
+- }
+-
+-/*
+- public String getMonth(){
+- if(this.hasMonth()){
+- return xmlDocument.getPublishdate().getMonth();
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasMonth(){
+- return (xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getMonth() != null && !xmlDocument.getPublishdate().getMonth().isEmpty());
+- }
+-
+- public String getDay(){
+- if(this.hasDay()){
+- return xmlDocument.getPublishdate().getDay();
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasDay(){
+- return (xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getDay() != null && !xmlDocument.getPublishdate().getDay().isEmpty());
+- }
+-
+- /*
+- public String getVenue() {
+- if(this.hasVenue()){
+- return xmlDocument.getVenue().getValue();
+- }
+- else{
+- return "";
+- }
+- }
+-
+- public boolean hasVenue(){
+- return (xmlDocument.getVenue() != null && xmlDocument.getVenue().getValue() != null && !xmlDocument.getVenue().getValue().isEmpty());
+- }*/
+-
+- private String getNameComplete(Author author){
+- if(author == null) return "";
+- String result = "";
+- if(getSimpleTypeValue(author.getName_First()) != null)
+- result = result + getSimpleTypeValue(author.getName_First()).trim() + " ";
+- if(getSimpleTypeValue(author.getName_Middle()) != null)
+- result = result + getSimpleTypeValue(author.getName_Middle()).trim() + " ";
+- if(getSimpleTypeValue(author.getName_Last_Prefix()) != null)
+- result = result + getSimpleTypeValue(author.getName_Last_Prefix()).trim() + " ";
+- if(getSimpleTypeValue(author.getName_Last()) != null)
+- result = result + getSimpleTypeValue(author.getName_Last()).trim() + " ";
+- if(getSimpleTypeValue(author.getName_Last_Suffix()) != null)
+- result = result + getSimpleTypeValue(author.getName_Last_Suffix()).trim() + " ";
+- return result.trim();
+- }
+-
+- private String getSimpleTypeValue(Bean bean){
+- if(bean == null || !(bean instanceof SimpleTypeElementBean)) return null;
+- SimpleTypeElementBean simpleTypeElementBean = (SimpleTypeElementBean)bean;
+- if(simpleTypeElementBean.getValue() == null || simpleTypeElementBean.getValue().equalsIgnoreCase("null") || simpleTypeElementBean.getValue().length() <= 0) return null;
+- return simpleTypeElementBean.getValue();
+- }
+-
+-}
+--- a/src/main/java/spl/DocumentsWrapper.java
++++ b/src/main/java/spl/DocumentsWrapper.java
@@ -1,132 +0,0 @@
--package spl;\r
--\r
--import java.util.ArrayList;\r
--import java.util.List;\r
--import java.util.Vector;\r
--\r
--import org.sciplore.beans.Author;\r
--import org.sciplore.beans.Document;\r
--import org.sciplore.beans.Year;\r
--import org.sciplore.formatter.Bean;\r
--import org.sciplore.formatter.SimpleTypeElementBean;\r
--\r
--/**\r
-- * Created by IntelliJ IDEA.\r
-- * User: Christoph Arbeit\r
-- * Date: 09.09.2010\r
-- * Time: 10:56:50\r
-- * To change this template use File | Settings | File Templates.\r
-- */\r
--public class DocumentsWrapper {\r
--\r
-- Document xmlDocuments;\r
--\r
-- public DocumentsWrapper(Document documents) {\r
-- this.xmlDocuments = documents;\r
-- }\r
--\r
-- public Document getXmlDocuments() {\r
-- return xmlDocuments;\r
-- }\r
--\r
-- public void setXmlDocuments(Document xmlDocuments) {\r
-- this.xmlDocuments = xmlDocuments;\r
-- }\r
--\r
-- public List<Vector> getDocuments(){\r
-- List<Vector> documents = new ArrayList<Vector>();\r
-- //List<XmlDocument> xmlDocuments = this.xmlDocuments.getDocuments();\r
-- //for(XmlDocument xmlDocument : xmlDocuments){\r
-- Document xmlDocument = xmlDocuments;\r
-- Vector<String> vector = new Vector<String>();\r
-- if(xmlDocument.getTitle() != null){\r
-- vector.add(xmlDocument.getTitle().getValue());\r
-- }\r
-- else{\r
-- vector.add("");\r
-- }\r
-- if(xmlDocument.getAuthors() != null){\r
-- List<Bean> authors = xmlDocument.getAuthors().getCollection();\r
-- authors = this.sortAuthors(authors);\r
-- String value = "";\r
-- int i = 1;\r
-- for(Bean author : authors){\r
-- if(i < authors.size()){\r
-- value = value + getNameComplete(((Author)author));\r
-- value = value + ", ";\r
-- }\r
-- else{\r
-- value = value + getNameComplete(((Author)author));\r
-- }\r
-- i++;\r
-- }\r
-- vector.add(value);\r
-- }\r
-- else{\r
-- vector.add("");\r
-- }\r
-- if(xmlDocument.getYear() != null && ((Year)xmlDocument.getYear()).getValue() != null && !((Year)xmlDocument.getYear()).getValue().equalsIgnoreCase("null")){\r
-- vector.add(((Year)xmlDocument.getYear()).getValue());\r
-- }\r
-- /*if(xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getYear() != null && !xmlDocument.getPublishdate().getYear().equalsIgnoreCase("null")){\r
-- vector.add(xmlDocument.getPublishdate().getYear());\r
-- }*/\r
-- else{\r
-- vector.add("");\r
-- }\r
-- documents.add(vector);\r
-- //}\r
-- return documents;\r
-- }\r
-- \r
-- private String getNameComplete(Author author){\r
-- if(author == null) return "";\r
-- String result = "";\r
-- if(getSimpleTypeValue(author.getName_First()) != null)\r
-- result = result + getSimpleTypeValue(author.getName_First()).trim() + " ";\r
-- if(getSimpleTypeValue(author.getName_Middle()) != null)\r
-- result = result + getSimpleTypeValue(author.getName_Middle()).trim() + " ";\r
-- if(getSimpleTypeValue(author.getName_Last_Prefix()) != null)\r
-- result = result + getSimpleTypeValue(author.getName_Last_Prefix()).trim() + " ";\r
-- if(getSimpleTypeValue(author.getName_Last()) != null)\r
-- result = result + getSimpleTypeValue(author.getName_Last()).trim() + " ";\r
-- if(getSimpleTypeValue(author.getName_Last_Suffix()) != null)\r
-- result = result + getSimpleTypeValue(author.getName_Last_Suffix()).trim() + " ";\r
-- return result.trim();\r
-- }\r
-- \r
-- private String getSimpleTypeValue(Bean bean){\r
-- if(bean == null || !(bean instanceof SimpleTypeElementBean)) return null;\r
-- SimpleTypeElementBean simpleTypeElementBean = (SimpleTypeElementBean)bean;\r
-- if(simpleTypeElementBean.getValue() == null || simpleTypeElementBean.getValue().equalsIgnoreCase("null") || simpleTypeElementBean.getValue().length() <= 0) return null;\r
-- return simpleTypeElementBean.getValue();\r
-- }\r
-- \r
-- private List<Bean> sortAuthors(List<Bean> authors){\r
-- boolean unsorted = true;\r
-- Bean temp;\r
-- \r
-- while (unsorted){\r
-- unsorted = false;\r
-- for (int i = 0; i < authors.size() - 1; i++){\r
-- int rank = 99;\r
-- int otherRank = 99;\r
-- if(((Author)authors.get(i)).getRank() != null && !((Author)authors.get(i)).getRank().equalsIgnoreCase("null")){\r
-- rank = Integer.parseInt(((Author)authors.get(i)).getRank());\r
-- } \r
-- if(((Author)authors.get(i + 1)).getRank() != null && !((Author)authors.get(i + 1)).getRank().equalsIgnoreCase("null")){\r
-- otherRank = Integer.parseInt(((Author)authors.get(i + 1)).getRank());\r
-- } \r
-- \r
-- if (rank > otherRank) { \r
-- temp = authors.get(i);\r
-- authors.set(i, authors.get(i + 1));\r
-- authors.set(i + 1, temp); \r
-- unsorted = true;\r
-- } \r
-- } \r
-- } \r
-- \r
-- return authors;\r
-- }\r
--}\r
---- a/src/java/spl/PdfImporter.java
-+++ b/src/java/spl/PdfImporter.java
-@@ -18,11 +18,8 @@
- import net.sf.jabref.undo.UndoableInsertEntry;\r
- import net.sf.jabref.util.XMPUtil;\r
- \r
--import org.sciplore.beans.Document;\r
--\r
- import spl.filter.PdfFileFilter;\r
- import spl.gui.ImportDialog;\r
--import spl.gui.MetaDataListDialog;\r
- \r
- \r
- /**\r
-@@ -101,7 +98,6 @@
- BibtexEntryType type;\r
- InputStream in = null;\r
- List<BibtexEntry> res = null;\r
-- MetaDataListDialog metaDataListDialog;\r
- switch (choice) {\r
- case ImportDialog.XMP:\r
- //SplDatabaseChangeListener dataListener = new SplDatabaseChangeListener(frame, panel, entryTable, fileName);\r
-@@ -188,84 +184,9 @@
- panel.adjustSplitter();\r
- }\r
- break;\r
-- case ImportDialog.MRDLIB:\r
-- metaDataListDialog = new MetaDataListDialog(fileName, true);\r
-- Tools.centerRelativeToWindow(metaDataListDialog, frame);\r
-- metaDataListDialog.showDialog();\r
-- Document document = metaDataListDialog.getXmlDocuments();\r
-- if(document != null /*&& documents.getDocuments() != null && documents.getDocuments().size() > 0*/ && metaDataListDialog.getResult() == JOptionPane.OK_OPTION){\r
-- int selected = metaDataListDialog.getTableMetadata().getSelectedRow();\r
-- if(selected > -1 /*&& selected < documents.getDocuments().size()*/){\r
-- //Document document = documents/*.getDocuments().get(selected)*/;\r
-- String id = Util.createNeutralId();\r
-- entry = new BibtexEntry(id);\r
-- if(fieldExists(document.getType())){\r
-- type = BibtexEntryType.getStandardType(document.getType());\r
-- if(type == null){\r
-- type = BibtexEntryType.ARTICLE;\r
-- }\r
-- entry.setType(type);\r
-- }\r
-- else{\r
-- entry.setType(BibtexEntryType.ARTICLE);\r
-- }\r
-- ArrayList<BibtexEntry> list = new ArrayList<BibtexEntry>();\r
-- list.add(entry);\r
-- Util.setAutomaticFields(list, true, true, false);\r
-- //insertFields(entry.getRequiredFields(), entry, document);\r
-- insertFields(BibtexFields.getAllFieldNames(), entry, document);\r
-- //insertFields(entry.getOptionalFields(), entry, document);\r
-- panel.database().insertEntry(entry);\r
-- dfh = new DroppedFileHandler(frame, panel);\r
-- dfh.linkPdfToEntry(fileName, entryTable, entry);\r
-- LabelPatternUtil.makeLabel(panel.metaData(), panel.database(), entry);\r
-- }\r
-- else{\r
-- createNewBlankEntry(fileName);\r
-- }\r
-- }\r
-- else if(metaDataListDialog.getResult() == JOptionPane.CANCEL_OPTION ){\r
-- continue;\r
-- }\r
-- else if(metaDataListDialog.getResult() == JOptionPane.NO_OPTION ){\r
-- createNewBlankEntry(fileName);\r
-- }\r
-- else if(document == null /*|| document.getDocuments() == null || document.getDocuments().size() <= 0*/ && metaDataListDialog.getResult() == JOptionPane.OK_OPTION){\r
-- createNewBlankEntry(fileName);\r
-- }\r
-- break;\r
- case ImportDialog.NOMETA:\r
- createNewBlankEntry(fileName);\r
- break;\r
-- case ImportDialog.UPDATEEMPTYFIELDS:\r
-- metaDataListDialog = new MetaDataListDialog(fileName, false); \r
-- Tools.centerRelativeToWindow(metaDataListDialog, frame);\r
-- metaDataListDialog.showDialog();\r
-- document = metaDataListDialog.getXmlDocuments();\r
-- if(document != null /*&& document.getDocuments() != null && document.getDocuments().size() > 0*/ && metaDataListDialog.getResult() == JOptionPane.OK_OPTION){\r
-- int selected = metaDataListDialog.getTableMetadata().getSelectedRow();\r
-- if(selected > -1 /*&& selected < document.getDocuments().size()*/){\r
-- //XmlDocument document = documents.getDocuments().get(selected);\r
-- entry = entryTable.getEntryAt(dropRow);\r
-- if(fieldExists(document.getType())){\r
-- type = BibtexEntryType.getStandardType(document.getType());\r
-- if(type != null){\r
-- entry.setType(type);\r
-- }\r
-- }\r
-- //insertFields(entry.getRequiredFields(), entry, document);\r
-- insertFields(BibtexFields.getAllFieldNames(), entry, document);\r
-- //insertFields(entry.getOptionalFields(), entry, document);\r
--\r
-- dfh = new DroppedFileHandler(frame, panel);\r
-- dfh.linkPdfToEntry(fileName, entryTable, dropRow);\r
-- }\r
-- }\r
-- break;\r
-- case ImportDialog.ONLYATTACH:\r
-- dfh = new DroppedFileHandler(frame, panel);\r
-- dfh.linkPdfToEntry(fileName, entryTable, dropRow);\r
-- break;\r
- }\r
- }\r
- \r
-@@ -283,58 +204,6 @@
- }\r
- }\r
- \r
-- private void insertFields(String[] fields, BibtexEntry entry, Document xmlDocument) {\r
-- DocumentWrapper document = new DocumentWrapper(xmlDocument);\r
-- for(String field : fields){\r
-- if(entry.getField(field) != null){\r
-- continue;\r
-- }\r
-- if(field.equalsIgnoreCase("author")){\r
-- entry.setField(field, document.getAuthors("and"));\r
-- }\r
-- if(field.equalsIgnoreCase("title")){\r
-- entry.setField(field, document.getTitle());\r
-- }\r
-- if(field.equalsIgnoreCase("abstract")){\r
-- entry.setField(field, document.getAbstract());\r
-- }\r
-- /*if(field.equalsIgnoreCase("keywords")){\r
-- entry.setField(field, document.getKeyWords());\r
-- }*/\r
-- if(field.equalsIgnoreCase("doi")){\r
-- entry.setField(field, document.getDoi());\r
-- }\r
-- /*if(field.equalsIgnoreCase("pages")){\r
-- entry.setField(field, document.getPages());\r
-- }\r
-- if(field.equalsIgnoreCase("volume")){\r
-- entry.setField(field, document.getVolume());\r
-- }\r
-- if(field.equalsIgnoreCase("number")){\r
-- entry.setField(field, document.getNumber());\r
-- }*/\r
-- if(field.equalsIgnoreCase("year")){\r
-- entry.setField(field, document.getYear());\r
-- }\r
-- /*if(field.equalsIgnoreCase("month")){\r
-- entry.setField(field, document.getMonth());\r
-- }\r
-- if(field.equalsIgnoreCase("day")){\r
-- entry.setField(field, document.getDay());\r
-- }\r
-- if(field.equalsIgnoreCase("booktitle")){\r
-- entry.setField(field, document.getVenue());\r
-- }\r
-- if(field.equalsIgnoreCase("journal")){\r
-- entry.setField(field, document.getVenue());\r
-- }*/\r
-- }\r
-- }\r
--\r
-- private boolean fieldExists(String string) {\r
-- return string != null && !string.isEmpty();\r
-- }\r
--\r
- private BibtexEntry createNewEntry() {\r
- \r
- // Find out what type is wanted.\r
---- a/src/java/spl/SplWebClient.java
-+++ /dev/null
-@@ -1,196 +0,0 @@
--package spl;\r
--\r
--import java.io.ByteArrayInputStream;\r
--import java.io.File;\r
--import java.io.FileInputStream;\r
--import java.io.InputStream;\r
--import java.io.UnsupportedEncodingException;\r
--\r
--import javax.ws.rs.core.MediaType;\r
--import javax.xml.bind.JAXB;\r
--\r
--import org.sciplore.beans.Author;\r
--import org.sciplore.beans.Document;\r
--import org.sciplore.deserialize.creator.AuthorBeanCreator;\r
--import org.sciplore.deserialize.creator.AuthorsBeanCreator;\r
--import org.sciplore.deserialize.creator.DefaultStringCreator;\r
--import org.sciplore.deserialize.creator.DocumentBeanCreator;\r
--import org.sciplore.deserialize.creator.DocumentsBeanCreator;\r
--import org.sciplore.deserialize.creator.ObjectCreator;\r
--import org.sciplore.deserialize.creator.TitleBeanCreator;\r
--import org.sciplore.deserialize.creator.YearBeanCreator;\r
--import org.sciplore.deserialize.reader.ObjectCreatorMapper;\r
--import org.sciplore.deserialize.reader.XmlResourceReader;\r
--import org.sciplore.formatter.Bean;\r
--import org.sciplore.formatter.SimpleTypeElementBean;\r
--\r
--import com.sun.jersey.api.client.Client;\r
--import com.sun.jersey.api.client.ClientResponse;\r
--import com.sun.jersey.api.client.WebResource;\r
--import com.sun.jersey.multipart.FormDataMultiPart;\r
--\r
--/**\r
-- * Created by IntelliJ IDEA.\r
-- * User: Christoph Arbeit\r
-- * Date: 09.09.2010\r
-- * Time: 10:35:20\r
-- * To change this template use File | Settings | File Templates.\r
-- */\r
--public class SplWebClient {\r
--\r
-- private static Client CLIENT = Client.create();\r
-- static{\r
-- CLIENT.setConnectTimeout(1000);\r
-- CLIENT.setReadTimeout(70000);\r
-- }\r
-- private static WebResource WEBRESOURCE = CLIENT.resource( "http://api.mr-dlib.org/" );\r
-- private static WebResource INTERNETRESOURCE = CLIENT.resource( "http://www.google.com" );\r
-- //private static WebResource WEBRESOURCE = CLIENT.resource( "http://localhost:8080/rest/" );\r
--\r
-- public static Document metadata;\r
--\r
-- public static WebServiceStatus getMetaData(File file){\r
-- try{\r
-- if(isWebServiceAvailable() == false){\r
-- if(isInternetAvailable()){\r
-- return WebServiceStatus.WEBSERVICE_DOWN;\r
-- }\r
-- else{\r
-- return WebServiceStatus.NO_INTERNET;\r
-- }\r
-- }\r
-- if(isWebServiceOutDated()){\r
-- return WebServiceStatus.OUTDATED;\r
-- }\r
-- if(isMetaDataServiceAvailable() == false){\r
-- return WebServiceStatus.UNAVAILABLE;\r
-- }\r
-- FileInputStream fin = new FileInputStream(file); \r
-- byte[] data = new byte[(int)file.length()]; \r
-- fin.read(data); \r
-- \r
-- FormDataMultiPart formDataMultiPart = new FormDataMultiPart(); \r
-- formDataMultiPart.field("file", data, MediaType.APPLICATION_OCTET_STREAM_TYPE); \r
-- formDataMultiPart.field("source", "jabref", MediaType.TEXT_PLAIN_TYPE);\r
-- formDataMultiPart.field("filename", file.getName(), MediaType.TEXT_PLAIN_TYPE);\r
-- \r
-- \r
-- ClientResponse response = WEBRESOURCE.path("documents").type(MediaType.MULTIPART_FORM_DATA_TYPE).post(ClientResponse.class, formDataMultiPart);\r
-- //System.out.println(response.getEntity(String.class));\r
-- if(response.getClientResponseStatus() == ClientResponse.Status.OK && response.hasEntity()){\r
-- String entity = response.getEntity(String.class);\r
-- byte[] bytes = new byte[0];\r
-- try {\r
-- bytes = entity.getBytes("UTF-8");\r
-- } catch (UnsupportedEncodingException e) {\r
-- return null;\r
-- }\r
-- InputStream is = new ByteArrayInputStream(bytes);\r
-- if(is != null){\r
-- ObjectCreatorMapper resourceMapper = new ObjectCreatorMapper();\r
-- ObjectCreator stringCreator = new DefaultStringCreator();\r
-- // initialize Mapper \r
-- resourceMapper.addCreator("documents", new DocumentsBeanCreator());\r
-- resourceMapper.addCreator("authors", new AuthorsBeanCreator());\r
-- resourceMapper.addCreator("document", new DocumentBeanCreator());\r
-- resourceMapper.addCreator("title", new TitleBeanCreator());\r
-- resourceMapper.addCreator("year", new YearBeanCreator());\r
-- resourceMapper.addCreator("author", new AuthorBeanCreator());\r
-- \r
-- resourceMapper.addCreator("name_first", stringCreator);\r
-- resourceMapper.addCreator("name_middle", stringCreator);\r
-- resourceMapper.addCreator("name_last", stringCreator);\r
-- resourceMapper.addCreator("name_last_prefix", stringCreator);\r
-- resourceMapper.addCreator("name_last_suffix", stringCreator);\r
-- \r
-- // initialize xml reader\r
-- XmlResourceReader<?> reader = new XmlResourceReader(resourceMapper);\r
-- \r
-- // parse given file -> create object tree\r
-- Document docs = (Document)reader.parse(is);\r
-- for(Bean author : docs.getAuthors().getCollection()){\r
-- Author temp = (Author)author;\r
-- System.out.println(((SimpleTypeElementBean)temp.getName_Last()).getValue() + " " + temp.getRank());\r
-- }\r
-- // XmlDocuments documents = JAXB.unmarshal(is, XmlDocuments.class);\r
-- SplWebClient.metadata = docs;\r
-- return WebServiceStatus.OK;\r
-- }\r
-- else{\r
-- return WebServiceStatus.NO_METADATA;\r
-- }\r
-- }\r
-- if(response.getClientResponseStatus() == ClientResponse.Status.SERVICE_UNAVAILABLE){\r
-- return WebServiceStatus.UNAVAILABLE;\r
-- }\r
-- }catch(Exception e){\r
-- System.out.println(Tools.getStackTraceAsString(e));\r
-- //Todo logging\r
-- }\r
-- return WebServiceStatus.NO_METADATA;\r
-- }\r
--\r
-- public static boolean isWebServiceOutDated(){\r
-- try{\r
-- ClientResponse response = WEBRESOURCE.path("service/versioncheck/" + Tools.WEBSERVICE_APP_ID + "/current").get(ClientResponse.class);\r
-- if(response.getClientResponseStatus() == ClientResponse.Status.OK && response.hasEntity()){\r
-- String entity = response.getEntity(String.class);\r
-- byte[] bytes = entity.getBytes();\r
-- InputStream is = new ByteArrayInputStream(bytes);\r
-- if(is != null){\r
-- /*XmlApplication app = JAXB.unmarshal(is, XmlApplication.class);\r
-- if(app != null){\r
-- if(app.getVersion() != null && !app.getVersion().equalsIgnoreCase(Tools.WEBSERVICE_VERSION_SHORT)){\r
-- return true;\r
-- }\r
-- }*/\r
-- }\r
-- }\r
-- }catch(Exception e){\r
-- //Todo logging\r
-- }\r
-- return false;\r
-- }\r
--\r
-- public static boolean isMetaDataServiceAvailable(){\r
-- try{\r
-- ClientResponse response = WEBRESOURCE.path("service/metadata/available").get(ClientResponse.class);\r
-- if(response.getClientResponseStatus() == ClientResponse.Status.OK && response.hasEntity()){\r
-- String entity = response.getEntity(String.class);\r
-- if(entity != null && entity.equalsIgnoreCase("false")){\r
-- return false;\r
-- }\r
-- }\r
-- }catch(Exception e){\r
-- //Todo logging\r
-- }\r
-- return true;\r
-- }\r
--\r
-- public static boolean isWebServiceAvailable(){\r
-- try{\r
-- ClientResponse response = WEBRESOURCE.path("service/metadata/available").get(ClientResponse.class);\r
-- }catch(Exception e){\r
-- return false;\r
-- }\r
-- return true;\r
-- }\r
--\r
-- public static boolean isInternetAvailable(){\r
-- try{\r
-- ClientResponse response = INTERNETRESOURCE.get(ClientResponse.class);\r
-- }catch(Exception e){\r
-- return false;\r
-- }\r
-- return true;\r
-- }\r
--\r
-- public enum WebServiceStatus {\r
-- OK,\r
-- NO_METADATA,\r
-- UNAVAILABLE,\r
-- OUTDATED,\r
-- WEBSERVICE_DOWN,\r
-- NO_INTERNET\r
-- }\r
--}\r
---- a/src/java/spl/gui/ImportDialog.java
-+++ b/src/java/spl/gui/ImportDialog.java
-@@ -20,9 +20,7 @@
- public final static int NOMETA = 0;\r
- public final static int XMP = 1;\r
- public final static int CONTENT = 2;\r
-- public final static int MRDLIB = 3;\r
- public final static int ONLYATTACH = 4;\r
-- public final static int UPDATEEMPTYFIELDS = 5;\r
- \r
- private JPanel contentPane;\r
- private JLabel labelSubHeadline;\r
-@@ -32,14 +30,10 @@
- private JCheckBox useDefaultPDFImportStyle;\r
- private JRadioButton radioButtonXmp;\r
- private JRadioButton radioButtonPDFcontent;\r
-- private JRadioButton radioButtonMrDlib;\r
- private JRadioButton radioButtonNoMeta;\r
- private JLabel labelHeadline;\r
- private JLabel labelFileName;\r
- private JRadioButton radioButtononlyAttachPDF;\r
-- private JRadioButton radioButtonUpdateEmptyFields;\r
-- private JLabel labelMrDlib1;\r
-- private JLabel labelMrDlib2;\r
- private int result;\r
- private int dropRow;\r
- private String fileName;\r
-@@ -71,15 +65,7 @@
- radioButtonNoMeta = new JRadioButton(Globals.lang("Create_blank_entry_linking_the_PDF"));\r
- radioButtonXmp = new JRadioButton(Globals.lang("Create_entry_based_on_XMP_data"));\r
- radioButtonPDFcontent = new JRadioButton(Globals.lang("Create_entry_based_on_content"));\r
-- radioButtonMrDlib = new JRadioButton(Globals.lang("Create_entry_based_on_data_fetched_from"));\r
- radioButtononlyAttachPDF = new JRadioButton(Globals.lang("Only_attach_PDF"));\r
-- radioButtonUpdateEmptyFields = new JRadioButton(Globals.lang("Update_empty_fields_with_data_fetched_from"));\r
-- labelMrDlib1 = new JLabel("Mr._dLib");\r
-- labelMrDlib1.setFont(new Font(labelMrDlib1.getFont().getName(), Font.BOLD, 13));\r
-- labelMrDlib1.setForeground(new Color(-16776961));\r
-- labelMrDlib2 = new JLabel("Mr._dLib");\r
-- labelMrDlib2.setFont(new Font(labelMrDlib1.getFont().getName(), Font.BOLD, 13));\r
-- labelMrDlib2.setForeground(new Color(-16776961));\r
- buttonOK = new JButton(Globals.lang("Ok"));\r
- buttonCancel = new JButton(Globals.lang("Cancel"));\r
- checkBoxDoNotShowAgain = new JCheckBox(Globals.lang("Do not show this box again for this import"));\r
-@@ -89,12 +75,8 @@
- b.append(radioButtonNoMeta, 3);\r
- b.append(radioButtonXmp, 3);\r
- b.append(radioButtonPDFcontent, 3);\r
-- b.append(radioButtonMrDlib);\r
-- b.append(labelMrDlib1);\r
- b.appendSeparator(Globals.lang("Update_Existing_Entry"));\r
- b.append(radioButtononlyAttachPDF, 3);\r
-- b.append(radioButtonUpdateEmptyFields);\r
-- b.append(labelMrDlib2);\r
- b.nextLine();\r
- b.append(checkBoxDoNotShowAgain);\r
- b.append(useDefaultPDFImportStyle);\r
-@@ -114,8 +96,6 @@
- //this.setText();\r
- if (this.dropRow < 0) {\r
- this.radioButtononlyAttachPDF.setEnabled(false);\r
-- this.radioButtonUpdateEmptyFields.setEnabled(false);\r
-- this.labelMrDlib2.setEnabled(false);\r
- }\r
- this.fileName = fileName;\r
- String name = new File(this.fileName).getName();\r
-@@ -124,8 +104,6 @@
- } else {\r
- this.labelFileName.setText(new File(this.fileName).getName().substring(0, 33) + "...");\r
- }\r
-- this.labelMrDlib1.addMouseListener(new LabelLinkListener(this.labelMrDlib1, "www.mr-dlib.org/docs/pdf_metadata_extraction.php"));\r
-- this.labelMrDlib2.addMouseListener(new LabelLinkListener(this.labelMrDlib2, "www.mr-dlib.org/docs/pdf_metadata_extraction.php"));\r
- this.setTitle(LocalizationSupport.message("Import_Metadata_From_PDF"));\r
- \r
- setModal(true);\r
-@@ -136,9 +114,7 @@
- bg.add(radioButtonNoMeta);\r
- bg.add(radioButtonXmp);\r
- bg.add(radioButtonPDFcontent);\r
-- bg.add(radioButtonMrDlib);\r
- bg.add(radioButtononlyAttachPDF);\r
-- bg.add(radioButtonUpdateEmptyFields);\r
- \r
- buttonOK.addActionListener(new ActionListener() {\r
- public void actionPerformed(ActionEvent e) {\r
-@@ -175,15 +151,9 @@
- case CONTENT:\r
- radioButtonPDFcontent.setSelected(true);\r
- break;\r
-- case MRDLIB:\r
-- radioButtonMrDlib.setSelected(true);\r
-- break;\r
- case ONLYATTACH:\r
- radioButtononlyAttachPDF.setSelected(true);\r
- break;\r
-- case UPDATEEMPTYFIELDS:\r
-- radioButtonUpdateEmptyFields.setSelected(true);\r
-- break;\r
- default:\r
- // fallback\r
- radioButtonPDFcontent.setSelected(true);\r
-@@ -218,14 +188,10 @@
- return XMP;\r
- else if (radioButtonPDFcontent.isSelected())\r
- return CONTENT;\r
-- else if (radioButtonMrDlib.isSelected())\r
-- return MRDLIB;\r
- else if (radioButtonNoMeta.isSelected())\r
- return NOMETA;\r
- else if (radioButtononlyAttachPDF.isSelected())\r
- return ONLYATTACH;\r
-- else if (radioButtonUpdateEmptyFields.isSelected())\r
-- return UPDATEEMPTYFIELDS;\r
- else throw new IllegalStateException();\r
- }\r
- \r
---- a/src/java/spl/gui/MetaDataListDialog.java
-+++ /dev/null
-@@ -1,314 +0,0 @@
--package spl.gui;\r
--\r
--\r
--import java.awt.BorderLayout;\r
--import java.awt.CardLayout;\r
--import java.awt.Color;\r
--import java.awt.Component;\r
--import java.awt.Dimension;\r
--import java.awt.Font;\r
--import java.awt.event.ActionEvent;\r
--import java.awt.event.ActionListener;\r
--import java.awt.event.KeyEvent;\r
--import java.awt.event.WindowAdapter;\r
--import java.awt.event.WindowEvent;\r
--import java.io.File;\r
--import java.io.IOException;\r
--import java.util.List;\r
--import java.util.Vector;\r
--\r
--import javax.swing.BorderFactory;\r
--import javax.swing.ImageIcon;\r
--import javax.swing.JButton;\r
--import javax.swing.JComponent;\r
--import javax.swing.JDialog;\r
--import javax.swing.JLabel;\r
--import javax.swing.JOptionPane;\r
--import javax.swing.JPanel;\r
--import javax.swing.JScrollPane;\r
--import javax.swing.JTable;\r
--import javax.swing.KeyStroke;\r
--import javax.swing.ListSelectionModel;\r
--import javax.swing.SwingWorker;\r
--import javax.swing.table.DefaultTableModel;\r
--\r
--import net.sf.jabref.Globals;\r
--import net.sf.jabref.MetaData;\r
--import net.sf.jabref.Util;\r
--\r
--import org.sciplore.beans.Document;\r
--\r
--import spl.DocumentsWrapper;\r
--import spl.SplWebClient;\r
--import spl.listener.LabelLinkListener;\r
--import spl.localization.LocalizationSupport;\r
--\r
--import com.jgoodies.forms.builder.ButtonBarBuilder;\r
--\r
--public class MetaDataListDialog extends JDialog {\r
-- private JPanel contentPane;\r
-- private JTable tableMetadata;\r
-- private JButton buttonOK;\r
-- private JButton buttonCancel;\r
-- private JScrollPane scrollPane;\r
-- private JPanel panelWait;\r
-- private JLabel labelFetch;\r
-- private JLabel iconLabel;\r
-- private JButton blankButton;\r
-- private JLabel labelLogo;\r
-- private JButton moreInformationButton;\r
-- private JPanel panelMetadata;\r
-- private DefaultTableModel tableModel;\r
-- private int result;\r
-- private Document xmlDocuments;\r
-- private String fileName;\r
-- private SplWebClient.WebServiceStatus webserviceStatus;\r
-- private Component thisDialog;\r
-- private boolean showBlankButton;\r
-- private CardLayout cardLayou = new CardLayout();\r
--\r
-- public MetaDataListDialog(String fileName, boolean showBlankButton) {\r
-- $$$setupUI$$$();\r
-- this.showBlankButton = showBlankButton;\r
-- this.thisDialog = this;\r
-- this.fileName = fileName;\r
-- this.labelLogo.addMouseListener(new LabelLinkListener(this.labelLogo, "www.mr-dlib.org"));\r
-- this.setTitle(LocalizationSupport.message("Mr._dLib_Metadata_Entries_Associated_With_PDF_File"));\r
-- this.tableMetadata.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
-- setContentPane(contentPane);\r
-- pack();\r
-- setModal(true);\r
-- getRootPane().setDefaultButton(buttonOK);\r
--\r
-- buttonOK.addActionListener(new ActionListener() {\r
-- public void actionPerformed(ActionEvent e) {\r
-- onOK();\r
-- }\r
-- });\r
--\r
-- buttonCancel.addActionListener(new ActionListener() {\r
-- public void actionPerformed(ActionEvent e) {\r
-- onCancel();\r
-- }\r
-- });\r
--\r
-- blankButton.addActionListener(new ActionListener() {\r
-- public void actionPerformed(ActionEvent e) {\r
-- onBlank();\r
-- }\r
-- });\r
--\r
-- moreInformationButton.addActionListener(new ActionListener() {\r
-- public void actionPerformed(ActionEvent e) {\r
-- onInfo();\r
-- }\r
-- });\r
--\r
-- setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);\r
-- addWindowListener(new WindowAdapter() {\r
-- public void windowClosing(WindowEvent e) {\r
-- onCancel();\r
-- }\r
-- });\r
--\r
-- contentPane.registerKeyboardAction(new ActionListener() {\r
-- public void actionPerformed(ActionEvent e) {\r
-- onCancel();\r
-- }\r
-- }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);\r
--\r
-- cardLayou.show(panelMetadata, "panelWait");\r
-- //this.scrollPane.setVisible(false);\r
-- //this.blankButton.setVisible(false);\r
-- this.moreInformationButton.setVisible(true);\r
-- this.setSize(616, 366);\r
-- }\r
--\r
-- private void onInfo() {\r
-- try {\r
-- Util.openExternalViewer(new MetaData(), "http://www.mr-dlib.org/docs/jabref_metadata_extraction_alpha.php", "url");\r
-- } catch (IOException exc) {\r
-- exc.printStackTrace();\r
-- }\r
-- }\r
--\r
-- private void onBlank() {\r
-- this.result = JOptionPane.NO_OPTION;\r
-- dispose();\r
-- }\r
--\r
-- private void onOK() {\r
-- this.result = JOptionPane.OK_OPTION;\r
-- dispose();\r
-- }\r
--\r
-- private void onCancel() {\r
-- this.result = JOptionPane.CANCEL_OPTION;\r
-- dispose();\r
-- }\r
--\r
-- public void showDialog() {\r
-- SwingWorker worker = new SwingWorker<Void, Void>() {\r
-- @Override\r
-- public Void doInBackground() {\r
-- System.out.println("Starting Webclient...");\r
-- webserviceStatus = SplWebClient.getMetaData(new File(fileName));\r
-- return null;\r
-- }\r
--\r
-- @Override\r
-- public void done() {\r
-- if (webserviceStatus == SplWebClient.WebServiceStatus.OK) {\r
-- xmlDocuments = SplWebClient.metadata;\r
-- if (xmlDocuments != null /*&& xmlDocuments.getDocuments() != null && xmlDocuments.getDocuments().size() > 0*/) {\r
-- DocumentsWrapper documents = new DocumentsWrapper(xmlDocuments);\r
-- List<Vector> vectorList = documents.getDocuments();\r
-- for (Vector vector : vectorList) {\r
-- tableModel.addRow(vector);\r
-- }\r
--\r
-- tableMetadata.getSelectionModel().setSelectionInterval(0, 0);\r
-- cardLayou.show(panelMetadata, "scrollPane");\r
-- //panelWait.setVisible(false);\r
-- //scrollPane.setVisible(true);\r
-- moreInformationButton.setVisible(true);\r
-- } else {\r
-- iconLabel.setVisible(false);\r
-- labelFetch.setText(LocalizationSupport.message("No_metadata_found."));\r
-- blankButton.setVisible(showBlankButton);\r
-- }\r
-- }\r
-- if (webserviceStatus == SplWebClient.WebServiceStatus.NO_METADATA) {\r
-- iconLabel.setVisible(false);\r
-- labelFetch.setText(LocalizationSupport.message("No_metadata_found."));\r
-- blankButton.setVisible(showBlankButton);\r
-- }\r
-- if (webserviceStatus == SplWebClient.WebServiceStatus.UNAVAILABLE) {\r
-- iconLabel.setVisible(false);\r
-- labelFetch.setText(LocalizationSupport.message("Mr._dLib_web_service_is_temporarily_unavailable."));\r
-- blankButton.setVisible(showBlankButton);\r
-- }\r
-- if (webserviceStatus == SplWebClient.WebServiceStatus.OUTDATED) {\r
-- iconLabel.setVisible(false);\r
-- labelFetch.setText(LocalizationSupport.message("The_Mr._dLib_web_service_version_you_trying_to_access_is_outdated."));\r
-- blankButton.setVisible(showBlankButton);\r
-- 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
-- }\r
-- if (webserviceStatus == SplWebClient.WebServiceStatus.WEBSERVICE_DOWN) {\r
-- iconLabel.setVisible(false);\r
-- labelFetch.setText(LocalizationSupport.message("Mr._dLib_web_service_is_temporarily_down._Please_try_again_later."));\r
-- blankButton.setVisible(showBlankButton);\r
-- }\r
-- if (webserviceStatus == SplWebClient.WebServiceStatus.NO_INTERNET) {\r
-- iconLabel.setVisible(false);\r
-- labelFetch.setText(LocalizationSupport.message("No_Internet_Connection."));\r
-- blankButton.setVisible(showBlankButton);\r
-- 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
-- }\r
-- }\r
-- };\r
-- worker.execute();\r
-- this.pack();\r
-- this.setVisible(true);\r
-- }\r
--\r
-- public Document getXmlDocuments() {\r
-- return xmlDocuments;\r
-- }\r
--\r
-- private void createUIComponents() {\r
-- this.tableModel = new MyTableModel();\r
-- this.tableModel.addColumn(LocalizationSupport.message("Title"));\r
-- this.tableModel.addColumn(LocalizationSupport.message("Author(s)"));\r
-- this.tableModel.addColumn(LocalizationSupport.message("Published_Year"));\r
-- this.tableMetadata = new JTable(this.tableModel);\r
-- }\r
--\r
-- public JTable getTableMetadata() {\r
-- return tableMetadata;\r
-- }\r
--\r
-- public int getResult() {\r
-- return result;\r
-- }\r
--\r
-- public JButton getBlankButton() {\r
-- return blankButton;\r
-- }\r
--\r
-- private void $$$setupUI$$$() {\r
-- createUIComponents();\r
-- contentPane = new JPanel();\r
-- contentPane.setLayout(new BorderLayout());\r
-- labelLogo = new JLabel();\r
-- labelLogo.setIcon(new ImageIcon(getClass().getResource("/spl/gui/mrdlib header.png")));\r
-- labelLogo.setText("");\r
-- contentPane.add(labelLogo, BorderLayout.NORTH);\r
-- panelMetadata = new JPanel();\r
-- panelMetadata.setLayout(cardLayou);\r
--\r
--\r
-- panelMetadata.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null));\r
-- scrollPane = new JScrollPane();\r
-- scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), null));\r
-- tableMetadata.setAutoCreateRowSorter(false);\r
-- tableMetadata.setEnabled(true);\r
-- tableMetadata.setFillsViewportHeight(true);\r
-- tableMetadata.setShowVerticalLines(true);\r
-- scrollPane.setViewportView(tableMetadata);\r
-- panelMetadata.add(scrollPane, "scrollPane");\r
-- panelWait = new JPanel();\r
-- panelWait.setLayout(new BorderLayout());\r
-- panelWait.setBackground(new Color(-1));\r
-- panelMetadata.add(panelWait, "panelWait");\r
-- panelWait.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), null));\r
-- iconLabel = new JLabel();\r
-- iconLabel.setBackground(new Color(-1));\r
-- iconLabel.setHorizontalAlignment(0);\r
-- iconLabel.setHorizontalTextPosition(11);\r
-- iconLabel.setIcon(new ImageIcon(getClass().getResource("/spl/gui/ajax-loader.gif")));\r
-- iconLabel.setText("");\r
-- panelWait.add(iconLabel, BorderLayout.CENTER);\r
-- labelFetch = new JLabel();\r
-- labelFetch.setHorizontalAlignment(JLabel.CENTER);\r
-- labelFetch.setFont(new Font(labelFetch.getFont().getName(), labelFetch.getFont().getStyle(), 13));\r
-- labelFetch.setText(Globals.lang("Fetching Metadata..."));\r
-- panelWait.add(labelFetch, BorderLayout.SOUTH);\r
--\r
-- cardLayou.show(panelMetadata, "panelWait");\r
-- panelMetadata.setPreferredSize(new Dimension(400, 200));\r
-- contentPane.add(panelMetadata, BorderLayout.CENTER);\r
--\r
-- buttonOK = new JButton(Globals.lang("Ok"));\r
-- buttonCancel = new JButton(Globals.lang("Cancel"));\r
-- moreInformationButton = new JButton(Globals.lang("More information"));\r
-- ButtonBarBuilder bb = new ButtonBarBuilder();\r
-- bb.addGlue();\r
-- bb.addButton(moreInformationButton);\r
-- bb.addButton(buttonOK);\r
-- bb.addButton(buttonCancel);\r
-- bb.addGlue();\r
-- blankButton = new JButton();\r
-- blankButton.setText("");\r
-- contentPane.add(bb.getPanel(), BorderLayout.SOUTH);\r
-- iconLabel.setLabelFor(scrollPane);\r
--\r
--\r
-- }\r
--\r
-- /**\r
-- * @noinspection ALL\r
-- */\r
-- public JComponent $$$getRootComponent$$$() {\r
-- return contentPane;\r
-- }\r
--\r
-- public class MyTableModel extends DefaultTableModel {\r
--\r
-- @Override\r
-- public boolean isCellEditable(int row, int column) {\r
-- return false;\r
-- }\r
-- }\r
--\r
--}\r
+-package spl;
+-
+-import java.util.ArrayList;
+-import java.util.List;
+-import java.util.Vector;
+-
+-import org.sciplore.beans.Author;
+-import org.sciplore.beans.Document;
+-import org.sciplore.beans.Year;
+-import org.sciplore.formatter.Bean;
+-import org.sciplore.formatter.SimpleTypeElementBean;
+-
+-/**
+- * Created by IntelliJ IDEA.
+- * User: Christoph Arbeit
+- * Date: 09.09.2010
+- * Time: 10:56:50
+- * To change this template use File | Settings | File Templates.
+- */
+-public class DocumentsWrapper {
+-
+- Document xmlDocuments;
+-
+- public DocumentsWrapper(Document documents) {
+- this.xmlDocuments = documents;
+- }
+-
+- public Document getXmlDocuments() {
+- return xmlDocuments;
+- }
+-
+- public void setXmlDocuments(Document xmlDocuments) {
+- this.xmlDocuments = xmlDocuments;
+- }
+-
+- public List<Vector<String>> getDocuments(){
+- List<Vector<String>> documents = new ArrayList<Vector<String>>();
+- //List<XmlDocument> xmlDocuments = this.xmlDocuments.getDocuments();
+- //for(XmlDocument xmlDocument : xmlDocuments){
+- Document xmlDocument = xmlDocuments;
+- Vector<String> vector = new Vector<String>();
+- if(xmlDocument.getTitle() != null){
+- vector.add(xmlDocument.getTitle().getValue());
+- }
+- else{
+- vector.add("");
+- }
+- if(xmlDocument.getAuthors() != null){
+- List<Bean> authors = xmlDocument.getAuthors().getCollection();
+- authors = sortAuthors(authors);
+- String value = "";
+- int i = 1;
+- for(Bean author : authors){
+- if(i < authors.size()){
+- value = value + getNameComplete(((Author)author));
+- value = value + ", ";
+- }
+- else{
+- value = value + getNameComplete(((Author)author));
+- }
+- i++;
+- }
+- vector.add(value);
+- }
+- else{
+- vector.add("");
+- }
+- if(xmlDocument.getYear() != null && ((Year)xmlDocument.getYear()).getValue() != null && !((Year)xmlDocument.getYear()).getValue().equalsIgnoreCase("null")){
+- vector.add(((Year)xmlDocument.getYear()).getValue());
+- }
+- /*if(xmlDocument.getPublishdate() != null && xmlDocument.getPublishdate().getYear() != null && !xmlDocument.getPublishdate().getYear().equalsIgnoreCase("null")){
+- vector.add(xmlDocument.getPublishdate().getYear());
+- }*/
+- else{
+- vector.add("");
+- }
+- documents.add(vector);
+- //}
+- return documents;
+- }
+-
+- private String getNameComplete(Author author){
+- if(author == null) return "";
+- String result = "";
+- if(getSimpleTypeValue(author.getName_First()) != null)
+- result = result + getSimpleTypeValue(author.getName_First()).trim() + " ";
+- if(getSimpleTypeValue(author.getName_Middle()) != null)
+- result = result + getSimpleTypeValue(author.getName_Middle()).trim() + " ";
+- if(getSimpleTypeValue(author.getName_Last_Prefix()) != null)
+- result = result + getSimpleTypeValue(author.getName_Last_Prefix()).trim() + " ";
+- if(getSimpleTypeValue(author.getName_Last()) != null)
+- result = result + getSimpleTypeValue(author.getName_Last()).trim() + " ";
+- if(getSimpleTypeValue(author.getName_Last_Suffix()) != null)
+- result = result + getSimpleTypeValue(author.getName_Last_Suffix()).trim() + " ";
+- return result.trim();
+- }
+-
+- private String getSimpleTypeValue(Bean bean){
+- if(bean == null || !(bean instanceof SimpleTypeElementBean)) return null;
+- SimpleTypeElementBean simpleTypeElementBean = (SimpleTypeElementBean)bean;
+- if(simpleTypeElementBean.getValue() == null || simpleTypeElementBean.getValue().equalsIgnoreCase("null") || simpleTypeElementBean.getValue().length() <= 0) return null;
+- return simpleTypeElementBean.getValue();
+- }
+-
+- protected static List<Bean> sortAuthors(List<Bean> authors){
+- boolean unsorted = true;
+- Bean temp;
+-
+- while (unsorted){
+- unsorted = false;
+- for (int i = 0; i < authors.size() - 1; i++){
+- int rank = 99;
+- int otherRank = 99;
+- if(((Author)authors.get(i)).getRank() != null && !((Author)authors.get(i)).getRank().equalsIgnoreCase("null")){
+- rank = Integer.parseInt(((Author)authors.get(i)).getRank());
+- }
+- if(((Author)authors.get(i + 1)).getRank() != null && !((Author)authors.get(i + 1)).getRank().equalsIgnoreCase("null")){
+- otherRank = Integer.parseInt(((Author)authors.get(i + 1)).getRank());
+- }
+-
+- if (rank > otherRank) {
+- temp = authors.get(i);
+- authors.set(i, authors.get(i + 1));
+- authors.set(i + 1, temp);
+- unsorted = true;
+- }
+- }
+- }
+-
+- return authors;
+- }
+-}
+--- a/src/main/java/spl/SplWebClient.java
++++ b/src/main/java/spl/SplWebClient.java
+@@ -1,195 +0,0 @@
+-package spl;
+-
+-import java.io.ByteArrayInputStream;
+-import java.io.File;
+-import java.io.FileInputStream;
+-import java.io.InputStream;
+-import java.io.UnsupportedEncodingException;
+-
+-import javax.ws.rs.core.MediaType;
+-
+-import org.sciplore.beans.Author;
+-import org.sciplore.beans.Document;
+-import org.sciplore.deserialize.creator.AuthorBeanCreator;
+-import org.sciplore.deserialize.creator.AuthorsBeanCreator;
+-import org.sciplore.deserialize.creator.DefaultStringCreator;
+-import org.sciplore.deserialize.creator.DocumentBeanCreator;
+-import org.sciplore.deserialize.creator.DocumentsBeanCreator;
+-import org.sciplore.deserialize.creator.ObjectCreator;
+-import org.sciplore.deserialize.creator.TitleBeanCreator;
+-import org.sciplore.deserialize.creator.YearBeanCreator;
+-import org.sciplore.deserialize.reader.ObjectCreatorMapper;
+-import org.sciplore.deserialize.reader.XmlResourceReader;
+-import org.sciplore.formatter.Bean;
+-import org.sciplore.formatter.SimpleTypeElementBean;
+-
+-import com.sun.jersey.api.client.Client;
+-import com.sun.jersey.api.client.ClientResponse;
+-import com.sun.jersey.api.client.WebResource;
+-import com.sun.jersey.multipart.FormDataMultiPart;
+-
+-/**
+- * Created by IntelliJ IDEA.
+- * User: Christoph Arbeit
+- * Date: 09.09.2010
+- * Time: 10:35:20
+- * To change this template use File | Settings | File Templates.
+- */
+-public class SplWebClient {
+-
+- private static Client CLIENT = Client.create();
+- static{
+- CLIENT.setConnectTimeout(1000);
+- CLIENT.setReadTimeout(70000);
+- }
+- private static WebResource WEBRESOURCE = CLIENT.resource( "http://api.mr-dlib.org/" );
+- private static WebResource INTERNETRESOURCE = CLIENT.resource( "http://www.google.com" );
+- //private static WebResource WEBRESOURCE = CLIENT.resource( "http://localhost:8080/rest/" );
+-
+- public static Document metadata;
+-
+- public static WebServiceStatus getMetaData(File file){
+- try{
+- if(!isWebServiceAvailable()){
+- if(isInternetAvailable()){
+- return WebServiceStatus.WEBSERVICE_DOWN;
+- }
+- else{
+- return WebServiceStatus.NO_INTERNET;
+- }
+- }
+- if(isWebServiceOutDated()){
+- return WebServiceStatus.OUTDATED;
+- }
+- if(!isMetaDataServiceAvailable()){
+- return WebServiceStatus.UNAVAILABLE;
+- }
+- FileInputStream fin = new FileInputStream(file);
+- byte[] data = new byte[(int)file.length()];
+- fin.read(data);
+-
+- FormDataMultiPart formDataMultiPart = new FormDataMultiPart();
+- formDataMultiPart.field("file", data, MediaType.APPLICATION_OCTET_STREAM_TYPE);
+- formDataMultiPart.field("source", "jabref", MediaType.TEXT_PLAIN_TYPE);
+- formDataMultiPart.field("filename", file.getName(), MediaType.TEXT_PLAIN_TYPE);
+-
+-
+- ClientResponse response = WEBRESOURCE.path("documents").type(MediaType.MULTIPART_FORM_DATA_TYPE).post(ClientResponse.class, formDataMultiPart);
+- //System.out.println(response.getEntity(String.class));
+- if(response.getClientResponseStatus() == ClientResponse.Status.OK && response.hasEntity()){
+- String entity = response.getEntity(String.class);
+- byte[] bytes = new byte[0];
+- try {
+- bytes = entity.getBytes("UTF-8");
+- } catch (UnsupportedEncodingException e) {
+- return null;
+- }
+- InputStream is = new ByteArrayInputStream(bytes);
+- if(is != null){
+- ObjectCreatorMapper resourceMapper = new ObjectCreatorMapper();
+- ObjectCreator stringCreator = new DefaultStringCreator();
+- // initialize Mapper
+- resourceMapper.addCreator("documents", new DocumentsBeanCreator());
+- resourceMapper.addCreator("authors", new AuthorsBeanCreator());
+- resourceMapper.addCreator("document", new DocumentBeanCreator());
+- resourceMapper.addCreator("title", new TitleBeanCreator());
+- resourceMapper.addCreator("year", new YearBeanCreator());
+- resourceMapper.addCreator("author", new AuthorBeanCreator());
+-
+- resourceMapper.addCreator("name_first", stringCreator);
+- resourceMapper.addCreator("name_middle", stringCreator);
+- resourceMapper.addCreator("name_last", stringCreator);
+- resourceMapper.addCreator("name_last_prefix", stringCreator);
+- resourceMapper.addCreator("name_last_suffix", stringCreator);
+-
+- // initialize xml reader
+- XmlResourceReader<?> reader = new XmlResourceReader(resourceMapper);
+-
+- // parse given file -> create object tree
+- Document docs = (Document)reader.parse(is);
+- for(Bean author : docs.getAuthors().getCollection()){
+- Author temp = (Author)author;
+- System.out.println(((SimpleTypeElementBean)temp.getName_Last()).getValue() + " " + temp.getRank());
+- }
+- // XmlDocuments documents = JAXB.unmarshal(is, XmlDocuments.class);
+- SplWebClient.metadata = docs;
+- return WebServiceStatus.OK;
+- }
+- else{
+- return WebServiceStatus.NO_METADATA;
+- }
+- }
+- if(response.getClientResponseStatus() == ClientResponse.Status.SERVICE_UNAVAILABLE){
+- return WebServiceStatus.UNAVAILABLE;
+- }
+- }catch(Exception e){
+- System.out.println(Tools.getStackTraceAsString(e));
+- //Todo logging
+- }
+- return WebServiceStatus.NO_METADATA;
+- }
+-
+- public static boolean isWebServiceOutDated(){
+- try{
+- ClientResponse response = WEBRESOURCE.path("service/versioncheck/" + Tools.WEBSERVICE_APP_ID + "/current").get(ClientResponse.class);
+- if(response.getClientResponseStatus() == ClientResponse.Status.OK && response.hasEntity()){
+- String entity = response.getEntity(String.class);
+- byte[] bytes = entity.getBytes();
+- InputStream is = new ByteArrayInputStream(bytes);
+- if(is != null){
+- /*XmlApplication app = JAXB.unmarshal(is, XmlApplication.class);
+- if(app != null){
+- if(app.getVersion() != null && !app.getVersion().equalsIgnoreCase(Tools.WEBSERVICE_VERSION_SHORT)){
+- return true;
+- }
+- }*/
+- }
+- }
+- }catch(Exception e){
+- //Todo logging
+- }
+- return false;
+- }
+-
+- public static boolean isMetaDataServiceAvailable(){
+- try{
+- ClientResponse response = WEBRESOURCE.path("service/metadata/available").get(ClientResponse.class);
+- if(response.getClientResponseStatus() == ClientResponse.Status.OK && response.hasEntity()){
+- String entity = response.getEntity(String.class);
+- if(entity != null && entity.equalsIgnoreCase("false")){
+- return false;
+- }
+- }
+- }catch(Exception e){
+- //Todo logging
+- }
+- return true;
+- }
+-
+- public static boolean isWebServiceAvailable(){
+- try{
+- ClientResponse response = WEBRESOURCE.path("service/metadata/available").get(ClientResponse.class);
+- }catch(Exception e){
+- return false;
+- }
+- return true;
+- }
+-
+- public static boolean isInternetAvailable(){
+- try{
+- ClientResponse response = INTERNETRESOURCE.get(ClientResponse.class);
+- }catch(Exception e){
+- return false;
+- }
+- return true;
+- }
+-
+- public enum WebServiceStatus {
+- OK,
+- NO_METADATA,
+- UNAVAILABLE,
+- OUTDATED,
+- WEBSERVICE_DOWN,
+- NO_INTERNET
+- }
+-}
+--- a/src/main/java/spl/gui/MetaDataListDialog.java
++++ b/src/main/java/spl/gui/MetaDataListDialog.java
+@@ -1,297 +0,0 @@
+-package spl.gui;
+-
+-
+-import java.awt.BorderLayout;
+-import java.awt.CardLayout;
+-import java.awt.Color;
+-import java.awt.Component;
+-import java.awt.Dimension;
+-import java.awt.Font;
+-import java.awt.event.ActionEvent;
+-import java.awt.event.ActionListener;
+-import java.awt.event.KeyEvent;
+-import java.awt.event.WindowAdapter;
+-import java.awt.event.WindowEvent;
+-import java.io.File;
+-import java.io.IOException;
+-import java.util.List;
+-import java.util.Vector;
+-
+-import javax.swing.*;
+-import javax.swing.table.DefaultTableModel;
+-
+-import net.sf.jabref.Globals;
+-import net.sf.jabref.MetaData;
+-import net.sf.jabref.Util;
+-
+-import org.sciplore.beans.Document;
+-
+-import spl.DocumentsWrapper;
+-import spl.SplWebClient;
+-import spl.listener.LabelLinkListener;
+-import spl.localization.LocalizationSupport;
+-
+-import com.jgoodies.forms.builder.ButtonBarBuilder;
+-
+-public class MetaDataListDialog extends JDialog {
+- private JPanel contentPane;
+- private JTable tableMetadata;
+- private JButton buttonOK;
+- private JButton buttonCancel;
+- private JLabel labelFetch;
+- private JLabel iconLabel;
+- private JButton blankButton;
+- private JLabel labelLogo;
+- private JButton moreInformationButton;
+- private JPanel panelMetadata;
+- private DefaultTableModel tableModel;
+- private int result;
+- private Document xmlDocuments;
+- private String fileName;
+- private SplWebClient.WebServiceStatus webserviceStatus;
+- private Component thisDialog;
+- private boolean showBlankButton;
+- private CardLayout cardLayou = new CardLayout();
+-
+- public MetaDataListDialog(String fileName, boolean showBlankButton) {
+- $$$setupUI$$$();
+- this.showBlankButton = showBlankButton;
+- this.thisDialog = this;
+- this.fileName = fileName;
+- this.labelLogo.addMouseListener(new LabelLinkListener(this.labelLogo, "www.mr-dlib.org"));
+- this.setTitle(LocalizationSupport.message("Mr._dLib_Metadata_Entries_Associated_With_PDF_File"));
+- this.tableMetadata.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+- setContentPane(contentPane);
+- pack();
+- setModal(true);
+- getRootPane().setDefaultButton(buttonOK);
+-
+- buttonOK.addActionListener(new ActionListener() {
+- public void actionPerformed(ActionEvent e) {
+- onOK();
+- }
+- });
+-
+- buttonCancel.addActionListener(new ActionListener() {
+- public void actionPerformed(ActionEvent e) {
+- onCancel();
+- }
+- });
+-
+- blankButton.addActionListener(new ActionListener() {
+- public void actionPerformed(ActionEvent e) {
+- onBlank();
+- }
+- });
+-
+- moreInformationButton.addActionListener(new ActionListener() {
+- public void actionPerformed(ActionEvent e) {
+- onInfo();
+- }
+- });
+-
+- setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+- addWindowListener(new WindowAdapter() {
+- public void windowClosing(WindowEvent e) {
+- onCancel();
+- }
+- });
+-
+- contentPane.registerKeyboardAction(new ActionListener() {
+- public void actionPerformed(ActionEvent e) {
+- onCancel();
+- }
+- }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+-
+- cardLayou.show(panelMetadata, "panelWait");
+- //this.scrollPane.setVisible(false);
+- //this.blankButton.setVisible(false);
+- this.moreInformationButton.setVisible(true);
+- this.setSize(616, 366);
+- }
+-
+- private void onInfo() {
+- try {
+- Util.openExternalViewer(new MetaData(), "http://www.mr-dlib.org/docs/jabref_metadata_extraction_alpha.php", "url");
+- } catch (IOException exc) {
+- exc.printStackTrace();
+- }
+- }
+-
+- private void onBlank() {
+- this.result = JOptionPane.NO_OPTION;
+- dispose();
+- }
+-
+- private void onOK() {
+- this.result = JOptionPane.OK_OPTION;
+- dispose();
+- }
+-
+- private void onCancel() {
+- this.result = JOptionPane.CANCEL_OPTION;
+- dispose();
+- }
+-
+- public void showDialog() {
+- SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
+- @Override
+- public Void doInBackground() {
+- System.out.println("Starting Webclient...");
+- webserviceStatus = SplWebClient.getMetaData(new File(fileName));
+- return null;
+- }
+-
+- @Override
+- public void done() {
+- if (webserviceStatus == SplWebClient.WebServiceStatus.OK) {
+- xmlDocuments = SplWebClient.metadata;
+- if (xmlDocuments != null /*&& xmlDocuments.getDocuments() != null && xmlDocuments.getDocuments().size() > 0*/) {
+- DocumentsWrapper documents = new DocumentsWrapper(xmlDocuments);
+- List<Vector<String>> vectorList = documents.getDocuments();
+- for (Vector<String> vector : vectorList) {
+- tableModel.addRow(vector);
+- }
+-
+- tableMetadata.getSelectionModel().setSelectionInterval(0, 0);
+- cardLayou.show(panelMetadata, "scrollPane");
+- //panelWait.setVisible(false);
+- //scrollPane.setVisible(true);
+- moreInformationButton.setVisible(true);
+- } else {
+- iconLabel.setVisible(false);
+- labelFetch.setText(LocalizationSupport.message("No_metadata_found."));
+- blankButton.setVisible(showBlankButton);
+- }
+- }
+- if (webserviceStatus == SplWebClient.WebServiceStatus.NO_METADATA) {
+- iconLabel.setVisible(false);
+- labelFetch.setText(LocalizationSupport.message("No_metadata_found."));
+- blankButton.setVisible(showBlankButton);
+- }
+- if (webserviceStatus == SplWebClient.WebServiceStatus.UNAVAILABLE) {
+- iconLabel.setVisible(false);
+- labelFetch.setText(LocalizationSupport.message("Mr._dLib_web_service_is_temporarily_unavailable."));
+- blankButton.setVisible(showBlankButton);
+- }
+- if (webserviceStatus == SplWebClient.WebServiceStatus.OUTDATED) {
+- iconLabel.setVisible(false);
+- labelFetch.setText(LocalizationSupport.message("The_Mr._dLib_web_service_version_you_trying_to_access_is_outdated."));
+- blankButton.setVisible(showBlankButton);
+- 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);
+- }
+- if (webserviceStatus == SplWebClient.WebServiceStatus.WEBSERVICE_DOWN) {
+- iconLabel.setVisible(false);
+- labelFetch.setText(LocalizationSupport.message("Mr._dLib_web_service_is_temporarily_down._Please_try_again_later."));
+- blankButton.setVisible(showBlankButton);
+- }
+- if (webserviceStatus == SplWebClient.WebServiceStatus.NO_INTERNET) {
+- iconLabel.setVisible(false);
+- labelFetch.setText(LocalizationSupport.message("No_Internet_Connection."));
+- blankButton.setVisible(showBlankButton);
+- 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);
+- }
+- }
+- };
+- worker.execute();
+- this.pack();
+- this.setVisible(true);
+- }
+-
+- public Document getXmlDocuments() {
+- return xmlDocuments;
+- }
+-
+- private void createUIComponents() {
+- this.tableModel = new MyTableModel();
+- this.tableModel.addColumn(LocalizationSupport.message("Title"));
+- this.tableModel.addColumn(LocalizationSupport.message("Author(s)"));
+- this.tableModel.addColumn(LocalizationSupport.message("Published_Year"));
+- this.tableMetadata = new JTable(this.tableModel);
+- }
+-
+- public JTable getTableMetadata() {
+- return tableMetadata;
+- }
+-
+- public int getResult() {
+- return result;
+- }
+-
+- public JButton getBlankButton() {
+- return blankButton;
+- }
+-
+- private void $$$setupUI$$$() {
+- createUIComponents();
+- contentPane = new JPanel();
+- contentPane.setLayout(new BorderLayout());
+- labelLogo = new JLabel();
+- labelLogo.setIcon(new ImageIcon(getClass().getResource("/spl/gui/mrdlib header.png")));
+- labelLogo.setText("");
+- contentPane.add(labelLogo, BorderLayout.NORTH);
+- panelMetadata = new JPanel();
+- panelMetadata.setLayout(cardLayou);
+-
+-
+- panelMetadata.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null));
+- JScrollPane scrollPane = new JScrollPane();
+- scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), null));
+- tableMetadata.setAutoCreateRowSorter(false);
+- tableMetadata.setEnabled(true);
+- tableMetadata.setFillsViewportHeight(true);
+- tableMetadata.setShowVerticalLines(true);
+- scrollPane.setViewportView(tableMetadata);
+- panelMetadata.add(scrollPane, "scrollPane");
+- JPanel panelWait = new JPanel();
+- panelWait.setLayout(new BorderLayout());
+- panelWait.setBackground(new Color(-1));
+- panelMetadata.add(panelWait, "panelWait");
+- panelWait.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLoweredBevelBorder(), null));
+- iconLabel = new JLabel();
+- iconLabel.setBackground(new Color(-1));
+- iconLabel.setHorizontalAlignment(SwingConstants.CENTER);
+- iconLabel.setHorizontalTextPosition(SwingConstants.TRAILING);
+- iconLabel.setIcon(new ImageIcon(getClass().getResource("/spl/gui/ajax-loader.gif")));
+- iconLabel.setText("");
+- panelWait.add(iconLabel, BorderLayout.CENTER);
+- labelFetch = new JLabel();
+- labelFetch.setHorizontalAlignment(JLabel.CENTER);
+- labelFetch.setFont(new Font(labelFetch.getFont().getName(), labelFetch.getFont().getStyle(), 13));
+- labelFetch.setText(Globals.lang("Fetching Metadata..."));
+- panelWait.add(labelFetch, BorderLayout.SOUTH);
+-
+- cardLayou.show(panelMetadata, "panelWait");
+- panelMetadata.setPreferredSize(new Dimension(400, 200));
+- contentPane.add(panelMetadata, BorderLayout.CENTER);
+-
+- buttonOK = new JButton(Globals.lang("Ok"));
+- buttonCancel = new JButton(Globals.lang("Cancel"));
+- moreInformationButton = new JButton(Globals.lang("More information"));
+- ButtonBarBuilder bb = new ButtonBarBuilder();
+- bb.addGlue();
+- bb.addButton(moreInformationButton);
+- bb.addButton(buttonOK);
+- bb.addButton(buttonCancel);
+- bb.addGlue();
+- blankButton = new JButton();
+- blankButton.setText("");
+- contentPane.add(bb.getPanel(), BorderLayout.SOUTH);
+- iconLabel.setLabelFor(scrollPane);
+-
+-
+- }
+-
+- public JComponent $$$getRootComponent$$$() {
+- return contentPane;
+- }
+-
+- public static class MyTableModel extends DefaultTableModel {
+-
+- @Override
+- public boolean isCellEditable(int row, int column) {
+- return false;
+- }
+- }
+-
+-}