private DataSource getModedDataSource(DataSource ds, int mode) {
DataSource ret = ds;
if ((mode & UNDOABLE) == UNDOABLE) {
if (ds instanceof AlphanumericDataSource) {
ret = new UndoableAlphanumericDataSource(
(AlphanumericDataSource) ret);
} else {
ret = new UndoableSpatialDataSource((SpatialDataSource) ret);
}
}