Can add features with no group
authoramwaterhouse <Andrew Waterhouse>
Wed, 11 Apr 2007 13:02:43 +0000 (13:02 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 11 Apr 2007 13:02:43 +0000 (13:02 +0000)
src/jalview/gui/FeatureRenderer.java

index cd188d2..c59ec1d 100755 (executable)
@@ -777,16 +777,17 @@ public class FeatureRenderer
 
     jalview.io.FeaturesFile ffile = new jalview.io.FeaturesFile();
 
-    if (reply == JOptionPane.OK_OPTION
-        && name.getText() != null
-        && source.getText() != null)
+    if (reply == JOptionPane.OK_OPTION && name.getText().length()>0)
     {
       // This ensures that the last sequence
       // is refreshed and new features are rendered
       lastSeq = null;
-      lastFeatureAdded = name.getText();
-      lastFeatureGroupAdded = source.getText();
+      lastFeatureAdded = name.getText().trim();
+      lastFeatureGroupAdded = source.getText().trim();
       lastDescriptionAdded = description.getText().replaceAll("\n", " ");
+
+      if(lastFeatureGroupAdded.length()<1)
+        lastFeatureGroupAdded = null;
     }
 
     if (!newFeatures)
@@ -839,14 +840,16 @@ public class FeatureRenderer
           featureGroups = new Hashtable();
         }
 
-        featureGroups.put(lastFeatureGroupAdded, new Boolean(true));
 
         Color col = colour.getBackground();
         setColour(lastFeatureAdded, colour.getBackground());
 
-        av.featuresDisplayed.put(lastFeatureGroupAdded,
-                                 new Integer(col.getRGB()));
-
+        if(lastFeatureGroupAdded!=null)
+        {
+          featureGroups.put(lastFeatureGroupAdded, new Boolean(true));
+          av.featuresDisplayed.put(lastFeatureGroupAdded,
+                                   new Integer(col.getRGB()));
+        }
         findAllFeatures();
 
         return true;