Re: [T5] loading parts of page after initial page load

2008-10-02 Thread Andy Pahne


I tried to implement a solution, inspiured by the source code of the 
Zone component. It works (almost). The problem is that the afterLoad 
block is empty for the dynamic request.


Can anybody see, at a first glance, what I am missing?

Next question would be: how can I force the update after loading? My 
suggestion would be something like

   renderSupport.addInit(" ??? ");


Thanks,
Andy




@SupportsInformalParameters
public class AfterLoadContent {

@Mixin
private DiscardBody discardBody;

@Inject
private Request request;

@Environmental
private RenderSupport renderSupport;

@Environmental
private ClientBehaviorSupport clientBehaviorSupport;

@Inject
private ComponentResources resources;

@Parameter(required=false, allowNull=false, 
defaultPrefix=BindingConstants.LITERAL)

private String id;

@Parameter(required=true, allowNull=false, 
defaultPrefix=BindingConstants.BLOCK)

private Block afterLoad;

@Parameter(required=true, allowNull=false, 
defaultPrefix=BindingConstants.BLOCK)

private Block initial;


public Object beginRender(MarkupWriter writer) {

if(request.isXHR()) {
return afterLoad;
}

if (!resources.isBound("id")) {
id = renderSupport.allocateClientId(resources);
}

Element e = writer.element("div", "id", id);

resources.renderInformalParameters(writer);

e.addClassName("t-zone");


clientBehaviorSupport.addZone(id, "show", "highlight");

return initial;

}



public void afterRender(MarkupWriter writer) {
if(!request.isXHR()) {
writer.end();
}
}




from the template:



   Initial
   AfterLoad



Update Zone










Andy Pahne schrieb:


Hi,

I need to build a page that dynamicly loads parts of itself after the 
initial render in the browser. Those parts are the result of longer 
running computation and can't be included when the page is rendered for 
the first time.



I remember that a third party component that achieves something very 
similar (dynamcly reloading parts, triggered automaticly) already 
exists. But I don't know where I read about it (mailing list, wiki, 
other sources) and cannot find it again.


Does anybody now what component I am talking about or has any pointers 
how I can achieve my goal?


Andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[T5] loading parts of page after initial page load

2008-10-02 Thread Andy Pahne


Hi,

I need to build a page that dynamicly loads parts of itself after the 
initial render in the browser. Those parts are the result of longer 
running computation and can't be included when the page is rendered for 
the first time.



I remember that a third party component that achieves something very 
similar (dynamcly reloading parts, triggered automaticly) already 
exists. But I don't know where I read about it (mailing list, wiki, 
other sources) and cannot find it again.


Does anybody now what component I am talking about or has any pointers 
how I can achieve my goal?


Andy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]