Merge branch 'develop' into features/r2_11_2_alphafold/JAL-629
[jalview.git] / src / jalview / gui / AlignFrame.java
index 77c0238..49bd4e9 100644 (file)
@@ -140,6 +140,7 @@ import jalview.io.JnetAnnotationMaker;
 import jalview.io.NewickFile;
 import jalview.io.ScoreMatrixFile;
 import jalview.io.TCoffeeScoreFile;
+import jalview.io.exceptions.ImageOutputException;
 import jalview.io.vcf.VCFLoader;
 import jalview.jbgui.GAlignFrame;
 import jalview.project.Jalview2XML;
@@ -1455,34 +1456,74 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   protected void htmlMenuItem_actionPerformed(ActionEvent e)
   {
     HtmlSvgOutput htmlSVG = new HtmlSvgOutput(alignPanel);
-    htmlSVG.exportHTML(null);
+    try {
+      htmlSVG.exportHTML(null);
+    } catch (ImageOutputException x) {
+      // report problem to console and raise dialog
+    }
   }
 
   @Override
   public void bioJSMenuItem_actionPerformed(ActionEvent e)
   {
     BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel);
+    try {
     bjs.exportHTML(null);
+  } catch (ImageOutputException x) {
+    // report problem to console and raise dialog
+  }
   }
 
   public void createImageMap(File file, String image)
   {
+    try {
     alignPanel.makePNGImageMap(file, image);
+    } catch (ImageOutputException x) {
+      // report problem to console and raise dialog
+    }
   }
 
+  @Override
+  public void createPNG_actionPerformed(ActionEvent e) {
+    try{
+      createPNG(null);
+    } catch (ImageOutputException ioex)
+    {
+      // raise dialog, and report via console
+    }
+  }
+  @Override
+  public void createEPS_actionPerformed(ActionEvent e) {
+    try{
+      createEPS(null);
+    } catch (ImageOutputException ioex)
+    {
+      // raise dialog, and report via console
+    }
+    
+  }
+  @Override
+  public void createSVG_actionPerformed(ActionEvent e) {
+    try{
+      createSVG(null);
+    } catch (ImageOutputException ioex)
+    {
+      // raise dialog, and report via console
+    }
+    
+  }
   /**
    * Creates a PNG image of the alignment and writes it to the given file. If
    * the file is null, the user is prompted to choose a file.
    * 
    * @param f
    */
-  @Override
-  public void createPNG(File f)
+  public void createPNG(File f) throws ImageOutputException
   {
     createPNG(f, null, BitmapImageSizing.nullBitmapImageSizing());
   }
 
-  public void createPNG(File f, String renderer, BitmapImageSizing userBis)
+  public void createPNG(File f, String renderer, BitmapImageSizing userBis) throws ImageOutputException
   {
     alignPanel.makeAlignmentImage(TYPE.PNG, f, renderer, userBis);
   }
@@ -1493,13 +1534,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    * 
    * @param f
    */
-  @Override
-  public void createEPS(File f)
+  public void createEPS(File f)  throws ImageOutputException
   {
     createEPS(f, null);
   }
 
-  public void createEPS(File f, String renderer)
+  public void createEPS(File f, String renderer) throws ImageOutputException
   {
     alignPanel.makeAlignmentImage(TYPE.EPS, f, renderer);
   }
@@ -1510,13 +1550,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    * 
    * @param f
    */
-  @Override
-  public void createSVG(File f)
+  public void createSVG(File f)  throws ImageOutputException
   {
     createSVG(f, null);
   }
 
-  public void createSVG(File f, String renderer)
+  public void createSVG(File f, String renderer) throws ImageOutputException
   {
     alignPanel.makeAlignmentImage(TYPE.SVG, f, renderer);
   }
@@ -4210,10 +4249,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     {
       NewickFile fin = new NewickFile(
               new FileParse(cm.getNewick(), DataSourceType.PASTE));
-      String title = cm.getAnnotLabel() + " " + cm.getTreeMethod() + " tree"
-              + aa.sequenceRef != null
+      String title = aa.label + " "
+              + cm.getTreeMethod() + " tree" + (aa.sequenceRef != null
                       ? (" for " + aa.sequenceRef.getDisplayId(false))
-                      : "";
+                      : "");
 
       showColumnWiseTree(fin, aa, title, w, h, x, y);
     } catch (Throwable xx)
@@ -4233,7 +4272,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       {
         return null;
       }
-      TreePanel tp = new TreePanel(alignPanel, nf, aa, title);
+      TreePanel tp = new TreePanel(alignPanel, nf, aa, treeTitle);
 
       tp.setSize(w, h);
 
@@ -4242,7 +4281,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         tp.setLocation(x, y);
       }
 
-      Desktop.addInternalFrame(tp, title, w, h);
+      Desktop.addInternalFrame(tp, treeTitle, w, h);
       return tp;
     } catch (Throwable xx)
     {