Refresher

Thanks for your answer, sorry for not being so clear but i wanted to get a general answer as the one you gave me.
I managed to solve my problem.
Somehow, i had the impression that the refresher needs a component as a target to refresh!
Obviously, this is wrong and i managed to realize my mistake reading your answer and figuring out that the thread is independent from the Refresher itself which wouldn’t be the case in my, faulty, point of view.

Thanks again

Great to hear that you got it working!

A true testament to Refresher’s quality is its constant support, while it has never gotten a patch!

1.1.0 does a few things:

First of all, the package has changed from “org.vaadin.henrik.refresher” to “com.github.wolfie.refresher”. Secondly, the example application has been changed to something more real-life, and less theoretical. Helps you getting started with it immediately. The Refresher also has now a default refresh rate of one second, so it starts refreshing immediately as it is added to the view. Fourth: I squashed a bug with awesome brute force: It used to keep on pinging even if the Refresher is disabled (“setEnabled(false)”) – NO MORE!

Last, but not least: the sources have been moved from the old school subversion repository to the brand spanking Github. So, get yours today. Hot stuff!


http://vaadin.com/directory#addon/refresher

Sweet Henrik!

Watch out though, because a package change is a backward-incompatible change (i.e. if I update to your 1.1.0 I can’t straight compile anymore…).

According to semmatic versioning (semver.org) it should have been 2.0.0.

I’m off to try it out! :slight_smile:

Didn’t know that there was something like that. Maybe I should’ve used a 2.0.0 version instead. Would’ve looked cooler anyways :).

But, this is not why I write here! I’ve done a very quick 150 LOC proof of concept chat application, that was very easy to do with Vaadin and Refresher. Blog post, code and live application here:
http://vaadin.com/web/henrik/wiki/-/wiki/Main/Simple%20Chat/

Could it be possible to make Refresher send an extra attribute (such as “origin=Refresher”) along the HTTP request, so that we could use a ServletFilter to determine whether the request was send by Refresher or if the request was sent because a “real” user did something on UI?

Unfortunately, that’s pretty hard to do. Vaadin’s client side component API doesn’t support request header modifications directly (afaik) and I really wouldn’t want to start toying around with Reflection (not sure would that work at all anyways). Also, since your request is pretty exotic, so I’d rather not undermine the stability of the whole Vaadin system for such an edge case.

Anyways, since you’re apparently doing pretty deep protocol inspection, you can use some heuristics on the request itself to determine whether it comes from a refresher or not: The request’s Content-Length is always very short and constant (according to my trials, 17).

Also, the request payload should always end with “PID#ri”, with the # being the PID number of the Refresher. (Actually, i thought it should end with “ri0”, but let’s ignore that for now). The PID number is constant unless the Refresher is removed and reinserted. And the rest comes from the fact that the client-side Refresher tells the server-side component to update an integer (hence “i”) variable by the name of “r” (hence “r”) to zero. I guess the zero is optimized out by something or the other. (The request is a NOOP on the server side.)

Hope that helps.

PS: I got a tip from Henri Sara that
com.vaadin.terminal.gwt.client.ApplicationConnection.doAsyncUIDLRequest(String, String, RequestCallback)
is where the request is compiled, and that method can be overridden to insert your own request headers. I haven’t looked into how that works in practice, so I wouldn’t hazard a guess if that is helpful to you in your case or not…

I am new to using vaadin addons. especially to the one which need to be compiled before using.

I am using Netbeans and i cant find the Widgetset.gwt.xml in the directories.
What settings should i make before use the component in Netbeans?
Can you please help me…
Thanks

Hi ,
I like to have some UI component (e.g. Graphs) in my app to refresh the data periodically.I added Refresher addon so as to run a background thread(Timer Thread) which is used to setting up model for the graphs so its working fine when only 1 graph is getting refresh .but when i try set model for different graphs simultaneously, it shows… error [b]
[u]
[i]
[b]

[/b]
[/i]
[/u]“out of sync”
[/b] .

I tried two workaround for this:-

  1. I set different refresh time for settjng up the model for graphs.
    2)I upraded my Vaadin version to version6.6.2.

Is there any other workaround.?

Thanks
Sneha-_-

Can anyone here see the thread [quote]
http://vaadin.com/forum/-/message_boards/view_message/523525
[/quote].

I was confused as when the Refresher component thread will get killed for a particular user. Is it like when the user changes the screen on which refresher is added, the refresher thread gets killed? Actually, i want to make sure that for every user there should be unique and single instance(on per user basis) of Refresher hence avoiding memory leaks.

But I guess using threadlocal for refresher is resposible for UI getting hang. Can anyone help me out in this?

Hi,

I’m seeing a similar “out of sync” problem that occurs with the following sequence:

  • Add Refresher to page and set the interval.
  • Disable Refresher - setEnable(false).
  • Enable Refresher - setEnable(true).
  • Remove Refresher from the page (with it still enabled).

An “out of sync” message is then seen. This is because the Refresher’s timer is still scheduling an event to be sent to the server even though it’s been removed from the page.
The client-side VRefresher has been designed to automatically cancel the timer when the widget is removed from the page, however I think there is a small problem with the logic in the onDetach method that is causing it to not work for the above sequence.

Henrik, could you help with this?

Many thanks
Michael.

Hi,
Maybe someone write a complete (and fresh) tutorial and link do main Refresher page.
There is a some confusing things.
I’m using netbeans and maven and … finally success by setting plugins, but compile time (every compile) is very looong.
I had to set in web.xml and *Widgetset.gwt.xml and set gwt-maven-plugin and vaadin-maven-plugin in pom.xml.
The same thing I achieved by ProgressIndicator :slight_smile:

Hi, I`m experiencing some strange behavior with refresher in my vaadin portlet.

I deploy my vaadin portlet war into liferay, and add two instances of it in portal. Refresher is attached to layout of the View component and works good.

BUT

when i enter edit mode (Preferences) in one of the portlet instances, refresher from the other instance keeps refreshing the edit view! Fortunately no data is being lost, but the vertical scroll position is being reseted which is really annoying (mostly with refresh interval of 1 second). I`m sure it is the other instances’ refresher, because when i add only one instance, nothing like that happens in the edit mode.

Any ideas what is wrong and how to fix it?

EDIT: so after some additional reading, it appears that refresher causes such an event that according to portlet specification makes portal refresh all portlets on the same page. Can anyone confirm that this is what is happening? If so i guess i would have to replace my refresher with some kind of ajax

All the portlets on a page normally share the same widgetset. If they are different Windows of the same Application (or from the same WAR), they share even more.

Try to add “?debug” to your URL (before “#”) and see what requests are sent and what updates are received. That might also give more information.

In any case, the issue is not quite that of the portlet specification: the spec is about a page reload (“render” phase) whereas here it is just the contents of the portlets that is being refreshed (using a “resource” request in portlet terms). When changing modes of a portlet, though, there is a render request if I remember correctly.

I`m fighting this issue for a weak now bu to no avail. Refresher seems to be casuing UI reset on everything (without render/resource request)

Hello.

Is it possible to refresh only one portlet on the page. I would like to refresh more than one instance of same portlet, but with different Refresh Intervals.

Thank you.

EDIT: I found different solution. Thank you.

Hello everyone,

I did a quick port of the refresher to Vaadin 7 beta1. The tough part was getting a working maven pom.xml to build the jar. I couldn’t find recent (post Vaadin7) instructions on how to build an add-on with maven. I’m still not sure if I’m doing it right. So here is the project. If you’d like Henrik, please take it and use it to update the refresher in the Add-ons directory.


https://github.com/cpoile/refresher-V7Beta1

Hi,

There’s a wiki tutorial on how to implement a Refresher-style feature in Vaadin 7 using the new Extension feature:

https://vaadin.com/wiki/-/wiki/Main/Creating%20a%20root%20extension

I’d probably use that… An unintended consequence of the upgrade is that the refresher erases (clears) any textfield on the page. I’m not sure why, and I don’t have the time to debug it. Can someone take a look and figure it out?

Has anyone had luck with the UI (root) extension solution? I can’t seem to get it to start polling, and I have no idea why. Help would be greatly appreciated!!l

(that, or somehow make the refresher add-on preserve the state of text fields on refresh!)

Many thanks to anyone who can help. I’ve banged my head against the wall all day on this problem. Beta1 seemed to break something in the Refresher.