X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSequenceFetcher.java;h=fb94c05c8fe299eb2950b22e9722ad2038259329;hb=e4da162f3c4eb461c40f7b97794cd77d3b1e2407;hp=29281022d929cb975b4c43571a373d8a75297e3b;hpb=b13f521553582ef2fbfd7815ae25e23284babdea;p=jalview.git diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index 2928102..fb94c05 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -59,7 +59,42 @@ import com.stevesoft.pat.Regex; public class SequenceFetcher extends JPanel implements Runnable { - // ASequenceFetcher sfetch; + JLabel dbeg = new JLabel(); + + JDatabaseTree database; + + JButton databaseButt; + + JLabel jLabel1 = new JLabel(); + + JCheckBox replacePunctuation = new JCheckBox(); + + JButton ok = new JButton(); + + JButton clear = new JButton(); + + JButton example = new JButton(); + + JButton close = new JButton(); + + JPanel jPanel1 = new JPanel(); + + JTextArea textArea = new JTextArea(); + + JScrollPane jScrollPane1 = new JScrollPane(); + + JPanel jPanel2 = new JPanel(); + + JPanel jPanel3 = new JPanel(); + + JPanel jPanel4 = new JPanel(); + + BorderLayout borderLayout1 = new BorderLayout(); + + BorderLayout borderLayout2 = new BorderLayout(); + + BorderLayout borderLayout3 = new BorderLayout(); + JInternalFrame frame; IProgressIndicator guiWindow; @@ -80,6 +115,7 @@ public class SequenceFetcher extends JPanel implements Runnable private static Thread initingThread = null; + int x = 0; /** * Blocking method that initialises and returns the shared instance of the * SequenceFetcher client @@ -318,37 +354,22 @@ public class SequenceFetcher extends JPanel implements Runnable databaseButt.setFont(JvSwingUtils.getLabelFont()); database.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { - try - { - databaseButt.setText(database.getSelectedItem() - + (database.getSelectedSources().size() > 1 ? " (and " - + database.getSelectedSources().size() - + " others)" : "")); - String eq = database.getExampleQueries(); - dbeg.setText(MessageManager.formatMessage( - "label.example_query_param", new String[] - { eq })); - boolean enablePunct = !(eq != null && eq.indexOf(",") > -1); - for (DbSourceProxy dbs : database.getSelectedSources()) - { - if (dbs instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource) - { - enablePunct = false; - break; - } - } - replacePunctuation.setEnabled(enablePunct); + x++; + String currentSelection = database.getSelectedItem(); - } catch (Exception ex) + if (!currentSelection.equalsIgnoreCase("pdb")) + { + otherSourceAction(); + } + if (currentSelection.equalsIgnoreCase("pdb") && ((x % 2) == 0)) { - dbeg.setText(""); - replacePunctuation.setEnabled(true); + frame.dispose(); + new EBIFetchPanel(); } - jPanel2.repaint(); + } }); dbeg.setText(""); @@ -367,6 +388,41 @@ public class SequenceFetcher extends JPanel implements Runnable } + private void hideX() + { + this.setVisible(false); + } + private void otherSourceAction() + { + try + { + databaseButt.setText(database.getSelectedItem() + + (database.getSelectedSources().size() > 1 ? " (and " + + database.getSelectedSources().size() + " others)" + : "")); + String eq = database.getExampleQueries(); + dbeg.setText(MessageManager.formatMessage( + "label.example_query_param", new String[] + { eq })); + boolean enablePunct = !(eq != null && eq.indexOf(",") > -1); + for (DbSourceProxy dbs : database.getSelectedSources()) + { + if (dbs instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource) + { + enablePunct = false; + break; + } + } + replacePunctuation.setEnabled(enablePunct); + + } catch (Exception ex) + { + dbeg.setText(""); + replacePunctuation.setEnabled(true); + } + jPanel2.repaint(); + } + protected void example_actionPerformed() { DbSourceProxy db = null; @@ -385,41 +441,7 @@ public class SequenceFetcher extends JPanel implements Runnable jPanel3.repaint(); } - JLabel dbeg = new JLabel(); - - JDatabaseTree database; - - JButton databaseButt; - - JLabel jLabel1 = new JLabel(); - - JCheckBox replacePunctuation = new JCheckBox(); - - JButton ok = new JButton(); - - JButton clear = new JButton(); - - JButton example = new JButton(); - - JButton close = new JButton(); - - JPanel jPanel1 = new JPanel(); - - JTextArea textArea = new JTextArea(); - - JScrollPane jScrollPane1 = new JScrollPane(); - - JPanel jPanel2 = new JPanel(); - - JPanel jPanel3 = new JPanel(); - - JPanel jPanel4 = new JPanel(); - - BorderLayout borderLayout1 = new BorderLayout(); - BorderLayout borderLayout2 = new BorderLayout(); - - BorderLayout borderLayout3 = new BorderLayout(); public void close_actionPerformed(ActionEvent e) {