client notification [message #727232] |
Tue, 20 September 2011 12:47  |
Eclipse User |
|
|
|
Is there any example on the client notification?
For example I added a dynamic code type in database, but the client side will not reflect this new code type until client restarted. Also if backend batch job modify the database it will not reflect on client side also. I try to turn on the client notification in Desktop, but it does not seems to work.
|
|
|
|
|
|
|
|
|
Re: client notification [message #732172 is a reply to message #728722] |
Tue, 04 October 2011 02:39  |
Eclipse User |
|
|
|
The most easiest way to get your page refreshed is to register a data-changed listener on the page. To to so, register the listener in execInitPage by calling registerDataChangeListener(xy). Thereby, xy is the type of data you are interested in receiving update notifications for. Typically, this is an enum represententing e.g. entities. For instance, that would be EntityEnum.Company or EntityEnum.Person.
Furthermore, you have to write the consumer to handle client notifications you are interested in. That is done as mentioned above by SERVICES.getService(IClientNotificationConsumerService.class).addGlobalClientNotificationConsumerListener(new IClientNotificationConsumerListener() { .. }
In handleEvent of that listener, you simply call ClientSession.get().getDesktop().dataChanged(EntityEnum.Company) unless the notification is not of interest for that data. In turn, the page gets updated automatically without calling reloadPage() manually.
I hope that helped.
[Updated on: Tue, 04 October 2011 02:40] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03145 seconds