Refresher

I am relatively new to Vaadin. I would like to use the Refresher Add-on with Vaadin 7.0.5 and using Maven.

  • Added the appropriate dependency and repository stanzas to my pom.xml.
    <dependency> <groupId>org.vaadin.addons</groupId> <artifactId>refresher</artifactId> <version>1.2.1.7</version> </dependency> ... <repository> <id>vaadin-addons</id> <url>http://maven.vaadin.com/vaadin-addons</url> </repository>
  • Re-compiled the widgetsets.
  • After this the default module “AppWidgetSet.gwt.xml” included the following:
    <inherits name="com.github.wolfie.refresher.RefresherWidgetset" />
  • Added the following to my xxxxUI class:
    #!java import com.github.wolfie.refresher.Refresher; import com.github.wolfie.refresher.Refresher.RefreshListener; ... refresher = new Refresher(); refresher.setRefreshInterval(10*1000); refresher.addListener(new RefreshListener() { int count = 0; @Override public void refresh(Refresher source) { System.out.println("REFRESHER TIME " + count++); //showLogs(); <--- do something with the ui. } }); addExtension(refresher);
  • But when the application is run the screen shows the following:



    Widgetset does not contain implementation for com.github.wolfie.refresher.Refresher. Check its component connector’s @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.



Not sure what I am doing wrong.

Any suggestions?

John,

How did you recompile the widgetset? You could try running “mvn vaadin:clean vaadin:compile”

Henrik, I tried your suggestion (running mvn vaadin:clean vaadin:compile). The goals completed successfully, but the message still appears when the application is run.

One thing I noticed that you didn’t mention was your web.xml. Did you check that it contains a reference to your AppWidgetSet.gwt.xml?

Another thing that popped into mind was Eclipse. Do you use it for development? Eclipse doesn’t notice if you do changes to files outside Eclipse (like maven build from command line). That means that it will most likely run with an old set of the files, except if you right click the project and select refresh. This is not a problem if you start the server from the command line or use another IDE that understands to listen to changes on the file system.

That are the things that I can come up with.

Jens Jansson, you are correct Sir! Thank you very much.


Book of Vaadin: section 4.8.3 Deployment Descriptor web.xml
:


<!-- If not using the default widget set-->
<init-param>
    <param-name>widgetset</param-name>
    <param-value>com.ex.myprj.MyWidgetSet</param-value>
</init-param>

Henrik Paul, very nice addon although i currently have a little problem described here:


https://vaadin.com/forum#!/thread/3268420

Short version: If the Refresher polls after the server restarted and the session is expired an exception gets thrown:
No UI provider returned a UI for the request

I am not 100% sure if it’s a problem with the Refresher but i don’t have such a problem in a non-refresher app. Also: This obviously never happened in Vaadin 6.

Can someone please help me?

Thanks in advance,
M.R.

Hi. I’m working on converting my Vaadin 6 based app to Vaadin 7.1.

Is Refresher 1.2.1.7 compatible with Vaadin 7.1? I read somewhere that Refresher is dead now that UI.setPollInterval() is in Vaadin 7.1, but I don’t see a listener for the UI method.

How do I best use Refresher (or UI poll) with Vaadin 7’s heartbeat and session expiration? I’d be polling every 30 seconds, so it seems redundant to have the heartbeat doing it too. However, I’d still like to have the sessions timeout. Do I just disable heartbeat and let the app container’s session timeout do it’s thing?

When I started reading up on Vaadin 7, I thought I’d replace Refresher with the heartbeat, but it doesn’t appear to have a listener either.

I will not fix this with Refresher, because, as said, Vaadin already has an internal polling functionality. It’s unfortunate that there hasn’t been a listener for this polling event, but that’s definitely the correct way to do it.

I noticed a ticket about this, opened 12 days ago:
http://dev.vaadin.com/ticket/12466
. You probably want to add your comments there. Add yourself as CC, or even vote for that enhancement if you have Pro Account. If i have some spare time and inspiration, I might submit a patch on that myself, but I make no promises.

Thanks. I added to the ticket. Until a poll listener is added to Vaadin 7, does Refresher 1.2.1.7 not work at all with Vaadin 7.1, or is the issue that it simply doesn’t allow for session timeout, the same as with Vaadin 6?

The issue with Refresher not working with Vaadin 7 is simply that I haven’t ported the code to support Vaadin 7, since the widget structure has changed radically. It shouldn’t be too big of a problem to actually port it, but I just have explicitly not done that work, since having duplicate functionality from both the framework and an add-on isn’t a good idea, imo.

But I can let everyone in on a secret: I’m currently having
a patch
going through into the Vaadin code review process - it’s being targeted to 7.2, so it might appear in a nightly at some point.

Thanks. Unfortunately according to the roadmap, Vaadin 7.2 is set to be released next year. I can’t just stop working for the next four or five months. The best temporary solution I can think of is to periodically update my servers-side UI, which unfortunately means that the information will already be stale by the time the poll happens on some other schedule. :frowning:

Has Refresher been fixed? Is it working on current Vaadin 7 distribution?

The Refresher Add-On itself probably won’t be ported to Vaadin 7 as the poll functionality is now a Core Vaadin7 functionality. If you need poll listeners i suggest trying
this
.

I’m working on a Vaadin 7.1 and Google App Engine project. As noted elsewhere, Vaadin 7.1 push doesn’t work with GAE. However, I have managed to get Refresher to work.

The add-on on the site (v1.2.1.7) has implemented Refresher as an Extension in line with the link in Marius’ previous post.

It works fine with GAE although it regularly throws ConcurrentModificationExceptions. The following small change to the fireRefreshEvents method (synchronizing the listeners list) in the Refresher class fixes that:

private void fireRefreshEvents() {
    List<RefreshListener> syncList = Collections.synchronizedList(refreshListeners);
    for (final RefreshListener listener : syncList) {
        listener.refresh(this);
    }
}

I am submitting this fix for inclusion in the add-on. I also would cast a vote for the add-on not to be retired because it remains the only way to get push functionality for Vaadin under GAE. Hopefully, Push that works everywhere is a future feature of Vaadin.

btw, I am using the functionality to highlight a menuitem the user needs to go to first, when they click on another menuitem. it changes the icon of the menuitem the user needs to go to first and then changes it back. The code is roughly as follows in the View where the menubar is located:

if (wrong menu item pressed) {
otherMenuItem.setIcon(new highlighting image);
refresher.addListener(new Refresher.RefreshListener() {

            @Override
            public void refresh(Refresher source) {
                otherMenuItem.setIcon(original image);
                refresher.removeListener(this);
                refresher.setRefreshInterval(-1);
            }
        });
        refresher.setRefreshInterval(1000);

}

Thanks Jonathan! That looks like a trivial fix indeed. I’ll set a reminder for myself so that I can fix it when I get back home. I’m notoriously bad at maintaining my add-ons once I have published them, but I’ll try to make this contribution upstream this time.

I haven’t checked whether Refresher works with the latest Vaadin version. But since it’s already ported to some earlier version of Vaadin 7, I’ll take a look at that at the same time.

Sorry about the delayed update. Both GitHub and Directory should now be updated with a version of Refresher that has 100% less chances for ConcurrentModificationExceptions!

Reposted a new version for Java 6 compilance.

Hello Henrik
I am having a vaadin application with attached pom.
It was already using touch kit addon <dependency> <groupId>com.vaadin.addon</groupId> <artifactId>vaadin-touchkit-agpl</artifactId> <version>4.0.0.alpha1</version> </dependency>
After adding the refresher addon, some how the UI seems broken, like the combo box missing the arrow and button borders doesnt look right.
what may be the reason for this?

The widget set xml after compilation looks like this [code]

<?xml version="1.0" encoding="UTF-8"?>
<!-- Inherit DefaultWidgetSet -->
<inherits name="com.vaadin.DefaultWidgetSet" />
<inherits name="com.vaadin.addon.touchkit.gwt.TouchKitWidgetSet" />
<inherits name="com.github.wolfie.refresher.RefresherWidgetset" />
[/code] [13566.xml|attachment](upload://AeOdrwvlZF4G0oKMFO6VkqZTwIX.xml) (17.9 KB)

Refersher doesn’t work with Vaadin 7.1 or later; which I’d guess that you’re using if you’re using Touch-Kit 4.0.
Check out this extension instead: https://vaadin.com/wiki/-/wiki/Main/Creating+an+UI+extension