Issue #2832 consolidate watch and warning recycle logic

Change-Id: I9d7e284bafbe8073ac99eb3ce0e7fbd81f3ff889

Former-commit-id: 8cd98e0b9f [formerly 814d21d0a5b58c95f6339e1816788953692f5e95]
Former-commit-id: 057f7671a0
This commit is contained in:
Nate Jensen 2014-03-10 13:02:45 -05:00
parent 9026f93f20
commit 8e734f917e
3 changed files with 38 additions and 47 deletions

View file

@ -84,6 +84,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* Sep 4, 2013 2176 jsanchez Made the polygon line width thicker and made regular text not bold. * Sep 4, 2013 2176 jsanchez Made the polygon line width thicker and made regular text not bold.
* Nov 11, 2013 2439 rferrel Changes to prevent getting future warning when in DRT mode. * Nov 11, 2013 2439 rferrel Changes to prevent getting future warning when in DRT mode.
* Dec 3, 2013 2576 jsanchez Increased the font size of EMER. * Dec 3, 2013 2576 jsanchez Increased the font size of EMER.
* Mar 10, 2014 2832 njensen Moved duplicated subclass's disposeInternal() logic here
*
* </pre> * </pre>
* *
* @author jsanchez * @author jsanchez
@ -695,4 +697,34 @@ public abstract class AbstractWWAResource extends
} }
return timeRange; return timeRange;
} }
@Override
protected void disposeInternal() {
for (WarningEntry entry : entryMap.values()) {
if (entry.shadedShape != null) {
entry.shadedShape.dispose();
}
if (entry.wireframeShape != null) {
entry.wireframeShape.dispose();
}
/*
* we set this to true and keep the entries around solely in case
* this resource is being recycled
*/
entry.project = true;
}
if (warningsFont != null) {
warningsFont.dispose();
// set font to null for recycle safety
warningsFont = null;
}
if (emergencyFont != null) {
emergencyFont.dispose();
// set font to null for recylcle safety
emergencyFont = null;
}
}
} }

View file

@ -63,8 +63,8 @@ import com.vividsolutions.jts.geom.Geometry;
* Jul 24, 2013 DR16350 mgamazaychikov Fix the problem with plotting EXP warning * Jul 24, 2013 DR16350 mgamazaychikov Fix the problem with plotting EXP warning
* Sep 5, 2013 2176 jsanchez Disposed the emergency font. * Sep 5, 2013 2176 jsanchez Disposed the emergency font.
* Feb 19, 2014 2819 randerso Removed unnecessary .clone() call * Feb 19, 2014 2819 randerso Removed unnecessary .clone() call
* Mar 04, 2014 2832 njensen Set fonts to null in disposeInternal() so recycle works * Mar 04, 2014 2832 njensen Moved disposeInternal() to abstract class
* Set entry.project to true for recycle *
* </pre> * </pre>
* *
* @author jsanchez * @author jsanchez
@ -134,30 +134,7 @@ public class WarningsResource extends AbstractWWAResource {
@Override @Override
protected void disposeInternal() { protected void disposeInternal() {
cancelRefreshTask(this); cancelRefreshTask(this);
for (WarningEntry entry : entryMap.values()) { super.disposeInternal();
if (entry.shadedShape != null) {
entry.shadedShape.dispose();
}
if (entry.wireframeShape != null) {
entry.wireframeShape.dispose();
}
/*
* we set this to true and keep the entries around solely in case
* this resource is being recycled
*/
entry.project = true;
}
if (warningsFont != null) {
warningsFont.dispose();
warningsFont = null;
}
if (emergencyFont != null) {
emergencyFont.dispose();
emergencyFont = null;
}
} }
@Override @Override

View file

@ -53,7 +53,8 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* Nov 8, 2013 16758 mgamazaychikov Changed access modifier of mergeWatches to protected * Nov 8, 2013 16758 mgamazaychikov Changed access modifier of mergeWatches to protected
* so a child class can override the implementation. * so a child class can override the implementation.
* Feb 19, 2014 2819 randerso Removed unnecessary .clone() call * Feb 19, 2014 2819 randerso Removed unnecessary .clone() call
* Mar 04, 2014 2832 njensen Set fonts to null in disposeInternal() so recycle works * Mar 04, 2014 2832 njensen Moved disposeInternal() to abstract class
*
* </pre> * </pre>
* *
* @author jsanchez * @author jsanchez
@ -131,26 +132,7 @@ public class WatchesResource extends AbstractWWAResource {
@Override @Override
protected void disposeInternal() { protected void disposeInternal() {
timer.cancel(); timer.cancel();
super.disposeInternal();
for (WarningEntry entry : entryMap.values()) {
if (entry.shadedShape != null) {
entry.shadedShape.dispose();
}
if (entry.wireframeShape != null) {
entry.wireframeShape.dispose();
}
}
entryMap.clear();
if (warningsFont != null) {
warningsFont.dispose();
warningsFont = null;
}
if (emergencyFont != null) {
emergencyFont.dispose();
emergencyFont = null;
}
} }
@Override @Override