Package org.foray.render.awt.viewer

Examples of org.foray.render.awt.viewer.Translator


     * @throws FOrayException For errors during FOray processing.
     */
    public void viewFO(final URL fo) throws IOException, FOrayException {
        //Setup l18n
        final String language = System.getProperty("user.language");
        final Translator translator = getResourceBundle(
            DemoAWTViewer.TRANSLATION_PATH + "resources." + language);
        final UserMessage userMessage = new UserMessage();
        userMessage.setTranslator(getResourceBundle(
                DemoAWTViewer.TRANSLATION_PATH + "messages." + language));
        // TODO: userMessage doesn't seem to be used anywhere.

        //Setup FOraySession
        final FOraySession session = FOraySpecific.makeFOraySession(null);

        //Setup FOrayDocument
        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") + " ...");

        //Show page
        frame.progress(translator.getString("Show"));
        frame.showPage();
    }
View Full Code Here

TOP

Related Classes of org.foray.render.awt.viewer.Translator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.