// A State pattern is used here because column insertion and
// deletion (as well as row changes), is not an atomic ODOM
// change. A sequence of events is generated, some of which
// must be processed, with the rest ignored. The
// ColumnChangeState handles all this for us.
GridModifierState columnChange =
new ColumnChangeState(this);
// Return to the current state after processing.
columnChange.setNextState(currentState);
// Process the column change and return to its terminal state,
// which was set above.
currentState = columnChange.processEvent(event);
} else if (attrName.equals(FormatComposite.ROWS_ATTR_NAME)) {
// See the comment above for the "columns" attribute.
GridModifierState rowChange =
new RowChangeState(this);
rowChange.setNextState(currentState);
currentState = rowChange.processEvent(event);
}
}
}