Vaadin Push feature - java

I've ran into a strange problem using Vaadin. In my application I need to dynamicly push new data to the table viewed by the user. I've done some reading and it seems that I could achive just that with Vaadins' #Push feature.
But as soon as I've added the #Push annotation to my UI class everything stopped working. What I mean by this is I'm getting that message when accessing the UI
Session Expired. Take note of any unsaved data, and click here or press ESC key to continue.
clicking on the message just refreshes the whole page.
I'm using Vaadin 8.0.6 and vaadingSpring 2.0.1, as well as Spring Boot 1.5.3
Does anyone know how to solve this?
Oh, I almost forgot. I've used this code as an example
https://github.com/peholmst/vaadin4spring/blob/master/samples/push-sample/src/main/java/org/vaadin/spring/samples/push/PushUI.java

I found Push (with Spring) hard to configure. It was my fault, for sure, but I finally decided to drop it in favor of this simple extension which implements a client-based polling: https://vaadin.com/directory#!addon/timerextension-add-on

Related

Eclipse - E4: Removing a Placeholder in a non-active perspective grabs control from active perspective

I've tried to place may concern in an eclipse forum weeks ago, but got no response. Maybe they are on holiday or the forum has already started its process of dying in order to find a new conversation platform. Nevertheless...
Now to my little big problem while developing on e4 rcp.
I've got a little issue with those MPlaceholders. What I'm trying to archive is, to remove every placeholder (one per perspective) referencing the same MPart, when closing any placeholder.
In order to realize this I've hijacked the EPartService method 'hidePart(MPart, boolean)' to remove the placeholders and finally to remove the part from windows.sharedElements.
Everything works fine with one exception. When closing a placeholder in a non-active perspective, its parent partstack activates a different part and grabs the control from the active perspective.
You can only see this, if the activated part is also visible in the active perspective.
I've already filed a bug for this: 520238
But I'm absolutely unsure if this strategy leads to a total mess-up in the application model.
Is there a better alternative to get this working?
Thank you in advance
Matthias

Vaadin scrolls window top on every field change

We've been migrating Vaadin application from Vaadin 6 to Vaadin 7. Everything looks fine except of one thing: every time I change any input value and lose focus, my window scrolls to top. In my debug tool window in Chrome I see vaadin sends response with string like "31":{"scrollTop":300}} included. I don't see any code that explicitly calls scrollTop() or any such thing. In which direction should I dig to solve this problem?
Update:
I've attached a screenshot of layout debug info: https://dl.dropboxusercontent.com/u/1405291/stackoverflow/19481515-screenshot.png
Update:
It seems like ajax request being sent to server itself includes "scrollTop" variable change, and Vaadin just processes this request. Still I don't get what's wrong.
UI.getCurrent().setScrollTop(0);

Logout flow in play! framework 2.0, java

I ran into this problem yesterday and haven't been able to find a solution to it.
Once a user logs out how do I prevent them from hitting the back button and loading the cached, previous page?
I ran into this post and read the suggested article, but I'm unsure if any of these suggestions are the correct way to handle this problem.
I even ran the sample apps from Play! notably the Forms app and it has the same problem. I thought their apps would at least show how to handle this.
Any help would be appreciated. Thanks.
You can disable the cache in the response's header (no-cache or must revalidate) for every page that needs to check the credentials.

Preserving application in vaadin

I was wondering how to preserve an application when the user leave the application completly by going to another site (for example when the user logs into the application and then goes to nytimes.com and then comes back to the application some components go missing). To preserve the application on a refresh you can use the #PreserveOnRefresh annotation, but this does not preserve the application when you leave it. The header, menu and footer are disappearing. These three components are have their own class and are only declared in the main ui. Each view (or page) has its own class (which sit between the menu and the footer). Everything works fine until the user leaves the webpage and comes back the header, menu, and footer disapear So my question is how to preserve my vaadin application when the user leaves it and comes back?
Well, there could be problem with serialization and deserialization from session. Make sure you have implemented Serialization interface for your own classes.
Have you tried to repaint the missing components? They should be set to setImmediate(false) during repaintRequest.
Anyway, ordinary Vaadin application works without problem after returning back from other url. So good luck.
To solve this situation you can add a listener to the navigator which will get the uri to the page you are going to and check your permissions. If you do not have permission it will keep you on the same page and give you a notification saying that you are not allowed to go to this page. If they are allowed you will proceed to direct them to that page.
What components are missing when you go back to the application? Vaadin applicaction lives as long as web session. If I go to nytimes.com and then go back before the web session ends, the Vaadin application will survive (if it has #PreserveOnRefresh) or will be renewed

Refreshing Swing application with Eclipse/MyEclipse

Say that we are writing a Java Swing application and we use Eclipse or MyEclipse to develop it. In web applications, you make code changes, you save and your ant deployment file takes care of the deployment of the changed files. Then you just refresh or hard refresh the web page and the changes appear there. Can we do the same thing for a Swing applications so that we don't have to close and open the program from the beginning every time we make a change?
I don't think so because you need hot code replacement ! Maybee using another framework.
You can't simply do that because once JVM is started, it loads the class files once and will not reload it untill next loading request. But you can use ClassLoader to load modified class files dynamically.
The following two articles may help:
IBM article on "hot class swap"
"Who Said Runtime Class Reloading Is Hard in Java?"
The first one is in Chinese, but you can look at the code and the result. I think the second article is more helpful for a GUI application.
In MyEclipse you can start your application in debug mode instead of run mode and changes you make will be pushed to the target VM; if changes you make cannot be replaced you'll see a dialog informing you the replace failed and you will need to restart your application. You don't need to place any breakpoints in the application, just starting in debug mode is sufficient.
As Guillaume states above, changes to the class structure will typically not be hot-synched, but changes within existing methods should be fine.
Obviously, how successfully hot-synched changes affect your running application would depend on your application design.

Categories