From 39a640a77b531e7b4801eebf6c43502cc9821180 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 9 Apr 2018 10:14:57 +0100 Subject: [PATCH] JAL-1847 superpose checkbox in structure chooser --- src/jalview/gui/StructureChooser.java | 17 ++++++++++++++--- src/jalview/jbgui/GStructureChooser.java | 4 ++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 1c99f02..1b69989 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -22,6 +22,7 @@ package jalview.gui; import jalview.api.structures.JalviewStructureDisplayI; +import jalview.bin.Cache; import jalview.bin.Jalview; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; @@ -108,6 +109,8 @@ public class StructureChooser extends GStructureChooser progressBar = new ProgressBar(this.statusPanel, this.statusBar); } + chk_superpose.setSelected(Cache.getDefault("AUTOSUPERIMPOSE", true)); + // ensure a filter option is in force for search populateFilterComboBox(true, cachedPDBExists); Thread discoverPDBStructuresThread = new Thread(new Runnable() @@ -999,17 +1002,24 @@ public class StructureChooser extends GStructureChooser return foundEntry; } + /** + * @param ssm + * @return targetted structure view (new or existing) configured according to + * superpose checkbox + */ public StructureViewer getTargetedStructureViewer( StructureSelectionManager ssm) { Object _sv = targetView.getSelectedItem(); - + StructureViewer sv; if (_sv == null) { - return new StructureViewer(ssm); + sv = new StructureViewer(ssm); } else { - return (StructureViewer) _sv; + sv = (StructureViewer) _sv; } + sv.setSuperpose(chk_superpose.isSelected()); + return sv; } private StructureViewer launchStructureViewer( StructureSelectionManager ssm, @@ -1020,6 +1030,7 @@ public class StructureChooser extends GStructureChooser setProgressBar(MessageManager .getString("status.launching_3d_structure_viewer"), progressId); final StructureViewer sViewer = getTargetedStructureViewer(ssm); + sViewer.setSuperpose(chk_superpose.isSelected()); setProgressBar(null, progressId); if (SiftsSettings.isMapWithSifts()) diff --git a/src/jalview/jbgui/GStructureChooser.java b/src/jalview/jbgui/GStructureChooser.java index 9c7ba6d..810813b 100644 --- a/src/jalview/jbgui/GStructureChooser.java +++ b/src/jalview/jbgui/GStructureChooser.java @@ -109,6 +109,9 @@ public abstract class GStructureChooser extends JPanel protected JButton btn_pdbFromFile = new JButton(); + protected JCheckBox chk_superpose = new JCheckBox( + MessageManager.getString("label.superpose_structures")); + protected JTextField txt_search = new JTextField(14); private JPanel pnl_actions = new JPanel(new MigLayout()); @@ -524,6 +527,7 @@ public abstract class GStructureChooser extends JPanel pnl_actions.add(chk_rememberSettings); pnl_actions.add(btn_view); pnl_actions.add(btn_cancel); + pnl_actions.add(chk_superpose, "left"); // pnl_filter.add(lbl_result); pnl_main.add(cmb_filterOption); -- 1.7.10.2