Merge branch 'develop' into
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 12 Feb 2016 14:11:34 +0000 (14:11 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 12 Feb 2016 14:11:34 +0000 (14:11 +0000)
features/JAL-653_JAL-1766_htslib_refseqsupport

Conflicts:
resources/lang/Messages.properties
src/jalview/gui/FeatureColourChooser.java

13 files changed:
resources/lang/Messages.properties
src/MCview/PDBViewer.java
src/jalview/ext/rbvi/chimera/ChimeraCommands.java
src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignmentPanel.java
src/jalview/gui/AppJmol.java
src/jalview/gui/Desktop.java
src/jalview/gui/FeatureColourChooser.java
src/jalview/gui/PCAPanel.java
src/jalview/io/BioJsHTMLOutput.java
src/jalview/io/HtmlSvgOutput.java
src/jalview/util/ImageMaker.java

index a33b810..c4d1098 100644 (file)
@@ -1145,7 +1145,7 @@ status.finished_searching_for_sequences_from = Finished searching for sequences
 label.eps_file = EPS file
 label.png_image = PNG image
 status.saving_file = Saving {0}
-status.export_complete = Export complete.
+status.export_complete = {0} Export completed.
 status.fetching_pdb = Fetching PDB {0}
 status.refreshing_news = Refreshing news
 status.importing_vamsas_session_from = Importing VAMSAS session from {0}
@@ -1284,3 +1284,7 @@ exception.pdb_server_unreachable = Jalview is unable to reach the PDBe Solr serv
 label.nw_mapping = Needleman & Wunsch Alignment
 label.sifts_mapping = SIFTs Mapping
 label.mapping_method = Sequence \u27f7 Structure mapping method
+label.mapping_method = Sequence \u27f7 Structure mapping method
+status.waiting_for_user_to_select_output_file = Waiting for user to select {0} file.
+status.cancelled_image_export_operation = Cancelled {0} export operation.
+info.error_creating_file = Error creating {0} file.
\ No newline at end of file
index e1324d2..309a0e1 100755 (executable)
@@ -145,6 +145,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     Desktop.addInternalFrame(this, title.toString(), 400, 400);
   }
 
+  @Override
   public void run()
   {
     try
@@ -169,6 +170,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
   {
     this.addKeyListener(new KeyAdapter()
     {
+      @Override
       public void keyPressed(KeyEvent evt)
       {
         pdbcanvas.keyPressed(evt);
@@ -183,6 +185,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     png.setText("PNG");
     png.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         png_actionPerformed(e);
@@ -191,6 +194,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     eps.setText("EPS");
     eps.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         eps_actionPerformed(e);
@@ -199,6 +203,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     mapping.setText(MessageManager.getString("label.view_mapping"));
     mapping.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         mapping_actionPerformed(e);
@@ -207,6 +212,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     wire.setText(MessageManager.getString("label.wireframe"));
     wire.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         wire_actionPerformed(e);
@@ -216,6 +222,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     depth.setText(MessageManager.getString("label.depthcue"));
     depth.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         depth_actionPerformed(e);
@@ -225,6 +232,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     zbuffer.setText(MessageManager.getString("label.z_buffering"));
     zbuffer.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         zbuffer_actionPerformed(e);
@@ -233,6 +241,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     charge.setText(MessageManager.getString("label.charge_cysteine"));
     charge.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         charge_actionPerformed(e);
@@ -241,6 +250,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     chain.setText(MessageManager.getString("action.by_chain"));
     chain.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         chain_actionPerformed(e);
@@ -250,6 +260,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     seqButton.setText(MessageManager.getString("action.by_sequence"));
     seqButton.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         seqButton_actionPerformed(e);
@@ -259,6 +270,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     allchains.setText(MessageManager.getString("label.show_all_chains"));
     allchains.addItemListener(new ItemListener()
     {
+      @Override
       public void itemStateChanged(ItemEvent e)
       {
         allchains_itemStateChanged(e);
@@ -267,6 +279,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     zappo.setText(MessageManager.getString("label.zappo"));
     zappo.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         zappo_actionPerformed(e);
@@ -275,6 +288,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     taylor.setText(MessageManager.getString("label.taylor"));
     taylor.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         taylor_actionPerformed(e);
@@ -283,6 +297,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     hydro.setText(MessageManager.getString("label.hydrophobicity"));
     hydro.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         hydro_actionPerformed(e);
@@ -291,6 +306,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     helix.setText(MessageManager.getString("label.helix_propensity"));
     helix.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         helix_actionPerformed(e);
@@ -299,6 +315,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     strand.setText(MessageManager.getString("label.strand_propensity"));
     strand.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         strand_actionPerformed(e);
@@ -307,6 +324,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     turn.setText(MessageManager.getString("label.turn_propensity"));
     turn.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         turn_actionPerformed(e);
@@ -315,6 +333,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     buried.setText(MessageManager.getString("label.buried_index"));
     buried.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         buried_actionPerformed(e);
@@ -323,6 +342,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     user.setText(MessageManager.getString("action.user_defined"));
     user.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         user_actionPerformed(e);
@@ -333,6 +353,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
             .setText(MessageManager.getString("action.background_colour"));
     background.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         background_actionPerformed(e);
@@ -341,6 +362,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
     savePDB.setText(MessageManager.getString("label.pdb_file"));
     savePDB.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         savePDB_actionPerformed(e);
@@ -391,6 +413,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
         radioItem.setName("USER_DEFINED");
         radioItem.addMouseListener(new MouseAdapter()
         {
+          @Override
           public void mousePressed(MouseEvent evt)
           {
             if (evt.isControlDown()
@@ -415,6 +438,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
               {
                 radioItem.addActionListener(new ActionListener()
                 {
+                  @Override
                   public void actionPerformed(ActionEvent evt)
                   {
                     user_actionPerformed(evt);
@@ -426,6 +450,7 @@ public class PDBViewer extends JInternalFrame implements Runnable
         });
         radioItem.addActionListener(new ActionListener()
         {
+          @Override
           public void actionPerformed(ActionEvent evt)
           {
             user_actionPerformed(evt);
@@ -525,20 +550,20 @@ public class PDBViewer extends JInternalFrame implements Runnable
     {
       im = new jalview.util.ImageMaker(this,
               jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from view",
-              width, height, null, null);
+              width, height, null, null, null, 0, false);
     }
     else if (type == jalview.util.ImageMaker.TYPE.EPS)
     {
       im = new jalview.util.ImageMaker(this,
               jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from view",
-              width, height, null, this.getTitle());
+              width, height, null, this.getTitle(), null, 0, false);
     }
     else
     {
 
       im = new jalview.util.ImageMaker(this,
               jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA",
-              width, height, null, this.getTitle());
+              width, height, null, this.getTitle(), null, 0, false);
     }
 
     if (im.getGraphics() != null)
index 5342dc8..a551ca2 100644 (file)
@@ -232,7 +232,7 @@ public class ChimeraCommands
               addColourRange(colourMap, lastColour, pdbfnum, startPos,
                       lastPos, lastChain);
             }
-            break;
+            // break;
           }
         }
       }
index 368918b..eee8bca 100644 (file)
@@ -831,6 +831,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
     }
     StringBuilder atomSpecs = new StringBuilder();
     boolean first = true;
+
     for (AtomSpec atom : atoms)
     {
       int pdbResNum = atom.getPdbResNum();
@@ -839,13 +840,9 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
       List<ChimeraModel> cms = chimeraMaps.get(pdbfile);
       if (cms != null && !cms.isEmpty())
       {
-        /*
-         * Formatting as #0:34.A,#1:33.A doesn't work as desired, so instead we
-         * concatenate multiple 'show' commands
-         */
-        atomSpecs.append(first ? "" : ";show ");
+        atomSpecs.append(first ? "" : ",");
         first = false;
-        atomSpecs.append("#" + cms.get(0).getModelNumber());
+        atomSpecs.append(cms.get(0).getModelNumber());
         atomSpecs.append(":" + pdbResNum);
         if (!chain.equals(" "))
         {
@@ -867,7 +864,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
     viewerCommandHistory(false);
     if (atomSpec.length() > 0)
     {
-      command.append("show ").append(atomSpec);
+      command.append("show #").append(atomSpec);
       viewer.sendChimeraCommand(command.toString(), false);
     }
     viewerCommandHistory(true);
@@ -994,6 +991,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
    */
   public abstract void refreshGUI();
 
+  @Override
   public void setLoadingFromArchive(boolean loadingFromArchive)
   {
     this.loadingFromArchive = loadingFromArchive;
@@ -1004,6 +1002,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
    * @return true if Chimeral is still restoring state or loading is still going
    *         on (see setFinsihedLoadingFromArchive)
    */
+  @Override
   public boolean isLoadingFromArchive()
   {
     return loadingFromArchive && !loadingFinished;
@@ -1015,6 +1014,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
    * 
    * @param finishedLoading
    */
+  @Override
   public void setFinishedLoadingFromArchive(boolean finishedLoading)
   {
     loadingFinished = finishedLoading;
index c047780..85f7d19 100644 (file)
@@ -1370,7 +1370,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   @Override
   public void bioJSMenuItem_actionPerformed(ActionEvent e)
   {
-    BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel);
+    BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel, this);
     bjs.exportJalviewAlignmentAsBioJsHtmlFile();
   }
 
index 4d49bc2..f06ca94 100644 (file)
@@ -137,6 +137,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
     final AlignmentPanel ap = this;
     av.addPropertyChangeListener(new PropertyChangeListener()
     {
+      @Override
       public void propertyChange(PropertyChangeEvent evt)
       {
         if (evt.getPropertyName().equals("alignment"))
@@ -509,6 +510,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
    * automatically adjust annotation panel height for new annotation whilst
    * ensuring the alignment is still visible.
    */
+  @Override
   public void adjustAnnotationHeight()
   {
     // TODO: display vertical annotation scrollbar if necessary
@@ -749,6 +751,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void adjustmentValueChanged(AdjustmentEvent evt)
   {
     int oldX = av.getStartRes();
@@ -782,6 +785,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
           // as preference setting
           SwingUtilities.invokeLater(new Runnable()
           {
+            @Override
             public void run()
             {
               setScrollValues(av.getStartRes(), av.getStartSeq());
@@ -852,6 +856,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
    * Repaint the alignment including the annotations and overview panels (if
    * shown).
    */
+  @Override
   public void paintAlignment(boolean updateOverview)
   {
     final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
@@ -878,6 +883,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
    * @param g
    *          DOCUMENT ME!
    */
+  @Override
   public void paintComponent(Graphics g)
   {
     invalidate();
@@ -936,6 +942,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
    * @throws PrinterException
    *           DOCUMENT ME!
    */
+  @Override
   public int print(Graphics pg, PageFormat pf, int pi)
           throws PrinterException
   {
@@ -1262,14 +1269,17 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
   void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file)
   {
-    long progress = System.currentTimeMillis();
+    long pSessionId = System.currentTimeMillis();
     headless = (System.getProperty("java.awt.headless") != null && System
             .getProperty("java.awt.headless").equals("true"));
     if (alignFrame != null && !headless)
     {
-      alignFrame.setProgressBar(MessageManager.formatMessage(
+      if (file != null)
+      {
+        alignFrame.setProgressBar(MessageManager.formatMessage(
               "status.saving_file", new Object[] { type.getLabel() }),
-              progress);
+                pSessionId);
+      }
     }
     try
     {
@@ -1296,7 +1306,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
         im = new jalview.util.ImageMaker(this, type, imageAction,
                 aDimension.getWidth(), aDimension.getHeight(), file,
-                imageTitle);
+                imageTitle, alignFrame, pSessionId, headless);
         if (av.getWrapAlignment())
         {
           if (im.getGraphics() != null)
@@ -1315,6 +1325,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
             im.writeImage();
           }
         }
+
       } catch (OutOfMemoryError err)
       {
         // Be noisy here.
@@ -1328,12 +1339,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
       }
     } finally
     {
-      if (alignFrame != null && !headless)
-      {
-        alignFrame.setProgressBar(
-                MessageManager.getString("status.export_complete"),
-                progress);
-      }
+
     }
   }
 
index e497d1a..a1846bc 100644 (file)
@@ -398,6 +398,7 @@ public class AppJmol extends StructureViewerBase
             MessageManager.getString("label.all"));
     menuItem.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent evt)
       {
         allChainsSelected = true;
@@ -420,6 +421,7 @@ public class AppJmol extends StructureViewerBase
       menuItem = new JCheckBoxMenuItem(chain, true);
       menuItem.addItemListener(new ItemListener()
       {
+        @Override
         public void itemStateChanged(ItemEvent evt)
         {
           if (!allChainsSelected)
@@ -452,6 +454,7 @@ public class AppJmol extends StructureViewerBase
     jmb.centerViewer(toshow);
   }
 
+  @Override
   public void closeViewer(boolean closeExternalViewer)
   {
     // Jmol does not use an external viewer
@@ -468,6 +471,7 @@ public class AppJmol extends StructureViewerBase
     jmb = null;
   }
 
+  @Override
   public void run()
   {
     _started = true;
@@ -631,6 +635,7 @@ public class AppJmol extends StructureViewerBase
       {
         javax.swing.SwingUtilities.invokeLater(new Runnable()
         {
+          @Override
           public void run()
           {
             if (jmb.viewer.isScriptExecuting())
@@ -753,20 +758,20 @@ public class AppJmol extends StructureViewerBase
     {
       im = new jalview.util.ImageMaker(this,
               jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from view",
-              width, height, null, null);
+              width, height, null, null, null, 0, false);
     }
     else if (type == jalview.util.ImageMaker.TYPE.EPS)
     {
       im = new jalview.util.ImageMaker(this,
               jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from view",
-              width, height, null, this.getTitle());
+              width, height, null, this.getTitle(), null, 0, false);
     }
     else
     {
 
       im = new jalview.util.ImageMaker(this,
               jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA",
-              width, height, null, this.getTitle());
+              width, height, null, this.getTitle(), null, 0, false);
     }
 
     if (im.getGraphics() != null)
@@ -1070,6 +1075,7 @@ public class AppJmol extends StructureViewerBase
 
   }
 
+  @Override
   public void setJalviewColourScheme(ColourSchemeI ucs)
   {
     jmb.setJalviewColourScheme(ucs);
index a10ec4e..8f0d210 100644 (file)
@@ -189,6 +189,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       this.delegate = delegate;
     }
 
+    @Override
     public void activateFrame(JInternalFrame f)
     {
       try
@@ -201,31 +202,37 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       }
     }
 
+    @Override
     public void beginDraggingFrame(JComponent f)
     {
       delegate.beginDraggingFrame(f);
     }
 
+    @Override
     public void beginResizingFrame(JComponent f, int direction)
     {
       delegate.beginResizingFrame(f, direction);
     }
 
+    @Override
     public void closeFrame(JInternalFrame f)
     {
       delegate.closeFrame(f);
     }
 
+    @Override
     public void deactivateFrame(JInternalFrame f)
     {
       delegate.deactivateFrame(f);
     }
 
+    @Override
     public void deiconifyFrame(JInternalFrame f)
     {
       delegate.deiconifyFrame(f);
     }
 
+    @Override
     public void dragFrame(JComponent f, int newX, int newY)
     {
       if (newY < 0)
@@ -235,31 +242,37 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       delegate.dragFrame(f, newX, newY);
     }
 
+    @Override
     public void endDraggingFrame(JComponent f)
     {
       delegate.endDraggingFrame(f);
     }
 
+    @Override
     public void endResizingFrame(JComponent f)
     {
       delegate.endResizingFrame(f);
     }
 
+    @Override
     public void iconifyFrame(JInternalFrame f)
     {
       delegate.iconifyFrame(f);
     }
 
+    @Override
     public void maximizeFrame(JInternalFrame f)
     {
       delegate.maximizeFrame(f);
     }
 
+    @Override
     public void minimizeFrame(JInternalFrame f)
     {
       delegate.minimizeFrame(f);
     }
 
+    @Override
     public void openFrame(JInternalFrame f)
     {
       delegate.openFrame(f);
@@ -276,6 +289,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       delegate.resizeFrame(f, newX, newY, newWidth, newHeight);
     }
 
+    @Override
     public void setBoundsForFrame(JComponent f, int newX, int newY,
             int newWidth, int newHeight)
     {
@@ -356,6 +370,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
     this.addWindowListener(new WindowAdapter()
     {
+      @Override
       public void windowClosing(WindowEvent evt)
       {
         quit();
@@ -365,6 +380,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     MouseAdapter ma;
     this.addMouseListener(ma = new MouseAdapter()
     {
+      @Override
       public void mousePressed(MouseEvent evt)
       {
         if (SwingUtilities.isRightMouseButton(evt))
@@ -397,6 +413,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     // Spawn a thread that shows the splashscreen
     SwingUtilities.invokeLater(new Runnable()
     {
+      @Override
       public void run()
       {
         new SplashScreen();
@@ -408,6 +425,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     // takes to open it later on.
     new Thread(new Runnable()
     {
+      @Override
       public void run()
       {
         Cache.log.debug("Filechooser init thread started.");
@@ -579,16 +597,19 @@ public class Desktop extends jalview.jbgui.GDesktop implements
         // reselected again.
         boolean refresh = true;
 
+        @Override
         public void menuCanceled(MenuEvent e)
         {
           refresh = true;
         }
 
+        @Override
         public void menuDeselected(MenuEvent e)
         {
           refresh = true;
         }
 
+        @Override
         public void menuSelected(MenuEvent e)
         {
           if (refresh)
@@ -609,6 +630,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
             MessageManager.getString("label.paste_new_window"));
     item.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent evt)
       {
         paste();
@@ -772,6 +794,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     final JMenuItem menuItem = new JMenuItem(title);
     frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
     {
+      @Override
       public void internalFrameActivated(
               javax.swing.event.InternalFrameEvent evt)
       {
@@ -783,6 +806,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
       }
 
+      @Override
       public void internalFrameClosed(
               javax.swing.event.InternalFrameEvent evt)
       {
@@ -800,6 +824,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
     menuItem.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         try
@@ -872,6 +897,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
   }
 
+  @Override
   public void lostOwnership(Clipboard clipboard, Transferable contents)
   {
     if (!internalCopy)
@@ -882,14 +908,17 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     internalCopy = false;
   }
 
+  @Override
   public void dragEnter(DropTargetDragEvent evt)
   {
   }
 
+  @Override
   public void dragExit(DropTargetEvent evt)
   {
   }
 
+  @Override
   public void dragOver(DropTargetDragEvent evt)
   {
   }
@@ -905,6 +934,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void drop(DropTargetDropEvent evt)
   {
     boolean success = true;
@@ -1212,6 +1242,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     // message.toString(), "About Jalview", JOptionPane.INFORMATION_MESSAGE);
     new Thread(new Runnable()
     {
+      @Override
       public void run()
       {
         new SplashScreen(true);
@@ -1522,6 +1553,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
       new Thread(new Runnable()
       {
+        @Override
         public void run()
         {
           // TODO: refactor to Jalview desktop session controller action.
@@ -1593,6 +1625,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
               selectedFile.getParent());
       new Thread(new Runnable()
       {
+        @Override
         public void run()
         {
           setProgressBar(
@@ -2112,6 +2145,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
           sessit.addActionListener(new ActionListener()
           {
 
+            @Override
             public void actionPerformed(ActionEvent e)
             {
               if (dsktp.v_client == null)
@@ -2119,6 +2153,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
                 Thread rthr = new Thread(new Runnable()
                 {
 
+                  @Override
                   public void run()
                   {
                     dsktp.v_client = new VamsasApplication(dsktp, mysesid);
@@ -2291,6 +2326,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       return showMemoryUsage;
     }
 
+    @Override
     public void run()
     {
       df = java.text.NumberFormat.getNumberInstance();
@@ -2365,6 +2401,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       groovyShell.setText(MessageManager.getString("label.groovy_console"));
       groovyShell.addActionListener(new ActionListener()
       {
+        @Override
         public void actionPerformed(ActionEvent e)
         {
           groovyShell_actionPerformed();
@@ -2503,6 +2540,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * 
    * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
    */
+  @Override
   public void setProgressBar(String message, long id)
   {
     if (progressBars == null)
@@ -2532,6 +2570,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * @see jalview.gui.IProgressIndicator#registerHandler(long,
    * jalview.gui.IProgressIndicatorHandler)
    */
+  @Override
   public void registerHandler(final long id,
           final IProgressIndicatorHandler handler)
   {
@@ -2552,6 +2591,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       cancel.addActionListener(new ActionListener()
       {
 
+        @Override
         public void actionPerformed(ActionEvent e)
         {
           handler.cancelActivity(id);
@@ -2710,6 +2750,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
             // only run if we aren't already displaying one of these.
             addDialogThread(serviceChangedDialog = new Runnable()
             {
+              @Override
               public void run()
               {
 
@@ -2793,6 +2834,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   {
     new Thread(new Runnable()
     {
+      @Override
       public void run()
       {
         try
@@ -2891,6 +2933,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   {
     dialogExecutor.submit(new Runnable()
     {
+      @Override
       public void run()
       {
         if (dialogPause)
@@ -2934,7 +2977,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     ImageMaker im = new jalview.util.ImageMaker(this, ImageMaker.TYPE.EPS,
             "View of Desktop", getWidth(), getHeight(), of = new File(
                     "Jalview_snapshot" + System.currentTimeMillis()
-                            + ".eps"), "View of desktop");
+                            + ".eps"), "View of desktop", null, 0, false);
     try
     {
       paintAll(im.getGraphics());
index 4f5e7ea..064d58b 100644 (file)
@@ -76,9 +76,11 @@ public class FeatureColourChooser extends JalviewDialog
 
   boolean adjusting = false;
 
-  private float min;
+  final private float min;
 
-  private float max;
+  final private float max;
+
+  final private float scaleFactor;
 
   String type = null;
 
@@ -107,7 +109,7 @@ public class FeatureColourChooser extends JalviewDialog
       {
         if (!adjusting)
         {
-          thresholdValue.setText((slider.getValue() / 1000f) + "");
+          thresholdValue.setText((slider.getValue() / scaleFactor) + "");
           valueChanged();
         }
       }
@@ -128,6 +130,14 @@ public class FeatureColourChooser extends JalviewDialog
     float mm[] = ((float[][]) fr.getMinMax().get(type))[0];
     min = mm[0];
     max = mm[1];
+
+    /*
+     * ensure scale factor allows a scaled range with
+     * 10 integer divisions ('ticks'); if we have got here,
+     * we should expect that max != min
+     */
+    scaleFactor = (max == min) ? 1f : 100f / (max - min);
+
     oldcs = fr.getFeatureColours().get(type);
     if (oldcs instanceof GraduatedColor)
     {
@@ -185,17 +195,6 @@ public class FeatureColourChooser extends JalviewDialog
     waitForInput();
   }
 
-  public FeatureColourChooser()
-  {
-    try
-    {
-      jbInit();
-    } catch (Exception ex)
-    {
-      ex.printStackTrace();
-    }
-  }
-
   private void jbInit() throws Exception
   {
 
@@ -441,11 +440,11 @@ public class FeatureColourChooser extends JalviewDialog
       adjusting = true;
       acg.setThresh(threshline.value);
 
-      float range = max * 1000f - min * 1000f;
+      float range = (max - min) * scaleFactor;
 
-      slider.setMinimum((int) (min * 1000));
-      slider.setMaximum((int) (max * 1000));
-      slider.setValue((int) (threshline.value * 1000));
+      slider.setMinimum((int) (min * scaleFactor));
+      slider.setMaximum((int) (max * scaleFactor));
+      slider.setValue((int) (threshline.value * scaleFactor));
       thresholdValue.setText(threshline.value + "");
       slider.setMajorTickSpacing((int) (range / 10f));
       slider.setEnabled(true);
@@ -545,7 +544,7 @@ public class FeatureColourChooser extends JalviewDialog
     try
     {
       float f = Float.parseFloat(thresholdValue.getText());
-      slider.setValue((int) (f * 1000));
+      slider.setValue((int) (f * scaleFactor));
       threshline.value = f;
     } catch (NumberFormatException ex)
     {
@@ -554,7 +553,7 @@ public class FeatureColourChooser extends JalviewDialog
 
   public void valueChanged()
   {
-    threshline.value = slider.getValue() / 1000f;
+    threshline.value = slider.getValue() / scaleFactor;
     cs.setThresh(threshline.value);
     changeColour();
     ap.paintAlignment(false);
index b6e5b94..47add28 100644 (file)
@@ -167,6 +167,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     }
   }
 
+  @Override
   public void bgcolour_actionPerformed(ActionEvent e)
   {
     Color col = JColorChooser.showDialog(this,
@@ -183,6 +184,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
   /**
    * DOCUMENT ME!
    */
+  @Override
   public void run()
   {
     long progId = System.currentTimeMillis();
@@ -288,6 +290,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void xCombobox_actionPerformed(ActionEvent e)
   {
     doDimensionChange();
@@ -299,6 +302,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void yCombobox_actionPerformed(ActionEvent e)
   {
     doDimensionChange();
@@ -310,11 +314,13 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void zCombobox_actionPerformed(ActionEvent e)
   {
     doDimensionChange();
   }
 
+  @Override
   public void outputValues_actionPerformed(ActionEvent e)
   {
     CutAndPasteTransfer cap = new CutAndPasteTransfer();
@@ -330,17 +336,20 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     }
   }
 
+  @Override
   public void showLabels_actionPerformed(ActionEvent e)
   {
     rc.showLabels(showLabels.getState());
   }
 
+  @Override
   public void print_actionPerformed(ActionEvent e)
   {
     PCAPrinter printer = new PCAPrinter();
     printer.start();
   }
 
+  @Override
   public void originalSeqData_actionPerformed(ActionEvent e)
   {
     // this was cut'n'pasted from the equivalent TreePanel method - we should
@@ -414,6 +423,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
 
   class PCAPrinter extends Thread implements Printable
   {
+    @Override
     public void run()
     {
       PrinterJob printJob = PrinterJob.getPrinterJob();
@@ -433,6 +443,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
       }
     }
 
+    @Override
     public int print(Graphics pg, PageFormat pf, int pi)
             throws PrinterException
     {
@@ -462,6 +473,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void eps_actionPerformed(ActionEvent e)
   {
     makePCAImage(jalview.util.ImageMaker.TYPE.EPS);
@@ -473,6 +485,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void png_actionPerformed(ActionEvent e)
   {
     makePCAImage(jalview.util.ImageMaker.TYPE.PNG);
@@ -489,19 +502,19 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     {
       im = new jalview.util.ImageMaker(this,
               jalview.util.ImageMaker.TYPE.PNG, "Make PNG image from PCA",
-              width, height, null, null);
+              width, height, null, null, null, 0, false);
     }
     else if (type == jalview.util.ImageMaker.TYPE.EPS)
     {
       im = new jalview.util.ImageMaker(this,
               jalview.util.ImageMaker.TYPE.EPS, "Make EPS file from PCA",
-              width, height, null, this.getTitle());
+              width, height, null, this.getTitle(), null, 0, false);
     }
     else
     {
       im = new jalview.util.ImageMaker(this,
               jalview.util.ImageMaker.TYPE.SVG, "Make SVG file from PCA",
-              width, height, null, this.getTitle());
+              width, height, null, this.getTitle(), null, 0, false);
 
     }
 
@@ -517,6 +530,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     }
   }
 
+  @Override
   public void viewMenu_menuSelected()
   {
     buildAssociatedViewMenu();
@@ -552,6 +566,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
       buttonGroup.add(item);
       item.addActionListener(new ActionListener()
       {
+        @Override
         public void actionPerformed(ActionEvent evt)
         {
           rc.applyToAllViews = false;
@@ -571,6 +586,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     itemf.setSelected(rc.applyToAllViews);
     itemf.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent evt)
       {
         rc.applyToAllViews = itemf.isSelected();
@@ -587,6 +603,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * jalview.jbgui.GPCAPanel#outputPoints_actionPerformed(java.awt.event.ActionEvent
    * )
    */
+  @Override
   protected void outputPoints_actionPerformed(ActionEvent e)
   {
     CutAndPasteTransfer cap = new CutAndPasteTransfer();
@@ -612,6 +629,7 @@ public class PCAPanel extends GPCAPanel implements Runnable,
    * jalview.jbgui.GPCAPanel#outputProjPoints_actionPerformed(java.awt.event
    * .ActionEvent)
    */
+  @Override
   protected void outputProjPoints_actionPerformed(ActionEvent e)
   {
     CutAndPasteTransfer cap = new CutAndPasteTransfer();
index ac29d8e..f8fa1f5 100644 (file)
@@ -24,6 +24,8 @@ import jalview.api.AlignExportSettingI;
 import jalview.api.AlignmentViewPanel;
 import jalview.datamodel.AlignmentExportData;
 import jalview.exceptions.NoFileSelectedException;
+import jalview.gui.IProgressIndicator;
+import jalview.gui.OOMWarning;
 import jalview.json.binding.biojs.BioJSReleasePojo;
 import jalview.json.binding.biojs.BioJSRepositoryPojo;
 import jalview.util.MessageManager;
@@ -44,6 +46,12 @@ public class BioJsHTMLOutput
 {
   private AlignmentViewPanel ap;
 
+  private long pSessionId;
+
+  private IProgressIndicator pIndicator;
+
+  private boolean headless;
+
   private static File currentBJSTemplateFile;
 
   private static TreeMap<String, File> bioJsMSAVersions;
@@ -59,20 +67,25 @@ public class BioJsHTMLOutput
                   "biojs_template_git_repo",
                   "https://raw.githubusercontent.com/jalview/exporter-templates/master/biojs/package.json");
 
-  public BioJsHTMLOutput(AlignmentViewPanel ap)
+  public BioJsHTMLOutput(AlignmentViewPanel ap,
+          IProgressIndicator pIndicator)
   {
     if (ap != null)
     {
       this.ap = ap;
+      this.pSessionId = System.currentTimeMillis();
+      this.pIndicator = pIndicator;
+      this.headless = (System.getProperty("java.awt.headless") != null && System
+              .getProperty("java.awt.headless").equals("true"));
     }
   }
 
   public void exportJalviewAlignmentAsBioJsHtmlFile()
   {
+    String outputFile = null;
     try
     {
-      String outputFile = getOutputFile();
-      // String jalviewAlignmentJson = JSONFile.getJSONData(ap);
+      outputFile = getOutputFile();
       AlignExportSettingI exportSettings = new AlignExportSettingI()
       {
         @Override
@@ -131,11 +144,23 @@ public class BioJsHTMLOutput
       out.flush();
       out.close();
       jalview.util.BrowserLauncher.openURL("file:///" + outputFile);
+      if (pIndicator != null && !headless)
+      {
+        pIndicator.setProgressBar(MessageManager.formatMessage(
+                "status.export_complete", "BioJS"), pSessionId);
+      }
     } catch (NoFileSelectedException ex)
     {
       // do noting if no file was selected
+    } catch (OutOfMemoryError err)
+    {
+      System.out.println("########################\n" + "OUT OF MEMORY "
+              + outputFile + "\n" + "########################");
+      new OOMWarning("Creating Image for " + outputFile, err);
     } catch (Exception e)
     {
+      pIndicator.setProgressBar(MessageManager.formatMessage(
+              "info.error_creating_file", "HTML"), pSessionId);
       e.printStackTrace();
     }
   }
@@ -143,6 +168,13 @@ public class BioJsHTMLOutput
   public String getOutputFile() throws NoFileSelectedException
   {
     String selectedFile = null;
+    if (pIndicator != null && !headless)
+    {
+      pIndicator.setProgressBar(MessageManager.formatMessage(
+              "status.waiting_for_user_to_select_output_file", "HTML"),
+              pSessionId);
+    }
+
     JalviewFileChooser jvFileChooser = new JalviewFileChooser(
             jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
             new String[] { "html" }, new String[] { "HTML files" },
@@ -162,6 +194,9 @@ public class BioJsHTMLOutput
     }
     else
     {
+      pIndicator.setProgressBar(MessageManager.formatMessage(
+              "status.cancelled_image_export_operation", "BioJS"),
+              pSessionId);
       throw new NoFileSelectedException("No file was selected.");
     }
     return selectedFile;
@@ -245,6 +280,7 @@ public class BioJsHTMLOutput
   {
     Thread updateThread = new Thread()
     {
+      @Override
       public void run()
       {
         try
index 6c2faca..e554b8e 100644 (file)
@@ -27,6 +27,8 @@ import jalview.datamodel.SequenceI;
 import jalview.gui.AlignViewport;
 import jalview.gui.AlignmentPanel;
 import jalview.gui.HTMLOptions;
+import jalview.gui.IProgressIndicator;
+import jalview.gui.OOMWarning;
 import jalview.math.AlignmentDimension;
 import jalview.util.MessageManager;
 
@@ -59,11 +61,20 @@ public class HtmlSvgOutput
 
   public void generateHtmlSvgOutput(File file)
   {
+    IProgressIndicator pIndicator = ap.alignFrame;
+    long pSessionId = System.currentTimeMillis();
     try
     {
+      boolean headless = (System.getProperty("java.awt.headless") != null && System
+              .getProperty("java.awt.headless").equals("true"));
       if (file == null)
       {
-
+        if (pIndicator != null && !headless)
+        {
+          pIndicator.setProgressBar(MessageManager.formatMessage(
+                  "status.waiting_for_user_to_select_output_file", "HTML"),
+                  pSessionId);
+        }
         JalviewFileChooser chooser = getHTMLChooser();
         chooser.setFileView(new jalview.io.JalviewFileView());
         chooser.setDialogTitle(ap.alignFrame.getTitle());
@@ -78,6 +89,13 @@ public class HtmlSvgOutput
         }
         else
         {
+
+          if (pIndicator != null && !headless)
+        {
+            pIndicator.setProgressBar(MessageManager.formatMessage(
+                    "status.cancelled_image_export_operation", "HTML"),
+                    pSessionId);
+          }
           return;
         }
       }
@@ -182,9 +200,21 @@ public class HtmlSvgOutput
       {
         jalview.util.BrowserLauncher.openURL("file:///" + file);
       }
+      if (pIndicator != null && !headless)
+      {
+        pIndicator.setProgressBar(MessageManager.formatMessage(
+                "status.export_complete", "HTML"), pSessionId);
+      }
+    } catch (OutOfMemoryError err)
+    {
+      System.out.println("########################\n" + "OUT OF MEMORY "
+              + file + "\n" + "########################");
+      new OOMWarning("Creating Image for " + file, err);
     } catch (Exception e)
     {
       e.printStackTrace();
+      pIndicator.setProgressBar(MessageManager.formatMessage(
+              "info.error_creating_file", "HTML"), pSessionId);
     }
   }
 
index e1543bf..b7aa4ca 100755 (executable)
@@ -22,6 +22,7 @@ package jalview.util;
 
 import jalview.bin.Jalview;
 import jalview.gui.EPSOptions;
+import jalview.gui.IProgressIndicator;
 import jalview.gui.SVGOptions;
 import jalview.io.JalviewFileChooser;
 
@@ -90,12 +91,20 @@ public class ImageMaker
   }
 
   public ImageMaker(Component parent, TYPE type, String title, int width,
-          int height, File file, String fileTitle)
+          int height, File file, String fileTitle,
+          IProgressIndicator pIndicator, long pSessionId, boolean headless)
   {
     this.type = type;
 
     if (file == null)
     {
+      if (pIndicator != null && !headless)
+      {
+        pIndicator.setProgressBar(
+                MessageManager.formatMessage(
+                        "status.waiting_for_user_to_select_output_file",
+                        type.name), pSessionId);
+      }
       JalviewFileChooser chooser;
       chooser = type.getChooser();
       chooser.setFileView(new jalview.io.JalviewFileView());
@@ -109,6 +118,15 @@ public class ImageMaker
                 .getSelectedFile().getParent());
         file = chooser.getSelectedFile();
       }
+      else
+      {
+        if (pIndicator != null && !headless)
+        {
+          pIndicator.setProgressBar(MessageManager.formatMessage(
+                  "status.cancelled_image_export_operation", type.name),
+                  pSessionId);
+        }
+      }
     }
 
     if (file != null)
@@ -128,10 +146,19 @@ public class ImageMaker
         {
           setupPNG(width, height);
         }
-
+        if (pIndicator != null && !headless)
+        {
+          pIndicator.setProgressBar(
+MessageManager.formatMessage(
+                  "status.export_complete", type.getName()),
+                  pSessionId);
+        }
       } catch (Exception ex)
       {
         System.out.println("Error creating " + type.getName() + " file.");
+
+        pIndicator.setProgressBar(MessageManager.formatMessage(
+                "info.error_creating_file", type.getName()), pSessionId);
       }
     }
   }