Package org.apache.tapestry.runtime

Examples of org.apache.tapestry.runtime.RenderCommand


    @Test
    public void command_failed()
    {
        final RuntimeException t = new RuntimeException("Oops.");

        RenderCommand rc = new RenderCommand()
        {

            public void render(MarkupWriter writer, RenderQueue queue)
            {
                throw t;
View Full Code Here


                return true; // abort other handler methods
            }

            if (result instanceof RenderCommand)
            {
                RenderCommand command = (RenderCommand) result;

                add(command);

                return false; // do not abort!
            }

            if (result instanceof Renderable)
            {
                final Renderable renderable = (Renderable) result;

                RenderCommand wrapper = new RenderCommand()
                {
                    public void render(MarkupWriter writer, RenderQueue queue)
                    {
                        renderable.render(writer);
                    }
View Full Code Here

        _queue.push(command);
    }

    public void run(MarkupWriter writer)
    {
        RenderCommand command = null;

        boolean traceEnabled = _logger.isTraceEnabled();

        // Seems to make sense to use one try/finally around the whole process, rather than
        // around each call to render() since the end result (in a failure scenario) is the same.

        try
        {
            while (!_queue.isEmpty())
            {
                command = _queue.pop();

                if (traceEnabled) _logger.trace(String.format("Executing: %s", command));

                command.render(writer, this);
            }
        }
        catch (RuntimeException ex)
        {
            // This will likely leave the page in a dirty state, and it will not go back into the
View Full Code Here

public class RenderQueueImplTest extends InternalBaseTestCase
{
    @Test
    public void run_commands()
    {
        final RenderCommand command2 = newMock(RenderCommand.class);
        RenderCommand command1 = new RenderCommand()
        {
            public void render(MarkupWriter writer, RenderQueue queue)
            {
                queue.push(command2);
            }
View Full Code Here

    @Test
    public void command_failed()
    {
        final RuntimeException t = new RuntimeException("Oops.");

        RenderCommand rc = new RenderCommand()
        {

            public void render(MarkupWriter writer, RenderQueue queue)
            {
                throw t;
View Full Code Here

        String nestedId = resources.getNestedId();

        // The user may return a complete page instance, which isn't really a partial render, I guess.
        // Depends on the structure of the page returned.

        RenderCommand command = nestedId == null ? page.getRootElement() : page.getComponentElementByNestedId(nestedId);

        _renderer.renderPartialPageMarkup(command);
    }
View Full Code Here

                return true; // abort other handler methods
            }

            if (result instanceof RenderCommand)
            {
                RenderCommand command = (RenderCommand) result;

                add(command);

                return false; // do not abort!
            }
View Full Code Here

        _queue.addFirst(command);
    }

    public void run(MarkupWriter writer)
    {
        RenderCommand command = null;

        // Seems to make sense to use one try/finally around the whole process, rather than
        // around each call to render() since the end result (in a failure scenario) is the same.

        try
        {
            while (!_queue.isEmpty())
            {
                command = _queue.removeFirst();

                if (_log.isDebugEnabled())
                    _log.debug(String.format("Executing: %s", command));

                command.render(writer, this);
            }
        }
        catch (RuntimeException ex)
        {
            // This will likely leave the page in a dirty state, and it will not go back into the
View Full Code Here

        String nestedId = resources.getNestedId();

        // The user may return a complete page instance, which isn't really a partial render, I guess.
        // Depends on the structure of the page returned.

        RenderCommand command = nestedId == null ? page.getRootElement() : page.getComponentElementByNestedId(nestedId);

        _pageRenderQueue.initializeForPartialPageRender(command);
    }
View Full Code Here

        if (!callback.isAborted()) return null;

        // Here's where it gets very, very tricky.

        final RenderCommand rootRenderCommand = _pageRenderQueue.getRootRenderCommand();

        final String formId = _request.getParameter(FORMID_PARAMETER);

        final Base64ObjectOutputStream actions = new Base64ObjectOutputStream();

        final RenderCommand cleanup = new RenderCommand()
        {
            public void render(MarkupWriter writer, RenderQueue queue)
            {
                try
                {
                    actions.close();
                }
                catch (IOException ex)
                {
                    throw new RuntimeException(ex);
                }

                _environment.pop(ValidationTracker.class);

                FormSupportImpl formSupport = (FormSupportImpl) _environment.pop(FormSupport.class);

                formSupport.executeDeferred();

                writer.element("input",

                               "type", "hidden",

                               "name", Form.FORM_DATA,

                               "value", actions.toBase64());
            }
        };

        final RenderCommand setup = new RenderCommand()
        {
            public void render(MarkupWriter writer, RenderQueue queue)
            {
                // Kind of ugly, but the only way to ensure we don't have name collisions on the
                // client side is to force a unique id into each name (as well as each id, but that's
View Full Code Here

TOP

Related Classes of org.apache.tapestry.runtime.RenderCommand

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.