X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=b1f0edb83284bdf2711ccb36a1372c527debc9f0;hb=3e6ab0cb043dd49393bf8a9cb6d79098d5a6b6a5;hp=bd903b34c4b6b386b176048dbd41af13221e4ff8;hpb=0d74306f282be2d15eeb5d8de53a949c0124a0a5;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index bd903b3..b1f0edb 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); @@ -304,7 +300,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, else if (action.equals(LABEL)) { String exMesg = collectAnnotVals(anot, LABEL); - String label = JOptionPane.showInputDialog(this, + String label = JvOptionPane.showInputDialog(this, MessageManager.getString("label.enter_label"), exMesg); if (label == null) @@ -384,7 +380,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, aa[activeRow].hasIcons = true; } - String label = JOptionPane.showInputDialog(MessageManager + String label = JvOptionPane.showInputDialog(MessageManager .getString("label.enter_label_for_the_structure"), symbol); if (label == null) @@ -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) @@ -814,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)) { @@ -1134,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(); + } + } }