I'm facing a problem with activities and places.
My use case is quite simple.
I have more kind of places in my app (e.g. CalendarPlace and
ResourcePlace). Each place can contain the ID of a given object.
When I switch place I want to load the correct editor for the kind of
object (switching if place type has changed) AND init it with the
correct value.
I use two activities to accomplish this. CalendarActivity and
ResourceActivity.
My ActivityMapper selects the correct kind, extracts the object ID
from the current Place and sets it on the correct Activity, then
returns it.
I load the details of the object on each activity's start(...) method.
My problem is that the two activities are actually singletons (not-
disposable), since they have different dependencies injected through
GIN.
In this case the ActivityManager (line 114) does NOT fire a start(...)
on the activity after the place has changed.
My place switch works fine when activity kind changes, but not when
the activity is the same but objectId has changed.
i.e calendar13 --> resource 14 is fine, and resource14 is loaded
resource14 --> resource15 is not: start is not called so resource15 is
not loaded
I wonder what is the best way to have a correct state change when
place chages occur.
*Build a GIN provider or the like for activities and have a different
Activity object returned each time
*Do the "new object" loading immediately when the ActivityMapper calls
the setter instead of the start(...) method
*Any other way?
I noticed things can be mixed reading
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/d827400bda6b996b/4367bbcc2d36aa5c?lnk=gst&q=reuse+activity#4367bbcc2d36aa5c
but I wonder if there's a suggested way to work around this.
Thanks for your help
Lorenzo
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment