Dear Wiki user, You have subscribed to a wiki page or wiki category on "Jakarta-tapestry Wiki" for change notification.
The following page has been changed by JesseKuhnert: http://wiki.apache.org/jakarta-tapestry/41RenderCycleDesign ------------------------------------------------------------------------------ } }}} + === Mirky Waters === + The previous solution section outlined what I believe is a good start to the steps needed to enable some of the functionality these ajax/json responses require. Namely being able to either suppress the output in a render cycle or perform entirely different output(as in the case with JSON responses). + + An AJAXResponseBuilder implementation would need to work itself into the render() logic in such a way that it could either internally choose to render or not render particular components, or have methods available allowing components to choose or not choose to render themselves. I would rather have the logic be internal to the ResponseBuilder as this is one of the largest gripes I have with tacos currently. It makes it very unclean to do things like this: + + {{{ + renderComponent(IMarkupWriter writer, IRequestCycle cycle) { + AjaxResponse ajax = getAjaxResponse(); //injected + + if (!ajax.isAjaxResponse()) { + renderJavaScriptOutput(); + } + + if (ajax.isAjaxResponse() && somethingFooIsTrue) { + ajax.addPreEffectsJavascript("javascript:doPreEffects()"); + } + } + }}} + + The example given is completely made up but more or less shows all of the "checks" that have to go on to correctly maintain server state with client browser state. It would be much nicer to ultimately have something along the lines of: + + {{{ + public class AjaxResponseBuilder implements ResponseBuilder { + + protected IMarkupWriter _writer; + protedted IMarkupWriter _nullWriter = new NullMarkupWriter(); + + protected List updateComponentIds; + + public AjaxResponseBuilder(IMarkupWriter writer) { ... } + + public void renderResponse(IRequestCycle cycle) { + IPage page = cycle.getPage(); + page.renderResponse(this, cycle); + } + + public void renderComponent(IComponent component, IRequestCycle cycle) { + if(updateComponentIds.contains(component.getId()) { + component.renderComponent(_writer, cycle); + } else + component.renderComponent(_nullWriter, cycle); + + if (updateComponentIds.contains(component.getId()) { + component.renderScriptContributions(_writer, cycle); + } + + //etc.... + } + } + }}} + + The basic idea is to take out the logic that was previously done via javassist contributions, and at the same time add a layer of additional logic. Such as pre/during/post javascript contributions to the "client request render cycle", as well as a lot of other things I'm sure I'm forgetting. + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]