JAL-3878 update branch from 2.12 merge from 2.11.2
[jalview.git] / src / jalview / gui / AnnotationColourChooser.java
index ad013f5..477fd6a 100644 (file)
@@ -66,6 +66,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
   JPanel maxColour = new JPanel();
 
   private JCheckBox thresholdIsMin = new JCheckBox();
+  private JCheckBox transparency = new JCheckBox();
 
   protected static final int MIN_WIDTH = 500;
 
@@ -145,8 +146,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
                 "error.implementation_error_dont_know_about_threshold_setting"));
       }
       thresholdIsMin.setSelected(acg.isThresholdIsMinMax());
-      thresholdValue
-              .setText(String.valueOf(acg.getAnnotationThreshold()));
+      thresholdValue.setText(String.valueOf(acg.getAnnotationThreshold()));
     }
 
     jbInit();
@@ -246,6 +246,19 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       }
     });
 
+    transparency.setBackground(Color.white);
+    transparency.setFont(JvSwingUtils.getLabelFont());
+    transparency
+            .setText(MessageManager.getString("Use Transparency"));
+    transparency.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent arg0)
+      {
+        transparency_actionPerformed();
+      }
+    });
     this.setLayout(new BorderLayout());
     JPanel jPanel1 = new JPanel();
     JPanel jPanel2 = new JPanel();
@@ -258,6 +271,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
     jPanel2.add(annotations, "grow, wrap");
     jPanel2.add(seqAssociated);
     jPanel2.add(useOriginalColours);
+    jPanel2.add(transparency);
     JPanel colpanel = new JPanel(new FlowLayout());
     colpanel.setBackground(Color.white);
     colpanel.add(minColour);
@@ -273,6 +287,10 @@ public class AnnotationColourChooser extends AnnotationRowFilter
     this.validate();
   }
 
+  protected void transparency_actionPerformed()
+  {
+    updateView();
+  }
   protected void resetColours_actionPerformed()
   {
     setDefaultMinMax();
@@ -300,7 +318,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
         updateView();
       }
     };
-    JalviewColourChooser.showColourChooser(Desktop.getDesktop(), ttl,
+    JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(), ttl,
             colourPanel.getBackground(), listener);
   }
 
@@ -426,6 +444,8 @@ public class AnnotationColourChooser extends AnnotationRowFilter
 
     acg.setThresholdIsMinMax(thresholdIsMin.isSelected());
 
+    acg.setPositionToTransparency(transparency.isSelected());
+    
     this.ap.alignFrame.changeColour(acg);
 
     if (av.getAlignment().getGroups() != null)
@@ -437,8 +457,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
         {
           continue;
         }
-        sg.setColourScheme(
-                acg.getInstance(av, sg));
+        sg.setColourScheme(acg.getInstance(av, sg));
       }
     }
   }