*
* @throws IOException
* @generated NOT
*/
public void rollbackTransaction() throws IOException {
fireEvent(new EditManagerEvent(this, EditManagerEvent.PRE_ROLLBACK, null, null));
startCommitRollback("Rolling back to Previous checkpoint");
HashMap<List<FeatureEvent>, FeatureEvent> modified = new HashMap<List<FeatureEvent>, FeatureEvent>();
try {
synchronized (this) {
for (Layer layer : getMapInternal().getLayersInternal()) {
if (layer.getFeatureChanges().size() != 0) {
List<FeatureEvent> changes = layer.getFeatureChanges();
// create an event that notifies listeners that the area has changed again.
// calculate bounds of all the Changes to date.
// The reason for this is that otherwise I would have to make the entire
// viewport re-render on a rollback.
// TODO This is a workaround to get around that.
Envelope envelope = new Envelope();
for (FeatureEvent event : changes) {
envelope.expandToInclude(event.getBounds());
}
FeatureSource<SimpleFeatureType, SimpleFeature> source = layer.getResource(
FeatureSource.class, null);
FeatureEvent event = new FeatureEvent(source,
FeatureEvent.FEATURES_CHANGED, envelope);
modified.put(changes, event);
}
}
}
if (selectedLayer != null)
selectedLayer.setFilter(Filter.EXCLUDE);
transaction.rollbackInternal();
} catch (IOException e) {
throw e;
} finally {
commitRollbackComplete();
triggerLayerEvents(modified);
setEditFeature(null, null);
fireEvent(new EditManagerEvent(this, EditManagerEvent.POST_ROLLBACK, null, null));
}
}