featureGroups not null
[jalview.git] / src / jalview / gui / FeatureRenderer.java
index 04324ac..4c4be5c 100755 (executable)
@@ -49,7 +49,7 @@ public class FeatureRenderer
 
   // A higher level for grouping features of a
   // particular type
-  Hashtable featureGroups = null;
+  Hashtable featureGroups = new Hashtable();
 
   // This is actually an Integer held in the hashtable,
   // Retrieved using the key feature type
@@ -119,7 +119,7 @@ public class FeatureRenderer
       }
     }
 
-    if (sequenceFeatures == null)
+    if (sequenceFeatures == null || sfSize==0)
     {
       return initialCol;
     }
@@ -196,9 +196,10 @@ public class FeatureRenderer
   SequenceFeature[] sequenceFeatures;
   int sfSize, sfindex, spos, epos;
 
-  public void drawSequence(Graphics g, SequenceI seq,
+  synchronized public void drawSequence(Graphics g, SequenceI seq,
                            int start, int end, int y1)
   {
+
     if (seq.getDatasetSequence().getSequenceFeatures() == null
         || seq.getDatasetSequence().getSequenceFeatures().length == 0)
     {
@@ -221,7 +222,6 @@ public class FeatureRenderer
       }
 
       sequenceFeatures = seq.getDatasetSequence().getSequenceFeatures();
-      sfSize = sequenceFeatures.length;
     }
 
     if (lastSeq == null || seq != lastSeq
@@ -229,7 +229,6 @@ public class FeatureRenderer
     {
       lastSeq = seq;
       sequenceFeatures = seq.getDatasetSequence().getSequenceFeatures();
-      sfSize = sequenceFeatures.length;
     }
 
     if (transparency != 1 && g != null)
@@ -246,6 +245,7 @@ public class FeatureRenderer
       epos = lastSeq.findPosition(end);
     }
 
+    sfSize = sequenceFeatures.length;
     String type;
     for (int renderIndex = 0; renderIndex < renderOrder.length; renderIndex++)
     {
@@ -260,10 +260,6 @@ public class FeatureRenderer
       // current feature to render
       for (sfindex = 0; sfindex < sfSize; sfindex++)
       {
-        if (sequenceFeatures.length <= sfindex)
-        {
-          continue;
-        }
         if (!sequenceFeatures[sfindex].type.equals(type))
         {
           continue;
@@ -459,6 +455,7 @@ public class FeatureRenderer
       {
         if (!av.featuresDisplayed.containsKey(features[index].getType()))
         {
+
           if(featureGroups.containsKey(features[index].getType()))
           {
             boolean visible = ( (Boolean) featureGroups.get(