boolean isBlankPage)
throws PageProductionException {
if (currentSubSequence == null) {
currentSubSequence = getNextSubSequence();
if (currentSubSequence == null) {
BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
getUserAgent().getEventBroadcaster());
eventProducer.missingSubsequencesInPageSequenceMaster(this,
masterName, getLocator());
}
}
String pageMasterName = currentSubSequence
.getNextPageMasterName(isOddPage, isFirstPage, isLastPage, isBlankPage);
boolean canRecover = true;
while (pageMasterName == null) {
SubSequenceSpecifier nextSubSequence = getNextSubSequence();
if (nextSubSequence == null) {
BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
getUserAgent().getEventBroadcaster());
eventProducer.pageSequenceMasterExhausted(this,
masterName, canRecover, getLocator());
currentSubSequence.reset();
canRecover = false;
} else {
currentSubSequence = nextSubSequence;
}
pageMasterName = currentSubSequence
.getNextPageMasterName(isOddPage, isFirstPage, isLastPage, isBlankPage);
}
SimplePageMaster pageMaster = this.layoutMasterSet
.getSimplePageMaster(pageMasterName);
if (pageMaster == null) {
BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
getUserAgent().getEventBroadcaster());
eventProducer.noMatchingPageMaster(this,
masterName, pageMasterName, getLocator());
}
return pageMaster;
}