Issue #1638 Fixed VizDisplayPane dispose and resize methods

Change-Id: I2bd4e703302a8645cdb2b43e13f87ed0732e386c

Former-commit-id: 2e96868c08 [formerly 2e96868c08 [formerly 0272170330da06169c9f59ac77fd9ab1d5a124a1]]
Former-commit-id: e7ea79782c
Former-commit-id: f7f7e2256f
This commit is contained in:
Max Schenkelberg 2013-05-03 12:54:39 -05:00
parent bd47526fc6
commit 2feb1fb50a

View file

@ -206,7 +206,7 @@ public class VizDisplayPane implements IDisplayPane {
this.canvas.addDisposeListener(new DisposeListener() { this.canvas.addDisposeListener(new DisposeListener() {
@Override @Override
public void widgetDisposed(DisposeEvent e) { public void widgetDisposed(DisposeEvent e) {
VizDisplayPane.this.dispose(); VizDisplayPane.this.disposePane();
} }
}); });
// set the renderable display // set the renderable display
@ -378,12 +378,7 @@ public class VizDisplayPane implements IDisplayPane {
return target; return target;
} }
/* private void disposePane() {
* (non-Javadoc)
*
* @see com.raytheon.viz.core.gl.IDisplayPane#dispose()
*/
public void dispose() {
synchronized (this) { synchronized (this) {
DrawCoordinatorJob.getInstance().unregisterPane(this.container, DrawCoordinatorJob.getInstance().unregisterPane(this.container,
this); 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) { protected void draw(final boolean actualDraw) {
if (renderableDisplay == null) { if (renderableDisplay == null) {
@ -809,20 +819,28 @@ public class VizDisplayPane implements IDisplayPane {
* Resize the pane * Resize the pane
*/ */
protected void resize() { protected void resize() {
if (canvas == null || canvas.isDisposed()) { synchronized (this) {
return; // 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();
} }
/* /*