Merge branch 'develop' into bug/JAL-2255_seq-fetcher-broken-on-linux
[jalview.git] / src / jalview / gui / TreeCanvas.java
index 0e513f7..9a38d4c 100755 (executable)
@@ -549,7 +549,16 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
   public void run()
   {
     PrinterJob printJob = PrinterJob.getPrinterJob();
-    PageFormat pf = printJob.pageDialog(printJob.defaultPage());
+    PageFormat defaultPage = printJob.defaultPage();
+    PageFormat pf = printJob.pageDialog(defaultPage);
+
+    if (defaultPage == pf)
+    {
+      /*
+       * user cancelled
+       */
+      return;
+    }
 
     printJob.setPrintable(this, pf);
 
@@ -997,17 +1006,21 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
         }
         else
         {
-          cs = ColourSchemeProperty.getColour(sg, ColourSchemeProperty
-                  .getColourName(av.getGlobalColourScheme()));
+          cs = ColourSchemeProperty.getColourScheme(sg,
+                  ColourSchemeProperty.getColourName(av
+                          .getGlobalColourScheme()));
         }
         // cs is null if shading is an annotationColourGradient
-        if (cs != null)
-        {
-          cs.setThreshold(av.getGlobalColourScheme().getThreshold(),
-                  av.isIgnoreGapsConsensus());
-        }
+        // if (cs != null)
+        // {
+        // cs.setThreshold(av.getViewportColourScheme().getThreshold(),
+        // av.isIgnoreGapsConsensus());
+        // }
       }
-      sg.cs = cs;
+      sg.setColourScheme(cs);
+      sg.getGroupColourScheme().setThreshold(
+              av.getResidueShading().getThreshold(),
+              av.isIgnoreGapsConsensus());
       // sg.recalcConservation();
       sg.setName("JTreeGroup:" + sg.hashCode());
       sg.setIdColour(col);
@@ -1015,10 +1028,11 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
       for (int a = 0; a < aps.length; a++)
       {
         if (aps[a].av.getGlobalColourScheme() != null
-                && aps[a].av.getGlobalColourScheme().conservationApplied())
+                && aps[a].av.getResidueShading()
+                        .conservationApplied())
         {
-          Conservation c = new Conservation("Group", 3,
-                  sg.getSequences(null), sg.getStartRes(), sg.getEndRes());
+          Conservation c = new Conservation("Group", sg.getSequences(null),
+                  sg.getStartRes(), sg.getEndRes());
           c.calculate();
           c.verdict(false, aps[a].av.getConsPercGaps());
           sg.cs.setConservation(c);