Merge "Issue #1638 Fixed VizDisplayPane dispose and resize methods" into development

Former-commit-id: b5d69b9aa8 [formerly 0ccc3576db] [formerly ff2ef956a7] [formerly 1110297ec5 [formerly ff2ef956a7 [formerly 0dcb3eca5d0ab42912a1310361b95505529ddab5]]]
Former-commit-id: 1110297ec5
Former-commit-id: 97332c9db89fea8b974a04faab114849e6c20a77 [formerly 056882504c]
Former-commit-id: 2134b51c9d
This commit is contained in:
Richard Peter 2013-05-03 15:42:26 -05:00 committed by Gerrit Code Review
commit 1c9fda40dc

View file

@ -206,7 +206,7 @@ public class VizDisplayPane implements IDisplayPane {
this.canvas.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
VizDisplayPane.this.dispose();
VizDisplayPane.this.disposePane();
}
});
// set the renderable display
@ -378,12 +378,7 @@ public class VizDisplayPane implements IDisplayPane {
return target;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.IDisplayPane#dispose()
*/
public void dispose() {
private void disposePane() {
synchronized (this) {
DrawCoordinatorJob.getInstance().unregisterPane(this.container,
this);
@ -403,6 +398,21 @@ public class VizDisplayPane implements IDisplayPane {
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.IDisplayPane#dispose()
*/
public void dispose() {
disposePane();
if (canvas.isDisposed() == false) {
// Dispose was called outside of our own canvas listener so
// destroy the canvas composite so the pane disappears
canvasComp.dispose();
}
}
protected void draw(final boolean actualDraw) {
if (renderableDisplay == null) {
@ -809,20 +819,28 @@ public class VizDisplayPane implements IDisplayPane {
* Resize the pane
*/
protected void resize() {
if (canvas == null || canvas.isDisposed()) {
return;
synchronized (this) {
// Schedule this to run so resize can finish if doing multiple panes and
// only called once if layout changing a lot
VizApp.runAsync(new Runnable() {
@Override
public void run() {
if (canvas == null || canvas.isDisposed()) {
return;
}
target.resize();
Rectangle clientArea = canvas.getClientArea();
if (renderableDisplay != null) {
renderableDisplay.calcPixelExtent(clientArea);
zoomLevel = renderableDisplay
.recalcZoomLevel(renderableDisplay
.getDimensions());
}
}
});
}
target.resize();
Rectangle clientArea = canvas.getClientArea();
if (renderableDisplay != null) {
renderableDisplay.calcPixelExtent(clientArea);
zoomLevel = renderableDisplay.recalcZoomLevel(renderableDisplay
.getDimensions());
}
refresh();
}
/*