X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=05abc2560cd3a97f95e99b454c05a357472da9a5;hb=304e64fb34b32659be1bbfd39fb4e15b2f79586e;hp=db6870e984a4435d693174c4cf7a980077a5d3aa;hpb=cfb79b69d9fa44595560659bd95d1d1cd27677ad;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index db6870e..05abc25 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -20,6 +20,72 @@ */ package jalview.gui; +import java.util.Locale; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Rectangle; +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.print.PageFormat; +import java.awt.print.PrinterJob; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Deque; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; + +import javax.swing.ButtonGroup; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JComponent; +import javax.swing.JEditorPane; +import javax.swing.JInternalFrame; +import javax.swing.JLabel; +import javax.swing.JLayeredPane; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; +import javax.swing.event.InternalFrameAdapter; +import javax.swing.event.InternalFrameEvent; + +import ext.vamsas.ServiceHandle; import jalview.analysis.AlignmentSorter; import jalview.analysis.AlignmentUtils; import jalview.analysis.CrossRef; @@ -98,6 +164,7 @@ import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemes; import jalview.schemes.ResidueColourScheme; import jalview.schemes.TCoffeeColourScheme; +import jalview.util.HttpUtils; import jalview.util.ImageMaker.TYPE; import jalview.util.MessageManager; import jalview.util.Platform; @@ -194,7 +261,6 @@ public class AlignFrame extends GAlignFrame { public static int frameCount; - public static final int DEFAULT_WIDTH = 700; public static final int DEFAULT_HEIGHT = 500; @@ -228,7 +294,6 @@ public class AlignFrame extends GAlignFrame private int id; private DataSourceType protocol ; - /** * Creates a new AlignFrame object with specific width and height. * @@ -323,9 +388,7 @@ public class AlignFrame extends GAlignFrame public AlignFrame(AlignmentI al, HiddenColumns hiddenColumns, int width, int height, String sequenceSetId, String viewId) { - id = (++frameCount); - setSize(width, height); if (al.getDataset() == null) @@ -382,7 +445,6 @@ public class AlignFrame extends GAlignFrame * initalise the alignframe from the underlying viewport data and the * configurations */ - void init() { boolean newPanel = (alignPanel == null); @@ -407,7 +469,6 @@ public class AlignFrame extends GAlignFrame addAlignmentPanel(alignPanel, newPanel); // setBackground(Color.white); // BH 2019 - if (!Jalview.isHeadlessMode()) { progressBar = new ProgressBar(this.statusPanel, this.statusBar); @@ -480,7 +541,7 @@ public class AlignFrame extends GAlignFrame addKeyListener(); - final List selviews = new ArrayList<>(); + final List selviews = new ArrayList<>(); final List origview = new ArrayList<>(); final String menuLabel = MessageManager .getString("label.copy_format_from"); @@ -548,16 +609,15 @@ public class AlignFrame extends GAlignFrame } } }); - if (Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase() + if (Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase(Locale.ROOT) .indexOf("devel") > -1 - || Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase() + || Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase(Locale.ROOT) .indexOf("test") > -1) { formatMenu.add(vsel); } addFocusListener(new FocusAdapter() { - @Override public void focusGained(FocusEvent e) { @@ -576,7 +636,6 @@ public class AlignFrame extends GAlignFrame * @param format * format of file */ - @Deprecated public void setFileName(String file, FileFormatI format) { @@ -607,7 +666,6 @@ public class AlignFrame extends GAlignFrame * * @param file */ - public void setFileObject(File file) { this.fileObject = file; @@ -617,12 +675,10 @@ public class AlignFrame extends GAlignFrame * Add a KeyListener with handlers for various KeyPressed and KeyReleased * events */ - void addKeyListener() { addKeyListener(new KeyAdapter() { - @Override public void keyPressed(KeyEvent evt) { @@ -652,7 +708,7 @@ public class AlignFrame extends GAlignFrame } if (viewport.cursorMode) { - alignPanel.getSeqPanel().moveCursor(0, 1); + alignPanel.getSeqPanel().moveCursor(0, 1, evt.isShiftDown()); } break; @@ -663,7 +719,7 @@ public class AlignFrame extends GAlignFrame } if (viewport.cursorMode) { - alignPanel.getSeqPanel().moveCursor(0, -1); + alignPanel.getSeqPanel().moveCursor(0, -1,evt.isShiftDown()); } break; @@ -676,7 +732,7 @@ public class AlignFrame extends GAlignFrame } else { - alignPanel.getSeqPanel().moveCursor(-1, 0); + alignPanel.getSeqPanel().moveCursor(-1, 0, evt.isShiftDown()); } break; @@ -688,7 +744,7 @@ public class AlignFrame extends GAlignFrame } else { - alignPanel.getSeqPanel().moveCursor(1, 0); + alignPanel.getSeqPanel().moveCursor(1, 0, evt.isShiftDown()); } break; @@ -908,7 +964,6 @@ public class AlignFrame extends GAlignFrame { buildWebServicesMenu(); } - /* Set up intrinsic listeners for dynamically generated GUI bits. */ private void addServiceListeners() { @@ -945,7 +1000,6 @@ public class AlignFrame extends GAlignFrame * Configure menu items that vary according to whether the alignment is * nucleotide or protein */ - public void setGUINucleotide() { AlignmentI al = getViewport().getAlignment(); @@ -970,7 +1024,6 @@ public class AlignFrame extends GAlignFrame * operation that affects the data in the current view (selection changed, * etc) to update the menus to reflect the new state. */ - @Override public void setMenusForViewport() { @@ -984,7 +1037,6 @@ public class AlignFrame extends GAlignFrame * @param av * AlignViewport */ - public void setMenusFromViewport(AlignViewport av) { padGapsMenuitem.setSelected(av.isPadGaps()); @@ -1040,7 +1092,6 @@ public class AlignFrame extends GAlignFrame * * @param b */ - public void setGroovyEnabled(boolean b) { runGroovy.setEnabled(b); @@ -1053,7 +1104,6 @@ public class AlignFrame extends GAlignFrame * * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long) */ - @Override public void setProgressBar(String message, long id) { @@ -1077,7 +1127,6 @@ public class AlignFrame extends GAlignFrame * * @return true if any progress bars are still active */ - @Override public boolean operationInProgress() { @@ -1089,7 +1138,6 @@ public class AlignFrame extends GAlignFrame * will cause the status bar to be hidden, with possibly undesirable flicker * of the screen layout. */ - @Override public void setStatus(String text) { @@ -1099,7 +1147,6 @@ public class AlignFrame extends GAlignFrame /* * Added so Castor Mapping file can obtain Jalview Version */ - public String getVersion() { return jalview.bin.Cache.getProperty("VERSION"); @@ -1415,10 +1462,7 @@ public class AlignFrame extends GAlignFrame Desktop.getInstance().closeAssociatedWindows(); FileLoader loader = new FileLoader(); -// DataSourceType protocol = fileName.startsWith("http:") -// ? DataSourceType.URL -// : DataSourceType.FILE; - loader.LoadFile(viewport, (fileObject == null ? fileName : fileObject), protocol, currentFileFormat); + loader.LoadFile(viewport, (fileObject == null ? fileName : fileObject), protocol, currentFileFormat); } else { @@ -1449,7 +1493,6 @@ public class AlignFrame extends GAlignFrame final FeatureSettings nfs = newframe.featureSettings; SwingUtilities.invokeLater(new Runnable() { - @Override public void run() { @@ -1461,7 +1504,6 @@ public class AlignFrame extends GAlignFrame } this.closeMenuItem_actionPerformed(true); } - } @Override @@ -1481,7 +1523,7 @@ public class AlignFrame extends GAlignFrame public void save_actionPerformed(ActionEvent e) { if (fileName == null || (currentFileFormat == null) - || fileName.startsWith("http")) + || HttpUtils.startsWithHttpOrHttps(fileName)) { saveAs_actionPerformed(); } @@ -1495,7 +1537,6 @@ public class AlignFrame extends GAlignFrame * Saves the alignment to a file with a name chosen by the user, if necessary * warning if a file would be overwritten */ - @Override public void saveAs_actionPerformed() { @@ -1550,17 +1591,25 @@ public class AlignFrame extends GAlignFrame * * @return true if last call to saveAlignment(file, format) was successful. */ - public boolean isSaveAlignmentSuccessful() { if (!lastSaveSuccessful) { - JvOptionPane.showInternalMessageDialog(this, MessageManager - .formatMessage("label.couldnt_save_file", new Object[] - { lastFilenameSaved }), - MessageManager.getString("label.error_saving_file"), - JvOptionPane.WARNING_MESSAGE); + if (!Platform.isHeadless()) + { + JvOptionPane.showInternalMessageDialog(this, MessageManager + .formatMessage("label.couldnt_save_file", new Object[] + { lastFilenameSaved }), + MessageManager.getString("label.error_saving_file"), + JvOptionPane.WARNING_MESSAGE); + } + else + { + Cache.log.error(MessageManager + .formatMessage("label.couldnt_save_file", new Object[] + { lastFilenameSaved })); + } } else { @@ -1583,7 +1632,6 @@ public class AlignFrame extends GAlignFrame * @param file * @param format */ - public void saveAlignment(String file, FileFormatI format) { lastSaveSuccessful = true; @@ -1600,18 +1648,15 @@ public class AlignFrame extends GAlignFrame } lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file, shortName); - statusBar.setText(MessageManager.formatMessage( "label.successfully_saved_to_file_in_format", new Object[] { fileName, format })); - return; } AlignExportSettingsI options = new AlignExportSettingsAdapter(false); Runnable cancelAction = new Runnable() { - @Override public void run() { @@ -1620,7 +1665,6 @@ public class AlignFrame extends GAlignFrame }; Runnable outputAction = new Runnable() { - @Override public void run() { @@ -1640,32 +1684,65 @@ public class AlignFrame extends GAlignFrame { // create backupfiles object and get new temp filename destination boolean doBackup = BackupFiles.getEnabled(); - BackupFiles backupfiles = doBackup ? new BackupFiles(file) : null; + BackupFiles backupfiles = null; + if (doBackup) + { + Cache.log.trace( + "ALIGNFRAME making backupfiles object for " + file); + backupfiles = new BackupFiles(file); + } try { String tempFilePath = doBackup ? backupfiles.getTempFilePath() : file; + Cache.log.trace("ALIGNFRAME setting PrintWriter"); PrintWriter out = new PrintWriter(new FileWriter(tempFilePath)); + if (backupfiles != null) + { + Cache.log.trace("ALIGNFRAME about to write to temp file " + + backupfiles.getTempFilePath()); + } + out.print(output); + Cache.log.trace("ALIGNFRAME about to close file"); out.close(); + Cache.log.trace("ALIGNFRAME closed file"); AlignFrame.this.setTitle(file); statusBar.setText(MessageManager.formatMessage( "label.successfully_saved_to_file_in_format", new Object[] { fileName, format.getName() })); lastSaveSuccessful = true; + } catch (IOException e) + { + lastSaveSuccessful = false; + Cache.log.error( + "ALIGNFRAME Something happened writing the temp file"); + Cache.log.error(e.getMessage()); + Cache.log.debug(Cache.getStackTraceString(e)); } catch (Exception ex) { lastSaveSuccessful = false; - ex.printStackTrace(); + Cache.log.error( + "ALIGNFRAME Something unexpected happened writing the temp file"); + Cache.log.error(ex.getMessage()); + Cache.log.debug(Cache.getStackTraceString(ex)); } if (doBackup) { backupfiles.setWriteSuccess(lastSaveSuccessful); + Cache.log.debug("ALIGNFRAME writing temp file was " + + (lastSaveSuccessful ? "" : "NOT ") + "successful"); // do the backup file roll and rename the temp file to actual file + Cache.log.trace( + "ALIGNFRAME about to rollBackupsAndRenameTempFile"); lastSaveSuccessful = backupfiles.rollBackupsAndRenameTempFile(); + Cache.log.debug( + "ALIGNFRAME performed rollBackupsAndRenameTempFile " + + (lastSaveSuccessful ? "" : "un") + + "successfully"); } } } @@ -1695,7 +1772,6 @@ public class AlignFrame extends GAlignFrame * * @param fileFormatName */ - @Override protected void outputText_actionPerformed(String fileFormatName) { @@ -1704,7 +1780,6 @@ public class AlignFrame extends GAlignFrame AlignExportSettingsI options = new AlignExportSettingsAdapter(false); Runnable outputAction = new Runnable() { - @Override public void run() { @@ -1755,7 +1830,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void htmlMenuItem_actionPerformed(ActionEvent e) { @@ -1771,7 +1845,6 @@ public class AlignFrame extends GAlignFrame } // ?? - public void createImageMap(File file, String image) { alignPanel.makePNGImageMap(file, image); @@ -1783,7 +1856,6 @@ public class AlignFrame extends GAlignFrame * * @param f */ - @Override public void createPNG(File f) { @@ -1796,7 +1868,6 @@ public class AlignFrame extends GAlignFrame * * @param f */ - @Override public void createEPS(File f) { @@ -1809,7 +1880,6 @@ public class AlignFrame extends GAlignFrame * * @param f */ - @Override public void createSVG(File f) { @@ -1829,7 +1899,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void printMenuItem_actionPerformed(ActionEvent e) { @@ -1863,7 +1932,6 @@ public class AlignFrame extends GAlignFrame chooser.setToolTipText(tooltip); chooser.setResponseHandler(0, new Runnable() { - @Override public void run() { @@ -1882,7 +1950,6 @@ public class AlignFrame extends GAlignFrame * * @param closeAllTabs */ - @Override public void closeMenuItem_actionPerformed(boolean closeAllTabs) { @@ -1937,7 +2004,6 @@ public class AlignFrame extends GAlignFrame * * @param panelToClose */ - public void closeView(AlignmentPanel panelToClose) { int index = tabbedPane.getSelectedIndex(); @@ -1961,7 +2027,6 @@ public class AlignFrame extends GAlignFrame /** * DOCUMENT ME! */ - void updateEditMenuBar() { @@ -2015,7 +2080,6 @@ public class AlignFrame extends GAlignFrame * * @return alignment objects for all views */ - AlignmentI[] getViewAlignments() { if (alignPanels != null) @@ -2041,7 +2105,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void undoMenuItem_actionPerformed(ActionEvent e) { @@ -2070,7 +2133,6 @@ public class AlignFrame extends GAlignFrame // viewport.getColumnSelection() // .getHiddenColumns().size() > 0); originalSource.notifyAlignment(); - } } @@ -2080,7 +2142,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void redoMenuItem_actionPerformed(ActionEvent e) { @@ -2111,7 +2172,6 @@ public class AlignFrame extends GAlignFrame // viewport.getColumnSelection() // .getHiddenColumns().size() > 0); originalSource.notifyAlignment(); - } } @@ -2158,20 +2218,35 @@ public class AlignFrame extends GAlignFrame } /** - * DOCUMENT ME! + * Calls AlignmentI.moveSelectedSequencesByOne with current sequence selection + * or the sequence under cursor in keyboard mode * * @param up - * DOCUMENT ME! + * or down (if !up) */ - public void moveSelectedSequences(boolean up) { SequenceGroup sg = viewport.getSelectionGroup(); if (sg == null) { + if (viewport.cursorMode) + { + sg = new SequenceGroup(); + sg.addSequence(viewport.getAlignment().getSequenceAt( + alignPanel.getSeqPanel().seqCanvas.cursorY), false); + } + else + { + return; + } + } + + if (sg.getSize() < 1) + { return; } + // TODO: JAL-3733 - add an event to the undo buffer for this ! viewport.getAlignment().moveSelectedSequencesByOne(sg, viewport.getHiddenRepSequences(), up); alignPanel.paintAlignment(true, false); @@ -2288,7 +2363,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void copy_actionPerformed() { @@ -2321,7 +2395,7 @@ public class AlignFrame extends GAlignFrame .setContents(new StringSelection(""), null); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, - Desktop.getInstance()); + d); } catch (OutOfMemoryError er) { new OOMWarning("copying region", er); @@ -2356,7 +2430,6 @@ public class AlignFrame extends GAlignFrame * @throws InterruptedException * @throws IOException */ - @Override protected void pasteNew_actionPerformed(ActionEvent e) throws IOException, InterruptedException @@ -2372,7 +2445,6 @@ public class AlignFrame extends GAlignFrame * @throws InterruptedException * @throws IOException */ - @Override protected void pasteThis_actionPerformed(ActionEvent e) throws IOException, InterruptedException @@ -2717,6 +2789,7 @@ public class AlignFrame extends GAlignFrame System.out.println("Exception whilst pasting: " + ex); // could be anything being pasted in here } + } @Override @@ -2729,6 +2802,7 @@ public class AlignFrame extends GAlignFrame AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, DEFAULT_HEIGHT); String newtitle = new String("Flanking alignment"); + Desktop d = Desktop.getInstance(); if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null) { @@ -2771,7 +2845,6 @@ public class AlignFrame extends GAlignFrame /** * Action Cut (delete and copy) the selected region */ - @Override protected void cut_actionPerformed() { @@ -2782,7 +2855,6 @@ public class AlignFrame extends GAlignFrame /** * Performs menu option to Delete the currently selected region */ - @Override protected void delete_actionPerformed() { @@ -2860,7 +2932,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void deleteGroups_actionPerformed(ActionEvent e) { @@ -2894,7 +2965,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e) { @@ -2907,7 +2977,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e) { @@ -2920,7 +2989,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void invertSequenceMenuItem_actionPerformed(ActionEvent e) { @@ -2960,7 +3028,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void remove2LeftMenuItem_actionPerformed(ActionEvent e) { @@ -2973,7 +3040,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void remove2RightMenuItem_actionPerformed(ActionEvent e) { @@ -3036,7 +3102,6 @@ public class AlignFrame extends GAlignFrame } viewport.notifyAlignment(); - } } @@ -3046,7 +3111,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e) { @@ -3088,7 +3152,6 @@ public class AlignFrame extends GAlignFrame ranges.setStartRes(seq.findIndex(startRes) - 1); viewport.notifyAlignment(); - } /** @@ -3097,7 +3160,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void removeAllGapsMenuItem_actionPerformed(ActionEvent e) { @@ -3125,6 +3187,7 @@ public class AlignFrame extends GAlignFrame viewport.getAlignment())); viewport.getRanges().setStartRes(seq.findIndex(startRes) - 1); + viewport.notifyAlignment(); } @@ -3135,32 +3198,27 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void padGapsMenuitem_actionPerformed(ActionEvent e) { viewport.setPadGaps(padGapsMenuitem.isSelected()); viewport.notifyAlignment(); - } /** - * DOCUMENT ME! + * Opens a Finder dialog * * @param e - * DOCUMENT ME! */ - @Override public void findMenuItem_actionPerformed(ActionEvent e) { - new Finder(); + new Finder(alignPanel, false, null); } /** * Create a new view of the current alignment. */ - @Override public void newView_actionPerformed(ActionEvent e) { @@ -3176,7 +3234,6 @@ public class AlignFrame extends GAlignFrame * if true then duplicate all annnotation, groups and settings * @return new alignment panel, already displayed. */ - public AlignmentPanel newView(String viewTitle, boolean copyAnnotation) { /* @@ -3249,7 +3306,6 @@ public class AlignFrame extends GAlignFrame * @param viewTitle * @return */ - protected String getNewViewName(String viewTitle) { int index = Desktop.getViewCount(viewport.getSequenceSetId()); @@ -3284,7 +3340,6 @@ public class AlignFrame extends GAlignFrame * @param comps * @return */ - protected List getExistingViewNames(List comps) { List existingNames = new ArrayList<>(); @@ -3305,7 +3360,6 @@ public class AlignFrame extends GAlignFrame /** * Explode tabbed views into separate windows. */ - @Override public void expandViews_actionPerformed(ActionEvent e) { @@ -3315,7 +3369,6 @@ public class AlignFrame extends GAlignFrame /** * Gather views in separate windows back into a tabbed presentation. */ - @Override public void gatherViews_actionPerformed(ActionEvent e) { @@ -3328,7 +3381,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void font_actionPerformed(ActionEvent e) { @@ -3341,7 +3393,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void seqLimit_actionPerformed(ActionEvent e) { @@ -3371,7 +3422,6 @@ public class AlignFrame extends GAlignFrame * * @see jalview.jbgui.GAlignFrame#followHighlight_actionPerformed() */ - @Override protected void followHighlight_actionPerformed() { @@ -3393,7 +3443,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void colourTextMenuItem_actionPerformed(ActionEvent e) { @@ -3407,7 +3456,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void wrapMenuItem_actionPerformed(ActionEvent e) { @@ -3444,7 +3492,6 @@ public class AlignFrame extends GAlignFrame * @param toggleSeqs * @param toggleCols */ - protected void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols) { @@ -3512,7 +3559,6 @@ public class AlignFrame extends GAlignFrame * jalview.jbgui.GAlignFrame#hideAllButSelection_actionPerformed(java.awt. * event.ActionEvent) */ - @Override public void hideAllButSelection_actionPerformed(ActionEvent e) { @@ -3527,7 +3573,6 @@ public class AlignFrame extends GAlignFrame * jalview.jbgui.GAlignFrame#hideAllSelection_actionPerformed(java.awt.event * .ActionEvent) */ - @Override public void hideAllSelection_actionPerformed(ActionEvent e) { @@ -3547,7 +3592,6 @@ public class AlignFrame extends GAlignFrame * jalview.jbgui.GAlignFrame#showAllhidden_actionPerformed(java.awt.event. * ActionEvent) */ - @Override public void showAllhidden_actionPerformed(ActionEvent e) { @@ -3579,7 +3623,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void scaleAbove_actionPerformed(ActionEvent e) { @@ -3594,7 +3637,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void scaleLeft_actionPerformed(ActionEvent e) { @@ -3609,7 +3651,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void scaleRight_actionPerformed(ActionEvent e) { @@ -3624,7 +3665,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void viewBoxesMenuItem_actionPerformed(ActionEvent e) { @@ -3638,7 +3678,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void viewTextMenuItem_actionPerformed(ActionEvent e) { @@ -3652,7 +3691,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void renderGapsMenuItem_actionPerformed(ActionEvent e) { @@ -3698,7 +3736,6 @@ public class AlignFrame extends GAlignFrame * @param evt * DOCUMENT ME! */ - @Override public void showSeqFeatures_actionPerformed(ActionEvent evt) { @@ -3715,7 +3752,6 @@ public class AlignFrame extends GAlignFrame * * @param e */ - @Override public void annotationPanelMenuItem_actionPerformed(ActionEvent e) { @@ -3760,7 +3796,6 @@ public class AlignFrame extends GAlignFrame JLabel textLabel = new JLabel(); textLabel.setText(content); textLabel.setBackground(Color.WHITE); - pane = new JPanel(new BorderLayout()); ((JPanel) pane).setOpaque(true); pane.setBackground(Color.WHITE); @@ -3794,7 +3829,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void overviewMenuItem_actionPerformed(ActionEvent e) { @@ -3804,7 +3838,6 @@ public class AlignFrame extends GAlignFrame } JInternalFrame frame = new JInternalFrame(); - // BH 2019.07.26 we allow for an embedded // undecorated overview with defined size frame.setName(Platform.getAppID("overview")); @@ -3815,7 +3848,6 @@ public class AlignFrame extends GAlignFrame dim = null; // hidden, not embedded } OverviewPanel overview = new OverviewPanel(alignPanel, dim); - frame.setContentPane(overview); if (dim == null) { @@ -3839,7 +3871,6 @@ public class AlignFrame extends GAlignFrame frame.addInternalFrameListener( new javax.swing.event.InternalFrameAdapter() { - @Override public void internalFrameClosed( javax.swing.event.InternalFrameEvent evt) @@ -3868,7 +3899,6 @@ public class AlignFrame extends GAlignFrame * CovariationColourScheme(viewport.getAlignment().getAlignmentAnnotation * ()[0])); } */ - @Override public void annotationColour_actionPerformed() { @@ -3888,7 +3918,6 @@ public class AlignFrame extends GAlignFrame * * @param selected */ - @Override public void applyToAllGroups_actionPerformed(boolean selected) { @@ -3901,7 +3930,6 @@ public class AlignFrame extends GAlignFrame * @param name * the name (not the menu item label!) of the colour scheme */ - @Override public void changeColour_actionPerformed(String name) { @@ -3929,7 +3957,6 @@ public class AlignFrame extends GAlignFrame * * @param cs */ - @Override public void changeColour(ColourSchemeI cs) { @@ -3944,7 +3971,6 @@ public class AlignFrame extends GAlignFrame /** * Show the PID threshold slider panel */ - @Override protected void modifyPID_actionPerformed() { @@ -3956,7 +3982,6 @@ public class AlignFrame extends GAlignFrame /** * Show the Conservation slider panel */ - @Override protected void modifyConservation_actionPerformed() { @@ -3968,7 +3993,6 @@ public class AlignFrame extends GAlignFrame /** * Action on selecting or deselecting (Colour) By Conservation */ - @Override public void conservationMenuItem_actionPerformed(boolean selected) { @@ -3990,7 +4014,6 @@ public class AlignFrame extends GAlignFrame /** * Action on selecting or deselecting (Colour) Above PID Threshold */ - @Override public void abovePIDThreshold_actionPerformed(boolean selected) { @@ -4019,7 +4042,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void sortPairwiseMenuItem_actionPerformed(ActionEvent e) { @@ -4037,7 +4059,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void sortIDMenuItem_actionPerformed(ActionEvent e) { @@ -4054,7 +4075,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void sortLengthMenuItem_actionPerformed(ActionEvent e) { @@ -4071,7 +4091,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void sortGroupMenuItem_actionPerformed(ActionEvent e) { @@ -4104,14 +4123,12 @@ public class AlignFrame extends GAlignFrame alignPanel.paintAlignment(true, false); } - /** * DOCUMENT ME! * * @param e * DOCUMENT ME! */ - @Override public void removeRedundancyMenuItem_actionPerformed(ActionEvent e) { @@ -4124,7 +4141,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e) { @@ -4153,9 +4169,6 @@ public class AlignFrame extends GAlignFrame viewport.setAutoCalculateConsensusAndConservation( autoCalculate.isSelected()); if (viewport.getAutoCalculateConsensusAndConservation()) - // ?? - // viewport.autoCalculateConsensus = autoCalculate.isSelected(); - // if (viewport.autoCalculateConsensus) { viewport.notifyAlignment(); } @@ -4183,7 +4196,6 @@ public class AlignFrame extends GAlignFrame * @param options * parameters for the distance or similarity calculation */ - void newTreePanel(String type, String modelName, SimilarityParamsI options) { @@ -4245,7 +4257,6 @@ public class AlignFrame extends GAlignFrame * @param order * DOCUMENT ME! */ - public void addSortByOrderMenuItem(String title, final AlignmentOrder order) { @@ -4255,7 +4266,6 @@ public class AlignFrame extends GAlignFrame sort.add(item); item.addActionListener(new java.awt.event.ActionListener() { - @Override public void actionPerformed(ActionEvent e) { @@ -4282,7 +4292,6 @@ public class AlignFrame extends GAlignFrame * the label used to retrieve scores for each sequence on the * alignment */ - public void addSortByAnnotScoreMenuItem(JMenu sort, final String scoreLabel) { @@ -4290,7 +4299,6 @@ public class AlignFrame extends GAlignFrame sort.add(item); item.addActionListener(new java.awt.event.ActionListener() { - @Override public void actionPerformed(ActionEvent e) { @@ -4316,7 +4324,6 @@ public class AlignFrame extends GAlignFrame * rebuilding in subsequence calls. * */ - @Override public void buildSortByAnnotationScoresMenu() { @@ -4374,7 +4381,6 @@ public class AlignFrame extends GAlignFrame * closed, and adjust the tree leaf to sequence mapping when the alignment is * modified. */ - @Override public void buildTreeSortMenu() { @@ -4387,7 +4393,6 @@ public class AlignFrame extends GAlignFrame final JMenuItem item = new JMenuItem(tp.getTitle()); item.addActionListener(new java.awt.event.ActionListener() { - @Override public void actionPerformed(ActionEvent e) { @@ -4415,7 +4420,6 @@ public class AlignFrame extends GAlignFrame } return treePanels; } - public boolean sortBy(AlignmentOrder alorder, String undoname) { SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); @@ -4434,7 +4438,6 @@ public class AlignFrame extends GAlignFrame * be submitted for multiple alignment. * */ - public jalview.datamodel.AlignmentView gatherSequencesForAlignment() { // Now, check we have enough sequences @@ -4480,7 +4483,6 @@ public class AlignFrame extends GAlignFrame * region or the whole alignment. (where the first sequence in the set is the * one that the prediction will be for). */ - public AlignmentView gatherSeqOrMsaForSecStrPrediction() { AlignmentView seqs = null; @@ -4514,7 +4516,6 @@ public class AlignFrame extends GAlignFrame * @param e * DOCUMENT ME! */ - @Override protected void loadTreeMenuItem_actionPerformed(ActionEvent e) { @@ -4529,7 +4530,6 @@ public class AlignFrame extends GAlignFrame chooser.setResponseHandler(0, new Runnable() { - @Override public void run() { @@ -4594,7 +4594,6 @@ public class AlignFrame extends GAlignFrame * position * @return TreePanel handle */ - public TreePanel showNewickTree(NewickFile nf, String treeTitle, AlignmentView input, int w, int h, int x, int y) { @@ -4607,6 +4606,7 @@ public class AlignFrame extends GAlignFrame if (nf.getTree() != null) { tp = new TreePanel(alignPanel, nf, treeTitle, input); + Dimension dim = Platform.getDimIfEmbedded(tp, -1, -1); if (dim == null) { @@ -4634,6 +4634,7 @@ public class AlignFrame extends GAlignFrame return tp; } + /** * Schedule the web services menu rebuild to the event dispatch thread. */ @@ -4715,7 +4716,6 @@ public class AlignFrame extends GAlignFrame * * @param webService */ - protected void build_urlServiceMenu(JMenu webService) { // TODO: remove this code when 2.7 is released @@ -4753,7 +4753,6 @@ public class AlignFrame extends GAlignFrame * * @return true if Show Cross-references menu should be enabled */ - public boolean canShowProducts() { SequenceI[] seqs = viewport.getAlignment().getSequencesArray(); @@ -4781,7 +4780,6 @@ public class AlignFrame extends GAlignFrame JMenuItem xtype = new JMenuItem(source); xtype.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { @@ -4814,7 +4812,6 @@ public class AlignFrame extends GAlignFrame * @param source * the database to show cross-references for */ - protected void showProductsFor(final SequenceI[] sel, final boolean _odna, final String source) { @@ -4826,7 +4823,6 @@ public class AlignFrame extends GAlignFrame * Construct and display a new frame containing the translation of this * frame's DNA sequences to their aligned protein (amino acid) equivalents. */ - @Override public void showTranslation_actionPerformed(GeneticCodeI codeTable) { @@ -4884,7 +4880,6 @@ public class AlignFrame extends GAlignFrame * * @param format */ - public void setFileFormat(FileFormatI format) { this.currentFileFormat = format; @@ -4899,7 +4894,6 @@ public class AlignFrame extends GAlignFrame * access mode of file (see jalview.io.AlignFile) * @return true if features file was parsed correctly. */ - public boolean parseFeaturesFile(Object file, DataSourceType sourceType) { // BH 2018 @@ -5091,6 +5085,7 @@ public class AlignFrame extends GAlignFrame + " with " + toassoc.getDisplayId(true)); assocfiles++; } + } // TODO: do we need to update overview ? only if features are // shown I guess @@ -5151,7 +5146,6 @@ public class AlignFrame extends GAlignFrame * @throws InterruptedException * @throws IOException */ - public void loadJalviewDataFile(Object file, DataSourceType sourceType, FileFormatI format, SequenceI assocSeq) { @@ -5266,6 +5260,7 @@ public class AlignFrame extends GAlignFrame } if (isAnnotation) { + updateForAnnotations(); } } catch (Exception ex) @@ -5338,7 +5333,6 @@ public class AlignFrame extends GAlignFrame * Method invoked by the ChangeListener on the tabbed pane, in other words * when a different tabbed pane is selected by the user or programmatically. */ - @Override public void tabSelectionChanged(int index) { @@ -5409,7 +5403,6 @@ public class AlignFrame extends GAlignFrame /** * On right mouse click on view tab, prompt for and set new view name. */ - @Override public void tabbedPane_mousePressed(MouseEvent e) { @@ -5436,7 +5429,6 @@ public class AlignFrame extends GAlignFrame /** * Open the dialog for regex description parsing. */ - @Override protected void extractScores_actionPerformed(ActionEvent e) { @@ -5460,7 +5452,6 @@ public class AlignFrame extends GAlignFrame * jalview.jbgui.GAlignFrame#showDbRefs_actionPerformed(java.awt.event.ActionEvent * ) */ - @Override protected void showDbRefs_actionPerformed(ActionEvent e) { @@ -5473,7 +5464,6 @@ public class AlignFrame extends GAlignFrame * @seejalview.jbgui.GAlignFrame#showNpFeats_actionPerformed(java.awt.event. * ActionEvent) */ - @Override protected void showNpFeats_actionPerformed(ActionEvent e) { @@ -5486,7 +5476,6 @@ public class AlignFrame extends GAlignFrame * * @param av */ - public boolean closeView(AlignViewportI av) { if (viewport == av) @@ -5530,7 +5519,6 @@ public class AlignFrame extends GAlignFrame Cache.getDefault(DBRefFetcher.TRIM_RETRIEVED_SEQUENCES, true)); trimrs.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { @@ -5552,7 +5540,6 @@ public class AlignFrame extends GAlignFrame { new Thread(new Runnable() { - @Override public void run() { @@ -5564,7 +5551,6 @@ public class AlignFrame extends GAlignFrame alignPanel.alignFrame.featureSettings, isNucleotide); dbRefFetcher.addListener(new FetchFinishedListenerI() { - @Override public void finished() { @@ -5588,7 +5574,6 @@ public class AlignFrame extends GAlignFrame rfetch.add(fetchr); new Thread(new Runnable() { - @Override public void run() { @@ -5597,7 +5582,6 @@ public class AlignFrame extends GAlignFrame // .getSequenceFetcherSingleton(); javax.swing.SwingUtilities.invokeLater(new Runnable() { - @Override public void run() { @@ -5652,7 +5636,6 @@ public class AlignFrame extends GAlignFrame dbRefFetcher .addListener(new FetchFinishedListenerI() { - @Override public void finished() { @@ -5687,7 +5670,6 @@ public class AlignFrame extends GAlignFrame { src.getDbSource() })); fetchr.addActionListener(new ActionListener() { - @Override public void actionPerformed(ActionEvent e) { @@ -5708,7 +5690,6 @@ public class AlignFrame extends GAlignFrame dbRefFetcher .addListener(new FetchFinishedListenerI() { - @Override public void finished() { @@ -5777,7 +5758,6 @@ public class AlignFrame extends GAlignFrame dbRefFetcher .addListener(new FetchFinishedListenerI() { - @Override public void finished() { @@ -5829,7 +5809,6 @@ public class AlignFrame extends GAlignFrame /** * Left justify the whole alignment. */ - @Override protected void justifyLeftMenuItem_actionPerformed(ActionEvent e) { @@ -5840,7 +5819,6 @@ public class AlignFrame extends GAlignFrame /** * Right justify the whole alignment. */ - @Override protected void justifyRightMenuItem_actionPerformed(ActionEvent e) { @@ -5862,7 +5840,6 @@ public class AlignFrame extends GAlignFrame * jalview.jbgui.GAlignFrame#showUnconservedMenuItem_actionPerformed(java. * awt.event.ActionEvent) */ - @Override protected void showUnconservedMenuItem_actionPerformed(ActionEvent e) { @@ -5877,7 +5854,6 @@ public class AlignFrame extends GAlignFrame * jalview.jbgui.GAlignFrame#showGroupConsensus_actionPerformed(java.awt.event * .ActionEvent) */ - @Override protected void showGroupConsensus_actionPerformed(ActionEvent e) { @@ -5893,7 +5869,6 @@ public class AlignFrame extends GAlignFrame * jalview.jbgui.GAlignFrame#showGroupConservation_actionPerformed(java.awt * .event.ActionEvent) */ - @Override protected void showGroupConservation_actionPerformed(ActionEvent e) { @@ -5908,7 +5883,6 @@ public class AlignFrame extends GAlignFrame * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt * .event.ActionEvent) */ - @Override protected void showConsensusHistogram_actionPerformed(ActionEvent e) { @@ -5923,7 +5897,6 @@ public class AlignFrame extends GAlignFrame * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt * .event.ActionEvent) */ - @Override protected void showSequenceLogo_actionPerformed(ActionEvent e) { @@ -5953,7 +5926,6 @@ public class AlignFrame extends GAlignFrame * jalview.jbgui.GAlignFrame#makeGrpsFromSelection_actionPerformed(java.awt * .event.ActionEvent) */ - @Override protected void makeGrpsFromSelection_actionPerformed(ActionEvent e) { @@ -6005,7 +5977,6 @@ public class AlignFrame extends GAlignFrame * * @param alignmentPanel */ - public void setDisplayedView(AlignmentPanel alignmentPanel) { if (!viewport.getSequenceSetId() @@ -6030,7 +6001,6 @@ public class AlignFrame extends GAlignFrame * @param forAlignment * update non-sequence-related annotations */ - @Override protected void setAnnotationsVisibility(boolean visible, boolean forSequences, boolean forAlignment) @@ -6064,7 +6034,6 @@ public class AlignFrame extends GAlignFrame /** * Store selected annotation sort order for the view and repaint. */ - @Override protected void sortAnnotations_actionPerformed() { @@ -6078,7 +6047,6 @@ public class AlignFrame extends GAlignFrame * * @return alignment panels in this alignment frame */ - public List getAlignPanels() { // alignPanels is never null @@ -6090,7 +6058,6 @@ public class AlignFrame extends GAlignFrame * Open a new alignment window, with the cDNA associated with this (protein) * alignment, aligned as is the protein. */ - protected void viewAsCdna_actionPerformed() { // TODO no longer a menu action - refactor as required @@ -6141,7 +6108,6 @@ public class AlignFrame extends GAlignFrame * * @param show */ - @Override protected void showComplement_actionPerformed(boolean show) { @@ -6156,7 +6122,6 @@ public class AlignFrame extends GAlignFrame * Generate the reverse (optionally complemented) of the selected sequences, * and add them to the alignment */ - @Override protected void showReverse_actionPerformed(boolean complement) { @@ -6182,7 +6147,6 @@ public class AlignFrame extends GAlignFrame * AlignFrame is set as currentAlignFrame in Desktop, to allow the script to * be targeted at this alignment. */ - @Override protected void runGroovy_actionPerformed() { @@ -6216,7 +6180,6 @@ public class AlignFrame extends GAlignFrame * @param columnsContaining * @return */ - public boolean hideFeatureColumns(String featureType, boolean columnsContaining) { @@ -6249,7 +6212,6 @@ public class AlignFrame extends GAlignFrame * Rebuilds the Colour menu, including any user-defined colours which have * been loaded either on startup or during the session */ - public void buildColourMenu() { colourMenu.removeAll(); @@ -6277,7 +6239,6 @@ public class AlignFrame extends GAlignFrame * Open a dialog (if not already open) that allows the user to select and * calculate PCA or Tree analysis */ - protected void openTreePcaDialog() { if (alignPanel.getCalculationDialog() == null) @@ -6293,7 +6254,6 @@ public class AlignFrame extends GAlignFrame { hmmerMenu.setEnabled(HmmerCommand.isHmmerAvailable()); } - @Override protected void loadVcf_actionPerformed() { @@ -6305,7 +6265,6 @@ public class AlignFrame extends GAlignFrame final AlignFrame us = this; chooser.setResponseHandler(0, new Runnable() { - @Override public void run() { @@ -6320,7 +6279,6 @@ public class AlignFrame extends GAlignFrame } private Rectangle lastFeatureSettingsBounds = null; - @Override public void setFeatureSettingsGeometry(Rectangle bounds) { @@ -6438,4 +6396,3 @@ public class AlignFrame extends GAlignFrame } } } -