Package geopms

Source Code of geopms.GeoPMSImportPDF

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* GeoPMSImportPDF.java
*
* Created on 02.06.2011, 22:16:45
*/

package geopms;

import java.io.*;
//import org.jibble.simpleftp.*;
import java.util.logging.*;


import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentInformation;
import org.apache.pdfbox.util.PDFTextStripper;


/**
*
* @author neroon
*/
public class GeoPMSImportPDF extends javax.swing.JDialog
{
    private static Logger logger = Logger.getLogger("com.geores.geopms");

    private File file;
    private int pdftextsource = 0// 1 = from Header, 2 = from File, 3 = from RIS
    private PDDocument document = null;
    private Integer pdfletter = 2000;
    private boolean isris = false;
    private boolean isimport = false;
    private String papertype = "";


    /** Creates new form GeoPMSImportPDF */
    public GeoPMSImportPDF(java.awt.Frame parent, boolean modal)
    {
        super(parent, modal);
        initComponents();
    }


    private void clearEntry()
    {
        pdftitle.setText("");
        pdfauthor.setText("");
        pdfabstract.setText("");
        doi.setText("");
        source.setText("");
        journal.setText("");
        pdfyear.setText("");
       
    }

    public void getPDFFileInfo()
    {
        String pdftext = "";

        clearEntry();
        try
        {
                isris = false;
                document = PDDocument.load(file);
                PDDocumentInformation infos = document.getDocumentInformation();

                PDFTextStripper textStripper=new PDFTextStripper();

                pdfletter = new Integer(pdftextletter.getText());
                if( pdfletter < textStripper.getText(document).length())
                {
                    pdftext = textStripper.getText(document).substring(0, pdfletter);
                }
                else
                {
                    pdftext = textStripper.getText(document).substring(0, textStripper.getText(document).length());
                }
                pdfabstract.setText(pdftext);

                if( document != null )
                {
                    document.close();
                }
        }
        catch(IOException e)
        {
           System.out.println("IO-Error: "+e);
        }

    }

    public void getPDFHeaderInfo()
    {

         clearEntry();
         try
            {
                isris = false;
                document = PDDocument.load(file);
                PDDocumentInformation infos = document.getDocumentInformation();

                //System.out.println( "Page Count=" + document.getNumberOfPages() );
               
                pdftitle.setText(infos.getTitle());
                pdfauthor.setText(infos.getAuthor());
                pdfabstract.setText(infos.getSubject());

                if( document != null )
                {
                    document.close();
                }
            }
            catch(IOException e)
            {
                    System.out.println("IO-Error: "+e);
            }
    }

    public void getPDFRisInfo()
    {
       String risdata;
       String pdfau = "";
       String journalname = "";
       String volume = "";
       String issue = "";
       String sp = "";
       String ep = "";
       String abst = "";
       String type = "";

       isris = true;

       clearEntry();
       try
       {
           BufferedReader in = new BufferedReader(new FileReader(file));

           while(true)
           {
              risdata = in.readLine();

              if(!in.ready())
              {
                  break;
              }
              if(risdata.length() > 5)
              {
                  if(risdata.substring(0,5).equals("AU  -"))
                  {
                      pdfau = pdfau+risdata.substring(6)+"; ";
                      pdfauthor.setText(pdfau);
                  }
                  if(risdata.substring(0,5).equals("TI  -") || risdata.substring(0,5).equals("T1  -"))
                  {
                      pdftitle.setText(risdata.substring(6));
                  }
                  if(risdata.substring(0,5).equals("JO  -"))
                  {
                      journalname = risdata.substring(6);
                  }
                  if(risdata.substring(0,5).equals("DO  -") || risdata.substring(0,5).equals("M3  -"))
                  {
                      doi.setText(risdata.substring(6));
                  }
                  if(risdata.substring(0,5).equals("PY  -"))
                  {
                      pdfyear.setText(risdata.substring(6));
                  }
                  if(risdata.substring(0,5).equals("UR  -"))
                  {
                      source.setText(risdata.substring(6));
                  }
                  if(risdata.substring(0,5).equals("VL  -"))
                  {
                      volume = (risdata.substring(6));
                  }
                  if(risdata.substring(0,5).equals("IS  -"))
                  {
                      issue = risdata.substring(6);
                  }
                  if(risdata.substring(0,5).equals("SP  -"))
                  {
                      sp = risdata.substring(6);
                  }
                  if(risdata.substring(0,5).equals("EP  -"))
                  {
                      ep = risdata.substring(6);
                  }
                  if(risdata.substring(0,5).equals("TY  -"))
                  {
                      type = risdata.substring(6);

                      if(type.equals("JOUR"))
                      {
                         papertype = "Article";
                      }
                      if(type.equals("ABST"))
                      {
                         papertype = "Abstract";
                      }
                      if(type.equals("CASE"))
                      {
                         papertype = "Case Study";
                      }
                      if(type.equals("RPRT"))
                      {
                         papertype = "Report";
                      }
                      if(type.equals("PAT"))
                      {
                         papertype = "Patent";
                      }
                      pubtype.setSelectedItem(papertype);
                  }

                  if(risdata.substring(0,5).equals("AB  -"))
                  {
                      if(risdata.substring(6).isEmpty())
                      {
                          risdata = in.readLine();
                          abst = abst+risdata;
                          while(!risdata.substring(0,5).equals("ER  -"))
                          {
                              abst = abst+risdata;
                              risdata = in.readLine();
                          }
                          pdfabstract.setText(abst);
                      }
                      else
                      {
                          pdfabstract.setText(risdata.substring(6));
                      }
                  }


              }
              journal.setText(journalname+" Vol. "+volume+", "+issue+", "+sp+"-"+ep);
           }
           in.close();
        }
        catch(NullPointerException e)
        {
           logger.severe("System error: "+e);
        }
        catch(IOException e)
        {
            logger.severe("IO error (Read config file error): "+e.getMessage());
        }

    }

    public String getPaperType()
    {
        return papertype;
    }

    public boolean isImport()
    {
        return isimport;
    }
   
    public String getPDFTitle()
    {
        return pdftitle.getText();
    }

    public String getPDFAuthor()
    {
        return pdfauthor.getText();
    }

    public String getPDFAbstract()
    {
        return pdfabstract.getText();
    }

    public String getFileName()
    {
        return file.getName();
    }

    public File getFile()
    {
        return file;
    }

    public String getDoi()
    {
        return doi.getText();
    }

    public String getSource()
    {
        return source.getText();
    }

    public String getYear()
    {
        return pdfyear.getText();
    }

    public String getJournal()
    {
        return journal.getText();
    }

    public boolean isRIS()
    {
        return isris;
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jRadioButton1 = new javax.swing.JRadioButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        pdftitle = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        pdfauthor = new javax.swing.JTextArea();
        jLabel3 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        doi = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        source = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        pdfyear = new javax.swing.JTextField();
        jScrollPane3 = new javax.swing.JScrollPane();
        journal = new javax.swing.JTextArea();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        pdfabstract = new javax.swing.JTextPane();
        pubtype = new javax.swing.JComboBox();
        jLabel11 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        pdffile = new javax.swing.JFileChooser();
        jPanel3 = new javax.swing.JPanel();
        importpdf = new javax.swing.JButton();
        fromFile = new javax.swing.JRadioButton();
        FromHeader = new javax.swing.JRadioButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        pdftextletter = new javax.swing.JTextField();
        fromRis = new javax.swing.JRadioButton();

        jRadioButton1.setText("jRadioButton1");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("GeoPMS PDF import");
        setResizable(false);

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel1.setText("Title:");

        pdftitle.setForeground(new java.awt.Color(0, 51, 204));

        jLabel2.setText("Author:");

        pdfauthor.setColumns(20);
        pdfauthor.setForeground(new java.awt.Color(0, 51, 204));
        pdfauthor.setRows(5);
        jScrollPane1.setViewportView(pdfauthor);

        jLabel3.setText("Abstract:");

        jLabel6.setText("DOI:");

        doi.setForeground(new java.awt.Color(0, 51, 204));

        jLabel7.setText("Source:");

        source.setForeground(new java.awt.Color(0, 51, 204));

        jLabel8.setText("Year:");

        pdfyear.setForeground(new java.awt.Color(0, 51, 204));
        pdfyear.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        journal.setColumns(20);
        journal.setForeground(new java.awt.Color(0, 51, 204));
        journal.setRows(5);
        jScrollPane3.setViewportView(journal);

        jLabel9.setText("Journal:");

        pdfabstract.setForeground(new java.awt.Color(0, 51, 204));
        jScrollPane2.setViewportView(pdfabstract);

        pubtype.setForeground(new java.awt.Color(0, 51, 204));
        pubtype.setMaximumRowCount(12);
        pubtype.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Abstract", "Expanded Abstract", "Article", "Case Study", "History", "Report", "Protocol", "Presentation", "Tutorial", "Requirement", "Patent", "others" }));
        pubtype.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pubtypeActionPerformed(evt);
            }
        });

        jLabel11.setText("Type:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2)
                            .addComponent(jLabel9))
                        .addGap(19, 19, 19))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pdftitle, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 699, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE))
                        .addGap(12, 12, 12)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel6)
                            .addComponent(jLabel7))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(source, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(pdfyear, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(pubtype, 0, 233, Short.MAX_VALUE))
                            .addComponent(doi, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 699, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(pdftitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6)
                            .addComponent(doi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(source, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(pdfyear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(pubtype, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE))
                .addContainerGap())
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        pdffile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                pdffileActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pdffile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pdffile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        importpdf.setText("Import");
        importpdf.setEnabled(false);
        importpdf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                importpdfActionPerformed(evt);
            }
        });

        fromFile.setText("from File ");
        fromFile.setEnabled(false);
        fromFile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fromFileActionPerformed(evt);
            }
        });

        FromHeader.setText("from Header");
        FromHeader.setEnabled(false);
        FromHeader.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                FromHeaderActionPerformed(evt);
            }
        });

        jLabel4.setText("Pdf information import:");

        jLabel5.setText("Max. letter:");

        pdftextletter.setForeground(new java.awt.Color(0, 51, 204));
        pdftextletter.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        pdftextletter.setText("2000");
        pdftextletter.setEnabled(false);

        fromRis.setText("from RIS (only one citation)");
        fromRis.setEnabled(false);
        fromRis.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fromRisActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(FromHeader)
                    .addComponent(jLabel4)
                    .addComponent(fromRis)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(importpdf)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(fromFile)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel5)))
                        .addGap(6, 6, 6)
                        .addComponent(pdftextletter, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(22, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(FromHeader)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(fromFile)
                    .addComponent(pdftextletter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(fromRis)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 189, Short.MAX_VALUE)
                .addComponent(importpdf)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void pdffileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pdffileActionPerformed
    if(evt.getActionCommand().equals("CancelSelection"))
    {
        this.dispose();
    }
    else
    {
        fromFile.setEnabled(true);
        FromHeader.setEnabled(true);
        fromRis.setEnabled(true);
        pdftextletter.setEnabled(true);
        file = pdffile.getSelectedFile();
        if(pdftextsource == 1)
            getPDFHeaderInfo();
        if(pdftextsource == 2)
            getPDFFileInfo();


    }

    }//GEN-LAST:event_pdffileActionPerformed

    private void importpdfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importpdfActionPerformed
        isimport = true;
        this.dispose();
    }//GEN-LAST:event_importpdfActionPerformed

    private void FromHeaderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FromHeaderActionPerformed
        if(FromHeader.isSelected())
        {
            fromFile.setSelected(false);
            fromRis.setSelected(false);
            importpdf.setEnabled(true);
            pdftextsource = 1;
            getPDFHeaderInfo();
        }
    }//GEN-LAST:event_FromHeaderActionPerformed

    private void fromFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fromFileActionPerformed
        if(fromFile.isSelected())
        {
            FromHeader.setSelected(false);
            fromRis.setSelected(false);
            importpdf.setEnabled(true);
            pdftextsource = 2;
            getPDFFileInfo();
        }
    }//GEN-LAST:event_fromFileActionPerformed

    private void fromRisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fromRisActionPerformed
        if(fromRis.isSelected())
        {
            FromHeader.setSelected(false);
            fromFile.setSelected(false);
            importpdf.setEnabled(true);
            pdftextsource = 3;
            getPDFRisInfo();
        }
    }//GEN-LAST:event_fromRisActionPerformed

    private void pubtypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pubtypeActionPerformed
        papertype = pubtype.getSelectedItem().toString();
}//GEN-LAST:event_pubtypeActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JRadioButton FromHeader;
    private javax.swing.JTextField doi;
    private javax.swing.JRadioButton fromFile;
    private javax.swing.JRadioButton fromRis;
    private javax.swing.JButton importpdf;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextArea journal;
    private javax.swing.JTextPane pdfabstract;
    private javax.swing.JTextArea pdfauthor;
    private javax.swing.JFileChooser pdffile;
    private javax.swing.JTextField pdftextletter;
    private javax.swing.JTextField pdftitle;
    private javax.swing.JTextField pdfyear;
    private javax.swing.JComboBox pubtype;
    private javax.swing.JTextField source;
    // End of variables declaration//GEN-END:variables

}
TOP

Related Classes of geopms.GeoPMSImportPDF

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.