package net.sf.jabref.gui.entryeditor;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.HashMap;
import java.util.Optional;

import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import net.sf.jabref.gui.BasePanel;
import net.sf.jabref.gui.JabRefFrame;
import net.sf.jabref.logic.pdf.PdfCommentImporter;
import net.sf.jabref.model.entry.FieldName;

public class PdfCommentsTab extends JPanel {


    private JList<String> commentList = new JList<>();

    private final JScrollPane scrollPane = new JScrollPane(commentList);

    private final EntryEditor parent;

    private final String tabTitle;

    private final JabRefFrame frame;

    private final BasePanel basePanel;

    public PdfCommentsTab(EntryEditor parent, JabRefFrame frame, BasePanel basePanel) {
        this.parent = parent;
        this.frame = frame;
        this.basePanel = basePanel;
        this.tabTitle = "PDF comments";
        this.setUpPdfCommentsTab();
    }

    private void setUpPdfCommentsTab() {
        Optional<String> field = parent.getEntry().getField(FieldName.FILE);
        if (field.isPresent()) {
            System.out.println("isPresent");
            DefaultListModel<String> listModel = new DefaultListModel<>();
            commentList.setModel(listModel);
            PdfCommentImporter commentImporter = new PdfCommentImporter();
            HashMap<String, String> importedNotes = commentImporter.importNotes(field.get());
            for (String note : importedNotes.values()) listModel.addElement(note);
        }
        scrollPane.setPreferredSize(new Dimension(450,200));
        this.add(scrollPane, BorderLayout.EAST);
    }

}

@@ -177,24 +177,51 @@
 tListModel;%0A
+import javax.swing.JLabel;%0A
 import javax
@@ -292,16 +292,46 @@
 ollPane;
+%0Aimport javax.swing.JTextArea;
 %0A%0Aimport
@@ -540,16 +540,68 @@
 anel %7B%0A%0A
+    private JPanel informationPanel = new JPanel();%0A
 %0A    pri
@@ -679,17 +679,24 @@
 ollPane 
-s
+commentS
 crollPan
@@ -726,24 +726,628 @@
 mentList);%0A%0A
+    private JLabel authorLabel = new JLabel(%22author%22,JLabel.CENTER);%0A%0A    private JTextArea authorArea = new JTextArea(%22author%22,2,25);%0A%0A    private JScrollPane authorScrollPane = new JScrollPane(authorArea);%0A%0A    private JLabel dateLabel = new JLabel (%22date%22,JLabel.CENTER);%0A%0A    private JTextArea dateArea = new JTextArea(%22date%22,2,25);%0A%0A    private JScrollPane dateScrollPane = new JScrollPane(dateArea);%0A%0A    private JLabel siteLabel = new JLabel(%22site%22,JLabel.CENTER);%0A%0A    private JTextArea siteArea = new JTextArea(%22site%22,2,25);%0A%0A    private JScrollPane siteScrollPane = new JScrollPane(siteArea);%0A%0A
     private 
@@ -1709,16 +1709,54 @@
 ments%22;%0A
+        this.setUpInformationPanel();%0A
         
@@ -1945,53 +1945,8 @@
 ) %7B%0A
-            System.out.println(%22isPresent%22);%0A
     
@@ -2312,16 +2312,78 @@
 t(note);
+%0A%0A            //TODO add context information for importedNotes
 %0A       
@@ -2385,24 +2385,25 @@
       %7D%0A
+%0A
         
 scrollPa
@@ -2394,17 +2394,24 @@
         
-s
+commentS
 crollPan
@@ -2450,24 +2450,25 @@
 (450,200));%0A
+%0A
         this
@@ -2476,37 +2476,648 @@
 add(
-scrollPane, BorderLayout.EAST
+commentScrollPane, BorderLayout.EAST);%0A        this.add(informationPanel,BorderLayout.WEST);%0A    %7D%0A%0A%0A    private void setUpInformationPanel()%7B%0A        authorArea.setEditable(false);%0A        dateArea.setEditable(false);%0A        siteArea.setEditable(false);%0A%0A        informationPanel.add(authorLabel, BorderLayout.NORTH);%0A        informationPanel.add(authorScrollPane,BorderLayout.NORTH);%0A        informationPanel.add(dateLabel, BorderLayout.CENTER);%0A        informationPanel.add(dateScrollPane, BorderLayout.CENTER);%0A        informationPanel.add(siteLabel, BorderLayout.SOUTH);%0A        informationPanel.add(siteScrollPane, BorderLayout.SOUTH
 );%0A 
@@ -3122,10 +3122,11 @@
 %0A    %7D%0A%0A
+%0A
 %7D%0A

Add textareas for further information display