repaintAll in Vaadin7? or, how do I know if user presses F5?

Hi all,

in Vaadin 6, I would use a servlet to search for the “repaintAll” request parameter: if available, I knew the user had requested a full repaint (e.g: by pressing F5).

That parameter is not included in Vaadin 7’s requests.
Is there another way for me to know if the user requested a full repaint?

Thanks a lot,
Marco

Hi,

see com.vaadin.server.ClientConnector.beforeClientResponse(boolean). You can override this in all components, including your UI class. When the UI class gets this call with the parameter true, it means that it’s either the initial page load or a reload. There are some limitations here (e.g. you can’t change the component hierarchy anymore), but basically it does the same thing.

Teppo, thanks a lot for your hint: it works like a charm! :slight_smile:

Thanks again,
Marco

Do note that unless you have annotated your UI with @PreserveOnRefresh, you get a new UI on every reload. So, basically, UI.init() is how you know if it’s a “full repaint”. There’s an
enhancement request
about adding a UI.reinit() method for the refresh case with a @PreserveOnRefresh UI.

Hi, I’m resuming this old thread because of some problems I have been experiencing in the last days.

See
here
and
here
for details, but basically: overriding UI.beforeClientResponse() prevented forms from being resized properly and Image/ImageScaler objects from being displayed in Tables.

My UI code was as following:

[...]

    public void beforeClientResponse(boolean initial) {
        super.beforeClientResponse(initial);
        //
        if (initial) {
            this.refreshCurrentView();
        }
    }
[...]

[/code]where refreshCurrentView() would contain a bunch of [code]
.setValue(...);

The point is, I just need a way to know whether the user pressed F5 to refresh the page, and then I have to reset all of the components’ values.
Can I do that in any way in Vaadin 7 (just as I did in Vaadin 6)? Or is it a
missing feature
in Vaadin and I have to wait?

Thanks for your help,
Marco

Thanks Vaadin team. The missing feature is now implemented (UI.refresh()).

Thanks,
Marco