Merge branch 'Release_2_8_0b1_Branch' into try_r20b1_merge
[jalview.git] / src / jalview / gui / AnnotationColourChooser.java
old mode 100755 (executable)
new mode 100644 (file)
index 7c9a118..69b54ea
@@ -31,6 +31,8 @@ import net.miginfocom.swing.MigLayout;
 import jalview.bin.Cache;
 import jalview.datamodel.*;
 import jalview.schemes.*;
+import jalview.util.MessageManager;
+
 import java.awt.Dimension;
 
 public class AnnotationColourChooser extends JPanel
@@ -119,18 +121,19 @@ public class AnnotationColourChooser extends JPanel
     // Always get default shading from preferences.
     setDefaultMinMax();
 
+    adjusting = true;
     if (oldcs instanceof AnnotationColourGradient)
     {
       AnnotationColourGradient acg = (AnnotationColourGradient) oldcs;
-      currentColours.setSelected(acg.predefinedColours);
-      if (!acg.predefinedColours)
+      currentColours.setSelected(acg.isPredefinedColours() || acg.getBaseColour()!=null);
+      if (!acg.isPredefinedColours() && acg.getBaseColour()==null)
       {
         minColour.setBackground(acg.getMinColour());
         maxColour.setBackground(acg.getMaxColour());
       }
       seqAssociated.setSelected(acg.isSeqAssociated());
+      
     }
-    adjusting = true;
     annotations = new JComboBox(
             getAnnotationItems(seqAssociated.isSelected()));
 
@@ -266,7 +269,7 @@ public class AnnotationColourChooser extends JPanel
       }
     });
     ok.setOpaque(false);
-    ok.setText("OK");
+    ok.setText(MessageManager.getString("action.ok"));
     ok.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -275,7 +278,7 @@ public class AnnotationColourChooser extends JPanel
       }
     });
     cancel.setOpaque(false);
-    cancel.setText("Cancel");
+    cancel.setText(MessageManager.getString("action.cancel"));
     cancel.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -284,7 +287,7 @@ public class AnnotationColourChooser extends JPanel
       }
     });
     defColours.setOpaque(false);
-    defColours.setText("Defaults");
+    defColours.setText(MessageManager.getString("action.set_defaults"));
     defColours
             .setToolTipText("Reset min and max colours to defaults from user preferences.");
     defColours.addActionListener(new ActionListener()
@@ -328,7 +331,7 @@ public class AnnotationColourChooser extends JPanel
     thresholdValue.setColumns(7);
     currentColours.setFont(JvSwingUtils.getLabelFont());
     currentColours.setOpaque(false);
-    currentColours.setText("Use Original Colours");
+    currentColours.setText(MessageManager.getString("label.use_original_colours"));
     currentColours.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -338,7 +341,7 @@ public class AnnotationColourChooser extends JPanel
     });
     thresholdIsMin.setBackground(Color.white);
     thresholdIsMin.setFont(JvSwingUtils.getLabelFont());
-    thresholdIsMin.setText("Threshold is Min/Max");
+    thresholdIsMin.setText(MessageManager.getString("label.threshold_minmax"));
     thresholdIsMin.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent actionEvent)
@@ -348,7 +351,7 @@ public class AnnotationColourChooser extends JPanel
     });
     seqAssociated.setBackground(Color.white);
     seqAssociated.setFont(JvSwingUtils.getLabelFont());
-    seqAssociated.setText("Per-sequence only");
+    seqAssociated.setText(MessageManager.getString("label.per_sequence_only"));
     seqAssociated.addActionListener(new ActionListener()
     {
 
@@ -549,7 +552,7 @@ public class AnnotationColourChooser extends JPanel
     if (currentAnnotation.graphMin == 0f
             && currentAnnotation.graphMax == 0f)
     {
-      acg.predefinedColours = true;
+      acg.setPredefinedColours(true);
     }
 
     acg.thresholdIsMinMax = thresholdIsMin.isSelected();