+ /**
+ * Saves the global and group colour schemes as they are when the dialog is
+ * opened, so they can be restored on Cancel. Note we also save the threshold
+ * value for each annotation, in case this gets modified.
+ */
+ void saveInitialState()
+ {
+ oldcs = av.getGlobalColourScheme();
+ if (av.getAlignment().getGroups() != null)
+ {
+ oldgroupColours = new HashMap<>();
+ for (SequenceGroup sg : ap.av.getAlignment().getGroups())
+ {
+ if (sg.getColourScheme() != null)
+ {
+ oldgroupColours.put(sg, sg.getColourScheme());
+ }
+ }
+ }
+
+ /*
+ * save any existing annotation threshold settings; note we make a copy
+ * of each in case the current threshold value gets amended
+ */
+ oldThresholds = new HashMap<>();
+ AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
+ if (anns != null)
+ {
+ for (AlignmentAnnotation ann : anns)
+ {
+ GraphLine thresh = ann.getThreshold();
+ oldThresholds.put(ann,
+ thresh == null ? null : new GraphLine(thresh));
+ }
+ }
+ }
+