final InputSource inputSource = new InputSource(fo.openStream());
final FOrayDocument document = new FOrayDocument(session, inputSource,
null);
//Setup renderer
final AWTRenderer renderer = new AWTRenderer(getLogger(), null);
//Setup FOrayTarget
new FOrayTarget(document, renderer, null, null);
//Create preview dialog (target for the AWTRenderer)
PreviewDialog frame;
try {
frame = createPreviewDialog(renderer, translator);
} catch (final OutputException e) {
throw new FOrayException(e);
}
renderer.setComponent(frame);
// TODO: This is probably not right. Needs to run session.process().
// build FO tree: time
frame.progress(translator.getString("Build FO tree") + " ...");