You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Neil Clayton <ne...@cloudnine.net.nz> on 2003/06/05 00:37:53 UTC

Further questions about TreeComonent (component by Misko Hevery)

I've been attempting to get the Misko TreeComponent working under 
Tapestry 3.0.

It does actually work, with the exception (I *think*) that it shows a 
stale link exception in a new browser window.
The code in question which causes this failure is the renderComponent 
method of the ServerRenderer, which is as follows:

        protected void renderComponent(IMarkupWriter writer, 
IRequestCycle cycle, Body body) {

            if (cycle.isRewinding()) {
                cycle.getNextActionId();
                if (cycle.isRewound(TreeComponent.this)) {
                    IPage currentPage = cycle.getPage();
                    log.debug("Activating the StaleLink, in ServerSide 
renderCompnent");
                    cycle.activate("StaleLink");
                    processEvents(cycle, body);
                    cycle.activate(currentPage);
                    throw new RenderRewoundException(TreeComponent.this);
                }
            } else {
                    writeScript(cycle, body);

                if (rewoundURL != null) {
                    String openUrl = "open(\"" + rewoundURL + "\", \"" + 
targetFrame + "\");";
                    body.addBodyScript(openUrl);
                    rewoundURL = null;
                }
                renderTree(writer, cycle, tree);
            }
        }


I added the logging, converted cycle.setPage(thing) to 
cycle.activate(thing) and perhaps changed the exception that is thrown 
(can't remember if I did, of if that exception existed in Tapestry 2.2)

The tree DOES actually show OK in the originating frame.  Just that 
another window pops up with a stale link exception.
Can anyone tell me if there is anything obviously wrong with the snippet 
above?

Specifically, I don't understand what is "trying to be achieved" by:

            if (cycle.isRewinding()) {
                cycle.getNextActionId();
                if (cycle.isRewound(TreeComponent.this)) {
                    IPage currentPage = cycle.getPage();



Regards,
Neil Clayton