Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reminder in GWT

Tags:

java

gwt

I am doing an project on Java and GWT and stuck in one part I want to create a reminder that is like user enters date and time and at that time a pop up should be displayed reminding user of his event. Can anyone suggest me any approach towards achieving this.

When I googled for the solution i found some stuff related to timers in GWT but I guess timer has method schedule() which takes milliseconds as parameter but converting date and time into milliseconds doesn't seem the solution so any other alternative is highly appreciated.

like image 365
Durrat Avatar asked Dec 20 '12 07:12

Durrat


1 Answers

You can't handle it with only timers. Seems that you need to implement some server side logic to achieve this.

  1. User select time and date for event on client -> call to server to store it somewhere (could be simple RPC or Ajax call)
  2. Notifying the user could be achieved by several ways:

    • Simple polling - ask server from client what events happened since last check every N (let't say 10) seconds, using Ajax calls. Server needs to compare current time and send events list back to the client

    • Long poll or Hidden Iframe to be used for pushing the events to the client - more complex, but also could be implemented

You can also take a look at GwtEventService to manage your events between server and client.

Finally your logic stays simple - client needs to listen from the server about happened events and to show pop up dialog in the handler.

like image 172
udalmik Avatar answered Oct 16 '22 17:10

udalmik