From: Jim Procter Date: Fri, 27 Oct 2017 16:26:43 +0000 (+0100) Subject: JAL-2810 prototype retrieve ID tab for the Uniprot FTS panel X-Git-Tag: Release_2_10_3b1~39^2~12 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=eae7b74da9179b461f4b63c65f488f87b1d26757;p=jalview.git JAL-2810 prototype retrieve ID tab for the Uniprot FTS panel --- diff --git a/src/jalview/fts/core/GFTSPanel.java b/src/jalview/fts/core/GFTSPanel.java index 67f1fdc..0c5ab11 100644 --- a/src/jalview/fts/core/GFTSPanel.java +++ b/src/jalview/fts/core/GFTSPanel.java @@ -33,6 +33,7 @@ import jalview.util.MessageManager; import java.awt.BorderLayout; import java.awt.CardLayout; +import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -89,6 +90,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI protected JInternalFrame mainFrame = new JInternalFrame( getFTSFrameTitle()); + protected JTabbedPane mainFramTabs = new JTabbedPane(); protected IProgressIndicator progressIndicator; protected JComboBox cmb_searchTarget = new JComboBox(); @@ -242,16 +244,36 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI public GFTSPanel() { + this(null); + } + + public GFTSPanel(SequenceFetcher fetcher) + { try { + if (fetcher == null) + { + mainFramTabs = null; + } jbInit(); + if (fetcher != null) + { + mainFramTabs.addTab("Retrieve IDs", fetcher); + fetcher.setDatabaseChooserVisible(false); + } mainFrame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); + final JPanel ftsPanel = this; mainFrame.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { - txt_search.requestFocusInWindow(); + // TODO: make selected tab gain focus in correct widget + if (mainFramTabs != null + && mainFramTabs.getSelectedComponent() == ftsPanel) + { + txt_search.requestFocusInWindow(); + } } }); mainFrame.invalidate(); @@ -644,7 +666,18 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI this.add(pnl_results, java.awt.BorderLayout.CENTER); this.add(pnl_actions, java.awt.BorderLayout.SOUTH); mainFrame.setVisible(true); - mainFrame.setContentPane(this); + if (mainFramTabs != null) + { + mainFramTabs.setOpaque(true); + mainFramTabs.setBackground(Color.white); + mainFramTabs.insertTab("Free Text Search", null, this, "", 0); + mainFrame.setContentPane(mainFramTabs); + mainFramTabs.setVisible(true); + } + else + { + mainFrame.setContentPane(this); + } mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); mainFrame.addInternalFrameListener( new javax.swing.event.InternalFrameAdapter() @@ -655,8 +688,6 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI closeAction(); } }); - mainFrame.setVisible(true); - mainFrame.setContentPane(this); mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Integer x = getTempUserPrefs().get("FTSPanel.x"); Integer y = getTempUserPrefs().get("FTSPanel.y"); diff --git a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java index 020331a..4f9e608 100644 --- a/src/jalview/fts/service/uniprot/UniprotFTSPanel.java +++ b/src/jalview/fts/service/uniprot/UniprotFTSPanel.java @@ -46,7 +46,7 @@ public class UniprotFTSPanel extends GFTSPanel public UniprotFTSPanel(SequenceFetcher fetcher) { - super(); + super(fetcher); pageLimit = UniProtFTSRestClient.getInstance() .getDefaultResponsePageSize(); this.seqFetcher = fetcher; diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index e05230b..b4619d9 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -1087,4 +1087,9 @@ public class SequenceFetcher extends JPanel implements Runnable { frame.setVisible(false); } + + public void setDatabaseChooserVisible(boolean b) + { + databaseButt.setVisible(b); + } }