Collection newOE = new ArrayList(currentMap.getObjEntities());
Collection newDE = new ArrayList(currentMap.getDbEntities());
Collection newQueries = new ArrayList(currentMap.getQueries());
EntityEvent entityEvent = new EntityEvent(Application.getFrame(), null);
QueryEvent queryEvent = new QueryEvent(Application.getFrame(), null);
Collection addedOE = CollectionUtils.subtract(newOE, originalOE);
Iterator it = addedOE.iterator();
while (it.hasNext()) {
Entity e = (Entity) it.next();
entityEvent.setEntity(e);
entityEvent.setId(MapEvent.ADD);
mediator.fireObjEntityEvent(entityEvent);
}
Collection removedOE = CollectionUtils.subtract(originalOE, newOE);
it = removedOE.iterator();
while (it.hasNext()) {
Entity e = (Entity) it.next();
entityEvent.setEntity(e);
entityEvent.setId(MapEvent.REMOVE);
mediator.fireObjEntityEvent(entityEvent);
}
Collection addedDE = CollectionUtils.subtract(newDE, originalDE);
it = addedDE.iterator();
while (it.hasNext()) {
Entity e = (Entity) it.next();
entityEvent.setEntity(e);
entityEvent.setId(MapEvent.ADD);
mediator.fireDbEntityEvent(entityEvent);
}
Collection removedDE = CollectionUtils.subtract(originalDE, newDE);
it = removedDE.iterator();
while (it.hasNext()) {
Entity e = (Entity) it.next();
entityEvent.setEntity(e);
entityEvent.setId(MapEvent.REMOVE);
mediator.fireDbEntityEvent(entityEvent);
}
// queries
Collection addedQueries = CollectionUtils.subtract(newQueries, originalQueries);
it = addedQueries.iterator();
while (it.hasNext()) {
Query q = (Query) it.next();
queryEvent.setQuery(q);
queryEvent.setId(MapEvent.ADD);
mediator.fireQueryEvent(queryEvent);
}
Collection removedQueries = CollectionUtils.subtract(originalQueries, newQueries);
it = removedQueries.iterator();
while (it.hasNext()) {
Query q = (Query) it.next();
queryEvent.setQuery(q);
queryEvent.setId(MapEvent.REMOVE);
mediator.fireQueryEvent(queryEvent);
}
mediator.fireDataMapDisplayEvent(new DataMapDisplayEvent(Application
.getFrame(), map, mediator.getCurrentDataDomain(), mediator