Blog

Refresher wins the add-on compo for November

By  
Joonas Lehtinen
Joonas Lehtinen
·
On Dec 6, 2010 8:48:00 PM
·

Refresher has won the add-on competition for November leaving CustomField  and HbnContainer add-ons the second and third places - again. This shows that the most interesting add-ons are the ones implementing a feature that is missing from the Vaadin Framework core. The author, Henrik Paul, has been creating a handful of other useful add-ons fitting to this pattern. It is great to see that he finally won the competition. Congratulations!

Here is what Henrik says about his add-on:

 

"It can't be a coincidence that the Refresher won the month after ICEPush won. It seems like the public really is in a need for UI updates beyond the normal event-request-update-response cycle (Artur Signell, author of the Vaadin adaptation of ICEPush, wrote all about it a few blog entries back.) Luckily, the public may now choose between two technologies to suit their needs the best. In contrary to the ICEPush component, it being a push solution, Refresher is a polling solution.

The Refresher is a relatively old component, about 18 months old, so it was written well before the Directory even existed. At the time, the forums had some lively discussion on how to do asynchronous UI updates with IT Mill Toolkit (ye old name for Vaadin). Then, the official workaround suggestion was to use the ProgressIndicator component from the core library, and hiding the visual part of the component with some CSS hijinks. As it happens, the ProgressIndicator will poll the server for any updates to itself. But in the same time, it will bring all UI updates for everything else that has been queued up with it. So in a nutshell, the ProgressIndicator was a used as a polling component that had some UI you'd need to get rid of.

I'm usually very careful about the semantics, readability and unsurprisingness of my code, so I thought this to be an awful official recommendation. I therefore made Refresher to be a more semantically correct poller. In essence, it's simply a stripped ProgressIndicator: it polls for server side changes, but has no UI of its own to start with. Also it doesn't poll for its own purposes, but for everyone else. Soon after it was released, I noticed the forum recommendations quickly transition into talking about the Refresher instead of the ProgressIndicator hack.

Similarly to the ICEPush counterpart, the Refresher is a Component that needs to be "visible" in the current layout. I say "visible" with quotes, since it doesn't have a visual representation, but it needs to be in a layout currently shown to the user in order to be active. (In contrast to ICEPush though, the Refresher doesn't need a special servlet in order to work, so it'll work just as well in portlets.) The Refresher calls any RefreshListeners that have been registered with the component each time the Refresher is refreshed, so to say. This way, you can put some code that you wish to execute once every refresh. But this isn't required; if you have a background Thread doing some work at its own pace, you may have that thread manipulate the UI as it wishes directly. Those changes will then be rendered on every refresh.

The Refresher has been dangling in the top 20 ever since the Directory launched. It happened to be the most popular in November, but I really didn't expect it since the last week was a furious three-way battle between CustomField, HbnContainer and the Refresher. I thank you all for the support I've got by appreciating my Refresher, as it really motivates me to write more useful stuff for the community. I'm sure a worthy competitor will take its rightful place during the grande finale, the December month."

 

We still have one month and one iPad left, so there are still chance for you to win! See the add-on compo page for more details and a real-time top 20 scoreboard.

Joonas Lehtinen
Joonas Lehtinen
Joonas is the CEO and co-founder of Vaadin. He has been working with web app development tools and technologies for over 20 years and speaks frequently in Java conferences around the world. Joonas lives is San Jose, CA, with his wife and 10 year old son. You can follow him on Twitter – @joonaslehtinen
Other posts by Joonas Lehtinen