@Override public void dispose() { if (featureSource != null) { if (sourceListener != null) { featureSource.removeFeatureListener(sourceListener); } featureSource = null; } style = null; query = null; super.dispose(); }
/** Used to connect/disconnect a FeatureListener if any map layer listeners are registered. */ protected synchronized void connectDataListener(boolean listen) { if (sourceListener == null) { sourceListener = new FeatureListener() { public void changed(FeatureEvent featureEvent) { fireMapLayerListenerLayerChanged(MapLayerEvent.DATA_CHANGED); } }; } if (listen) { featureSource.addFeatureListener(sourceListener); } else { featureSource.removeFeatureListener(sourceListener); } }