From d59a0599fa4d5723f89eee748a97333c47df5199 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 7 Nov 2017 17:12:08 +0000 Subject: [PATCH] JAL-2810 working back button shown for bulk ID retrieval tab in FTS search --- src/jalview/fts/core/GFTSPanel.java | 5 +++-- src/jalview/gui/SequenceFetcher.java | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/jalview/fts/core/GFTSPanel.java b/src/jalview/fts/core/GFTSPanel.java index 3fdac2a..8d6b092 100644 --- a/src/jalview/fts/core/GFTSPanel.java +++ b/src/jalview/fts/core/GFTSPanel.java @@ -259,6 +259,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI { mainFramTabs.addTab("Retrieve IDs", fetcher); fetcher.setDatabaseChooserVisible(false); + fetcher.embedWithFTSPanel(this); } mainFrame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); final JPanel ftsPanel = this; @@ -835,7 +836,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI } } - protected void btn_back_ActionPerformed() + public void btn_back_ActionPerformed() { closeAction(); new SequenceFetcher(progressIndicator); @@ -848,7 +849,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI btn_cancel.setEnabled(false); } - protected void btn_cancel_ActionPerformed() + public void btn_cancel_ActionPerformed() { closeAction(); } diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index b4619d9..3d8ae43 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -26,6 +26,7 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; +import jalview.fts.core.GFTSPanel; import jalview.fts.service.pdb.PDBFTSPanel; import jalview.fts.service.uniprot.UniprotFTSPanel; import jalview.io.FileFormatI; @@ -78,6 +79,8 @@ public class SequenceFetcher extends JPanel implements Runnable JButton close = new JButton(); + JButton back = new JButton(); + JPanel jPanel1 = new JPanel(); JTextArea textArea = new JTextArea(); @@ -383,6 +386,15 @@ public class SequenceFetcher extends JPanel implements Runnable .getString("label.additional_sequence_fetcher")); } + GFTSPanel parentFTSframe = null; + /** + * change the buttons so they fit with the FTS panel. + */ + public void embedWithFTSPanel(GFTSPanel toClose) + { + back.setVisible(true); + parentFTSframe = toClose; + } private void jbInit() throws Exception { this.setLayout(borderLayout2); @@ -436,6 +448,17 @@ public class SequenceFetcher extends JPanel implements Runnable close_actionPerformed(e); } }); + back.setText(MessageManager.getString("action.back")); + back.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + parentFTSframe.btn_back_ActionPerformed(); + } + }); + // back not visible unless embedded + back.setVisible(false); textArea.setFont(JvSwingUtils.getLabelFont()); textArea.setLineWrap(true); textArea.addKeyListener(new KeyAdapter() @@ -451,9 +474,10 @@ public class SequenceFetcher extends JPanel implements Runnable }); jPanel3.setLayout(borderLayout1); borderLayout1.setVgap(5); - jPanel1.add(ok); + jPanel1.add(back); jPanel1.add(example); jPanel1.add(clear); + jPanel1.add(ok); jPanel1.add(close); jPanel2.setLayout(borderLayout3); databaseButt = /*database.getDatabaseSelectorButton(); @@ -582,6 +606,10 @@ public class SequenceFetcher extends JPanel implements Runnable try { frame.setClosed(true); + if (parentFTSframe!=null) + { + parentFTSframe.btn_cancel_ActionPerformed(); + } } catch (Exception ex) { } @@ -594,7 +622,7 @@ public class SequenceFetcher extends JPanel implements Runnable textArea.setEnabled(false); ok.setEnabled(false); close.setEnabled(false); - + back.setEnabled(false); Thread worker = new Thread(this); worker.start(); } @@ -606,6 +634,7 @@ public class SequenceFetcher extends JPanel implements Runnable textArea.setEnabled(true); ok.setEnabled(true); close.setEnabled(true); + back.setEnabled(parentFTSframe != null); } @Override -- 1.7.10.2