From f73031db2e38bfe6e3f1cd42f91b0f9b0130071a Mon Sep 17 00:00:00 2001 From: Charles Ofoegbu Date: Wed, 14 Jan 2015 11:21:57 +0000 Subject: [PATCH] Modified AnnotationColumnChooser to maintain state of previous selection when current operation is canceled --- src/jalview/gui/AnnotationColumnChooser.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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); + } + } } -- 1.7.10.2