On Friday, July 8, 2011 12:57:01 PM UTC+2, Eugen Paraschiv wrote: > > I get where you're coming from with this, but consider this scenario: > I now have the following entities in the list: 1, 2, 3, so the first > element in the list would be 1. When going to the list, I would go to abc:1 > which is fine - 1 will be selected and nothing else will happen (a place > changed event will still be fired, but GWT will figure out that I'm > navigating to the same place and ignore it). But then, 1 is deleted and so > the list is 2, 3..., so the hardcoded navigation to 1 doesn't work any more.
That's what you're doing right now, not what I'm suggesting. > I cannot keep recalculating the URLs based on the first element of the > list, because that would mean HTTP requests and queries just to navigate > somewhere. Why would you "recalculate the URLs"? (see below) When you go to "abc:null", it shows the list and 'selects' the first one (be it abc:1, or abc:2, it depends what the list contains) When you go to "abc:1", it shows the first item (if it exists) and also shows the list with that item selected. Where you might have issues is if your list and detail are two distinct activities, but then again, it's a design flaw: you're not navigating to "abc:1", you're navigating to "abc:null" (which happens to also display "abc:1"), firing a subsequent navigation to "abc:1" is IMO a mistake, and that's what you should try to fix, rather than workaround the consequences. There are several possible fixes: - abc:null triggers a special details activity (or more probably a details activity in a special state) that waits for an event on the EventBus before doing anything. the list activity, when loading from "abc:null", dispatches such an event pointing to the first item in the list. - "calculating places", as you said, each time you want to go to "the list", to actually go to "the first item in the list" instead. and there are probably others. > What's worse is that 1 2 3 are id's so it will be dependent on the id > generation strategy I'm using - if for instance 1 is deleted, then it may be > reused for a new entity (it won't but just for the sake of the argument), > which would lead to invalid bookmarks. > That's another issue, dependent on your PlaceTokenizer and ID generation stategy. It's up to you to define whether a given "URL" can be reused or not. > Perhaps the solution is to consider abc:null as a place where no element is > selected and then let the user select the element. > It'd make things much easier for sure! but the event-based approach above shouldn't be that hard to implement I guess. -- 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/-/SOaVQv1lrxcJ. 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.
