JAL-2401 change 'Lower Case Colour' to checkbox with tooltip
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 9 Feb 2017 10:39:22 +0000 (10:39 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 9 Feb 2017 10:39:22 +0000 (10:39 +0000)
resources/lang/Messages.properties
src/jalview/gui/UserDefinedColours.java
src/jalview/jbgui/GUserDefinedColours.java
src/jalview/schemes/UserColourScheme.java

index c451f07..070dc5f 100644 (file)
@@ -721,7 +721,8 @@ label.mark_unlinked_leaves = Mark Unlinked Leaves
 label.associate_leaves_with = Associate Leaves With
 label.save_colour_scheme_with_unique_name_added_to_colour_menu = Save your colour scheme with a unique name and it will be added to the Colour menu
 label.case_sensitive = Case Sensitive
-label.lower_case_colour = Lower Case Colour
+label.lower_case_colour = Colour All Lower Case
+label.lower_case_tip = Apply colour choice to all lower case symbols
 label.index_by_host = Index by Host
 label.index_by_type = Index by Type
 label.enable_jabaws_services = Enable JABAWS Services
index 10a9687..83a8d24 100755 (executable)
@@ -124,7 +124,6 @@ public class UserDefinedColours extends GUserDefinedColours implements
       {
         caseSensitive.setSelected(true);
         lcaseColour.setEnabled(true);
-        lcaseColour.setForeground(Color.GRAY);
         resetButtonPanel(true);
       }
       else
@@ -283,9 +282,8 @@ public class UserDefinedColours extends GUserDefinedColours implements
       button.setBackground(newColour);
       button.setForeground(ColorUtils.brighterThan(newColour));
     }
-    if (button == lcaseColour)
+    if (lcaseColour.isSelected())
     {
-      button.setForeground(Color.black);
       for (int i = 0; i < lowerCaseButtons.size(); i++)
       {
         button = lowerCaseButtons.get(i);
@@ -636,7 +634,6 @@ public class UserDefinedColours extends GUserDefinedColours implements
     {
       caseSensitive.setSelected(true);
       lcaseColour.setEnabled(true);
-      lcaseColour.setForeground(Color.GRAY);
       resetButtonPanel(true);
       for (int i = 0; i < lowerCaseButtons.size(); i++)
       {
@@ -855,29 +852,5 @@ public class UserDefinedColours extends GUserDefinedColours implements
     boolean selected = caseSensitive.isSelected();
     resetButtonPanel(selected);
     lcaseColour.setEnabled(selected);
-    lcaseColour.setForeground(Color.GRAY);
-  }
-
-  /**
-   * Action on clicking 'Lower case colour', which results in changing colour of
-   * all lower-case buttons when a colour is picked. A second click of the
-   * button turns off this behaviour.
-   */
-  @Override
-  public void lcaseColour_actionPerformed(ActionEvent e)
-  {
-    boolean enable = !selectedButtons.contains(lcaseColour);
-    selectedButtons.clear();
-    if (enable)
-    {
-      selectedButtons.add(lcaseColour);
-      lcaseColour.setForeground(lowerCaseButtons.get(0).getForeground());
-      lcaseColour.setForeground(Color.black);
-    }
-    else
-    {
-      lcaseColour.setBackground(Color.white);
-      lcaseColour.setForeground(Color.gray);
-    }
   }
 }
index fe20baf..aa5319c 100755 (executable)
@@ -104,7 +104,7 @@ public class GUserDefinedColours extends JPanel
 
   protected JCheckBox caseSensitive = new JCheckBox();
 
-  protected JButton lcaseColour = new JButton();
+  protected JCheckBox lcaseColour = new JCheckBox();
 
   protected List<JButton> selectedButtons;
 
@@ -223,14 +223,8 @@ public class GUserDefinedColours extends JPanel
     });
     lcaseColour
             .setText(MessageManager.getString("label.lower_case_colour"));
-    lcaseColour.addActionListener(new ActionListener()
-    {
-      @Override
-      public void actionPerformed(ActionEvent e)
-      {
-        lcaseColour_actionPerformed(e);
-      }
-    });
+    lcaseColour.setToolTipText(MessageManager
+            .getString("label.lower_case_tip"));
 
     saveLoadPanel.add(savebutton);
     saveLoadPanel.add(loadbutton);
index 85bf54e..8e58c20 100755 (executable)
@@ -73,7 +73,7 @@ public class UserColourScheme extends ResidueColourScheme
     schemeName = from.schemeName;
     if (from.lowerCaseColours != null)
     {
-      lowerCaseColours = new Color[lowerCaseColours.length];
+      lowerCaseColours = new Color[from.lowerCaseColours.length];
       System.arraycopy(from.lowerCaseColours, 0, lowerCaseColours, 0,
               from.lowerCaseColours.length);
     }