Event bus looks to be promising and can solve this problem. Will try
it and see how much it can help. But first need to use MVP in my
project....

Thanks
Ravi.

On Jun 16, 2:23 am, fmod <francisco.mode...@gdsoft.eu> wrote:
> Using the event bus may help 
> there.http://code.google.com/events/io/2009/sessions/GoogleWebToolkitBestPr...
> and the two 
> articleshttp://code.google.com/webtoolkit/articles/mvp-architecture.html
>
> On Jun 15, 9:14 am, ping2ravi <ping2r...@gmail.com> wrote:
>
>
>
> > Hi Guys,
> > I have just implemented a multipage(basically multi url) website using
> > History. It works great using history token. But i need something else
> > from GWT which i am not able to solve.
> > Now when user clicks on something(link/button etc) i add the token to
> > History and my history callbacks get called.
> > Now in history value change handler i do something like this
>
> > 1) FInd out what page need to be dispalyed(basically identify the
> > panels etc).
> > 2) now each of my panel which can have history implementing
> > hasHistory(my own) interface, which has function
> > recoverPanelFromHistory.
> > 3) In this function, i check if i have client side data cahced for
> > this panel, if yes then load it into panel and display it(basically
> > add to main panel widget tree).
> > 4) But if no cache data found then go to server and get data.
>
> > one such implementation
> > @Override
> >         public boolean recoverPanelFromHistory(Map<String, String>
> > historyTokens) {
> >                 String page = historyTokens.get(PAGE_PARAM);
> >                 boolean returnValue = false;
> >                 if("home".equalsIgnoreCase(page))
> >                 {
> >                         returnValue =
> > userHomePanel.recoverPanelFromHistory(historyTokens); //and this
> > function will calls its child panels if they support history
> >                         if(returnValue )
> >                         {
> >                                 mainContentPanel.clear(); //clearing the 
> > mainPanel view of client
> >                                 mainContentPanel.add(userHomePanel); //and 
> > adding the view
> > according to history token value
> >                         }
> >                       else
> >                       {
> >                            //dont change the browser view and stay at
> > current panel/view/page. This also means child panel can not be
> > recovered and there must be some problem with history tokens provided.
> >                       }
>
> >                 }
> >                 if("profile".equalsIgnoreCase(page))
> >                 {
> >                         returnValue =
> > prodilePanel.recoverPanelFromHistory(historyTokens); //and this
> > function will calls its child panels if they support history
> >                         if(returnValue )
> >                         {
> >                                 mainContentPanel.clear(); //clearing the 
> > mainPanel view of client
> >                                 mainContentPanel.add(profilePanel); //and 
> > adding the view
> > according to history token value
> >                         }
> >                       else
> >                       {
> >                            //dont change the browser view and stay at
> > current panel/view/page. This also means child panel can not be
> > recovered and there must be some problem with history tokens provided.
> >                       }
>
> >                 }
> >                 return returnValue;
>
> >         }
>
> > So till now theoretically it sounds good and works good.
>
> > Problem starts when lets say user lost his Internet connection or call
> > fail at server because of any system level error..
>
> > userHomePanel.recoverPanelFromHistory(historyTokens);
>
> > This function does following things.
> > 1) get the data from cache for this panel
> > 2) if found call loadDataIntoPanel(data) function and load it into
> > panel and return true.
> > 3)  else call the server to get data.
> >     Now server call is async and I need to return some value from
> > userHomePanel.recoverPanelFromHistory(historyTokens);, so if i return
> > true and call fails at server because of some network problem then
> > ideally i dont want to switch to new view as per this history action
> > but my function has already returned true and mainPanle has already
> > changed the view to new panel.
> > Now i dont want child panels to call parentPanel's method to tell them
> > later that server call was success or failure so that main parent
> > panel can decide whethere i should switch panels/view or not. If child
> > need to know parent then my all panels will be too much dependent on
> > each other and they will be too much crossed chain to each other.
>
> > If you see gmail it uses such features. If you have loaded ur inbox
> > and then you lost ur internet connection and then u click on any
> > email. Then gmail doesnt take you to single mail viewer page and then
> > tell "oh u lost ur connection" but it just keep you on inbox view and
> > keep trying and after some time stop trying.
>
> > How can i achieve such functionality.?
> > Are there any existing libraries to do that or any particular design
> > pattern is there?
>
> > Thanks, in advance
>
> > Ravi.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to