JAL-3187 reset ViewStyle on Cancel in FeatureSettings
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 18 Feb 2019 09:19:14 +0000 (09:19 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 18 Feb 2019 09:19:14 +0000 (09:19 +0000)
src/jalview/gui/FeatureSettings.java
src/jalview/viewmodel/styles/ViewStyle.java

index 9dbeb8a..47c0cc5 100644 (file)
@@ -23,6 +23,7 @@ package jalview.gui;
 import jalview.api.AlignViewportI;
 import jalview.api.FeatureColourI;
 import jalview.api.FeatureSettingsControllerI;
+import jalview.api.ViewStyleI;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.features.FeatureMatcherI;
@@ -35,6 +36,7 @@ import jalview.schemes.FeatureColour;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
 import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean;
+import jalview.viewmodel.styles.ViewStyle;
 import jalview.xml.binding.jalview.JalviewUserColours;
 import jalview.xml.binding.jalview.JalviewUserColours.Colour;
 import jalview.xml.binding.jalview.JalviewUserColours.Filter;
@@ -140,6 +142,8 @@ public class FeatureSettings extends JPanel
 
   private float originalTransparency;
 
+  private ViewStyleI originalViewStyle;
+
   private Map<String, FeatureMatcherSetI> originalFilters;
 
   final JInternalFrame frame;
@@ -197,6 +201,7 @@ public class FeatureSettings extends JPanel
     transparency.setMaximum(100 - originalTransparencyAsPercent);
 
     originalFilters = new HashMap<>(fr.getFeatureFilters()); // shallow copy
+    originalViewStyle = new ViewStyle(af.viewport.getViewStyle());
 
     try
     {
@@ -1207,6 +1212,7 @@ public class FeatureSettings extends JPanel
         fr.setTransparency(originalTransparency);
         fr.setFeatureFilters(originalFilters);
         updateFeatureRenderer(originalData);
+        af.getViewport().setViewStyle(originalViewStyle);
         close();
       }
     });
index 7fa1e39..91f2f0c 100644 (file)
@@ -214,6 +214,7 @@ public class ViewStyle implements ViewStyleI
     setShowSequenceFeaturesHeight(vs.isShowSequenceFeaturesHeight());
     setShowSequenceFeatures(vs.isShowSequenceFeatures());
     setShowComplementFeatures(vs.isShowComplementFeatures());
+    setShowComplementFeaturesOnTop(vs.isShowComplementFeaturesOnTop());
     setShowText(vs.getShowText());
     setShowUnconserved(vs.getShowUnconserved());
     setTextColour(vs.getTextColour());
@@ -277,6 +278,8 @@ public class ViewStyle implements ViewStyleI
                     .isShowSequenceFeaturesHeight()
             && isShowSequenceFeatures() == vs.isShowSequenceFeatures()
             && isShowComplementFeatures() == vs.isShowComplementFeatures()
+            && isShowComplementFeaturesOnTop() == vs
+                    .isShowComplementFeaturesOnTop()
             && getShowText() == vs.getShowText()
             && getShowUnconserved() == vs.getShowUnconserved()
             && getThreshold() == vs.getThreshold()