X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=3dd581e97d9d370b99f5cd88b266290d21be2c18;hb=d9c7868a610eff29a8eddb160b6dc78a94a72470;hp=f06ca94a1acf8557c3797fb95ffee7969011be70;hpb=e1767448d422ab26a6920bae2173804eda662e31;p=jalview.git diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index f06ca94..3dd581e 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2) + * Copyright (C) 2015 The Jalview Authors * * This file is part of Jalview. * @@ -101,6 +101,8 @@ public class AlignmentPanel extends GAlignmentPanel implements */ private boolean dontScrollComplement; + private PropertyChangeListener propertyChangeListener; + /** * Creates a new AlignmentPanel object. * @@ -135,7 +137,7 @@ public class AlignmentPanel extends GAlignmentPanel implements vscroll.addAdjustmentListener(this); final AlignmentPanel ap = this; - av.addPropertyChangeListener(new PropertyChangeListener() + propertyChangeListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) @@ -146,7 +148,8 @@ public class AlignmentPanel extends GAlignmentPanel implements alignmentChanged(); } } - }); + }; + av.addPropertyChangeListener(propertyChangeListener); fontChanged(); adjustAnnotationHeight(); updateLayout(); @@ -1269,6 +1272,7 @@ public class AlignmentPanel extends GAlignmentPanel implements void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file) { + int boarderBottomOffset = 5; long pSessionId = System.currentTimeMillis(); headless = (System.getProperty("java.awt.headless") != null && System .getProperty("java.awt.headless").equals("true")); @@ -1277,7 +1281,7 @@ public class AlignmentPanel extends GAlignmentPanel implements if (file != null) { alignFrame.setProgressBar(MessageManager.formatMessage( - "status.saving_file", new Object[] { type.getLabel() }), + "status.saving_file", new Object[] { type.getLabel() }), pSessionId); } } @@ -1305,14 +1309,15 @@ public class AlignmentPanel extends GAlignmentPanel implements } im = new jalview.util.ImageMaker(this, type, imageAction, - aDimension.getWidth(), aDimension.getHeight(), file, - imageTitle, alignFrame, pSessionId, headless); + aDimension.getWidth(), aDimension.getHeight() + + boarderBottomOffset, file, imageTitle, + alignFrame, pSessionId, headless); if (av.getWrapAlignment()) { if (im.getGraphics() != null) { printWrappedAlignment(im.getGraphics(), aDimension.getWidth(), - aDimension.getHeight(), 0); + aDimension.getHeight() + boarderBottomOffset, 0); im.writeImage(); } } @@ -1593,8 +1598,18 @@ public class AlignmentPanel extends GAlignmentPanel implements PaintRefresher.RemoveComponent(getSeqPanel().seqCanvas); PaintRefresher.RemoveComponent(getIdPanel().getIdCanvas()); PaintRefresher.RemoveComponent(this); + + /* + * try to ensure references are nulled + */ + if (annotationPanel != null) + { + annotationPanel.dispose(); + } + if (av != null) { + av.removePropertyChangeListener(propertyChangeListener); jalview.structure.StructureSelectionManager ssm = av .getStructureSelectionManager(); ssm.removeStructureViewerListener(getSeqPanel(), null); @@ -1602,7 +1617,7 @@ public class AlignmentPanel extends GAlignmentPanel implements ssm.removeCommandListener(av); ssm.removeStructureViewerListener(getSeqPanel(), null); ssm.removeSelectionListener(getSeqPanel()); - av.setAlignment(null); + av.dispose(); av = null; } else