*/
private boolean dontScrollComplement;
+ private PropertyChangeListener propertyChangeListener;
+
/**
* Creates a new AlignmentPanel object.
*
vscroll.addAdjustmentListener(this);
final AlignmentPanel ap = this;
- av.addPropertyChangeListener(new PropertyChangeListener()
+ propertyChangeListener = new PropertyChangeListener()
{
@Override
public void propertyChange(PropertyChangeEvent evt)
alignmentChanged();
}
}
- });
+ };
+ av.addPropertyChangeListener(propertyChangeListener);
fontChanged();
adjustAnnotationHeight();
updateLayout();
PaintRefresher.RemoveComponent(getSeqPanel().seqCanvas);
PaintRefresher.RemoveComponent(getIdPanel().getIdCanvas());
PaintRefresher.RemoveComponent(this);
+
+ /*
+ * try to ensure references are nulled
+ */
+ if (annotationPanel != null)
+ {
+ annotationPanel.dispose();
+ }
+
if (av != null)
{
+ av.removePropertyChangeListener(propertyChangeListener);
jalview.structure.StructureSelectionManager ssm = av
.getStructureSelectionManager();
ssm.removeStructureViewerListener(getSeqPanel(), null);
ssm.removeCommandListener(av);
ssm.removeStructureViewerListener(getSeqPanel(), null);
ssm.removeSelectionListener(getSeqPanel());
- av.setAlignment(null);
+ av.dispose();
av = null;
}
else
import jalview.datamodel.ColumnSelection;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
+import jalview.util.Platform;
import java.awt.BasicStroke;
import java.awt.Color;
*/
private final boolean debugRedraw;
+ private int charWidth, endRes, charHeight;
+
+ private boolean validCharWidth, hasHiddenColumns;
+
+ private FontMetrics fm;
+
+ private final boolean MAC = Platform.isAMac();
+
+ boolean av_renderHistogram = true, av_renderProfile = true,
+ av_normaliseProfile = false;
+
+ ColourSchemeI profcolour = null;
+
+ private ColumnSelection columnSelection;
+
+ private Hashtable[] hconsensus;
+
+ private Hashtable[] complementConsensus;
+
+ private Hashtable[] hStrucConsensus;
+
+ private boolean av_ignoreGapsConsensus;
+
+ /**
+ * attributes set from AwtRenderPanelI
+ */
+ /**
+ * old image used when data is currently being calculated and cannot be
+ * rendered
+ */
+ private Image fadedImage;
+
+ /**
+ * panel being rendered into
+ */
+ private ImageObserver annotationPanel;
+
+ /**
+ * width of image to render in panel
+ */
+ private int imgWidth;
+
+ /**
+ * offset to beginning of visible area
+ */
+ private int sOffset;
+
+ /**
+ * offset to end of visible area
+ */
+ private int visHeight;
+
+ /**
+ * indicate if the renderer should only render the visible portion of the
+ * annotation given the current view settings
+ */
+ private boolean useClip = true;
+
+ /**
+ * master flag indicating if renderer should ever try to clip. not enabled for
+ * jalview 2.8.1
+ */
+ private boolean canClip = false;
+
public AnnotationRenderer()
{
this(false);
this.debugRedraw = debugRedraw;
}
+ /**
+ * Remove any references and resources when this object is no longer required
+ */
+ public void dispose()
+ {
+ hconsensus = null;
+ complementConsensus = null;
+ hStrucConsensus = null;
+ fadedImage = null;
+ annotationPanel = null;
+ }
+
void drawStemAnnot(Graphics g, Annotation[] row_annotations,
int lastSSX, int x, int y, int iconOffset, int startRes,
int column, boolean validRes, boolean validEnd)
g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
}
- private int charWidth, endRes, charHeight;
-
- private boolean validCharWidth, hasHiddenColumns;
-
- private FontMetrics fm;
-
- private final boolean MAC = jalview.util.Platform.isAMac();
-
- boolean av_renderHistogram = true, av_renderProfile = true,
- av_normaliseProfile = false;
-
- ColourSchemeI profcolour = null;
-
- private ColumnSelection columnSelection;
-
- private Hashtable[] hconsensus;
-
- private Hashtable[] complementConsensus;
-
- private Hashtable[] hStrucConsensus;
-
- private boolean av_ignoreGapsConsensus;
-
- /**
- * attributes set from AwtRenderPanelI
- */
- /**
- * old image used when data is currently being calculated and cannot be
- * rendered
- */
- private Image fadedImage;
-
- /**
- * panel being rendered into
- */
- private ImageObserver annotationPanel;
-
- /**
- * width of image to render in panel
- */
- private int imgWidth;
-
- /**
- * offset to beginning of visible area
- */
- private int sOffset;
-
- /**
- * offset to end of visible area
- */
- private int visHeight;
-
- /**
- * indicate if the renderer should only render the visible portion of the
- * annotation given the current view settings
- */
- private boolean useClip = true;
-
- /**
- * master flag indicating if renderer should ever try to clip. not enabled for
- * jalview 2.8.1
- */
- private boolean canClip = false;
-
void drawNotCanonicalAnnot(Graphics g, Color nonCanColor,
Annotation[] row_annotations, int lastSSX, int x, int y,
int iconOffset, int startRes, int column, boolean validRes,