JAL-1663 apply new colour correctly; source formatting
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 18 May 2015 12:38:41 +0000 (13:38 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 18 May 2015 12:38:41 +0000 (13:38 +0100)
src/jalview/appletgui/FeatureRenderer.java

index 9751514..4536b1a 100644 (file)
  */
 package jalview.appletgui;
 
-import java.util.*;
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Choice;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.ScrollPane;
+import java.awt.TextArea;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Hashtable;
+
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
 import jalview.schemes.AnnotationColourGradient;
 import jalview.schemes.GraduatedColor;
 import jalview.util.MessageManager;
 import jalview.viewmodel.AlignmentViewport;
-import jalview.viewmodel.seqfeatures.FeaturesDisplayed;
 
 /**
  * DOCUMENT ME!
@@ -37,7 +51,8 @@ import jalview.viewmodel.seqfeatures.FeaturesDisplayed;
  * @author $author$
  * @version $Revision$
  */
-public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRenderer
+public class FeatureRenderer extends
+        jalview.renderer.seqfeatures.FeatureRenderer
 {
 
   // Holds web links for feature groups and feature types
@@ -55,7 +70,8 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere
     super();
     this.av = av;
 
-    setTransparencyAvailable(!System.getProperty("java.version").startsWith("1.1"));
+    setTransparencyAvailable(!System.getProperty("java.version")
+            .startsWith("1.1"));
   }
 
   static String lastFeatureAdded;
@@ -101,7 +117,9 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere
       }
       else
       {
-        throw new Error(MessageManager.getString("error.invalid_colour_for_mycheckbox"));
+        throw new Error(
+                MessageManager
+                        .getString("error.invalid_colour_for_mycheckbox"));
       }
       if (col != null)
       {
@@ -198,7 +216,9 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere
                 + "-" + features[i].getEnd();
 
         if (features[i].getFeatureGroup() != null)
+        {
           item += " (" + features[i].getFeatureGroup() + ")";
+        }
 
         overlaps.addItem(item);
       }
@@ -303,8 +323,11 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere
       }
     }
 
-    String title = newFeatures ? MessageManager.getString("label.create_new_sequence_features")
-            : MessageManager.formatMessage("label.amend_delete_features", new String[]{sequences[0].getName()});
+    String title = newFeatures ? MessageManager
+            .getString("label.create_new_sequence_features")
+            : MessageManager.formatMessage("label.amend_delete_features",
+                    new String[]
+                    { sequences[0].getName() });
 
     final JVDialog dialog = new JVDialog(ap.alignFrame, title, true, 385,
             240);
@@ -377,7 +400,9 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere
     }
 
     if (lastFeatureGroupAdded != null && lastFeatureGroupAdded.length() < 1)
+    {
       lastFeatureGroupAdded = null;
+    }
 
     if (!newFeatures)
     {
@@ -402,7 +427,8 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere
         }
 
         ffile.parseDescriptionHTML(sf, false);
-        setVisible(lastFeatureAdded); // if user edited name then make sure new type is visible
+        setVisible(lastFeatureAdded); // if user edited name then make sure new
+                                      // type is visible
       }
       if (deleteFeature)
       {
@@ -423,16 +449,16 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere
           ffile.parseDescriptionHTML(features[i], false);
         }
 
-        col = colourPanel.getBackground();
+        Color newColour = colourPanel.getBackground();
         // setColour(lastFeatureAdded, fcol);
 
         if (lastFeatureGroupAdded != null)
         {
           setGroupVisibility(lastFeatureGroupAdded, true);
         }
-        setColour(lastFeatureAdded, fcol);
+        setColour(lastFeatureAdded, newColour); // was fcol
         setVisible(lastFeatureAdded);
-        findAllFeatures(false); // different to original applet behaviour ? 
+        findAllFeatures(false); // different to original applet behaviour ?
         // findAllFeatures();
       }
       else