On Thursday, January 24, 2013 4:12:43 PM UTC+1, Darsha Sai wrote:
>
> Hi Thomas,
>
> Thanks for your response.
>
> I am not using MVP .
>

activities != MVP (see "debunking misconceptions" at 
http://tbroyer.posterous.com/gwt-21-places)
 

> I am not using  PlaceController . So I only relay on 
>  History.addValueChangeHandler. 
>
> What problem I am facing is ...
>
> In GWT have History ,HistoryImpl classes. 
>
> HistoryImpl class have newItem() , newItemOnEvent() these two  final 
> methods will change the $wnd.location.hash value when we click on browser 
> back button.
>
> Moreover, GWT have different HistoryImpl   classes for browser specific 
>  and  contain native methods to update the $wnd.location.hash .
> Like under package com.google.gwt.user.client.impl
>
> HistoryImpl
> HistoryImplIE6
> HistoryImplMozilla
> HistoryImplSafari
> HistoryImplTimer
>
>
> *For Example :* In Mozilla browser , if I click on browser back 
> button,control is going to  HistoryImplMozilla (see below GWT 
> implementation in History.gwt.xml) and change the the browser URL in 
> "nativeUpdate" method  and then control will come to   
> History.addValueChangeHandler (onValueChange())   at this time the browser 
> URL already modified and difficult to get the original URL from here.
>
> History.gwt.xml
>
>   <!-- Mozilla has a slightly different history implementation than the   
>   -->
>   <!-- standard case.                                                     
>   -->
>   <replace-with class="com.google.gwt.user.client.impl.HistoryImplMozilla">
>     <when-type-is class="com.google.gwt.user.client.impl.HistoryImpl"/>
>     <any>
> <when-property-is name="user.agent" value="gecko1_8"/>
> <when-property-is name="user.agent" value="gecko"/>
> </any>
>   </replace-with>
>
> How to show the alert message  in this time ? in Alert message if user 
> clicks to NO button means wants to stay in same page then its difficult to 
> get the original URL . because original URL already modified.
>
> In which place is suitable for showing Alert message to the user  if form 
> is dirty and clicks on browser back button.
>


You have basically two solutions:

   - globally; you'll have to somehow ask the "current form" whether it's 
   dirty or not and depending on that display a confirm message
   - at the form level; addValueChangeHandler when the form is displayed, 
   removeHandler when navigating away

In any case, you can either live with the history token no longer 
representing your current "place" 
(see https://code.google.com/p/google-web-toolkit/issues/detail?id=6726) or 
track the current token and issue a History.newItem() when you want to 
"cancel" the navigation to "reinstall" the current token.
 

> Its difficult to customize the HistoryImpl class for newItem() , 
> newItemOnEvent() these are final methods can't over ride in sub classes. If 
> i do that (copy entire class and done the customize) I need to customize 
> History ,HistoryImpl ,HistoryImplIE6,HistoryImplMozilla , HistoryImplSafari 
> ,HistoryImplTimer.
>

These are implementation details, you don't need to (and shouldn't) mess 
with them.

-- 
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to