From: gmungoc Date: Mon, 4 Mar 2019 15:17:17 +0000 (+0000) Subject: JAL-3083 another try: restore original GraphLines with original values X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=refs%2Fheads%2Fbug%2FJAL-3083cancelAnnotationColour JAL-3083 another try: restore original GraphLines with original values --- diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index b29a1dd..2b7d678 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -63,7 +63,9 @@ public class AnnotationColourChooser extends AnnotationRowFilter private Map oldgroupColours; - private Map oldThresholds; + private Map oldGraphLines; + + private Map oldThresholds; private JCheckBox useOriginalColours = new JCheckBox(); @@ -183,6 +185,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter * save any existing annotation threshold settings; note we make a copy * of each in case the current threshold value gets amended */ + oldGraphLines = new HashMap<>(); oldThresholds = new HashMap<>(); AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation(); if (anns != null) @@ -190,8 +193,11 @@ public class AnnotationColourChooser extends AnnotationRowFilter for (AlignmentAnnotation ann : anns) { GraphLine thresh = ann.getThreshold(); - oldThresholds.put(ann, - thresh == null ? null : new GraphLine(thresh)); + oldGraphLines.put(ann, thresh); + if (thresh != null) + { + oldThresholds.put(thresh, thresh.value); + } } } } @@ -364,10 +370,15 @@ public class AnnotationColourChooser extends AnnotationRowFilter sg.setColourScheme(oldgroupColours.get(sg)); } } - for (Entry entry : oldThresholds + for (Entry entry : oldGraphLines .entrySet()) { - entry.getKey().setThreshold(entry.getValue()); + GraphLine graphLine = entry.getValue(); + entry.getKey().setThreshold(graphLine); + if (graphLine != null) + { + graphLine.value = oldThresholds.get(graphLine).floatValue(); + } } }