*/
package jalview.gui;
-import jalview.bin.Cache;
-import jalview.datamodel.ColumnSelection;
-import jalview.datamodel.SequenceGroup;
-import jalview.datamodel.SequenceI;
-import jalview.structure.SecondaryStructureListener;
-import jalview.structure.SelectionListener;
-import jalview.structure.SelectionSource;
-import jalview.structure.StructureSelectionManager;
-import jalview.structure.VamsasSource;
-import jalview.util.ShiftList;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.ArrayList;
import javax.swing.JInternalFrame;
import javax.swing.JSplitPane;
-
-import jalview.bin.Cache;
-import jalview.util.MessageManager;
-import jalview.util.ShiftList;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
import fr.orsay.lri.varna.VARNAPanel;
import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
import fr.orsay.lri.varna.models.rna.ModeleBase;
import fr.orsay.lri.varna.models.rna.RNA;
+import jalview.bin.Cache;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.structure.SecondaryStructureListener;
+import jalview.structure.SelectionListener;
+import jalview.structure.SelectionSource;
+import jalview.structure.StructureSelectionManager;
+import jalview.structure.VamsasSource;
+import jalview.util.MessageManager;
+import jalview.util.ShiftList;
+
public class AppVarna extends JInternalFrame implements
InterfaceVARNAListener, SelectionListener,
SecondaryStructureListener// implements
// System.out.println(ssm.toString());
ssm.addStructureViewerListener(this);
ssm.addSelectionListener(this);
+ addInternalFrameListener(new InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosed(InternalFrameEvent evt)
+ {
+ close();
+ }
+ });
+
}
public void initVarna()
}
+ /**
+ * Tidy up as necessary when the viewer panel is closed
+ */
+ protected void close()
+ {
+ /*
+ * Deregister as a listener, to free references to this object
+ */
+ if (ap != null)
+ {
+ StructureSelectionManager ssm = ap.getStructureSelectionManager();
+ if (ssm != null)
+ {
+ ssm.removeStructureViewerListener(AppVarna.this, null);
+ ssm.removeSelectionListener(AppVarna.this);
+ }
+ }
+ }
+
}