add-on Refresher

I am finalizing my very nice vaadin project where I connect via JNA to an integration server.

The transfer information like errors ed are visible in vaadin.
Also I can start a transfer on the server. This server is written in C++

When I start an integration transfer the server transfers records from one to an other database.
In this transfer I created mapping and functional logic.

When the transfer runs it generate transfer information.
I can extract this information and when I user System.err.print I see the information in the console.

But I want to see this information in a panel of vaadin. I created a text box.

Now I implemented the add-on refresher but it does not update the panel like I would.
I copied basically the code from the example project. But no refresh occur.

I run the integration and reading of transfer information in a separate java thread,

Does somebody have experience with this add-on and maybe have a clue why it isn’t working?

Chris

Have you started the refresher ?
Just adding it on the screen is not enough (As far as I remember…)

You could also just put the progressbar on the screen and set it to indeterminate state,
this also triggers regular refreshes…

Do you have an example of the progress bar?

I added an progress bar on the window that has the text box.
This box need to be updated from a thread but it isn’t.

I cannot add the progress bar to the thread script because that is not an window.
I also added the progress bar to the main window. Also did didn’t fixed my problem.

Very un cool. I have a brilliant webgui on my integration server and only this is not working.

Chris

ProgressIndicator pi = new ProgressIndicator();
pi.setIndeterminate(true);
pi.setVisible(false) - until you start the new Thread

Try these steps:
In Main App
pi.setVisible(true)

Then Start New Thread

In New Thread
synchronize (getApplication()) {
update your UI
}

At the end of your New Thread
pi.setVisible(false)

Hope that does it!
Dana

I did a test with the process indicator.

In my simple test program it worked fine.
In my real application it doesn’t. I think that the JNA call to the integration server block this.
When I start a call via JNA to the server Vaadin shows already a progress indicator.
Maybe this call block the communication to the sub window.

The JNA calls are all running in a different thread.

Chris

Just a guess: the JNA call is inside the synchronized block and therefore blocks UI updates.

To expand a bit on the pattern in the example, in the new thread you should first do any non-UI operations such as fetching data from external systems outside the synchronized block and then perform any UI changes (including changes to Vaadin containers etc.) in a block synchronized to the correct application instance. You can also alternate more between these: some background operations followed by a synchronized UI update block followed by background operations etc.

Also make sure that you pass the correct application instance to the background thread - remember that your system may have multiple concurrent users.

I am new with Vaadin. Just worked with it a few weeks.

In the run loop of the thread I do a synchonized to the textArea and update the setValue of it.
After that I fetch another block of information from JNA.

Do you have an example for me?

Chris

If you wish you can go to my program and do the test.
You will exactly see what I mean.

http://mycloudy.synology.me:25000/ITKthinClient
login
user: itk
pwd: itk

Select IKT_SCPDB database

Go to Start profile
Select Transfer_Static_data_Inbox_to_core

Click Start.

The integration will run and after it finish it display results.

If you wish you can look of source also to the rest of the app.
I just finished the Profile analyze and Profile Job analyze stuff.

I am extremely happy with the result.

It becomes an super gui for my server.

Chris