Hi All, 

I am trying to get the code splitting working on the ActivityMapper. 
I have taken the MVP tutorial sample (
http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html)
 and 
converted that to use GIN.

After reading a number of posts on the group decided to implement 
ActivityAsyncProxy (following example from here:  
http://code.google.com/p/google-web-toolkit/issues/detail?id=5129 )
and AsyncGoodbyeActivityProvider. Below are the listings for some of the 
code: 

public class AppActivityMapper implements ActivityMapper {

public AppActivityMapper() {
super();
}
 ActivityAsyncProxy<GoodbyeActivity> goodbyeActivityProxy = new 
ActivityAsyncProxy<GoodbyeActivity>(Ginjector.INSTANCE.getAsyncGoodbyeActivityProvider());
 @Override
public Activity getActivity(final Place place) {
Activity activity = null;
 if (place instanceof HelloPlace) {
final HelloActivity.Factory factory = 
Ginjector.INSTANCE.getHelloActivityFactory();
activity = factory.get((HelloPlace) place);
}
else if (place instanceof GoodbyePlace) {
 activity = goodbyeActivityProxy;
}
 return activity;
}

}

And Ginjector

@GinModules({GinModule.class})
public interface Ginjector extends com.google.gwt.inject.client.Ginjector {
 static final Ginjector INSTANCE = GWT.create(Ginjector.class);
 EventBus getEventBus();
HelloView getHelloView();
GoodbyeView getGoodbyeView();

PlaceController getPlaceController();
 HelloActivity.Factory getHelloActivityFactory();
HelloPlace.Factory getHelloPlaceFactory();
 GoodbyeActivity.Factory getGoodbyeActivityFactory();
GoodbyePlace.Factory getGoodbyePlaceFactory();
 AsyncProvider<GoodbyeActivity> getAsyncGoodbyeActivityProvider();

}


public class GinModule extends AbstractGinModule {

@Override
protected void configure() {
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
 bind(HelloView.class).to(HelloViewImpl.class).in(Singleton.class);
bind(GoodbyeView.class).to(GoodbyeViewImpl.class).in(Singleton.class);
 
bind(PlaceController.class).to(AppPlaceController.class).in(Singleton.class);
 bind(new TypeLiteral<AsyncProvider<GoodbyeActivity>>() 
{}).to(AsyncGoodbyeActivityProvider.class);
 install(new GinFactoryModuleBuilder().build(HelloActivity.Factory.class));
install(new GinFactoryModuleBuilder().build(HelloPlace.Factory.class));
 install(new 
GinFactoryModuleBuilder().build(GoodbyeActivity.Factory.class));
install(new GinFactoryModuleBuilder().build(GoodbyePlace.Factory.class));
 }

}


public class AsyncGoodbyeActivityProvider implements 
AsyncProvider<GoodbyeActivity> {

public void get(AsyncCallback<GoodbyeActivity> asyncCallback) {
 GoodbyePlace place = new GoodbyePlace("Frank");
asyncCallback.onSuccess(Ginjector.INSTANCE.getGoodbyeActivityFactory().get(place));
}

}


All that works fine with AsyncGoodbyeActivityProvider being bound in GIN. 

However, what I want to achieve is to use AsyncProxy in AppActivityMapper . 
I read number of samples and couldn't find the approach that I can use with 
GIN. 

Could anyone recommend the solution?  

How can I use the AsyncProxy instead of writing own ActivityAsyncProxy? 


Thanks,
Kris

-- 
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/-/EnME2RQUcXQJ.
To post to this group, send email to google-web-toolkit@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