JAL-3814 NONEWS property
[jalview.git] / src / jalview / gui / FeatureRenderer.java
index 9c4b009..e22f506 100644 (file)
@@ -180,15 +180,15 @@ public class FeatureRenderer
     final JSpinner end = new JSpinner();
     start.setPreferredSize(new Dimension(80, 20));
     end.setPreferredSize(new Dimension(80, 20));
-    final FeatureRenderer me = this;
     final JLabel colour = new JLabel();
     colour.setOpaque(true);
     // colour.setBorder(BorderFactory.createEtchedBorder());
     colour.setMaximumSize(new Dimension(30, 16));
     colour.addMouseListener(new MouseAdapter()
     {
-      FeatureColourChooser fcc = null;
-
+      /*
+       * open colour chooser on click in colour panel
+       */
       @Override
       public void mousePressed(MouseEvent evt)
       {
@@ -205,28 +205,26 @@ public class FeatureRenderer
         }
         else
         {
-          if (fcc == null)
+          /*
+           * variable colour dialog - on OK, refetch the updated
+           * feature colour and update this display
+           */
+          final String ft = features.get(featureIndex).getType();
+          final String type = ft == null ? lastFeatureAdded : ft;
+          FeatureTypeSettings fcc = new FeatureTypeSettings(
+                  FeatureRenderer.this, type);
+          fcc.setRequestFocusEnabled(true);
+          fcc.requestFocus();
+          fcc.addActionListener(new ActionListener()
           {
-            final String ft = features.get(featureIndex).getType();
-            final String type = ft == null ? lastFeatureAdded : ft;
-            fcc = new FeatureColourChooser(me, type);
-            fcc.setRequestFocusEnabled(true);
-            fcc.requestFocus();
-
-            fcc.addActionListener(new ActionListener()
+            @Override
+            public void actionPerformed(ActionEvent e)
             {
-
-              @Override
-              public void actionPerformed(ActionEvent e)
-              {
-                fcol = fcc.getLastColour();
-                fcc = null;
-                setColour(type, fcol);
-                updateColourButton(mainPanel, colour, fcol);
-              }
-            });
-
-          }
+              fcol = FeatureRenderer.this.getFeatureStyle(ft);
+              setColour(type, fcol);
+              updateColourButton(mainPanel, colour, fcol);
+            }
+          });
         }
       }
     });
@@ -271,8 +269,8 @@ public class FeatureRenderer
             name.setText(sf.getType());
             description.setText(sf.getDescription());
             group.setText(sf.getFeatureGroup());
-            start.setValue(new Integer(sf.getBegin()));
-            end.setValue(new Integer(sf.getEnd()));
+            start.setValue(Integer.valueOf(sf.getBegin()));
+            end.setValue(Integer.valueOf(sf.getEnd()));
 
             SearchResultsI highlight = new SearchResults();
             highlight.addResult(sequences.get(0), sf.getBegin(),
@@ -359,8 +357,8 @@ public class FeatureRenderer
     name.setText(featureType);
     group.setText(featureGroup);
 
-    start.setValue(new Integer(firstFeature.getBegin()));
-    end.setValue(new Integer(firstFeature.getEnd()));
+    start.setValue(Integer.valueOf(firstFeature.getBegin()));
+    end.setValue(Integer.valueOf(firstFeature.getEnd()));
     description.setText(firstFeature.getDescription());
     updateColourButton(mainPanel, colour,
             (oldcol = fcol = getFeatureStyle(featureType)));