X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignFrame.java;fp=src%2Fjalview%2Fgui%2FAlignFrame.java;h=c38f336cf6440b310893bf67127cd92f758544fb;hb=d043ce47fc710d3eb2629ba926a8a7417bd67d8c;hp=c41f57cc924db867de493008b2c5f773434981ae;hpb=49db0dff1da16c3355b43a41498c1fc93ef47e91;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index c41f57c..c38f336 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -28,7 +28,6 @@ import java.util.Set; import javax.swing.JFileChooser; import javax.swing.JOptionPane; - import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -104,6 +103,7 @@ import jalview.api.SplitContainerI; import jalview.api.ViewStyleI; import jalview.api.analysis.SimilarityParamsI; import jalview.bin.Cache; +import jalview.bin.Console; import jalview.bin.Jalview; import jalview.commands.CommandI; import jalview.commands.EditCommand; @@ -467,8 +467,8 @@ public class AlignFrame extends GAlignFrame alignPanel = new AlignmentPanel(this, viewport); } addAlignmentPanel(alignPanel, newPanel); - // setBackground(Color.white); // BH 2019 + if (!Jalview.isHeadlessMode()) { progressBar = new ProgressBar(this.statusPanel, this.statusBar); @@ -489,7 +489,7 @@ public class AlignFrame extends GAlignFrame // modifyPID.setEnabled(false); } - String sortby = jalview.bin.Cache.getDefault(Preferences.SORT_ALIGNMENT, + String sortby = Cache.getDefault(Preferences.SORT_ALIGNMENT, "No sort"); if (sortby.equals("Id")) @@ -534,7 +534,7 @@ public class AlignFrame extends GAlignFrame wrapMenuItem_actionPerformed(null); } - if (jalview.bin.Cache.getDefault(Preferences.SHOW_OVERVIEW, false)) + if (Cache.getDefault(Preferences.SHOW_OVERVIEW, false)) { this.overviewMenuItem_actionPerformed(null); } @@ -611,8 +611,8 @@ public class AlignFrame extends GAlignFrame }); if (Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase(Locale.ROOT) .indexOf("devel") > -1 - || Cache.getDefault("VERSION", "DEVELOPMENT").toLowerCase(Locale.ROOT) - .indexOf("test") > -1) + || Cache.getDefault("VERSION", "DEVELOPMENT") + .toLowerCase(Locale.ROOT).indexOf("test") > -1) { formatMenu.add(vsel); } @@ -719,7 +719,7 @@ public class AlignFrame extends GAlignFrame } if (viewport.cursorMode) { - alignPanel.getSeqPanel().moveCursor(0, -1,evt.isShiftDown()); + alignPanel.getSeqPanel().moveCursor(0, -1, evt.isShiftDown()); } break; @@ -1149,7 +1149,7 @@ public class AlignFrame extends GAlignFrame */ public String getVersion() { - return jalview.bin.Cache.getProperty("VERSION"); + return Cache.getProperty("VERSION"); } public FeatureRenderer getFeatureRenderer() @@ -1606,7 +1606,7 @@ public class AlignFrame extends GAlignFrame } else { - Cache.log.error(MessageManager + Console.error(MessageManager .formatMessage("label.couldnt_save_file", new Object[] { lastFilenameSaved })); } @@ -1648,9 +1648,11 @@ 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; } @@ -1687,7 +1689,7 @@ public class AlignFrame extends GAlignFrame BackupFiles backupfiles = null; if (doBackup) { - Cache.log.trace( + Console.trace( "ALIGNFRAME making backupfiles object for " + file); backupfiles = new BackupFiles(file); } @@ -1695,19 +1697,19 @@ public class AlignFrame extends GAlignFrame { String tempFilePath = doBackup ? backupfiles.getTempFilePath() : file; - Cache.log.trace("ALIGNFRAME setting PrintWriter"); + Console.trace("ALIGNFRAME setting PrintWriter"); PrintWriter out = new PrintWriter(new FileWriter(tempFilePath)); if (backupfiles != null) { - Cache.log.trace("ALIGNFRAME about to write to temp file " + Console.trace("ALIGNFRAME about to write to temp file " + backupfiles.getTempFilePath()); } out.print(output); - Cache.log.trace("ALIGNFRAME about to close file"); + Console.trace("ALIGNFRAME about to close file"); out.close(); - Cache.log.trace("ALIGNFRAME closed file"); + Console.trace("ALIGNFRAME closed file"); AlignFrame.this.setTitle(file); statusBar.setText(MessageManager.formatMessage( "label.successfully_saved_to_file_in_format", @@ -1717,29 +1719,29 @@ public class AlignFrame extends GAlignFrame } catch (IOException e) { lastSaveSuccessful = false; - Cache.log.error( + Console.error( "ALIGNFRAME Something happened writing the temp file"); - Cache.log.error(e.getMessage()); - Cache.log.debug(Cache.getStackTraceString(e)); + Console.error(e.getMessage()); + Console.debug(Cache.getStackTraceString(e)); } catch (Exception ex) { lastSaveSuccessful = false; - Cache.log.error( + Console.error( "ALIGNFRAME Something unexpected happened writing the temp file"); - Cache.log.error(ex.getMessage()); - Cache.log.debug(Cache.getStackTraceString(ex)); + Console.error(ex.getMessage()); + Console.debug(Cache.getStackTraceString(ex)); } if (doBackup) { backupfiles.setWriteSuccess(lastSaveSuccessful); - Cache.log.debug("ALIGNFRAME writing temp file was " + Console.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( + Console.trace( "ALIGNFRAME about to rollBackupsAndRenameTempFile"); lastSaveSuccessful = backupfiles.rollBackupsAndRenameTempFile(); - Cache.log.debug( + Console.debug( "ALIGNFRAME performed rollBackupsAndRenameTempFile " + (lastSaveSuccessful ? "" : "un") + "successfully"); @@ -1924,7 +1926,7 @@ public class AlignFrame extends GAlignFrame throws IOException, InterruptedException { final JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); String tooltip = MessageManager .getString("label.load_jalview_annotations"); @@ -1936,7 +1938,7 @@ public class AlignFrame extends GAlignFrame public void run() { String choice = chooser.getSelectedFile().getPath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice); + Cache.setProperty("LAST_DIRECTORY", choice); loadJalviewDataFile(chooser.getSelectedFile(), null, null, null); } }); @@ -2123,7 +2125,7 @@ public class AlignFrame extends GAlignFrame { if (originalSource != viewport) { - Cache.log.warn( + Console.warn( "Implementation worry: mismatch of viewport origin for undo"); } originalSource.updateHiddenColumns(); @@ -2162,7 +2164,7 @@ public class AlignFrame extends GAlignFrame if (originalSource != viewport) { - Cache.log.warn( + Console.warn( "Implementation worry: mismatch of viewport origin for redo"); } originalSource.updateHiddenColumns(); @@ -2246,7 +2248,9 @@ public class AlignFrame extends GAlignFrame { return; } + // TODO: JAL-3733 - add an event to the undo buffer for this ! + viewport.getAlignment().moveSelectedSequencesByOne(sg, viewport.getHiddenRepSequences(), up); alignPanel.paintAlignment(true, false); @@ -2867,7 +2871,6 @@ public class AlignFrame extends GAlignFrame Runnable okAction = new Runnable() { - @Override public void run() { @@ -2885,7 +2888,6 @@ public class AlignFrame extends GAlignFrame viewport.getAlignment().deleteGroup(sg); viewport.notifyAlignment(); - if (viewport.getAlignment().getHeight() < 1) { try @@ -3796,6 +3798,7 @@ 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); @@ -4521,7 +4524,7 @@ public class AlignFrame extends GAlignFrame { // Pick the tree file JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle( MessageManager.getString("label.select_newick_like_tree_file")); @@ -4641,11 +4644,11 @@ public class AlignFrame extends GAlignFrame public void buildWebServicesMenu() { SwingUtilities.invokeLater(() -> { - Cache.log.info("Rebuiling WS menu"); + Console.info("Rebuiling WS menu"); webService.removeAll(); if (Cache.getDefault("SHOW_SLIVKA_SERVICES", true)) { - Cache.log.info("Building web service menu for slivka"); + Console.info("Building web service menu for slivka"); SlivkaWSDiscoverer discoverer = SlivkaWSDiscoverer.getInstance(); JMenu submenu = new JMenu("Slivka"); buildWebServicesMenu(discoverer, submenu); @@ -4794,7 +4797,7 @@ public class AlignFrame extends GAlignFrame showProducts.setEnabled(showp); } catch (Exception e) { - Cache.log.warn( + Console.warn( "canShowProducts threw an exception - please report to help@jalview.org", e); return false; @@ -4835,8 +4838,8 @@ public class AlignFrame extends GAlignFrame al = dna.translateCdna(codeTable); } catch (Exception ex) { - jalview.bin.Cache.log.error( - "Exception during translation. Please report this !", ex); + Console.error("Exception during translation. Please report this !", + ex); final String msg = MessageManager.getString( "label.error_when_translating_sequences_submit_bug_report"); final String errorTitle = MessageManager @@ -5204,7 +5207,7 @@ public class AlignFrame extends GAlignFrame } } catch (Exception x) { - Cache.log.debug( + Console.debug( "Exception when processing data source as T-COFFEE score file", x); tcf = null; @@ -6280,6 +6283,7 @@ public class AlignFrame extends GAlignFrame } private Rectangle lastFeatureSettingsBounds = null; + @Override public void setFeatureSettingsGeometry(Rectangle bounds) {