From: Charles Ofoegbu Date: Wed, 14 Jan 2015 11:21:57 +0000 (+0000) Subject: Modified AnnotationColumnChooser to maintain state of previous selection when current... X-Git-Tag: Jalview_2_9~118^2 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=refs%2Fheads%2Ffeatures%2FJAL-1553_select-columns-by-annotation Modified AnnotationColumnChooser to maintain state of previous selection when current operation is canceled --- diff --git a/src/jalview/gui/AnnotationColumnChooser.java b/src/jalview/gui/AnnotationColumnChooser.java index 4abf49d..87e2d78 100644 --- a/src/jalview/gui/AnnotationColumnChooser.java +++ b/src/jalview/gui/AnnotationColumnChooser.java @@ -1,5 +1,6 @@ package jalview.gui; +import jalview.datamodel.ColumnSelection; import jalview.schemes.AnnotationColourGradient; import jalview.util.MessageManager; @@ -21,6 +22,8 @@ import net.miginfocom.swing.MigLayout; public class AnnotationColumnChooser extends AnnotationRowFilter { + private ColumnSelection oldColumnSelection; + private JComboBox annotations; JButton ok = new JButton(); @@ -51,7 +54,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter { return; } - + setOldColumnSelection(av.getColumnSelection()); adjusting = true; setAnnotations(new JComboBox( @@ -196,6 +199,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter public void reset() { av.getColumnSelection().clear(); + av.setColumnSelection(this.getOldColumnSelection()); } public void valueChanged(boolean updateAllAnnotation) @@ -288,4 +292,18 @@ public class AnnotationColumnChooser extends AnnotationRowFilter ap.alignmentChanged(); ap.paintAlignment(true); } + + public ColumnSelection getOldColumnSelection() + { + return oldColumnSelection; + } + + public void setOldColumnSelection(ColumnSelection currentColumnSelection) + { + if (currentColumnSelection != null) + { + this.oldColumnSelection = new ColumnSelection(); + this.oldColumnSelection.setElementsFrom(currentColumnSelection); + } + } }