X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSequenceFetcher.java;h=828a2aa6dfa57a17dcb364b79a3f9044daa784c3;hb=ccc31f21ed36c2e43b5a1b450846284151c680bb;hp=e567d2031c71b959e4ca07a26f1be7f5bd83b18c;hpb=461b359b7338934b198a22bd70c622f333ac4661;p=jalview.git diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index e567d20..828a2aa 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -31,6 +31,7 @@ import jalview.fts.service.uniprot.UniprotFTSPanel; import jalview.io.gff.SequenceOntologyI; import jalview.util.DBRefUtils; import jalview.util.MessageManager; +import jalview.util.Platform; import jalview.ws.dbsources.das.api.DasSourceRegistryI; import jalview.ws.seqfetcher.DbSourceProxy; @@ -274,13 +275,13 @@ public class SequenceFetcher extends JPanel implements Runnable frame = new JInternalFrame(); frame.setContentPane(this); - if (new jalview.util.Platform().isAMac()) + if (Platform.isAMac()) { - Desktop.addInternalFrame(frame, getFrameTitle(), 400, 240); + Desktop.addInternalFrame(frame, getFrameTitle(), false, 400, 240); } else { - Desktop.addInternalFrame(frame, getFrameTitle(), 400, 180); + Desktop.addInternalFrame(frame, getFrameTitle(), false, 400, 180); } } @@ -365,7 +366,19 @@ public class SequenceFetcher extends JPanel implements Runnable jPanel1.add(close); jPanel3.add(jPanel2, java.awt.BorderLayout.CENTER); jPanel2.setLayout(borderLayout3); - databaseButt = database.getDatabaseSelectorButton(); + databaseButt = /*database.getDatabaseSelectorButton(); + final JButton viewdbs =*/new JButton( + MessageManager.getString("action.select_ddbb")); + databaseButt.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent arg0) + { + hidePanel(); + database.showDialog(); + } + }); databaseButt.setFont(JvSwingUtils.getLabelFont()); database.addActionListener(new ActionListener() { @@ -374,6 +387,12 @@ public class SequenceFetcher extends JPanel implements Runnable { debounceTrap++; String currentSelection = database.getSelectedItem(); + if (currentSelection == null) + { + close_actionPerformed(null); + } + + showPanel(); if (currentSelection.equalsIgnoreCase("pdb") && (database.action == KeyEvent.VK_ENTER || ((debounceTrap % 2) == 0))) @@ -407,6 +426,10 @@ public class SequenceFetcher extends JPanel implements Runnable this.add(jPanel2, java.awt.BorderLayout.NORTH); jScrollPane1.getViewport().add(textArea); + /* + * open the database tree + */ + database.waitForInput(); } private void pdbSourceAction() @@ -813,10 +836,8 @@ public class SequenceFetcher extends JPanel implements Runnable Cache.log.info( "Error retrieving " + accession + " from " + proxy.getDbName(), e); - } finally - { - return success; } + return success; } /** @@ -836,7 +857,6 @@ public class SequenceFetcher extends JPanel implements Runnable for (String q : queries) { - DBRefEntry[] found = null; DBRefEntry dbr = new DBRefEntry(); dbr.setSource(proxy.getDbSource()); dbr.setVersion(null); @@ -847,8 +867,9 @@ public class SequenceFetcher extends JPanel implements Runnable { if (rs[r] != null) { - found = DBRefUtils.searchRefs(rs[r].getDBRefs(), accId); - if (found != null && found.length > 0) + List found = DBRefUtils.searchRefs(rs[r].getDBRefs(), + accId); + if (!found.isEmpty()) { rfound = true; break; @@ -968,4 +989,22 @@ public class SequenceFetcher extends JPanel implements Runnable { this.progressIndicator = progressIndicator; } + + /** + * Make this panel visible (after a selection has been made in the database + * chooser) + */ + void showPanel() + { + frame.setVisible(true); + } + + /** + * Hide this panel (on clicking the database button to open the database + * chooser) + */ + void hidePanel() + { + frame.setVisible(false); + } }