}
/** {@inheritDoc} */
public void handleExtensionObject(Object extension) throws IFException {
if (extension instanceof AFPPageSetup) {
AFPPageSetup aps = (AFPPageSetup)extension;
String element = aps.getElementName();
if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) {
switch (this.location) {
case FOLLOWING_PAGE_SEQUENCE:
case IN_PAGE_HEADER:
String name = aps.getName();
String value = aps.getValue();
dataStream.createTagLogicalElement(name, value);
break;
default:
throw new IFException(
"TLE extension must be in the page header or between page-sequence"
+ " and the first page: " + aps, null);
}
} else if (AFPElementMapping.NO_OPERATION.equals(element)) {
switch (this.location) {
case FOLLOWING_PAGE_SEQUENCE:
if (aps.getPlacement() == ExtensionPlacement.BEFORE_END) {
this.deferredPageSequenceExtensions.add(aps);
break;
}
case IN_DOCUMENT_HEADER:
case IN_PAGE_HEADER: