From d3bf4ae12b72df02dee34c95da750ab38a3816b9 Mon Sep 17 00:00:00 2001 From: BobHanson Date: Fri, 12 Jun 2020 00:31:52 -0500 Subject: [PATCH] JAL-3446 from applet -- reload; also fixes some repaint issues --- src/jalview/gui/AlignFrame.java | 79 +++++++++++++++------- src/jalview/gui/AlignmentPanel.java | 6 +- src/jalview/gui/AnnotationPanel.java | 93 ++++++++++++++++---------- src/jalview/gui/IdCanvas.java | 6 +- src/jalview/gui/PaintRefresher.java | 19 ++++-- src/jalview/gui/SeqCanvas.java | 18 ++--- src/jalview/gui/SeqPanel.java | 1 + src/jalview/io/FileLoader.java | 3 +- src/jalview/io/VamsasAppDatastore.java | 18 ++++- src/jalview/project/Jalview2XML.java | 29 +++++--- src/jalview/util/jarInputStreamProvider.java | 6 ++ 11 files changed, 184 insertions(+), 94 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 14e09e7..5f7d0d4 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -199,6 +199,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, private int id; + private DataSourceType protocol ; + /** * Creates a new AlignFrame object with specific width and height. * @@ -548,6 +550,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * format of file */ + @Deprecated public void setFileName(String file, FileFormatI format) { fileName = file; @@ -556,6 +559,22 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } /** + * + * @param fileName + * @param file from SwingJS; may contain bytes -- for reload + * @param protocol from SwingJS; may be RELATIVE_URL + * @param format + */ + public void setFile(String fileName, File file, DataSourceType protocol, FileFormatI format) + { + this.fileName = fileName; + this.fileObject = file; + this.protocol = protocol; + setFileFormat(format); + reload.setEnabled(true); + } + + /** * JavaScript will have this, maybe others. More dependable than a file name * and maintains a reference to the actual bytes loaded. * @@ -1084,7 +1103,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void reload_actionPerformed(ActionEvent e) { - if (fileName == null) + if (fileName == null && fileObject == null) { return; } @@ -1114,10 +1133,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Desktop.getInstance().closeAssociatedWindows(); FileLoader loader = new FileLoader(); - DataSourceType protocol = fileName.startsWith("http:") - ? DataSourceType.URL - : DataSourceType.FILE; - loader.LoadFile(viewport, fileName, protocol, currentFileFormat); +// DataSourceType protocol = fileName.startsWith("http:") +// ? DataSourceType.URL +// : DataSourceType.FILE; + loader.LoadFile(viewport, (fileObject == null ? fileName : fileObject), protocol, currentFileFormat); } else { @@ -1129,10 +1148,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (fileObject == null) { - - DataSourceType protocol = (fileName.startsWith("http:") - ? DataSourceType.URL - : DataSourceType.FILE); newframe = loader.LoadFileWaitTillLoaded(fileName, protocol, currentFileFormat); } @@ -2518,6 +2533,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } catch (Exception ex) { } + } else { + updateAll(null); } } }; @@ -2560,10 +2577,26 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (avc.deleteGroups()) { - PaintRefresher.Refresh(this, viewport.getSequenceSetId()); - alignPanel.updateAnnotation(); + updateAll(viewport.getSequenceSetId()); + } + } + + private void updateAll(String id) + { + if (id == null) + { + // this will force a non-fast repaint of both the IdPanel and SeqPanel + alignPanel.getIdPanel().getIdCanvas().setNoFastPaint(); + alignPanel.getSeqPanel().seqCanvas.setNoFastPaint(); + alignPanel.repaint(); + } + else + { + // original version + PaintRefresher.Refresh(this, id); alignPanel.paintAlignment(true, true); } + alignPanel.updateAnnotation(); } /** @@ -4755,25 +4788,25 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, for (int i = 0; i < files.size(); i++) { // BH 2018 - Object file = files.get(i); - String fileName = file.toString(); + Object fileObj = files.get(i); + String fileName = fileObj.toString(); String pdbfn = ""; - DataSourceType protocol = (file instanceof File + DataSourceType protocol = (fileObj instanceof File ? DataSourceType.FILE : FormatAdapter.checkProtocol(fileName)); if (protocol == DataSourceType.FILE) { - File fl; - if (file instanceof File) + File file; + if (fileObj instanceof File) { - fl = (File) file; - Platform.cacheFileData(fl); + file = (File) fileObj; + Platform.cacheFileData(file); } else { - fl = new File(fileName); + file = new File(fileName); } - pdbfn = fl.getName(); + pdbfn = file.getName(); } else if (protocol == DataSourceType.URL) { @@ -4802,20 +4835,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, FileFormatI type; try { - type = new IdentifyFile().identify(file, protocol); + type = new IdentifyFile().identify(fileObj, protocol); } catch (Exception ex) { type = null; } if (type != null && type.isStructureFile()) { - filesmatched.add(new Object[] { file, protocol, mtch }); + filesmatched.add(new Object[] { fileObj, protocol, mtch }); continue; } } // File wasn't named like one of the sequences or wasn't a PDB // file. - filesnotmatched.add(file); + filesnotmatched.add(fileObj); } } int assocfiles = 0; diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index b57bc08..a84a468 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -123,6 +123,7 @@ public class AlignmentPanel extends GAlignmentPanel implements */ public AlignmentPanel(AlignFrame af, final AlignViewport av) { + setName("AligmentPanel"); // setBackground(Color.white); // BH 2019 alignFrame = af; this.av = av; @@ -664,7 +665,7 @@ public class AlignmentPanel extends GAlignmentPanel implements // System.out.println("seqpan dim = " + getSeqPanel().getSize()); // System.out.println("seqcan dim = " + getSeqPanel().seqCanvas.getSize()); - // BH not added to anything yet! repaint(); + repaint(); } /** @@ -860,12 +861,12 @@ public class AlignmentPanel extends GAlignmentPanel implements if (updateOverview) { alignFrame.repaint(); - if (overviewPanel != null) { overviewPanel.updateOverviewImage(); } } else { + invalidate(); // needed so that the id width adjuster works correctly repaint(); } } @@ -873,6 +874,7 @@ public class AlignmentPanel extends GAlignmentPanel implements @Override public void paintComponent(Graphics g) { + // BH OUCH! invalidate(); // needed so that the id width adjuster works correctly Dimension d = getIdPanel().getIdCanvas().getPreferredSize(); diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 01be3b5..0eec840 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -150,6 +150,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, */ public AnnotationPanel(AlignmentPanel ap) { + setName("AnnotationPanel"); ToolTipManager.sharedInstance().registerComponent(this); ToolTipManager.sharedInstance().setInitialDelay(0); ToolTipManager.sharedInstance().setDismissDelay(10000); @@ -355,7 +356,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, @Override public void colourSelected(Color c) { - HiddenColumns hiddenColumns = av.getAlignment().getHiddenColumns(); + HiddenColumns hiddenColumns = av.getAlignment() + .getHiddenColumns(); for (int index : av.getColumnSelection().getSelected()) { if (hiddenColumns.isVisible(index)) @@ -366,10 +368,11 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } fAnot[index].colour = c; } - }}; + } + }; }; - JalviewColourChooser.showColourChooser(this, - title, Color.black, listener); + JalviewColourChooser.showColourChooser(this, title, Color.black, + listener); } else // HELIX, SHEET or STEM @@ -711,14 +714,13 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } if (dragMode == DragMode.Undefined) - { + { /* * drag is diagonal - defer deciding whether to * treat as up/down or left/right */ - return; - } - + return; + } try { if (dragMode == DragMode.Resize) @@ -734,6 +736,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, int newHeight = Math.max(0, graphAnnotation.graphHeight + deltaY); graphAnnotation.graphHeight = newHeight; adjustPanelHeight(); + setNoFastPaint(); ap.paintAlignment(false, false); } } @@ -986,7 +989,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } private volatile boolean imageFresh = false; - private Rectangle visibleRect = new Rectangle(), clipBounds = new Rectangle(); + + private Rectangle visibleRect = new Rectangle(), + clipBounds = new Rectangle(); /** * DOCUMENT ME! @@ -997,37 +1002,37 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, @Override public void paintComponent(Graphics g) { - - // BH: note that this method is generally recommended to - // call super.paintComponent(g). Otherwise, the children of this - // component will not be rendered. That is not needed here - // because AnnotationPanel does not have any children. It is - // just a JPanel contained in a JViewPort. + + // BH: note that this method is generally recommended to + // call super.paintComponent(g). Otherwise, the children of this + // component will not be rendered. That is not needed here + // because AnnotationPanel does not have any children. It is + // just a JPanel contained in a JViewPort. computeVisibleRect(visibleRect); - + g.setColor(Color.white); g.fillRect(0, 0, visibleRect.width, visibleRect.height); ViewportRanges ranges = av.getRanges(); - - - - if (image != null) + + if (allowFastPaint && image != null) { - // BH 2018 optimizing generation of new Rectangle(). - if (fastPaint || (visibleRect.width != (clipBounds = g.getClipBounds(clipBounds)).width) - || (visibleRect.height != clipBounds.height)) + // BH 2018 optimizing generation of new Rectangle(). + if (fastPaint + || (visibleRect.width != (clipBounds = g + .getClipBounds(clipBounds)).width) + || (visibleRect.height != clipBounds.height)) { - g.drawImage(image, 0, 0, this); + g.drawImage(image, 0, 0, this); fastPaint = false; return; } } - - imgWidth = (ranges.getEndRes() - ranges.getStartRes() - + 1) * av.getCharWidth(); - + + imgWidth = (ranges.getEndRes() - ranges.getStartRes() + 1) + * av.getCharWidth(); + if (imgWidth < 1) { fastPaint = false; @@ -1069,13 +1074,14 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, gg.setColor(Color.white); gg.fillRect(0, 0, imgWidth, image.getHeight()); imageFresh = true; - } else { - gg = (Graphics2D) image.getGraphics(); + } + else + { + gg = (Graphics2D) image.getGraphics(); } - - drawComponent(gg, ranges.getStartRes(), - av.getRanges().getEndRes() + 1); + + drawComponent(gg, ranges.getStartRes(), av.getRanges().getEndRes() + 1); gg.dispose(); imageFresh = false; g.drawImage(image, 0, 0, this); @@ -1101,8 +1107,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, int sr = av.getRanges().getStartRes(); int er = av.getRanges().getEndRes() + 1; int transX = 0; - - if (er == sr + 1) { + + if (er == sr + 1) + { fastPaint = false; return; } @@ -1129,7 +1136,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, gg.translate(-transX, 0); gg.dispose(); - + fastPaint = true; // Call repaint on alignment panel so that repaints from other alignment @@ -1247,6 +1254,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, private int[] bounds = new int[2]; + private boolean allowFastPaint; + @Override public int[] getVisibleVRange() { @@ -1273,7 +1282,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, ap = null; image = null; fadedImage = null; -// gg = null; + // gg = null; _mwl = null; /* @@ -1353,4 +1362,14 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } return annotationHeight; } + + /** + * Clears the flag that allows a 'fast paint' on the next repaint, so + * requiring a full repaint + */ + public void setNoFastPaint() + { + allowFastPaint = false; + } + } diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 14ae033..b883e98 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -67,6 +67,8 @@ public class IdCanvas extends JPanel implements ViewportListenerI private Font idfont; + private boolean allowFastPaint; + /** * Creates a new IdCanvas object. * @@ -230,7 +232,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); - if (fastPaint) + if (allowFastPaint && fastPaint) { fastPaint = false; g.drawImage(image, 0, 0, this); @@ -631,6 +633,6 @@ public class IdCanvas extends JPanel implements ViewportListenerI */ public void setNoFastPaint() { - fastPaint = false; + allowFastPaint = false; } } diff --git a/src/jalview/gui/PaintRefresher.java b/src/jalview/gui/PaintRefresher.java index 326bac0..7e203b2 100755 --- a/src/jalview/gui/PaintRefresher.java +++ b/src/jalview/gui/PaintRefresher.java @@ -39,6 +39,9 @@ import java.util.Map; */ public class PaintRefresher { + private static final int ALIGNMENT_CHANGED = 1 << 0; + private static final int VALIDATE_SEQUENCES = 1 << 1; + static Map> components = new HashMap<>(); /** @@ -101,25 +104,32 @@ public class PaintRefresher { List comps = components.get(id); + int mode = (alignmentChanged ? ALIGNMENT_CHANGED : 0) | (validateSequences ? VALIDATE_SEQUENCES : 0); if (comps == null) { return; } + repaintComponents(source, mode, comps.toArray(new Component[comps.size()])); + } - for (Component comp : comps) + public static void repaintComponents(Component source, int mode, + Component... comps) + { + for (int i = 0; i < comps.length; i++) { - if (comp == source) + Component comp = comps[i]; + if (comp == null) { continue; } if (comp instanceof AlignmentPanel) { - if (validateSequences && source instanceof AlignmentPanel) + if ((mode & VALIDATE_SEQUENCES) != 0 && source instanceof AlignmentPanel) { validateSequences(((AlignmentPanel) source).av.getAlignment(), ((AlignmentPanel) comp).av.getAlignment()); } - if (alignmentChanged) + if ((mode & ALIGNMENT_CHANGED) != 0) { ((AlignmentPanel) comp).alignmentChanged(); } @@ -262,4 +272,5 @@ public class PaintRefresher return tmp.toArray(new AlignmentPanel[tmp.size()]); } + } diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index f62507a..59a6cb1 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -99,6 +99,8 @@ public class SeqCanvas extends JPanel implements ViewportListenerI private int availHeight; + private boolean allowFastPaint; + // Don't do this! Graphics handles are supposed to be transient // private Graphics2D gg; @@ -363,7 +365,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI // Call repaint on alignment panel so that repaints from other alignment // panel components can be aggregated. Otherwise performance of the // overview window and others may be adversely affected. - // System.out.println("SeqCanvas fastPaint() repaint() request..."); av.getAlignPanel().repaint(); } finally { @@ -385,7 +386,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI { return; } - ViewportRanges ranges = av.getRanges(); int startRes = ranges.getStartRes(); int startSeq = ranges.getStartSeq(); @@ -415,11 +415,9 @@ public class SeqCanvas extends JPanel implements ViewportListenerI // } Rectangle vis, clip; - if (img != null - && (fastPaint - || (vis = getVisibleRect()).width != (clip = g - .getClipBounds()).width - || vis.height != clip.height)) + if (allowFastPaint && img != null + && (fastPaint || (vis = getVisibleRect()).width != (clip = g.getClipBounds()).width + || vis.height != clip.height)) { g.drawImage(img, 0, 0, this); drawSelectionGroup((Graphics2D) g, startRes, endRes, startSeq, @@ -428,6 +426,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI } else { + allowFastPaint = true; // img is a cached version of the last view we drew. // If we have no img or the size has changed, make a new one. // @@ -1744,9 +1743,6 @@ public class SeqCanvas extends JPanel implements ViewportListenerI - ((int[]) evt.getOldValue())[0]; scrollY = ((int[]) evt.getNewValue())[1] - ((int[]) evt.getOldValue())[1]; - - // System.out.println("SC dx dy " + scrollX + " " + scrollY); - if (scrollX != 0 && scrollY != 0) { // all sorts of problems in JavaScript if this is commented out. @@ -2274,7 +2270,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI */ public void setNoFastPaint() { - fastPaint = false; + allowFastPaint = false; } } diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 3de631f..9b3ae3e 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -243,6 +243,7 @@ public class SeqPanel extends JPanel */ public SeqPanel(AlignViewport viewport, AlignmentPanel alignPanel) { + setName("SeqPanel"); seqARep = new SequenceAnnotationReport(true); ToolTipManager.sharedInstance().registerComponent(this); ToolTipManager.sharedInstance().setInitialDelay(0); diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 7eda110..0317c7d 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -463,8 +463,7 @@ public class FileLoader implements Runnable // add metadata and update ui if (!(protocol == DataSourceType.PASTE)) { - alignFrame.setFileName(file, format); - alignFrame.setFileObject(selectedFile); // BH 2018 SwingJS + alignFrame.setFile(file, selectedFile, protocol, format); } if (proxyColourScheme != null) { diff --git a/src/jalview/io/VamsasAppDatastore.java b/src/jalview/io/VamsasAppDatastore.java index c60fd88..15c481d 100644 --- a/src/jalview/io/VamsasAppDatastore.java +++ b/src/jalview/io/VamsasAppDatastore.java @@ -35,8 +35,10 @@ import jalview.io.vamsas.DatastoreRegistry; import jalview.io.vamsas.Rangetype; import jalview.project.Jalview2XML; import jalview.util.MessageManager; +import jalview.util.jarInputStreamProvider; import jalview.viewmodel.AlignmentViewport; +import java.io.File; import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; @@ -1320,7 +1322,7 @@ public class VamsasAppDatastore // and // mapValuesToString fromxml.setSkipList(skipList); - jalview.util.jarInputStreamProvider jprovider = new jalview.util.jarInputStreamProvider() + jarInputStreamProvider jprovider = new jarInputStreamProvider() { @Override @@ -1338,6 +1340,12 @@ public class VamsasAppDatastore "Returning client input stream for Jalview from Vamsas Document."); return new JarInputStream(cappdata.getClientInputStream()); } + + @Override + public File getFile() + { + return null; + } }; if (dojvsync) { @@ -1368,7 +1376,7 @@ public class VamsasAppDatastore fromxml.setSkipList(skipList); fromxml.setObjectMappingTables(mapKeysToString(vobj2jv), mapValuesToString(jv2vobj)); - jalview.util.jarInputStreamProvider jarstream = new jalview.util.jarInputStreamProvider() + jarInputStreamProvider jarstream = new jarInputStreamProvider() { @Override @@ -1386,6 +1394,12 @@ public class VamsasAppDatastore "Returning user input stream for Jalview from Vamsas Document."); return new JarInputStream(cappdata.getUserInputStream()); } + + @Override + public File getFile() + { + return null; + } }; if (dojvsync) { diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index 9303aed..b4b5003 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -2850,6 +2850,12 @@ public class Jalview2XML } @Override + public File getFile() + { + return jarFile; + } + + @Override public String getFilename() { return file; @@ -2885,8 +2891,8 @@ public class Jalview2XML AlignFrame af = null, _af = null; IdentityHashMap importedDatasets = new IdentityHashMap<>(); Map gatherToThisFrame = new HashMap<>(); - final String file = jprovider.getFilename(); - + String fileName = jprovider.getFilename(); + File file = jprovider.getFile(); List alignFrames = new ArrayList<>(); try @@ -2941,7 +2947,7 @@ public class Jalview2XML // Q: Do we have to load from the model, even if it // does not have a viewport, could we discover that early on? // Q: Do we need to load this object? - _af = loadFromObject(model, file, true, jprovider); + _af = loadFromObject(model, fileName, file, true, jprovider); // Platform.timeCheck("Jalview2XML.loadFromObject", // Platform.TIME_MARK); @@ -2984,7 +2990,7 @@ public class Jalview2XML } catch (IOException ex) { ex.printStackTrace(); - errorMessage = "Couldn't locate Jalview XML file : " + file; + errorMessage = "Couldn't locate Jalview XML file : " + fileName; System.err.println( "Exception whilst loading jalview XML file : " + ex + "\n"); } catch (Exception ex) @@ -3356,16 +3362,17 @@ public class Jalview2XML * * @param jalviewModel * DOM - * @param file + * @param fileName * filename source string + * @param file * @param loadTreesAndStructures * when false only create Viewport * @param jprovider * data source provider * @return alignment frame created from view stored in DOM */ - AlignFrame loadFromObject(JalviewModel jalviewModel, String file, - boolean loadTreesAndStructures, jarInputStreamProvider jprovider) + AlignFrame loadFromObject(JalviewModel jalviewModel, String fileName, + File file, boolean loadTreesAndStructures, jarInputStreamProvider jprovider) { SequenceSet vamsasSet = jalviewModel.getVamsasModel().getSequenceSet().get(0); List vamsasSeqs = vamsasSet.getSequence(); @@ -4132,7 +4139,7 @@ public class Jalview2XML if (af == null) { - af = loadViewport(file, jseqs, hiddenSeqs, al, jalviewModel, view, + af = loadViewport(fileName, file, jseqs, hiddenSeqs, al, jalviewModel, view, uniqueSeqSetId, viewId, autoAlan); av = af.getViewport(); // note that this only retrieves the most recently accessed @@ -4991,7 +4998,7 @@ public class Jalview2XML } } - AlignFrame loadViewport(String fileName, List JSEQ, + AlignFrame loadViewport(String fileName, File file, List JSEQ, List hiddenSeqs, AlignmentI al, JalviewModel jm, Viewport view, String uniqueSeqSetId, String viewId, List autoAlan) @@ -5011,7 +5018,7 @@ public class Jalview2XML // } ; af.alignPanel.setHoldRepaint(true); - af.setFileName(fileName, FileFormat.Jalview); + af.setFile(fileName, file, null, FileFormat.Jalview); af.setFileObject(jarFile); // BH 2019 JAL-3436 final AlignViewport viewport = af.getViewport(); @@ -6127,7 +6134,7 @@ public class Jalview2XML viewportsAdded.clear(); - AlignFrame af = loadFromObject(jm, null, false, null); + AlignFrame af = loadFromObject(jm, null, null, false, null); af.getAlignPanels().clear(); af.closeMenuItem_actionPerformed(true); af.alignPanel.setHoldRepaint(false); diff --git a/src/jalview/util/jarInputStreamProvider.java b/src/jalview/util/jarInputStreamProvider.java index 828a72f..58d52da 100644 --- a/src/jalview/util/jarInputStreamProvider.java +++ b/src/jalview/util/jarInputStreamProvider.java @@ -20,6 +20,7 @@ */ package jalview.util; +import java.io.File; import java.io.IOException; import java.util.jar.JarInputStream; @@ -45,4 +46,9 @@ public interface jarInputStreamProvider * with it */ String getFilename(); + + /** + * @return jarFile name if from SwingJS + */ + File getFile(); } -- 1.7.10.2