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/?a=commitdiff_plain;h=f73031db2e38bfe6e3f1cd42f91b0f9b0130071a;p=jalview.git 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); + } + } }