On Tue, 14 Apr 2015 16:04:27 -0300, Тимур Бухараев <bukhar...@gmail.com> wrote:

Heartbeat is really interesting option. Thank you for idea. The next my
question is: how update template with actual content in deffered commands?

Templates cannot be rendered in a deferred way. What Label does is to use MarkupWriter to generate markup programatically:

    boolean beginRender(MarkupWriter writer)
    {
        final Field field = this.field;

        decorator.beforeLabel(field);

        labelElement = writer.element("label");

        resources.renderInformalParameters(writer);

// Since we don't know if the field has rendered yet, we need to defer writing the for and id // attributes until we know the field has rendered (and set its clientId property). That's
        // exactly what Heartbeat is for.

        Runnable command = new Runnable()
        {
            public void run()
            {
                String fieldId = field.getClientId();

labelElement.forceAttributes("for", fieldId, "id", fieldId + "-label");

                decorator.insideLabel(field, labelElement);
            }
        };

        heartbeat.defer(command);

        return !ignoreBody;
    }

Anyway, the approach I described in another e-mail in this thread should be enough for you to traverse the component tree, trigger an event telling components to start fetching data (probably wrapped in a Future) and after that letting rendering happen normally.

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to