"core" refers to the source part of the downloaded application.
To bind URLs to places, GWT uses a PlaceTokenizer<P extends Place> . When loading the application from the URL, it calls the P getPlace(String token) method to get a new instance of the place to call.
due to the asynchronous nature of the code splitting, I cannot create a space inside runAsync in this method. Therefore, I have to put all the places in my application into the kernel.
To associate places with activity, GWT calls Activity getActivity(Place place) (from com.google.gwt.activity.shared.ActivityMapper ) to get a new instance of the activity.
Once again, I have to put all my actions in the kernel.
Here is what I want to try: write a custom com.google.gwt.place.shared.Delegate which
- bind yourself to a
PlaceChangeRequestEvent . If the AppPiece corresponding to the requested item is not loaded, it calls event.setWarning(NEED_TO_LOAD_MODULE) - in the
confirm(String message) method always returns false when the message is NEED_TO_LOAD_MODULE (therefore, it does not bother the user) and loads the module through runAsync . - After loading the module, call
goTo(requestedPlace)
Each AppPiece of my application contains a bunch of actions and corresponding views. Since mappers is only called when PlaceChangeEvent starts, I could create a new instance of my action through AppPiece.getSomeActivityInstance() .
I'm sure it will work, but it bothers me that
- Finding what AppPiece to load depending on the requested parameter will make me write code that will be very similar to my cartographers
- I would like to have my places inside the corresponding AppPiece
- Overriding
Delegate for this purpose is difficult, and I'm looking for a better solution.
source share