From 6d1f6d9f50eb9beca568907bd90bda54a133986a Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 4 May 2016 16:04:26 +0100 Subject: [PATCH] JAL-2092 hide columns with/without feature --- resources/lang/Messages.properties | 2 + src/jalview/appletgui/FeatureSettings.java | 72 ++++++++++++++++++++++++++++ src/jalview/gui/FeatureSettings.java | 24 +++++++++- 3 files changed, 96 insertions(+), 2 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index be5f040..8dac5c6 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -801,6 +801,8 @@ label.wswublast_client_credits = To display sequence features an exact Uniprot i label.blasting_for_unidentified_sequence = BLASTing for unidentified sequences label.select_columns_containing = Select columns containing label.select_columns_not_containing = Select columns that do not contain +label.hide_columns_containing = Hide columns containing +label.hide_columns_not_containing = Hide columns that do not contain option.trim_retrieved_seqs = Trim retrieved sequences label.trim_retrieved_sequences = When the reference sequence is longer than the sequence that you are working with, only keep the relevant subsequences. label.use_sequence_id_1 = Use $SEQUENCE_ID$ or $SEQUENCE_ID=//=$ diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java index bef6437..7ae318c 100755 --- a/src/jalview/appletgui/FeatureSettings.java +++ b/src/jalview/appletgui/FeatureSettings.java @@ -222,6 +222,7 @@ public class FeatureSettings extends Panel implements ItemListener, }); men.add(dens); + if (minmax != null) { final float[][] typeMinMax = minmax.get(type); @@ -267,6 +268,57 @@ public class FeatureSettings extends Panel implements ItemListener, }); } } + + MenuItem selectContaining = new MenuItem( + MessageManager.getString("label.select_columns_containing")); + selectContaining.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + me.ap.alignFrame.avc.markColumnsContainingFeatures(false, false, + false, type); + } + }); + men.add(selectContaining); + + MenuItem selectNotContaining = new MenuItem( + MessageManager.getString("label.select_columns_not_containing")); + selectNotContaining.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + me.ap.alignFrame.avc.markColumnsContainingFeatures(true, false, + false, type); + } + }); + men.add(selectNotContaining); + + MenuItem hideContaining = new MenuItem( + MessageManager.getString("label.hide_columns_containing")); + hideContaining.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + hideFeatureColumns(type, true); + } + }); + men.add(hideContaining); + + MenuItem hideNotContaining = new MenuItem( + MessageManager.getString("label.hide_columns_not_containing")); + hideNotContaining.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + hideFeatureColumns(type, false); + } + }); + men.add(hideNotContaining); + this.featurePanel.add(men); men.show(this.featurePanel, x, y); } @@ -778,4 +830,24 @@ public class FeatureSettings extends Panel implements ItemListener, { } + /** + * Hide columns containing (or not containing) a given feature type + * + * @param type + * @param columnsContaining + */ + void hideFeatureColumns(final String type, + boolean columnsContaining) + { + if (ap.alignFrame.avc.markColumnsContainingFeatures( + columnsContaining, false, false, type)) + { + if (ap.alignFrame.avc.markColumnsContainingFeatures( + !columnsContaining, false, false, type)) + { + ap.alignFrame.viewport.hideSelectedColumns(); + } + } + } + } diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 6633156..40635c0 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -394,7 +394,6 @@ public class FeatureSettings extends JPanel implements MessageManager.getString("label.select_columns_containing")); selCols.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent arg0) { @@ -406,7 +405,6 @@ public class FeatureSettings extends JPanel implements MessageManager.getString("label.select_columns_not_containing")); clearCols.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent arg0) { @@ -414,8 +412,30 @@ public class FeatureSettings extends JPanel implements false, type); } }); + JMenuItem hideCols = new JMenuItem( + MessageManager.getString("label.hide_columns_containing")); + hideCols.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent arg0) + { + fr.ap.alignFrame.hideFeatureColumns(type, true); + } + }); + JMenuItem hideOtherCols = new JMenuItem( + MessageManager.getString("label.hide_columns_not_containing")); + hideOtherCols.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent arg0) + { + fr.ap.alignFrame.hideFeatureColumns(type, false); + } + }); men.add(selCols); men.add(clearCols); + men.add(hideCols); + men.add(hideOtherCols); men.show(table, x, y); } -- 1.7.10.2