I had the pleasure of reading the article as well.

Although I was slightly disappointed that the source code was not shared
fully in the article, the concept is nicely explained, and the code can be
developed based on the snippets in the article.

At a high level, the AppController is a class that contains code that does
not belong the the view, model or the presenter. The version of the
AppController that I have has the following:

a) It implements ValueChangeHandler interface to act as a handler of history
changed events.
b) It accepts the RPC Service & the event bus as the constructor arguments
to be able to pass on these objects to the presenters that it will
instantiate.
c) It has a go(HasWidgets) method which gets called by the module entry
point class. This initiates everything in the app - such as firing the
default history token(which in turn calls the onValueChange). I also have
the code to add the AppController to the history as a listener in this
function itself.
d) Most important of it all - atleast the thing I liked most - is the
onValueChange method. This method gets called whenever History stack
changes. This allows you to manage history & view transitions in your app.

For ex:

public void onValueChange(ValueChangeEvent<String> event) {
        String token = event.getValue();
        if(token!=null) {

            if(token.equals("registersmart")) {
                RegisterSmartPresenter presenter = new
RegisterSmartPresenter(rpcService,eventBus,new RegisterSmartView());
                presenter.go(container);
            }else if(token.equals("userhome")) {
                UserHomePresenter presenter = new
UserHomePresenter(rpcService,eventBus,new UserHomeView());
                presenter.go(container);
            }

        }

    }

Hope this helps.

Regards

On Tue, Dec 29, 2009 at 11:29 PM, jpnet <[email protected]> wrote:

> I really liked the article, but it's useless without the source code.
>
> -JP
>
> On Dec 29, 7:55 am, Abdullah Shaikh <[email protected]>
> wrote:
> > Anyone ?
> >
> > On Tue, Dec 29, 2009 at 2:45 PM, Abdullah Shaikh <
> >
> > [email protected]> wrote:
> > > I went through
> > >http://code.google.com/webtoolkit/doc/latest/tutorial/mvp-architectur..
> .,
> > > I am confused, does AppController as mentioned in the article does the
> same
> > > that can be done by gwt-presenter's PlaceManager ?
> >
> > > If yes, should I go with AppController or PlaceManager ?
> >
> > > As I am new to GWT, I understood the gwt-presenter, but I couldn't get
> how
> > > the AppController as described in the above link works ?
> >
> > > Thanks,
> > >  Abdullah
> >
> >
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to