X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=0b2f6cc24dcaacaad9f3be57b2fe8d52a1cbc6fc;hb=c32ab1543aaab3e21606e570d12bec7e14610b6a;hp=60c95472f5d9063c65b684ca20b76e773f3d215a;hpb=e2227e5cbd0772e74c24f9e5420a8427fae5ddac;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 60c9547..0b2f6cc 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -49,6 +49,7 @@ import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.awt.image.BufferedImage; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -122,8 +123,6 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, boolean mouseDragging = false; - boolean MAC = false; - // for editing cursor int cursorX = 0; @@ -141,9 +140,6 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, */ public AnnotationPanel(AlignmentPanel ap) { - - MAC = jalview.util.Platform.isAMac(); - ToolTipManager.sharedInstance().registerComponent(this); ToolTipManager.sharedInstance().setInitialDelay(0); ToolTipManager.sharedInstance().setDismissDelay(10000); @@ -445,8 +441,12 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, StringBuilder collatedInput = new StringBuilder(64); String last = ""; ColumnSelection viscols = av.getColumnSelection(); - // TODO: refactor and save av.getColumnSelection for efficiency - List selected = viscols.getSelected(); + + /* + * the selection list (read-only view) is in selection order, not + * column order; make a copy so we can sort it + */ + List selected = new ArrayList(viscols.getSelected()); Collections.sort(selected); for (int index : selected) { @@ -532,6 +532,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } } + /* + * isPopupTrigger fires in mousePressed on Mac, + * not until mouseRelease on Windows + */ if (evt.isPopupTrigger() && activeRow != -1) { showPopupMenu(y, evt.getX()); @@ -539,7 +543,6 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } ap.getScalePanel().mousePressed(evt); - } /** @@ -603,6 +606,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, mouseDragging = false; ap.getScalePanel().mouseReleased(evt); + /* + * isPopupTrigger is set in mouseReleased on Windows + * (in mousePressed on Mac) + */ if (evt.isPopupTrigger() && activeRow != -1) { showPopupMenu(evt.getY(), evt.getX()); @@ -1127,4 +1134,25 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, return null; } } + + /** + * Try to ensure any references held are nulled + */ + public void dispose() + { + av = null; + ap = null; + image = null; + fadedImage = null; + gg = null; + _mwl = null; + + /* + * I created the renderer so I will dispose of it + */ + if (renderer != null) + { + renderer.dispose(); + } + } }