Hi Eduardo:

Comments inline.

On 01/20/2010 09:34 AM, Eduardo Nunes wrote:
> I'm using a different approach, below a draft source code of my
> AppController class. What do you think?
> 
> public class AppController implements ValueChangeHandler<String> {
> 
> private final Map<String, PresenterType> urls;
> private final Map<PresenterType, Provider<? extends Presenter>> presenters;
> 
> @Inject
> public AppController() {
> 
> urls = new TreeMap<String, PresenterType>();

Could you expand a bit on why the choice of TreeMap vs. another HashMap?

> presenters = new HashMap<PresenterType, Provider<? extends Presenter>>();
> 
> urls.put("/contacts/list", PresenterType.CONTACT_LIST);
> 
> History.addValueChangeHandler(this);
> 
> }
> 
> @Override
> public void onValueChange(ValueChangeEvent<String> event) {
> 
> final PresenterType presenterType = urls.get(event.getValue());
> 
> if (presenterType != null) {
> 
> final Provider<? extends Presenter> presenter = presenters
> .get(presenterType);

Is there a way to do this asynchronously at startup? I'm interested in
the shortest response time during event handling.

> 
> final Presenter<? extends Display> instance = presenter.get();
> instance.bind();

Ibid.

> 
> RootPanel.get().add(instance.getDisplay().asWidget());
> 
> }
> 
> }
> 
> @Inject
> void configureContactListPresenter(Provider<ContactListPresenter>
> presenter) {
> presenters.put(PresenterType.CONTACT_LIST, presenter);

Ibid. I don't understand why the get() can't be done here (i.e.
asynchronously at startup)


Thanks for the examples!
-- 
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