add(prague);
add(london);
// add the timer behavior to the page and make it update all
// other components as well
final AbstractAjaxTimerBehavior timer = new AbstractAjaxTimerBehavior(Duration.seconds(1))
{
/**
* @see org.apache.wicket.ajax.AbstractAjaxTimerBehavior#onTimer(org.apache.wicket.ajax.AjaxRequestTarget)
*/
@Override
protected void onTimer(AjaxRequestTarget target)
{
target.add(la);
target.add(ny);
target.add(moscow);
target.add(prague);
target.add(london);
}
};
add(timer);
add(new AjaxLink<Void>("stop")
{
@Override
public void onClick(AjaxRequestTarget target)
{
timer.stop(target);
}
});
add(new AjaxLink<Void>("restart")
{
@Override
public void onClick(AjaxRequestTarget target)
{
timer.restart(target);
}
});
}