import org.apache.xmlgraphics.util.XMLizable;
import org.apache.fop.accessibility.StructureTreeEventHandler;
+import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.extensions.InternalElementMapping;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.render.DefaultRendererConfigurator;
+import org.apache.fop.render.RendererEventProducer;
import org.apache.fop.render.RenderingContext;
import org.apache.fop.render.intermediate.IFRendererConfig.IFRendererConfigParser;
import org.apache.fop.render.intermediate.IFStructureTreeBuilder.IFStructureTreeElement;
private String currentID = "";
private IFStructureTreeBuilder structureTreeBuilder;
+ private int pageNumberEnded;
public IFSerializer(IFContext context) {
super(context);
} catch (SAXException e) {
throw new IFException("SAX error in endPage()", e);
}
+ if (mimicHandler != null) {
+ pageNumberEnded++;
+ FOUserAgent userAgent = mimicHandler.getContext().getUserAgent();
+ RendererEventProducer.Provider.get(userAgent.getEventBroadcaster()).endPage(this, pageNumberEnded);
+ }
}
//---=== IFPainter ===---
package org.apache.fop.render.intermediate;
import java.awt.Rectangle;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.transform.sax.SAXResult;
import org.apache.xmlgraphics.image.loader.ImageSessionContext;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.events.EventChecker;
+import org.apache.fop.render.afp.AFPDocumentHandler;
public class IFSerializerTestCase {
verify(imageManager).closeImage(eq(IMAGE), any(ImageSessionContext.class));
}
+ @Test
+ public void testPageEvent() throws IFException {
+ FOUserAgent userAgent = FopFactory.newInstance(new File(".").toURI()).newFOUserAgent();
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put("number", 1);
+ EventChecker eventChecker = new EventChecker("org.apache.fop.render.RendererEventProducer.endPage", params);
+ userAgent.getEventBroadcaster().addEventListener(eventChecker);
+ sut.mimicDocumentHandler(new AFPDocumentHandler(new IFContext(userAgent)));
+ sut.setResult(new SAXResult(new DefaultHandler()));
+ sut.endPage();
+ eventChecker.end();
+ }
}