From e1767448d422ab26a6920bae2173804eda662e31 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Tue, 9 Feb 2016 11:56:17 +0000 Subject: [PATCH] JAL-1975 updated image export pipeline to produce more informative messages. --- resources/lang/Messages.properties | 7 ++++-- src/MCview/PDBViewer.java | 31 +++++++++++++++++++++--- src/jalview/gui/AlignmentPanel.java | 26 ++++++++++++-------- src/jalview/gui/AppJmol.java | 12 +++++++--- src/jalview/gui/Desktop.java | 45 ++++++++++++++++++++++++++++++++++- src/jalview/gui/PCAPanel.java | 24 ++++++++++++++++--- src/jalview/util/ImageMaker.java | 31 ++++++++++++++++++++++-- 7 files changed, 152 insertions(+), 24 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index ec5f592..db6cdad 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1143,7 +1143,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} @@ -1281,4 +1281,7 @@ exception.pdb_server_error = There seems to be an error from the PDB server exception.pdb_server_unreachable = Jalview is unable to reach the PDBe Solr server. \nPlease ensure that you are connected to the internet and try again. label.nw_mapping = Needleman & Wunsch Alignment label.sifts_mapping = SIFTs Mapping -label.mapping_method = Sequence \u27f7 Structure mapping method \ No newline at end of file +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 diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java index e1324d2..309a0e1 100755 --- a/src/MCview/PDBViewer.java +++ b/src/MCview/PDBViewer.java @@ -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) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 4d49bc2..f06ca94 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -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); - } + } } diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index e497d1a..a1846bc 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -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); diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index d3b8afc..8ba21e5 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -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()); diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index b6e5b94..47add28 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -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(); diff --git a/src/jalview/util/ImageMaker.java b/src/jalview/util/ImageMaker.java index e1543bf..b7aa4ca 100755 --- a/src/jalview/util/ImageMaker.java +++ b/src/jalview/util/ImageMaker.java @@ -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); } } } -- 1.7.10.2