Hi,
I’m using refresher to update a page with messages coming from an ActiveMQ.
I’ve made a view and my init method is like this:
@PostConstruct
public void initialize ()
{
final Refresher refresher = new Refresher();
refresher.setRefreshInterval(500);
refresher.addListener(new TextRefreshListener());
addExtension(refresher);
//conversation is a label where I want to display the texts coming from the ActiveMQ
layout.addComponent(conversation);
setCompositionRoot(layout);
}
Of course I have implemented the TextRefreshListener class.
The problem is that calling
addExtension(refresher)
makes the components disappear from the view (they are not added) and I’ve never got the refresher working.
I was basing my code on the Chat application example (https://vaadin.com/ca_ES/web/henrik/wiki/-/wiki/Main/Simple%20Chat/) but now the Refresher is not a component anymore. I’ve had a look at the example in the add-on page but I don’t want to create threads… I just want to call a certain bunch of code every x seconds.
What am I missing to make the refresher work and why aren’t my components displayed?
Thank you!