Sample App using DI/Gin, MVP, UiBinder, etc

349 views
Skip to first unread message

Ashton Thomas

unread,
Oct 27, 2010, 8:16:47 PM10/27/10
to Google Web Toolkit
Hey Everyone,

I am working on a seminar for GWT 2.1 that will happen in late
November. But I will be putting together a lot of sample code. I have
already pushed one app to github:

http://gwt.acrinta.com/

I am still working on this, so expect updates

Cheers!

Ashton Thomas

unread,
Oct 27, 2010, 10:19:45 PM10/27/10
to Google Web Toolkit
Here is a direct link to the source code:
http://github.com/ashtonthomas/gwt-seminar

I will continue to update the code for this site as well as the
content on this app. Over the next few weeks I will post a lot of
different sample code.

Hopefully it will help others get started quicker!

StrongSteve

unread,
Oct 28, 2010, 2:12:45 AM10/28/10
to Google Web Toolkit
Very nice idea. Thanks a lot for your effort.

Will there be a recording of the seminar for all of us on the other
side of the pond? ;)

Greetings
Stefan

Ashton Thomas

unread,
Oct 28, 2010, 10:52:06 AM10/28/10
to Google Web Toolkit
I will definitely try to post a video. It just puts the pressure on to
actually do a good job!

Thanks very much,
-Ashton

Daghan

unread,
Nov 17, 2010, 11:22:44 AM11/17/10
to Google Web Toolkit
Ashton,

The example is very cool and helpful. Thank you.
One thing I am struggling with is the ActivityManager.
I am trying to manage a composite through the activity manager.
I was hoping that you had figured it out but I see that you also pass
a SimplePanel

mainActivityManager.setDisplay(shell.getContent());

Do you know what I need to do so that ActivityManager.setDisplay
function doesn't force me to pass an "AcceptsOneWidget" object?
For the sake of the argument, I want to be able to pass the whole
shell, like this:

mainActivityManager.setDisplay(shell);

Thank you.


On Oct 28, 6:52 am, Ashton Thomas <ash...@acrinta.com> wrote:
> I will definitely try to post a video. It just puts the pressure on to
> actually do a good job!
>
> Thanks very much,
> -Ashton
>
> On Oct 28, 2:12 am, StrongSteve <swe.sta...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Very nice idea. Thanks a lot for your effort.
>
> > Will there be a recording of the seminar for all of us on the other
> > side of the pond? ;)
>
> > Greetings
> > Stefan
>
> > On Oct 28, 4:19 am,AshtonThomas<ash...@acrinta.com> wrote:
>
> > > Here is a direct link to the source code:http://github.com/ashtonthomas/gwt-seminar
>
> > > I will continue to update the code for this site as well as the
> > > content on this app. Over the next few weeks I will post a lot of
> > > different sample code.
>
> > > Hopefully it will help others get started quicker!
>

Daghan

unread,
Nov 18, 2010, 10:38:24 AM11/18/10
to Google Web Toolkit
Hi Ashton,

Have you figured out a way to pass anything but SimplePanel objects to
activityManager.setDisplay() function?

I am trying to figure out how to pass
activityManager.setDisplay(composite)

Thanks.

On Oct 28, 6:52 am, Ashton Thomas <ash...@acrinta.com> wrote:
> I will definitely try to post a video. It just puts the pressure on to
> actually do a good job!
>
> Thanks very much,
> -Ashton
>
> On Oct 28, 2:12 am, StrongSteve <swe.sta...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Very nice idea. Thanks a lot for your effort.
>
> > Will there be a recording of the seminar for all of us on the other
> > side of the pond? ;)
>
> > Greetings
> > Stefan
>
> > On Oct 28, 4:19 am,AshtonThomas<ash...@acrinta.com> wrote:
>
> > > Here is a direct link to the source code:http://github.com/ashtonthomas/gwt-seminar
>
> > > I will continue to update the code for this site as well as the
> > > content on this app. Over the next few weeks I will post a lot of
> > > different sample code.
>
> > > Hopefully it will help others get started quicker!
>

Brian Reilly

unread,
Nov 19, 2010, 11:43:05 AM11/19/10
to google-we...@googlegroups.com
Ashton,

It's good that you're doing this. I think we need some good examples of how to put together a GWT application using GWT 2.0/2.1 features, GIN, etc.

I took a quick look at some of the code (still planning to look more) and I have a couple of comments.

* I almost did the same thing as you to get a singleton PlaceController... creating a provider class and binding PlaceController to that in singleton scope. I had started out with a simple @Provider method in my GIN module, but then adding bind(PlaceController.class).in(Singleton.class) was overriding that. Finally, I found that I could just use a @Singleton annotation on the method as well, so putting this in my GIN module works beautifully:

    @Provides
    @Singleton
    PlaceController providePlaceController(EventBus eventBus) {
        PlaceController placeController = new PlaceController(eventBus);
        return placeController;
    }


* I notice that you're injecting instances of your activities into your activity mapper. Activities are meant to be fairly lightweight objects, as opposed to the views that represent them, so they don't need to be singletons (which they effectively are since you have a single app with a single injected activity mapper). It's probably not necessarily a problem unless your activities have state associated with them (such as the entity that the user is currently working with), which you have to be careful to clear out between uses with different data. The same can be said about places.

There are probably some flaws with how I'm thinking about activities. I'm still trying to learn how best to do all of this myself. I'm looking forward to seeing the finished version of your example.

-Brian

--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Ashton Thomas

unread,
Nov 22, 2010, 10:51:41 AM11/22/10
to Google Web Toolkit
Hey Daghan,

My understanding is that you only want a single area of the shell to
be managed by one ActivityManager.

So if you have an entire shell/layout with more than one area that
changes, let's say a main content area as well as a context menu (If I
have MainAppPlace and SettingsAppPlace and OtherAppPlace both of which
extend MainAppPlace, and you want to show a different context menu for
Place of type SettingsAppPlace and places of type OtherAppPlace)

I would just have main Shell that has a SimplePanel for content and
Simplepanel for context_menu

I just use an ActivityManager to control one spot of the main layout.

is this not right? do you want your activitymanager controlling more
than one area??

Ashton Thomas

unread,
Nov 22, 2010, 10:52:58 AM11/22/10
to Google Web Toolkit
Hey Brian, I am going to be updating a new example and will look into
your comments. I would also like to include Code Splitting while still
using DI/Gin which I think will change things slightly.

I will try to have some more example code on GitHub by next week

Thanks!
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsubs cr...@googlegroups.com>
> > .

Mauro Bertapelle

unread,
Nov 22, 2010, 1:49:34 PM11/22/10
to Google Web Toolkit
On 18 Nov, 16:38, Daghan <dag...@gmail.com> wrote:
>
> I am trying to figure out how to pass
> activityManager.setDisplay(composite)
>

Implement AcceptOneWidget in your Composite, and in the setWidget
method take care of inserting/removing the Activity's view in our
Composite's receiving area
Reply all
Reply to author
Forward
0 new messages