JAL-4090 JAL-1551 spotlessApply
[jalview.git] / src / jalview / gui / AnnotationColourChooser.java
index d898398..965770c 100644 (file)
@@ -73,9 +73,11 @@ public class AnnotationColourChooser extends AnnotationRowFilter
 
   public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap)
   {
-    this(av,ap,null);
+    this(av, ap, null);
   }
-  public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap,AnnotationColourGradient initSettings)
+
+  public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap,
+          AnnotationColourGradient initSettings)
   {
     super(av, ap);
     oldcs = av.getGlobalColourScheme();
@@ -110,15 +112,17 @@ public class AnnotationColourChooser extends AnnotationRowFilter
     setDefaultMinMax();
 
     adjusting = true;
-    if (oldcs instanceof AnnotationColourGradient && initSettings==null)
+    if (oldcs instanceof AnnotationColourGradient && initSettings == null)
     {
       // init from oldcs
       initialiseFrom((AnnotationColourGradient) oldcs);
-    } else {
+    }
+    else
+    {
       // use initial colour gradient - if any..
       initialiseFrom(initSettings);
     }
-    
+
     jbInit();
     adjusting = false;
 
@@ -126,12 +130,13 @@ public class AnnotationColourChooser extends AnnotationRowFilter
     frame.invalidate();
     frame.pack();
   }
+
   private void initialiseFrom(AnnotationColourGradient acg)
   {
-    if (acg!=null)
+    if (acg != null)
     {
       useOriginalColours.setSelected(
-            acg.isPredefinedColours() || acg.getBaseColour() != null);
+              acg.isPredefinedColours() || acg.getBaseColour() != null);
       if (!acg.isPredefinedColours() && acg.getBaseColour() == null)
       {
         minColour.setBackground(acg.getMinColour());
@@ -146,10 +151,11 @@ public class AnnotationColourChooser extends AnnotationRowFilter
 
     populateThresholdComboBox(threshold);
 
-    if (acg!=null)
+    if (acg != null)
     {
       String label = getAnnotationMenuLabel(acg.getAnnotation());
-      // TODO: workaround below shouldn't be necessary - there's a bug in getAnnotationMenuLabel!
+      // TODO: workaround below shouldn't be necessary - there's a bug in
+      // getAnnotationMenuLabel!
       if (acg.isSeqAssociated())
       {
         label = acg.getAnnotation().label;
@@ -375,8 +381,7 @@ public class AnnotationColourChooser extends AnnotationRowFilter
       return;
     }
 
-    int selIndex = annotations
-            .getSelectedIndex();
+    int selIndex = annotations.getSelectedIndex();
     int annIndex = annmap[selIndex];
     setCurrentAnnotation(
             av.getAlignment().getAlignmentAnnotation()[annIndex]);
@@ -475,26 +480,34 @@ public class AnnotationColourChooser extends AnnotationRowFilter
    * @param av
    * @param ap
    * @param alignmentAnnotation
-   * @param perseq - when true, enable per-sequence if alignment annotation is per sequence 
+   * @param perseq
+   *          - when true, enable per-sequence if alignment annotation is per
+   *          sequence
    */
   public static void displayFor(AlignViewport av, AlignmentPanel ap,
           AlignmentAnnotation alignmentAnnotation, boolean perSeq)
   {
     ColourSchemeI global = av.getGlobalColourScheme();
-    AnnotationColourGradient newCS = new AnnotationColourGradient(alignmentAnnotation, global, alignmentAnnotation.threshold!=null ? AnnotationColourGradient.ABOVE_THRESHOLD:AnnotationColourGradient.NO_THRESHOLD);
-    if (alignmentAnnotation.sequenceRef!=null)
+    AnnotationColourGradient newCS = new AnnotationColourGradient(
+            alignmentAnnotation, global,
+            alignmentAnnotation.threshold != null
+                    ? AnnotationColourGradient.ABOVE_THRESHOLD
+                    : AnnotationColourGradient.NO_THRESHOLD);
+    if (alignmentAnnotation.sequenceRef != null)
     {
       newCS.setSeqAssociated(perSeq);
     }
-    for (int i=0;i<alignmentAnnotation.annotations.length;i++)
+    for (int i = 0; i < alignmentAnnotation.annotations.length; i++)
     {
       Annotation ann = alignmentAnnotation.annotations[i];
-      if (ann!=null && ann.colour!=null && !ann.colour.equals(Color.white))
+      if (ann != null && ann.colour != null
+              && !ann.colour.equals(Color.white))
       {
         newCS.setPredefinedColours(true);
         break;
       }
     }
-    AnnotationColourChooser achooser = new AnnotationColourChooser(av,ap,newCS);
+    AnnotationColourChooser achooser = new AnnotationColourChooser(av, ap,
+            newCS);
   }
 }