/*
* PaperScopeUI.java
*
* Created on 07 June 2007, 11:13
* @author Mark
*/
package paperscope;
import prefuse.data.Graph;
import java.io.File;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.Font;
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingWorker;
import javax.swing.JFileChooser;
public class PaperScopeUI extends javax.swing.JFrame {
/** Creates new form PaperScopeUI */
public PaperScopeUI() {
initComponents();
this.currentDirectory = "";
thisSession = new PaperScopeSession("", this);
}
/** 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() {
Main_Tab_Pane = new javax.swing.JTabbedPane();
Author_Search_Panel = new javax.swing.JPanel();
Author_Search_Toolbar = new javax.swing.JToolBar();
Author_Search_Label = new javax.swing.JLabel();
Author_Search_Field = new javax.swing.JTextField();
Author_Search_Button = new javax.swing.JButton();
Author_Search_Progress_Label = new javax.swing.JLabel();
Author_Search_Progress_Bar = new javax.swing.JProgressBar();
Author_Panel = new javax.swing.JPanel();
Author_Search_Frame = new javax.swing.JInternalFrame();
Graph_View_Panel = new javax.swing.JPanel();
Bibcode_Toolbar = new javax.swing.JToolBar();
Bibcode_Label = new javax.swing.JLabel();
Bibcode_TextField = new javax.swing.JTextField();
Submit_Query = new javax.swing.JButton();
ProgressLabel = new javax.swing.JLabel();
QueryProgressBar = new javax.swing.JProgressBar();
Graph_Panel = new javax.swing.JPanel();
Graph_View_Frame = new javax.swing.JInternalFrame();
Main_Menu_Bar = new javax.swing.JMenuBar();
File_Menu = new javax.swing.JMenu();
Open_File_Menu_Item = new javax.swing.JMenuItem();
Save_File_Menu_Item = new javax.swing.JMenuItem();
jSeparator1 = new javax.swing.JSeparator();
Exit_Menu_Item = new javax.swing.JMenuItem();
Tools_Menu = new javax.swing.JMenu();
saveGraphLayoutItem = new javax.swing.JMenuItem();
loadGraphLayoutItem = new javax.swing.JMenuItem();
jSeparator2 = new javax.swing.JSeparator();
updateGraphItem = new javax.swing.JMenuItem();
jSeparator3 = new javax.swing.JSeparator();
advancedGraphToolsItem = new javax.swing.JMenuItem();
Help_Menu = new javax.swing.JMenu();
About_Menu_Item = new javax.swing.JMenuItem();
Help_Menu_Item = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("PaperScope 1.0");
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setName("Main Frame");
Author_Search_Label.setText(" Author Name: ");
Author_Search_Toolbar.add(Author_Search_Label);
Author_Search_Field.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
Author_Search_FieldKeyPressed(evt);
}
});
Author_Search_Toolbar.add(Author_Search_Field);
Author_Search_Button.setText("Submit");
Author_Search_Button.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
Author_Search_ButtonMouseClicked(evt);
}
});
Author_Search_Toolbar.add(Author_Search_Button);
Author_Search_Progress_Label.setText(" Query Progress: ");
Author_Search_Toolbar.add(Author_Search_Progress_Label);
Author_Search_Toolbar.add(Author_Search_Progress_Bar);
Author_Search_Frame.setTitle("Author Search Results");
Author_Search_Frame.setToolTipText("");
Author_Search_Frame.setVisible(true);
org.jdesktop.layout.GroupLayout Author_Search_FrameLayout = new org.jdesktop.layout.GroupLayout(Author_Search_Frame.getContentPane());
Author_Search_Frame.getContentPane().setLayout(Author_Search_FrameLayout);
Author_Search_FrameLayout.setHorizontalGroup(
Author_Search_FrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 530, Short.MAX_VALUE)
);
Author_Search_FrameLayout.setVerticalGroup(
Author_Search_FrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 357, Short.MAX_VALUE)
);
org.jdesktop.layout.GroupLayout Author_PanelLayout = new org.jdesktop.layout.GroupLayout(Author_Panel);
Author_Panel.setLayout(Author_PanelLayout);
Author_PanelLayout.setHorizontalGroup(
Author_PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, Author_Search_Frame)
);
Author_PanelLayout.setVerticalGroup(
Author_PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, Author_Search_Frame)
);
org.jdesktop.layout.GroupLayout Author_Search_PanelLayout = new org.jdesktop.layout.GroupLayout(Author_Search_Panel);
Author_Search_Panel.setLayout(Author_Search_PanelLayout);
Author_Search_PanelLayout.setHorizontalGroup(
Author_Search_PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(Author_Search_Toolbar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, Author_Panel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
Author_Search_PanelLayout.setVerticalGroup(
Author_Search_PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(Author_Search_PanelLayout.createSequentialGroup()
.add(Author_Search_Toolbar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(Author_Panel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
Main_Tab_Pane.addTab("Author Search", null, Author_Search_Panel, "Author Search panel");
Graph_View_Panel.setName("Graph_View_Panel");
Bibcode_Toolbar.setFloatable(false);
Bibcode_Label.setText(" Bibcode: ");
Bibcode_Toolbar.add(Bibcode_Label);
Bibcode_TextField.setColumns(20);
Bibcode_TextField.setToolTipText("Enter complete bibcode for a paper");
Bibcode_TextField.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
Bibcode_TextFieldKeyPressed(evt);
}
});
Bibcode_Toolbar.add(Bibcode_TextField);
Submit_Query.setText("Submit");
Submit_Query.setToolTipText("Click to submit query");
Submit_Query.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
Submit_QueryMouseClicked(evt);
}
});
Bibcode_Toolbar.add(Submit_Query);
ProgressLabel.setText(" Query Progess: ");
Bibcode_Toolbar.add(ProgressLabel);
ProgressLabel.getAccessibleContext().setAccessibleName("Progress Label");
QueryProgressBar.setName("QueryProgressBar");
Bibcode_Toolbar.add(QueryProgressBar);
QueryProgressBar.getAccessibleContext().setAccessibleName("QueryProgressBar");
Graph_View_Frame.setTitle("Radial Graph View");
Graph_View_Frame.setToolTipText("");
Graph_View_Frame.setVisible(true);
org.jdesktop.layout.GroupLayout Graph_View_FrameLayout = new org.jdesktop.layout.GroupLayout(Graph_View_Frame.getContentPane());
Graph_View_Frame.getContentPane().setLayout(Graph_View_FrameLayout);
Graph_View_FrameLayout.setHorizontalGroup(
Graph_View_FrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 530, Short.MAX_VALUE)
);
Graph_View_FrameLayout.setVerticalGroup(
Graph_View_FrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(0, 355, Short.MAX_VALUE)
);
org.jdesktop.layout.GroupLayout Graph_PanelLayout = new org.jdesktop.layout.GroupLayout(Graph_Panel);
Graph_Panel.setLayout(Graph_PanelLayout);
Graph_PanelLayout.setHorizontalGroup(
Graph_PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(Graph_View_Frame)
);
Graph_PanelLayout.setVerticalGroup(
Graph_PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(Graph_View_Frame)
);
org.jdesktop.layout.GroupLayout Graph_View_PanelLayout = new org.jdesktop.layout.GroupLayout(Graph_View_Panel);
Graph_View_Panel.setLayout(Graph_View_PanelLayout);
Graph_View_PanelLayout.setHorizontalGroup(
Graph_View_PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(Bibcode_Toolbar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, Graph_Panel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
Graph_View_PanelLayout.setVerticalGroup(
Graph_View_PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(Graph_View_PanelLayout.createSequentialGroup()
.add(Bibcode_Toolbar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(Graph_Panel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
Main_Tab_Pane.addTab("Graph", null, Graph_View_Panel, "Graph view panel");
File_Menu.setText("File");
Open_File_Menu_Item.setText("Open Graph");
Open_File_Menu_Item.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Open_File_Menu_ItemActionPerformed(evt);
}
});
File_Menu.add(Open_File_Menu_Item);
Save_File_Menu_Item.setText("Save Graph");
Save_File_Menu_Item.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Save_File_Menu_ItemActionPerformed(evt);
}
});
File_Menu.add(Save_File_Menu_Item);
File_Menu.add(jSeparator1);
Exit_Menu_Item.setText("Exit");
Exit_Menu_Item.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Exit_Menu_ItemActionPerformed(evt);
}
});
File_Menu.add(Exit_Menu_Item);
Main_Menu_Bar.add(File_Menu);
Tools_Menu.setText("Tools");
saveGraphLayoutItem.setText("Save Graph Layout");
saveGraphLayoutItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveGraphLayoutItemActionPerformed(evt);
}
});
Tools_Menu.add(saveGraphLayoutItem);
loadGraphLayoutItem.setText("Load Graph Layout");
loadGraphLayoutItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
loadGraphLayoutItemActionPerformed(evt);
}
});
Tools_Menu.add(loadGraphLayoutItem);
Tools_Menu.add(jSeparator2);
updateGraphItem.setText("Update Graph");
updateGraphItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
updateGraphItemActionPerformed(evt);
}
});
Tools_Menu.add(updateGraphItem);
Tools_Menu.add(jSeparator3);
advancedGraphToolsItem.setText("Advanced Graph Tools");
advancedGraphToolsItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
advancedGraphToolsItemActionPerformed(evt);
}
});
Tools_Menu.add(advancedGraphToolsItem);
Main_Menu_Bar.add(Tools_Menu);
Help_Menu.setText("Help");
About_Menu_Item.setText("About PaperScope");
About_Menu_Item.setToolTipText("About PaperScope");
About_Menu_Item.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
About_Menu_ItemActionPerformed(evt);
}
});
Help_Menu.add(About_Menu_Item);
Help_Menu_Item.setText("Help Menu");
Help_Menu_Item.setToolTipText("Help Menu");
Help_Menu_Item.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Help_Menu_ItemActionPerformed(evt);
}
});
Help_Menu.add(Help_Menu_Item);
Main_Menu_Bar.add(Help_Menu);
setJMenuBar(Main_Menu_Bar);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, Main_Tab_Pane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, Main_Tab_Pane)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void advancedGraphToolsItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_advancedGraphToolsItemActionPerformed
if(!(thisSession.getRadialGraph()==null))
{
AdvancedGraphFeatures features = new AdvancedGraphFeatures(thisSession);
features.setLocationRelativeTo(this);
features.setVisible(true);
}
else
{
GraphErrorMessage error = new GraphErrorMessage();
error.setLocationRelativeTo(this);
error.setVisible(true);
}
}//GEN-LAST:event_advancedGraphToolsItemActionPerformed
private void updateGraphItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateGraphItemActionPerformed
if(!(thisSession.getRadialGraph()==null))
{
//==== Swing worker for executing the graph update
class UpdateGraphExecuter extends SwingWorker<JPanel, Void> {
@Override
public JPanel doInBackground() {
thisSession.updateGraph();
RadialGraph graphme = thisSession.getRadialGraph();
return graphme.getGraphDisplayPanel();
}
@Override
protected void done() {
try {
stopQueryProgressBar();
Graph_View_Frame.setContentPane(get());
} catch (Exception ignore) {}
}
} //end class, InitialQueryExecuter
//==== Create the runnable
UpdateGraphExecuter update = new UpdateGraphExecuter();
//==== Turn on the progress bar (it is turned off when the done() method is called)
this.startQueryProgressBar();
//==== Execute the query
update.execute();
}
else
{
GraphErrorMessage error = new GraphErrorMessage();
error.setLocationRelativeTo(this);
error.setVisible(true);
}
}//GEN-LAST:event_updateGraphItemActionPerformed
private void loadGraphLayoutItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadGraphLayoutItemActionPerformed
if(!(thisSession.getRadialGraph()==null))
{
thisSession.getRadialGraph().loadGraphLayout();
}
else
{
GraphErrorMessage error = new GraphErrorMessage();
error.setLocationRelativeTo(this);
error.setVisible(true);
}
}//GEN-LAST:event_loadGraphLayoutItemActionPerformed
private void saveGraphLayoutItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveGraphLayoutItemActionPerformed
if(!(thisSession.getRadialGraph()==null))
{
thisSession.getRadialGraph().saveGraphLayout();
SaveGraphLayoutSuccessMessage success = new SaveGraphLayoutSuccessMessage();
success.setLocationRelativeTo(this);
success.setVisible(true);
}
else
{
GraphErrorMessage error = new GraphErrorMessage();
error.setLocationRelativeTo(this);
error.setVisible(true);
}
}//GEN-LAST:event_saveGraphLayoutItemActionPerformed
private void Author_Search_FieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_Author_Search_FieldKeyPressed
//==== If the user hits enter, submit the query
if(evt.getKeyCode()==KeyEvent.VK_ENTER)
{
final String author = Author_Search_Field.getText();
if (!author.equals("") && !author.equals(null))
{
submitAuthorQuery(author);
}
}
}//GEN-LAST:event_Author_Search_FieldKeyPressed
private void Bibcode_TextFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_Bibcode_TextFieldKeyPressed
//==== If the user hits enter, submit the query
if(evt.getKeyCode()==KeyEvent.VK_ENTER)
{
String bibcode = Bibcode_TextField.getText();
if (!bibcode.equals("") && !bibcode.equals(null))
{
submitBibcodeQuery(bibcode);
} //end if, text is entered
}
}//GEN-LAST:event_Bibcode_TextFieldKeyPressed
private void Exit_Menu_ItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Exit_Menu_ItemActionPerformed
System.exit(0);
}//GEN-LAST:event_Exit_Menu_ItemActionPerformed
private void Save_File_Menu_ItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Save_File_Menu_ItemActionPerformed
if(thisSession.getRadialGraph() != null)
{
SaveGraphDialog save = new SaveGraphDialog(thisSession.getRadialGraph(), this.currentDirectory);
save.setLocationRelativeTo(this);
save.setVisible(true);
this.currentDirectory = save.getCurrentDirectory();
}
else
{
GraphErrorMessage error = new GraphErrorMessage();
}
}//GEN-LAST:event_Save_File_Menu_ItemActionPerformed
private void Help_Menu_ItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Help_Menu_ItemActionPerformed
//==== create frame with info on PaperScope help and documentation
HelpMenuWindow help = new HelpMenuWindow();
help.setVisible(true);
}//GEN-LAST:event_Help_Menu_ItemActionPerformed
private void About_Menu_ItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_About_Menu_ItemActionPerformed
//==== Create frame with information about paperScope
AboutPaperScopeWindow about = new AboutPaperScopeWindow();
about.setVisible(true);
}//GEN-LAST:event_About_Menu_ItemActionPerformed
private void Open_File_Menu_ItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Open_File_Menu_ItemActionPerformed
//==== Initialize the filechooser, using the user's home dir, or the last working dir
if(this.currentDirectory.equals(""))
{ this.fc = new JFileChooser(); }
else
{ this.fc = new JFileChooser(this.currentDirectory); }
int returnVal = fc.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = fc.getSelectedFile();
if(file.exists())
{
ResultXML xml = new ResultXML();
boolean itSaved = xml.openFile(file);
if (itSaved)
{
Graph graph = xml.getGraph();
thisSession = new PaperScopeSession(graph, this);
this.Graph_View_Frame.setContentPane(thisSession.getRadialGraph().getGraphDisplayPanel());
this.Main_Tab_Pane.setSelectedIndex(1);
}
else
{
//==== File couldn't open, give an error message
final JFrame errorMessage = new JFrame();
errorMessage.setTitle("File Error");
errorMessage.setLocationRelativeTo(fc);
JLabel title = new JLabel("Error opening file, check file format and try again.");
title.setFont(new Font("Tahoma", 0, 12));
//==== Create the button for not overwriting the file
JButton closeButton = new JButton();
closeButton.setText("Close");
closeButton.setToolTipText("Close");
closeButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
errorMessage.setVisible(false);
}
});
//==== Add the label and the button to the panel
JPanel complete = new JPanel();
GridLayout layout = new GridLayout(2,1);
layout.addLayoutComponent("title", title);
layout.addLayoutComponent("button", closeButton);
complete.add(title);
complete.add(closeButton);
complete.setLayout(layout);
Dimension d = new Dimension(300, 100);
errorMessage.setSize(d);
errorMessage.setContentPane(complete);
errorMessage.setVisible(true);
} //end else, file read error
this.currentDirectory = file.getPath();
} //end if, file exists
} //end if, user clicked the button
}//GEN-LAST:event_Open_File_Menu_ItemActionPerformed
private void Author_Search_ButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Author_Search_ButtonMouseClicked
//==== If the user clicks the button, and the field has text, submit the query
final String author = Author_Search_Field.getText();
if (!author.equals("") && !author.equals(null))
{
submitAuthorQuery(author);
}
}//GEN-LAST:event_Author_Search_ButtonMouseClicked
private void Submit_QueryMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Submit_QueryMouseClicked
//==== If the user clicks the button, and the field has text, submit the query
String bibcode = Bibcode_TextField.getText();
if (!bibcode.equals("") && !bibcode.equals(null))
{
submitBibcodeQuery(bibcode);
} //end if, text is entered
}//GEN-LAST:event_Submit_QueryMouseClicked
//#########################################################################################
public void startQueryProgressBar()
{
this.QueryProgressBar.setIndeterminate(true);
}
//#########################################################################################
public void stopQueryProgressBar()
{
this.QueryProgressBar.setIndeterminate(false);
}
//#########################################################################################
public void updateGraphFrame(JPanel g)
{
this.Graph_View_Frame.setContentPane(g);
}
//#########################################################################################
public void submitAuthorQuery(final String author)
{
//==== Initial a session with a blank bibcode
thisSession = new PaperScopeSession("", this);
//==== Swing worker for executing the query on author name
class AuthorQueryExecuter extends SwingWorker<JScrollPane, Void> {
@Override
public JScrollPane doInBackground() {
return thisSession.executeAuthorQuery(author);
}
@Override
protected void done() {
try {
Author_Search_Progress_Bar.setIndeterminate(false);
Author_Search_Frame.setContentPane(get());
} catch (Exception ignore) {}
}
} //end class, InitialQueryExecuter
//==== Create the runnable
AuthorQueryExecuter query = new AuthorQueryExecuter();
//==== Turn on the progress bar (it is turned off when the done() method is called)
Author_Search_Progress_Bar.setIndeterminate(true);
//==== Execute the query
query.execute();
}
//########################################################################################
public void submitBibcodeQuery(final String bibcode)
{
thisSession = new PaperScopeSession(bibcode, this);
//==== Swing worker for executing the initial query
class InitialQueryExecuter extends SwingWorker<JPanel, Void> {
@Override
public JPanel doInBackground() {
thisSession.executeInitialQuery();
RadialGraph graphme = thisSession.getRadialGraph();
return graphme.getGraphDisplayPanel();
}
@Override
protected void done() {
try {
stopQueryProgressBar();
Graph_View_Frame.setContentPane(get());
} catch (Exception ignore) {}
}
} //end class, InitialQueryExecuter
//==== Create the runnable
InitialQueryExecuter query = new InitialQueryExecuter();
//==== Turn on the progress bar (it is turned off when the done() method is called)
this.startQueryProgressBar();
//==== Execute the query
query.execute();
}
//########################################################################################
public void setBibcodeTextField(String bibcode)
{
this.Bibcode_TextField.setText(bibcode);
}
//########################################################################################
public void selectGraphTab()
{
this.Main_Tab_Pane.setSelectedIndex(1);
}
//########################################################################################
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PaperScopeUI().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem About_Menu_Item;
private javax.swing.JPanel Author_Panel;
private javax.swing.JButton Author_Search_Button;
private javax.swing.JTextField Author_Search_Field;
private javax.swing.JInternalFrame Author_Search_Frame;
private javax.swing.JLabel Author_Search_Label;
private javax.swing.JPanel Author_Search_Panel;
private javax.swing.JProgressBar Author_Search_Progress_Bar;
private javax.swing.JLabel Author_Search_Progress_Label;
private javax.swing.JToolBar Author_Search_Toolbar;
private javax.swing.JLabel Bibcode_Label;
private javax.swing.JTextField Bibcode_TextField;
private javax.swing.JToolBar Bibcode_Toolbar;
private javax.swing.JMenuItem Exit_Menu_Item;
private javax.swing.JMenu File_Menu;
private javax.swing.JPanel Graph_Panel;
private javax.swing.JInternalFrame Graph_View_Frame;
private javax.swing.JPanel Graph_View_Panel;
private javax.swing.JMenu Help_Menu;
private javax.swing.JMenuItem Help_Menu_Item;
private javax.swing.JMenuBar Main_Menu_Bar;
private javax.swing.JTabbedPane Main_Tab_Pane;
private javax.swing.JMenuItem Open_File_Menu_Item;
private javax.swing.JLabel ProgressLabel;
private javax.swing.JProgressBar QueryProgressBar;
private javax.swing.JMenuItem Save_File_Menu_Item;
private javax.swing.JButton Submit_Query;
private javax.swing.JMenu Tools_Menu;
private javax.swing.JMenuItem advancedGraphToolsItem;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JMenuItem loadGraphLayoutItem;
private javax.swing.JMenuItem saveGraphLayoutItem;
private javax.swing.JMenuItem updateGraphItem;
// End of variables declaration//GEN-END:variables
public PaperScopeSession thisSession;
private File xmlResults;
private String currentDirectory;
private JFileChooser fc;
}