Grid update from a another form

Vaadin version: 7.6.3


I have main page with 4 grids and I want to add, modify the data via modal formLayot which is Window.
So, I click the button, appears the form, I add the data and close the window.

Close button has the code as follows:

Deposito produccion = new Deposito();
ui.refreshGridProduccion(); // ui is the mainpage, in fact a main class

the metod of refreshGridProduccion has:

final void refreshGridProduccion() {
gridProduccion.setContainerDataSource(new BeanItemContainer<>(Deposito.class, listaProduccion));

Done like this does not refresh the gridProduccion after closing the windos. I have to refresh the main page.

I tried to add data to the grid “diretly” from the main page instead of calling the form and this case, yes,
the grid was refreshed(updated).

So, I don’t understand what I’m doing wrong. Pleas, help mi out.


I do not fully get how your application is implemented. But it looks like you are having a method which commits the new entity to data base or something like that. If that triggers update to container etc., i.e. you are not manually syncing the container and database, but relying to Spring or something like that, then it would be prefarable to enable Vaadin Push in your application. Then server originated container updated would trigger also UI to refresh.


Thanks for the answer.
I wanted to describe as short es possible. I will attach the files if this helps.

My application is in the begining stage and so I haven’t implemented nothig yet. I will probably implement JPA.
So I have “dummy” entities, one, let say, basic “dummy” DAOImpl.

I think that refreshing the grid should or must work no mather what implementation is in use.
Well, if this is not the case, please, send mi a simple Vaadin Push example with explanation because, honestly, I never understud quite well all this about PUSH. And, to do it worse, I don’t have knowledge about Spring, it would be nice to know it, but I never found the time to learn it.

Regards to my files. They are a mix of methods, variables etc in english, spanish and slovenian language (my native language). I hope you will not find “messy” the code.

I’m new in Vaadin and this is my first application. Besides, this “problem” about refreshing the grid is essential because the applicatin is based on this. I attached some printscreens to you to have some idea what I want to achieve.

If you need to know something more, please, let me know.

Aleksander (3.76 KB) (5.42 KB) (25.1 KB)
24604.jpg (6.96 KB)


I’m still waiting for some help, adwice, tip, whatever.
No one in the “Vaadin world” had this kind of problems?



Well, I managed my intent to use push to run, but now I have another problem.
How to implement this “mechanism” in another case.

As I explained in my previous posts, I have one main page and several window forms with grids.
From those forms I call another window form to enter data, save them and by closing this form I need
to refresh the grid on the previosly opened window form.

The problem is that I was not able to implement
like I wanted. Namely, the “push code” is not recognized
in the form that saves data. So,
can’t be recognized and I don’t know if calling this code from the
main page is the best solution.

access(new Runnable() { @Override public void run() { try { form.refresGridProducts(); push(); } catch (InvocationTargetException ex) { Logger.getLogger(Forma.class.getName()).log(Level.SEVERE, null, ex); } } }); Then in the
runnable is not recognized anymore.

new Thread(new RefresherRunnable(tblListProducts, list)).start() which is an inner class.

class RefresherRunnable implements Runnable {
private final Grid tabela;
private final List podatki;

public RefresherRunnable(Grid tabela, List<MyEntity> podatki) {
  this.tabela = tabela;
  this.podatki = podatki;   

public void run() {
  access(new Runnable() {
   public void run() {
      System.out.println("RefresherRunnable - podatki.size():"+ podatki);
      access(new AzurirajTabelaRunnable(tabela, podatki));

[/code]Please help. There is no - not so - trivial example of use of
and if there doesn’t exist another way to refresh
parts of a page, object etc this should be explained better.
Besides, en Vaadin docs pages the
on-line examples
don’t exist on existing link

Please, can you correct this. Thanks.



I have to say that I’m really disappointed.
First, there is no one out there with such o similar problems?!
Second, no one from Vaadin Team did not have the time to answer me.
Third, really I did nato expect to have problems with refreshing components in VAADIN if it is based on AJAX.
There has to be a simple solution to that. I’m seriosly thinking to replace VAADIN for another framework because
I have to many unexpected problems with it and no support.

If you need to access UI from a thread, you need to use

getUI().getCurrent().access(new Runnable() { … } );

Note, you should not need to call push() or anything there.

If you have form in another window and want to store item in the container and get Grid updated, you need to just add item int the container in your Runnable, nothing else. That will fire ItemChangeEvent in the Container which subsequently will cause Grid to update itself. Push takes care of that automatically.


Vaadin version: 7.6.3
Windows 7 64-bit

Thanks a lot for answer. Yes, maybe we can talk via Skype (account:
) but for now let me describe again my problem.
My application is prety simple. Has one main page (attached) with 4 grids which will constatly change the content (data).
The rest are - for now - all window type forms for data manipulation (show, add, change, delete).
There are 2 type of these forms. One type contains grid to show data and another I use to add and change the data.
Grid containg form clicking on the button calls the form do add or change the data. Then last form saves the data in close it self and then the grid of the grid containg form should update (refresh, rerender…).
I hope you understand the issue here.

I managed to update one of the grid in the mainPage after adding the data via window form (CNSdialogProduction.jpg)
with runnable and push. This I call
window-main Page relationship

Now I need this to happend between
two window forms
. The situation is represented by two attachment.
(CNSwindowProducts.jpg → CNSProductDialogAddChange.jpg)

I’m little lost here, so my cuestion is, where to put this code
getUI().getCurrent().access(new Runnable() { … } );
It has to be placed in the form with the grid that I want to update?

Here, where I call the window form?

getUI.getCurrent().addWindow(myFormAddData); like this:

getUI().getCurrent().access(new Runnable() { @Override public void run() { getUI.getCurrent().addWindow(myFormAddData) } }); or in the other window form in
boton “Save”
like this:

public void save() { . . ui.access(new Runnable() { @Override public void run() { formProducts.updateGridProducts(); } }); } I’m sorry to disturb you, but I without that solution I can’t continue making this aplication and I’m late already.