patch for JAL-682 - copy over current display settings to the associated viewport...
authorjprocter <Jim Procter>
Fri, 12 Nov 2010 15:55:33 +0000 (15:55 +0000)
committerjprocter <Jim Procter>
Fri, 12 Nov 2010 15:55:33 +0000 (15:55 +0000)
src/jalview/appletgui/FeatureRenderer.java
src/jalview/gui/FeatureRenderer.java

index 6e9da1a..de03c03 100755 (executable)
@@ -84,6 +84,23 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
     featureGroups = fr.featureGroups;
     featureColours = fr.featureColours;
     transparency = fr.transparency;
+    if (av!=null && fr.av!=null && fr.av!=av)
+    {
+      if (fr.av.featuresDisplayed!=null)
+      {
+        if (av.featuresDisplayed==null)
+        {
+          av.featuresDisplayed = new Hashtable();
+        } else {
+          av.featuresDisplayed.clear();
+        }
+        Enumeration en=fr.av.featuresDisplayed.keys();
+        while (en.hasMoreElements())
+        {
+          av.featuresDisplayed.put(en.nextElement(), Boolean.TRUE);
+        }
+      }
+    }
   }
 
   static String lastFeatureAdded;
index 4e72719..021c27e 100755 (executable)
@@ -165,11 +165,37 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
 
   public void transferSettings(FeatureRenderer fr)
   {
-    this.renderOrder = fr.renderOrder;
-    this.featureGroups = fr.featureGroups;
-    this.featureColours = fr.featureColours;
-    this.transparency = fr.transparency;
-    this.featureOrder = fr.featureOrder;
+    FeatureRendererSettings frs = new FeatureRendererSettings(fr);
+    this.renderOrder = frs.renderOrder;
+    this.featureGroups = frs.featureGroups;
+    this.featureColours = frs.featureColours;
+    this.transparency = frs.transparency;
+    this.featureOrder = frs.featureOrder;
+    if (av != null && av!=fr.av)
+    {
+      // copy over the displayed feature settings
+      if (fr.av != null)
+      {
+        if (fr.av.featuresDisplayed != null)
+        {
+          // update display settings
+          if (av.featuresDisplayed == null)
+          {
+            av.featuresDisplayed = new Hashtable(fr.av.featuresDisplayed);
+          }
+          else
+          {
+            av.featuresDisplayed.clear();
+            Enumeration en = fr.av.featuresDisplayed.keys();
+            while (en.hasMoreElements())
+            {
+              av.featuresDisplayed.put(en.nextElement(), Boolean.TRUE);
+            }
+
+          }
+        }
+      }
+    }
   }
 
   BufferedImage offscreenImage;
@@ -229,7 +255,8 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
     }
 
     currentColour = null;
-    // TODO: non-threadsafe - each rendering thread needs its own instance of the feature renderer - or this should be synchronized.
+    // TODO: non-threadsafe - each rendering thread needs its own instance of
+    // the feature renderer - or this should be synchronized.
     offscreenRender = true;
 
     if (offscreenImage != null)