On Friday, January 21, 2011 6:59:03 PM UTC+1, zixzigma wrote:
>
>
> > Just that your ActivityMapper would probably return the very same 
> Activity 
> > instance, so the activity isn't "re started" as a result of navigation 
> > between pages. 
>
> please refer to the sample code below [1], which is used to put this 
> post into context. 
>
> "They would still be distinct Place instances" 
> yes, therefore as we go from one place to the next, 
> (going from ListEmployeePlace(4) to ListEmployeePlace(5)) 
> we are going to a new Place, which results in ActivityMapper 
> attempting 
> to find the correct Activity for this place, and the ActivityMapper, 
> creates a "New" ListEmployeeActivity 
> every time " return new ListEmployeeActivity(listPage.getPageNumber);" 
>
> here we are returning a "New EmployeeListActivity" everytime. 
> when a New Activity is returned, the corresponding ActivityManager, 
> invokes "start" method on it. 
> which contradicts with "so the activity isn't re started". 
>
> how can the behaviour you described be achieved ?
>

By returning the same instance as from the previous call to the 
ActivityMapper. In that case, the ActivityManager won't stop/start the 
activity.
 

> "Just that your ActivityMapper would probably return the very same 
> Activity 
> instance, so the activity isn't "re started" as a result of navigation 
> between pages." 
>
> by returning the "same activity instance", do we need to use 
> Provider<ListEmployeeActivity> listEmployeeActivity; 
> and bind this provider in Singleton scope ?
>

No.

You can just store the last returned activity instance in a field in your 
ActivityMapper and then decide whether you should return that instance or a 
new one (which you'd store in the field before returning it).

But this is what CachingActivityMapper does it the Place passed to it 
equals() the previous one. Because your Activity instance spans many places, 
it can listen to PlaceChangeEvent-s and thus be kept inform of the place 
change without being restarted, and therefore update its data with the page 
number from the new place.

then what about GWT Activity philosophy that Activities are to be 
> discarded, that they are not singletons ? 
> and AbstractActivity's onStop method, would stop the current activity 
> ListEmployeeActivity(4), 
> when it is stopped how can it NOT be restarted when in 
> ListEmployeePlace(5)?
>

Simply by returning the same instance as from the previous call to your 
ActivityMapper.
 

> you mentioned activity "isn't re started", 
> but as a result of going to a new Place, (from ListEmployeePlace(4) to 
> ListEmployeePlace(5)), 
> onStop method causes the Activity to stop. 
> do we need to make the onStop to do nothing, a method with empty 
> body ? 
> implementing Activity directly, isntead of extending AbstractActivity?
>

At the risk of repeating myself, you just have to return the same instance 
as from the previous call to your ActivityMapper.

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

Reply via email to