Refresher

While I have this component in another package (called
HComponents
), I’ve re-packaged them as single components. They are also compatible with a current Vaadin 6.2-nighty. HComponents will be deprecated.

The Refresher is a component that tries to help with the lack of a push-functionality in Vaadin. It’s a component that polls asynchronous UI changes from the server. While UI changes are normally made only during a user-initiated roundtrip from the client to the server and back, with the Refresher, you can have a background process that updates the UI with the user being inactive.

While a picture tells more than a thousand words, this
video
tells more than a few handful of pictures.



Sources
are available at the incubator at http://dev.vaadin.com/svn/incubator/Refresher/
Sources moved to
http://dev.vaadin.com/svn/contrib/Refresher/
, but check the
Directory
for the official addon entry.

You are welcome to try the component out for yourself at
http://henrik.virtuallypreinstalled.com/Refresher/

Note for interested users: These are only the sources for the component. I will later today provide a JAR file that you can just drop in, instead of needing clutter your project with sources from various package structures.

Jar is now in SVN! (
http://dev.vaadin.com/browser/incubator/Refresher/refresher-0.0.1.jar
). If you’re using one of the latest Vaadin 6.2 nightlies and the experimental Eclipse plugin, you should be able to just drop the jar in your classpath, agree to re-compiling your widgetset, and you should be set.

Make sure that you have the string “” in your application’s widgetset.gwt.xml-file.

Thanks much for the pointers, but I had to do a bit more guesswork to get things working, because my application had no widgetset to begin with (as many people I suspect, I started with AddressBook and mutated it)

A ) The first thing to do is to edit web.xml to add a widget set named after your application


    <servlet>
        <servlet-name>CompetitionApplication</servlet-name>
        <servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
        <init-param>
            <param-name>application</param-name>
            <param-value>org.concordiainternational.competition.ui.CompetitionApplication</param-value>
        </init-param>
        <init-param>
            <description>Application widgetset</description>
            <param-name>widgetset</param-name>
            <param-value>org.concordiainternational.competition.ui.CompetitionApplicationWidgetset</param-value>
        </init-param>
    </servlet>

B ) You need to create a .xml file next to the application’s .java (in this case, CompetitionApplicationWidgetset.gwt.xml ). with the following content (adjust for the various widget sets you are including)

<module>
    <!-- Inherit super widgetset -->
    <inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" /> 
    <inherits name="com.vaadin.incubator.superimmediatetextfield.SuperimmediatetextfieldApplicationWidgetset" />
    <inherits name="com.vaadin.incubator.refresher.RefresherApplicationWidgetset" />
</module>

C ) Drop the various jars for the widgetsets in your WEB-INF/lib (I took the Refresher and SuperImmediateTextField jars)

D ) If you want to recompile your widget set, there is a vaadin logo in the toolbar after you install the plugin. In theory you should be able to click on your project and trigger a recompile, but for some reason, this has stopped working for me. What seems to work reliably is to click on the .gwt.xml file that defines the widgetset, and then click on the icon.

Thanks for the comprehensive how-to steps! I sure hope R&D will be supplying us with an official step-by-step howto/checklist for these new Vaadin Addons. But, to be fair, this is a very new feature, and it’s only in the nightlies for now.

The R&D team has said that they have wishes and plans that the Plugin will handle all this even more intelligently, so I, for one, will be eagerly waiting for these updates.

In any case, these pointers might serve better outside this thread – I doubt people finding these nuggets of information from this thread, if they have the same problems.

I had troubles getting the vaadin-logo-compiler to work, too. The trick I did to get it working is to use the Project Explorer (I normally use the Package Explorer, which didn’t work for me), and you have to make sure that the Project Explorer is active (and not, say, your source code window) before you click on the icon – otherwise the plugin doesn’t understand which project you are trying to compile. The R&D has, again, expressed their regrets about this, they have are planning on getting this more robustly done.

Just to make things a bit easier:

No longer needed with the latest plugin, you can ignore your web.xml on this part, as long as you don’t have your own widgetset in that project.

Again, not needed. The Vaadin Widgetset Compiler will generate this for you automatically.

Happy compiling!

ps. remember, currently only with the latest and greatest plugin & nightlies

Well, not quite.

If I drop two jars, and omit the .gwt.xml that does the inherits for both, the plugin gets confused and seems to generate a widget set named after the first jar, and gives a warning of the form [WARN] Widget implementation for com.vaadin.incubator.refresher.Refresher not available for GWT compiler (but mapped for component found in classpath). If this is not intentional, check your gwt module definition file.

Your comment could be interpreted in two ways:
a) the file is no longer necessary OR
b) the plugin now deals with the file and you no longer have to.

So it seems that at least the gwt file is required.

You get the warning because Henrik has made a small mistake in packaging the JAR: the source files are not included, only the compiled .class-files. The GWT Compiler needs the actual .java-files. So this is Henrik’s problem, ask for a new JAR.

The Widgetset Compiler should name the generated widgetset after the project, not one single JAR, as far as I know.

Do you mean web.xml or the .gwt.xml?

You can ignore the thing I said about web.xml, I guess you still need to specify the used widgetset there. My mistake.

About .gwt.xml, I can’t say 100% sure how this is, since I’m not involved in the code level development of the plugin. But as I interpret it, the plugin generates the .gwt.xml file for you, and uses that in the compilation.

I hope Matti will provide us with more clear instructions soon enough, since I’m probably just confusing people more :slight_smile:

Although this starts to get off-topic (as the refresher has its own thread), I just checked that the jar in SVN contains both .java and .class files for both the server and client side components. The same applies to the SITF jar. There must be some kind of confusion here.

As of 2009-10-13, both the entry in web.xml and the presence of a Application.gwt.xml file are required,

In my test configuration, the plugin does not generate a .gwt.xml. Furthermore, it does not correctly generate a widgetset when two jars are present.

The workaround is to add a .gwt.xml with inheritance for the two widgetsets.

Is there a way to move the “widgetset” HOWTO to its own thread somewhere else ?

Just to report that I just did that on 6.2.0 and everything is peachy, no other actions required. I love the new packaging system! :slight_smile:

The refresher is very nice too, it’s completely usable despite the too-modest version number.

hi…
i want to implement refresher in my vaadin web, i’m using jetty and equinox for moduling as plugin my web application.
i want to asking about how i can implement the refresher component, in last tutorial explainded that configure it to web.xml, i’m really not using this file for configure the servlet becouse i’m using HttpService from osgi to register any servlet…
how can i introduce the refrehser component to my servlet that register with httpservice from osgi?

I’m not really sure about the problems you have with this, but OSGi, Jetty or Equinox shouldn’t have anything to do with Vaadin add-ons. Please read
http://vaadin.com/directory/help/using-vaadin-add-ons
about how to use Vaadin add-ons.

To be clear, Refresher is a Vaadin add-on.

Henrik,

Once you add Refresher to your layout, if user never closes the connection or goes idle does session expires automatically ? In otherwords, how do I still make session to expire when user is idle for long time?

Thanks

Raj.

No, as long as the Refresher is active (i.e. the component is refreshing, and the browser tab is still open), there is constant traffic between the browser and the server, therefore the session doesn’t have a chance to expire…

You could try to have some kind of timer thread in your server that is reset every time the user does something of importance to your application, and once the timer runs out, you disable the refresher. After that, there is no traffic, and the session is allowed to start to expire.

http://dev.vaadin.com/svn/incubator/Refresher/



Not Found
The requested URL /svn/incubator/Refresher/ was not found on this server.

Where can I find latest Refresher?

Thanks,
Arthur.

I spend a lot of time analyzing sources and I found last Refresher here http://dev.vaadin.com/browser/incubator/Refresher?rev=10926 .

Where is it now? Was it replaced by new component/strategy?

I am using lates Vaadin 6.3.2.

Thanks,
Arthur.

OK, now I found refresher here
http://dev.vaadin.com/browser/contrib/Refresher
thanks to google.

It’s sad that searcher on dev.vaadin.com can’t simply show location.

Thanks,
Arthur.


http://vaadin.com/directory/#browse:search=refresher