Comments inline.

On Wed, Jan 20, 2010 at 2:46 PM, Jeff Chimene <jchim...@gmail.com> wrote:

> 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?
>

Usually when I have a String as a key, I use TreeMap, it's faster to get the
information but slower to add. In this case the add process will happen just
once, so it's not a problem.


> > 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.
>

What do you mean by asynchronously in this case?


>
> >
> > 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)
>
>
If I do the get, google-gin will create the whole object tree connected to
this presenter, in this case it will create the view too. This means that at
startup time, all presenters and views will be created, which in my opinion
isn't good.


>
> 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<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>
>


-- 
Eduardo S. Nunes
http://enunes.org
--
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