if (!canFlipToNextPage())
{
throw new IllegalStateException("Wizard is already on the last page");
}
UIBuilderImpl currentBuilder = getCurrentBuilder();
NavigationResult result = currentBuilder.getWizard().next(context);
Class<? extends UICommand>[] successors = result.getNext();
final Class<? extends UICommand> successor;
if (successors == null)
{
successor = subflows.pop();
}
else
{
successor = successors[0];
for (int i = 1; i < successors.length; i++)
{
subflows.push(successors[i]);
}
}
UIBuilderImpl nextBuilder = createBuilder((Class<W>) successor);
pages.add(nextBuilder);
return result.getMessage();
}