/*
* PaperPanel.java
*
* Created on 07 September 2007, 10:50
*/
/**
*
* @author Mark
*/
package paperscope;
import edu.stanford.ejalbert.BrowserLauncher;
public class PaperPanel extends javax.swing.JPanel {
/** Creates new form PaperPanel */
public PaperPanel(PaperScopeSession session, int count, String title, String authors, String journal, String date, String citCount, String bibcode, String url) {
initComponents();
this.thisSession = session;
this.count = count+1;
this.title = title;
this.authors = authors;
this.journal = journal;
this.date = date;
this.citCount = citCount;
this.bibcode = bibcode;
this.url = url;
insertText();
}
public void insertText()
{
this.titleText.setText(this.title);
this.numberLabel.setText(String.valueOf(this.count));
this.authorText.setText(this.authors);
this.journalText.setText(this.journal);
this.dateText.setText(this.date);
this.citCountText.setText(this.citCount);
this.bibcodeText.setText(this.bibcode);
}
/** 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.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
numberLabel = new javax.swing.JLabel();
titleLabel = new javax.swing.JLabel();
titleText = new javax.swing.JTextField();
authorLabel = new javax.swing.JLabel();
authorText = new javax.swing.JTextField();
journalLabel = new javax.swing.JLabel();
journalText = new javax.swing.JTextField();
dateLabel = new javax.swing.JLabel();
dateText = new javax.swing.JTextField();
citCountLabel = new javax.swing.JLabel();
citCountText = new javax.swing.JTextField();
bibcodeLabel = new javax.swing.JLabel();
bibcodeText = new javax.swing.JTextField();
abstractButton = new javax.swing.JButton();
graphButton = new javax.swing.JButton();
setBorder(javax.swing.BorderFactory.createEtchedBorder());
titleLabel.setText("Title: ");
titleText.setEditable(false);
authorLabel.setText("Authors: ");
authorText.setEditable(false);
journalLabel.setText("Journal: ");
journalText.setEditable(false);
dateLabel.setText("Date: ");
dateText.setColumns(7);
dateText.setEditable(false);
citCountLabel.setText("Citation Count: ");
citCountText.setColumns(5);
citCountText.setEditable(false);
bibcodeLabel.setText("Bibcode: ");
bibcodeText.setColumns(20);
bibcodeText.setEditable(false);
abstractButton.setText("Read Abstract");
abstractButton.setToolTipText("Open Abstract in web browser");
abstractButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
abstractButtonMouseClicked(evt);
}
});
graphButton.setText("Graph it");
graphButton.setToolTipText("Graph this paper");
graphButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
graphButtonMouseClicked(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(numberLabel)
.addGroup(layout.createSequentialGroup()
.addGap(34, 34, 34)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(authorLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(authorText, javax.swing.GroupLayout.DEFAULT_SIZE, 395, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(titleLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(titleText, javax.swing.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(journalLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(journalText, javax.swing.GroupLayout.DEFAULT_SIZE, 395, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(dateLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(abstractButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(graphButton))
.addGroup(layout.createSequentialGroup()
.addComponent(dateText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(citCountLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(citCountText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bibcodeLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bibcodeText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(numberLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(titleLabel)
.addComponent(titleText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(authorLabel)
.addComponent(authorText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(journalLabel)
.addComponent(journalText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(dateLabel)
.addComponent(dateText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(citCountLabel)
.addComponent(citCountText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bibcodeLabel)
.addComponent(bibcodeText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(graphButton)
.addComponent(abstractButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void graphButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_graphButtonMouseClicked
thisSession.graphPaperMouseClicked(this.bibcode);
}//GEN-LAST:event_graphButtonMouseClicked
private void abstractButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_abstractButtonMouseClicked
try{
//==== Create the browser launcher, open the URL in the user's browser
BrowserLauncher launch = new BrowserLauncher();
launch.openURLinBrowser(url);
}
catch (Exception e){
System.out.println(e);
}
}//GEN-LAST:event_abstractButtonMouseClicked
PaperScopeSession thisSession;
int count;
String bibcode, title, authors, journal, citCount, date, url;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton abstractButton;
private javax.swing.JLabel authorLabel;
private javax.swing.JTextField authorText;
private javax.swing.JLabel bibcodeLabel;
private javax.swing.JTextField bibcodeText;
private javax.swing.JLabel citCountLabel;
private javax.swing.JTextField citCountText;
private javax.swing.JLabel dateLabel;
private javax.swing.JTextField dateText;
private javax.swing.JButton graphButton;
private javax.swing.JLabel journalLabel;
private javax.swing.JTextField journalText;
private javax.swing.JLabel numberLabel;
private javax.swing.JLabel titleLabel;
private javax.swing.JTextField titleText;
// End of variables declaration//GEN-END:variables
}