previousStates = new LinkedList<mxCellState>();
Iterator<mxCellState> it = deltas.keySet().iterator();
while (it.hasNext())
{
mxCellState state = it.next();
previousStates.addAll(snapshot(state));
}
}
// Translates the states in step
Iterator<mxCellState> it = deltas.keySet().iterator();
while (it.hasNext())
{
mxCellState state = it.next();
mxPoint delta = deltas.get(state);
mxCellState parentState = graph.getView().getState(
model.getParent(state.getCell()));
translateState(parentState, state, delta.getX(), delta.getY());
}
// Revalidates the states in step
mxRectangle dirty = null;
it = deltas.keySet().iterator();
while (it.hasNext())
{
mxCellState state = it.next();
mxPoint delta = deltas.get(state);
mxCellState parentState = graph.getView().getState(
model.getParent(state.getCell()));
mxRectangle tmp = revalidateState(parentState, state, delta.getX(),
delta.getY());
if (dirty != null)
{
dirty.add(tmp);
}
else
{
dirty = tmp;
}
}
// Takes a snapshot of the states for later drawing. If the states
// are not cloned then this does nothing and just expects a repaint
// of the dirty rectangle.
if (previousStates != null)
{
cellStates = new LinkedList<mxCellState>();
it = deltas.keySet().iterator();
while (it.hasNext())
{
mxCellState state = it.next();
cellStates.addAll(snapshot(state));
}
// Restores the previous states
restore(previousStates);