X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=199c4e599a9ff1e5cc0cf83a272f668e993b91b1;hb=37de9310bec3501cbc6381e0c3dcb282fcaad812;hp=60c95472f5d9063c65b684ca20b76e773f3d215a;hpb=e2227e5cbd0772e74c24f9e5420a8427fae5ddac;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 60c9547..199c4e5 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) { @@ -458,8 +458,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, String tlabel = null; if (anots[index] != null) { // LML added stem code - if (type.equals(HELIX) || type.equals(SHEET) - || type.equals(STEM) || type.equals(LABEL)) + if (type.equals(HELIX) || type.equals(SHEET) || type.equals(STEM) + || type.equals(LABEL)) { tlabel = anots[index].description; if (tlabel == null || tlabel.length() < 1) @@ -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()); @@ -807,8 +814,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, { text.append(", ") .append(MessageManager.getString("label.sequence")) - .append(" ") - .append(seqIndex + 1); + .append(" ").append(seqIndex + 1); char residue = seqref.getCharAt(column); if (!Comparison.isGap(residue)) { @@ -1127,4 +1133,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(); + } + } }