You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by maggie <ma...@gmail.com> on 2008/03/08 09:15:42 UTC
How can I update the repeatingview periodically
Hi, all,
I develope a repeatingview to show some information like the clock example,
updating the clock with AjaxSelfUpdatingTimerBehavior.
I want to update these information periodiacally. But it takes no effect.
Would anyone give me some hints?
**************************************************************************************
final RefreshingView view=new RefreshingView("view1"){
protected Iterator getItemModels() {
ThreadDataProvider provider=new ThreadDataProvider();
return provider.iterator();
}
protected void populateItem(Item item) {
ThreadInfo threadInfo=(ThreadInfo)item.getModelObject();
Label threadIdLabel=new Label("ThreadId",
threadInfo.getThreadIdStr());
Label methodNameLabel=new Label("MethodName",
threadInfo.getMethodName());
Label timeStampLabel=new Label("TimeStamp",
threadInfo.getTimestamp().toString());
item.add(threadIdLabel);
item.add(methodNameLabel);
item.add(timeStampLabel);
}
};
view.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
****************************************************************************************
--
maggie
Re: How can I update the repeatingview periodically
Posted by Erik van Oosten <e....@grons.nl>.
The problem is in the models of the labels. These are statically
assigned once.
fix:
protected void populateItem(Item item) {
item.setModel(new CompoundPropertyModel(item.getModel()));
ThreadInfo threadInfo=(ThreadInfo)item.getModelObject();
Label threadIdLabel=new Label("threadIdStr");
Label methodNameLabel=new Label("methodName");
Label timeStampLabel=new Label("timeStamp");
item.add(threadIdLabel);
item.add(methodNameLabel);
item.add(timeStampLabel);
}
Regards,
Erik.
maggie wrote:
> Hi, all,
>
> I develope a repeatingview to show some information like the clock example,
> updating the clock with AjaxSelfUpdatingTimerBehavior.
>
> I want to update these information periodiacally. But it takes no effect.
> Would anyone give me some hints?
>
> **************************************************************************************
> final RefreshingView view=new RefreshingView("view1"){
> protected Iterator getItemModels() {
> ThreadDataProvider provider=new ThreadDataProvider();
> return provider.iterator();
> }
>
> protected void populateItem(Item item) {
> ThreadInfo threadInfo=(ThreadInfo)item.getModelObject();
> Label threadIdLabel=new Label("ThreadId",
> threadInfo.getThreadIdStr());
> Label methodNameLabel=new Label("MethodName",
> threadInfo.getMethodName());
> Label timeStampLabel=new Label("TimeStamp",
> threadInfo.getTimestamp().toString());
> item.add(threadIdLabel);
> item.add(methodNameLabel);
> item.add(timeStampLabel);
> }
> };
>
> view.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));
> ****************************************************************************************
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org