revalidateList.add(e.getKey());
// schedule adding the listener
scheduleChange(new Change(e.getKey(), null, null) {
public void run() {
SpatialCell cell = universe.getSpatialCell(cellID);
if (cell == null) {
// the cell no longer exists.
return;
}
logger.log(Level.INFO, "Restoring listener " +
record.get() + " type " + e.getValue());
if (e.getValue() == ListenerRecord.Type.TRANSFORM ||
e.getValue() == ListenerRecord.Type.BOTH)
{
universe.addTransformChangeListener(cellID, (TransformChangeListenerSrv) record.get());
}
if (e.getValue() == ListenerRecord.Type.VIEW ||
e.getValue() == ListenerRecord.Type.BOTH)
{
universe.addViewUpdateListener(cellID, (ViewUpdateListener) record.get());
}
}
});
}
}
// now schedule a change to revalidate each cell ID we added, so
// the transform is up to date
for (CellID cellID : revalidateList) {
scheduleChange(new Change(cellID, null, null) {
public void run() {
SpatialCell cell = universe.getSpatialCell(cellID);
if (cell != null) {
cell.revalidateListeners(taskOwner);
}
}
});
}
}