Saturday, March 3, 2012

Re: Selecting list items from history actions using Activities and Places

That's pretty much the same way my app is set up, so you can see the
problem. Like I said, I solved it by essentially repeating the same
code as in the placeChangeHandler in the activity start() method, but
it seems little hokey.

Any ideas how to make this a little cleaner?

- Shaun

On Mar 3, 2012, at 8:50 AM, Chris Price <price.c@gmail.com> wrote:

> I see what you're getting at.
>
> Not that it helps, but that link was meant to be -
>
> https://github.com/chrisprice/menubodyexample/blob/master/src/com/scottlogic/cprice/menubodyexample/client/Menubodyexample.java#L48
>
> i.e. historyHandler.handleCurrentHistory();
>
> On Sat, Mar 3, 2012 at 1:39 PM, Shaun Tarves <shaun@tarves.net> wrote:
>> What I meant is that in your app structure, you'll typically have a call to
>> initBrowserHistory pretty early on. That will fire the initial
>> placeChangeEvent. When that happens, the activity containing the menu hasn't
>> event been started yet (or likely instantiated even), so the placeChange
>> handler isn't available to listen for that event.
>>
>> That is of course assuming you follow the typical activities/places set up
>> with multiple activity mappers, etc
>>
>> - Shaun
>>
>> On Mar 3, 2012, at 6:26 AM, Chris Price <price.c@gmail.com> wrote:
>>
>> Does this line not fire that event for you -
>>
>> https://github.com/chrisprice/menubodyexample/blob/master/src/com/scottlogic/cprice/menubodyexample/client/menu/Menu.java#L48
>>
>> On 2 Mar 2012 20:57, "Shaun Tarves" <shaun@tarves.net> wrote:
>>>
>>> This worked out fine. However, the obvious issue is that it's pretty hard
>>> to have anything done in your app BEFORE that initial PlaceChangeEvent (say,
>>> if you directly go to a specific place via the URL) gets fired.
>>>
>>> My solution was to write the same logic in both a placeChangeHandler and
>>> on initialization of the menu to select an item.
>>>
>>> Thanks for the help.
>>>
>>> On Thu, Mar 1, 2012 at 12:03 PM, Thomas Broyer <t.broyer@gmail.com> wrote:
>>>>
>>>>
>>>>
>>>> On Thursday, March 1, 2012 4:54:04 PM UTC+1, Jens wrote:
>>>>>
>>>>> Provide a correct equals()/hashcode() implementation in your places as
>>>>> mentioned in JavaDoc for Place.java.
>>>>>
>>>>> If you don't do so, CachingActivityMapper wont cache anything because it
>>>>> also does an oldPlace.equals(newPlace) to see if it can return the cached
>>>>> activity.
>>>>
>>>>
>>>> ...if you don't do this, you risk an infinite loop... (well, the loop
>>>> should be broken by the SelectionModel, which shouldn't fire an event when
>>>> you don't actually change the selection)
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "Google Web Toolkit" group.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msg/google-web-toolkit/-/9n07mtAs3foJ.
>>>>
>>>> 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.
>>>
>>>
>>> --
>>> 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.
>>
>> --
>> 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.
>>
>> --
>> 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.
>
> --
> 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.
>

--
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