Liferay with Vaadin: call to Java method from JS

Hello everyone.

I’m developing Vaadin portlet with Liferay and I ran into a problem I can’t resolve. What I need is to execute specific JavaScript code on a client and fetch the result into the portlet. Due to the fact that Window.executeJavaScript() won’t return any value, I think I have to call Java method from within JavaScript code.

The pseudocode below is to illustrate what I’m talking about.

public class VaadinWidget extends Application {
    public void init() {
            "var param = 14; " +
            "// call updateWindow(param)";

    public void updateWindow(int value) {
        // do something with the value