another clue?

It seems to have something to do with the Tokenizers.  If I comment
out these places from the @WithTokenizers{} section of my
PlaceHistoryMapper definition as shown at the bottom below, the
navigation works correctly (in the sense that the correct page is
loaded and navigation stops) but there are no bookmarkable urls and
the back button does not work.

What I'm looking for here is pretty simple: For the places defined so
far, I want a url that looks like: http://myDomainEtc#SomePlace with
no more specific data needed.

I saw in the documentation: "Many places in the app might not save any
state to the URL, so they could just extend a BasicPlace that declares
a PlaceTokenizer that returns a null token."  I tried that, with the
same result as the original implementation. The URL now looks like
http://myDomainEtc#SomePlace:null, but as long as @WithTokenizers{}
includes my SomePlace class, the URL is replaced immediately with a
plain one and the browser loads the defaultPlace.

On Jan 3, 1:48 pm, jones34 <ljw1...@gmail.com> wrote:
> Hi
>
> In my application, I'm using the MVP pattern with activities and
> places.  I have a situation where:
>
> (1) I explicitely call: placeController.goto(new SomePlace());
> (2) The appropriate SomePlaceActivity's start() gets called via event
> management as expected.
> (3) This method creates gets a SomePlaceView, and swaps it into the UI
> (4) An appropriate history event happens 
> andhttp://mylocalenvironment#SomePlace:someplace
> appears briefly on my browser's nav bar.
>
> Then it gets weird.
>
> (5) A new empty String token gets created somehow.
> (6) It goes through the history management process, causing the
> defaultPlace to be created
> (7) The start() method on DefaultPlaceActivity() gets called
> (8) The app navigates away from SomePlace to DefaultPlace
>
> which makes me sad and very confused.  I cannot figure out how that
> empty token gets created and the event handling mechanism gets invoked
> the second time. The code for this is, of course, spread over many
> files so its difficult to provide all the relevant code, but I've
> included much of what I think could be useful here. I'm hoping that
> people have seen this happen before and can point me to a typical
> cause.
>
> // from my ActivityMapper
>         public Activity getActivity(Place place) {
>             if (place instanceof LoginPlace)
>                 return new LoginPresenter((LoginPlace) place,
> factory);
>             else if (place instanceof SomePlace )
>                 return new SomePlaceActivity((SomePlace) place,
> factory);
>             else if (place instanceof ForgotPasswordPlace )
>                 return new
> ForgotPasswordPresenter((ForgotPasswordPlace) place, factory);
>
>             return null;
>         }
>
> // from SomePlace
>
> public class SomePlace extends Place {
>     private final String name = "somePlace";
>
>     public SomePlace() { }
>
>     public String getName() { return name;}
>
>     public static class Tokenizer implements PlaceTokenizer<SomePlace>
>     {
>
>         public String getToken(SomePlace place)
>         {
>             return place.getName();
>         }
>
>         public SomePlace getPlace(String token)
>         {
>             return new SomePlace();
>         }
>     }
>
> }
>
> // from SomePlaceActivity
>
> public class SomePlaceActivity extends AbstractActivity implements
> Activity {
>
>     private ClientFactory clientFactory;
>     private SomePlace place;
>
>     public SomePlaceActivity(SomePlace place, ClientFactory
> clientFactory){
>         this.clientFactory=clientFactory;
>         this.place = place;
>     }
>
>     public void start(AcceptsOneWidget panel, EventBus eventBus) {
>
> clientFactory.getMainPanel().replaceCenter(clientFactory.getSomePlaceView() 
> .asWidget());
>     }
>
> }
>
> // from my entrypoint class's onModuleLoad() method
>
>                 ActivityMapper activityMapper = new
> ClientFactoryImpl.Controller(clientFactory);
>                 ActivityManager activityManager = new
> ActivityManager(activityMapper, clientFactory.getEventBus());
>
> activityManager.setDisplay(clientFactory.getMainPanel().getCenter());
>
>                 AppPlaceHistoryMapper historyMapper=
> GWT.create(AppPlaceHistoryMapper.class);
>                 PlaceHistoryHandler historyHandler = new
> PlaceHistoryHandler(historyMapper);
>                 historyHandler.register(placeController,
> clientFactory.getEventBus(), defaultPlace);
>
>                 // Goes to place represented on URL or default place
>                 historyHandler.handleCurrentHistory();
>
> // from my AppPlaceHistoryMapper interface
>
> @WithTokenizers(
>         {
>                 LoginPlace.Tokenizer.class,
>                 SomePlace.Tokenizer.class,
>                 ForgotPasswordPlace.Tokenizer.class
>         })
>
>     public interface AppPlaceHistoryMapper extends PlaceHistoryMapper
> {
>
>
>
>
>
>
>
> }

-- 
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-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to