Monday, February 27, 2012

Re: Accessint GWT's HIstory Stack

I like the idea, but I'm finding that the value change event only fires when prefix portion of the token changes.

It does NOT fire when the token changes from:

But it DOES fire when it changes from:

This makes it impossible to keep track of the last INDEX place the user was on this way... I suppose I could track it in the constructor of the INDEX place activity... i.e. make a call to your hypothetical LastIndexTracker class in the Index place activity's constructor...

Thanks for your reply... By the way, am I right that the value change event only fires this way?

On Monday, February 27, 2012 2:07:47 PM UTC-5, Ovidiu Mihaescu wrote:
Add your own valueChangeHandler that keeps track of the last Index state:

class LastIndexTracker implements ValueChangeHandler<String> {
   Index lastIndex;

   void onValueChange(ValueChangeEvent<String> event) {
       if (isIndexToken(...)) {
         lastIndex = ....;

   Index getLastIndex() {
      return lastIndex;

On Mon, Feb 27, 2012 at 10:14 AM, Lars wrote:
Been searching for an answer to the following problem.... I have an application with 2 Places: "Index" and "Edit" each have representative tokens that carry state information.

My desire:
I want for the user to be able to return to the last "Index" state after many possible "Edit" states, so say these tokens are on the history stack:
1. INDEX:--23--pg1
2. INDEX:--23--pg2
(user sees the document they want to edit and thus enter EDIT place)
3. EDIT:--docFOO
(see anther document from a widget in the EDIT place)
4. EDIT:--docBAR
(and another)
5. EDIT:--docBING

Now arrives the problem... I want the user to be able to go back to the last INDEX state. Right now my solution is to carry the token (in this example "INDEX:--23--pg2") around on the query string as part of the EDIT token. What I don't like about this solution is that if the user bookmarks a particular EDIT token the INDEX token that is part of the EDIT token gets bookmarked as well obviously, and i cannot tell whether the user really came from that INDEX state or not.

Preferred solution: Search the History stack for the last INDEX token.

Alternative solution: Use a cookie with a fairly short expiration time to store the last INDEX token.

Thoughts? Is there a way to loop through the History stack to find particular tokens?

Thanks in advance.

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment