From 692665370a03079eee96e3e47482df5e792ee5d0 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Sun, 18 Jan 2015 15:36:14 +0000 Subject: [PATCH] JAL-1628 method to hide insertions to current sequence selection --- src/jalview/gui/PopupMenu.java | 33 +++++++++++++++++++++++++- src/jalview/viewmodel/AlignmentViewport.java | 5 ++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 41cb6b1..b300f5d 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -29,6 +29,7 @@ import jalview.commands.EditCommand.Action; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; +import jalview.datamodel.ColumnSelection; import jalview.datamodel.DBRefEntry; import jalview.datamodel.PDBEntry; import jalview.datamodel.Sequence; @@ -222,6 +223,8 @@ public class PopupMenu extends JPopupMenu JMenu groupLinksMenu; + JMenuItem hideInsertions = new JMenuItem(); + /** * Creates a new PopupMenu object. * @@ -1524,6 +1527,16 @@ public class PopupMenu extends JPopupMenu } }); + hideInsertions.setText(MessageManager.getString("label.hide_insertions")); + hideInsertions.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent e) + { + hideInsertions_actionPerformed(e); + } + }); /* * annotationMenuItem.setText("By Annotation"); * annotationMenuItem.addActionListener(new ActionListener() { public void @@ -1533,7 +1546,11 @@ public class PopupMenu extends JPopupMenu groupMenu.add(sequenceSelDetails); add(groupMenu); add(sequenceMenu); - this.add(structureMenu); + add(structureMenu); + if (sequence!=null) + { + add(hideInsertions); + } // annotations configuration panel suppressed for now // groupMenu.add(chooseAnnotations); @@ -1952,6 +1969,20 @@ protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent) refresh(); } + protected void hideInsertions_actionPerformed(ActionEvent actionEvent) + { + if (sequence != null) + { + ColumnSelection cs = ap.av.getColumnSelection(); + if (cs == null) + { + cs = new ColumnSelection(); + } + cs.hideInsertionsFor(sequence); + ap.av.setColumnSelection(cs); + } + refresh(); + } protected void sequenceSelectionDetails_actionPerformed() { createSequenceDetailsReport(ap.av.getSequenceSelection()); diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 9510c2f..98b8d64 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -649,9 +649,14 @@ public abstract class AlignmentViewport implements AlignViewportI return colSel; } + @Override public void setColumnSelection(ColumnSelection colSel) { this.colSel = colSel; + if (colSel != null) + { + updateHiddenColumns(); + } } /** -- 1.7.10.2