Merge branch 'develop' into features/JAL-2094_colourInterface
[jalview.git] / src / jalview / gui / FeatureSettings.java
index 874ce16..62aba6d 100644 (file)
@@ -28,7 +28,9 @@ import jalview.datamodel.SequenceI;
 import jalview.gui.Help.HelpId;
 import jalview.io.JalviewFileChooser;
 import jalview.schemabinding.version2.JalviewUserColours;
+import jalview.schemes.Colour;
 import jalview.schemes.FeatureColour;
+import jalview.util.ColorUtils;
 import jalview.util.Format;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
@@ -378,7 +380,8 @@ public class FeatureSettings extends JPanel implements
                         "Select new Colour", true, // modal
                         colorChooser, this, // OK button handler
                         null); // no CANCEL button handler
-                colorChooser.setColor(featureColour.getMaxColour());
+                colorChooser.setColor(ColorUtils.getColor(featureColour
+                        .getMaxColour()));
                 dialog.setVisible(true);
               }
             }
@@ -788,7 +791,8 @@ public class FeatureSettings extends JPanel implements
               Cache.log.warn("Couldn't parse out graduated feature color.",
                       e);
             }
-            FeatureColourI gcol = new FeatureColour(mincol, maxcol,
+            FeatureColourI gcol = new FeatureColour(new Colour(mincol),
+                    new Colour(maxcol),
                     newcol.getMin(), newcol.getMax());
             if (newcol.hasAutoScale())
             {
@@ -821,7 +825,7 @@ public class FeatureSettings extends JPanel implements
             Color color = new Color(
                     Integer.parseInt(jucs.getColour(i).getRGB(), 16));
             fr.setColour(name = jucs.getColour(i).getName(),
-                    new FeatureColour(color));
+                    new FeatureColour(new Colour(color)));
           }
           fr.setOrder(name, (i == 0) ? 0 : i / jucs.getColourCount());
         }
@@ -1532,7 +1536,7 @@ public class FeatureSettings extends JPanel implements
       {
         this.setText("");
         this.setIcon(null);
-        newColor = cellColour.getColour();
+        newColor = ColorUtils.getColor(cellColour.getColour());
         setBackground(newColor);
       }
       if (isSelected)
@@ -1610,7 +1614,7 @@ public class FeatureSettings extends JPanel implements
     }
     else
     {
-      Color newColor = gcol.getMaxColour();
+      Color newColor = ColorUtils.getColor(gcol.getMaxColour());
       comp.setBackground(newColor);
       // System.err.println("Width is " + w / 2);
       Icon ficon = new FeatureIcon(gcol, comp.getBackground(), w, h, thr);
@@ -1690,7 +1694,7 @@ class FeatureIcon implements Icon
       g.setColor(backg);
       g.fillRect(0, 0, width, height);
       // need an icon here.
-      g.setColor(gcol.getMaxColour());
+      g.setColor(ColorUtils.getColor(gcol.getMaxColour()));
 
       g.setFont(new Font("Verdana", Font.PLAIN, 9));
 
@@ -1704,7 +1708,7 @@ class FeatureIcon implements Icon
     }
     else
     {
-      Color minCol = gcol.getMinColour();
+      Color minCol = ColorUtils.getColor(gcol.getMinColour());
       g.setColor(minCol);
       g.fillRect(0, 0, s1, height);
       if (midspace)
@@ -1712,7 +1716,7 @@ class FeatureIcon implements Icon
         g.setColor(Color.white);
         g.fillRect(s1, 0, e1 - s1, height);
       }
-      g.setColor(gcol.getMaxColour());
+      g.setColor(ColorUtils.getColor(gcol.getMaxColour()));
       g.fillRect(0, e1, width - e1, height);
     }
   }
@@ -1771,8 +1775,9 @@ class ColorEditor extends AbstractCellEditor implements TableCellEditor,
       if (currentColor.isSimpleColour())
       {
         // bring up simple color chooser
-        button.setBackground(currentColor.getColour());
-        colorChooser.setColor(currentColor.getColour());
+        button.setBackground(ColorUtils.getColor(currentColor.getColour()));
+        colorChooser
+                .setColor(ColorUtils.getColor(currentColor.getColour()));
         dialog.setVisible(true);
       }
       else
@@ -1791,7 +1796,8 @@ class ColorEditor extends AbstractCellEditor implements TableCellEditor,
     { // User pressed dialog's "OK" button.
       if (currentColor.isSimpleColour())
       {
-        currentColor = new FeatureColour(colorChooser.getColor());
+        currentColor = new FeatureColour(
+                new Colour(colorChooser.getColor()));
       }
       else
       {
@@ -1833,7 +1839,7 @@ class ColorEditor extends AbstractCellEditor implements TableCellEditor,
     {
       button.setText("");
       button.setIcon(null);
-      button.setBackground(currentColor.getColour());
+      button.setBackground(ColorUtils.getColor(currentColor.getColour()));
     }
     return button;
   }