From: gmungoc Date: Mon, 28 Aug 2017 12:51:42 +0000 (+0100) Subject: JAL-2608 close any Overview when alignment view is closed X-Git-Tag: Release_2_10_3b1~86^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=eac3f8019fe37f2c84784adef3a7db56598c5cb8;p=jalview.git JAL-2608 close any Overview when alignment view is closed --- diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index b48dec9..7d82dd7 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -1590,10 +1590,12 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { System.exit(0); } - else + + viewport = null; + if (alignPanel != null && alignPanel.overviewPanel != null) { + alignPanel.overviewPanel.dispose(); } - viewport = null; alignPanel = null; this.dispose(); } @@ -1725,7 +1727,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { EditCommand editCommand = (EditCommand) command; al = editCommand.getAlignment(); - Vector comps = (Vector) PaintRefresher.components + Vector comps = PaintRefresher.components .get(viewport.getSequenceSetId()); for (int i = 0; i < comps.size(); i++) { @@ -2485,7 +2487,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, PaintRefresher.Register(newaf.alignPanel.seqPanel.seqCanvas, newaf.alignPanel.av.getSequenceSetId()); - Vector comps = (Vector) PaintRefresher.components + Vector comps = PaintRefresher.components .get(viewport.getSequenceSetId()); int viewSize = -1; for (int i = 0; i < comps.size(); i++) diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index be552c0..3ee3c1d 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -31,6 +31,7 @@ import java.awt.BorderLayout; import java.awt.CheckboxMenuItem; import java.awt.Cursor; import java.awt.Dimension; +import java.awt.Frame; import java.awt.Panel; import java.awt.PopupMenu; import java.awt.event.ComponentAdapter; @@ -325,6 +326,9 @@ public class OverviewPanel extends Panel implements Runnable, try { av.getRanges().removePropertyChangeListener(this); + Frame parent = (Frame) getParent(); + parent.dispose(); + parent.setVisible(false); } finally { av = null; diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 922e481..b6bd4af 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1625,6 +1625,7 @@ public class AlignmentPanel extends GAlignmentPanel implements if (annotationPanel != null) { annotationPanel.dispose(); + annotationPanel = null; } if (av != null) @@ -1654,9 +1655,15 @@ public class AlignmentPanel extends GAlignmentPanel implements */ protected void closeChildFrames() { + if (overviewPanel != null) + { + overviewPanel.dispose(); + overviewPanel = null; + } if (calculationDialog != null) { calculationDialog.closeFrame(); + calculationDialog = null; } } diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index 28de801..7cbe8b7 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -38,8 +38,10 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import java.beans.PropertyChangeEvent; +import java.beans.PropertyVetoException; import javax.swing.JCheckBoxMenuItem; +import javax.swing.JInternalFrame; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; @@ -316,7 +318,20 @@ public class OverviewPanel extends JPanel { try { - av.getRanges().removePropertyChangeListener(this); + if (av != null) + { + av.getRanges().removePropertyChangeListener(this); + } + + /* + * close the parent frame (which also removes it from the + * Desktop Windows menu) + */ + ((JInternalFrame) SwingUtilities.getAncestorOfClass( + JInternalFrame.class, (this))).setClosed(true); + } catch (PropertyVetoException e) + { + // ignore } finally { av = null;