Thursday, July 29, 2010

Re: Views without presenters - how should they handle events?

Thanks for the reply. I think I will use the event bus for now. Half
way through reading about Guice. Looks pretty neat. Will finish up and
start reading about Gin. I still don't know at this stage if I can
dependency inject the event bus to the view that is created by the
binder. Sounds a bit unlikely as it won't be requesting the instance
from the injector, but we shall see...

Thanks,

Pete

On 28 July, 15:39, xworker <blomqvist.andr...@gmail.com> wrote:
> Hi
>
> For now I'm putting events on the eventbus from the view. Then in the
> entrypoint class handle all the events. I send the eventbus in the
> constructor to the view since I have'nt put in GIN yet. I will look
> into the new AcitvityManager concept from the 2010 IO and the
> PlaceManager.
>
> /A
>
> On 28 Juli, 16:23, PeteUK <newbar...@gmail.com> wrote:
>
> > Hello,
>
> > I'm starting with GWT and struggling to know how I should architect my
> > program.
>
> > I am using the Mail application's source code as a basis for mine, so
> > I'm hoping this reaches others who have inspected the source for the
> > Mail application.
>
> > Within the Shortcuts area, are three sub-areas (stacks in the
> > StackLayoutPanel): Mailboxes, Tasks, and Contacts. Inside Mailboxes,
> > assume I replaced the tree with a single button "In Box", and created
> > an event handler for it:
>
> > public class Mailboxes extends Composite {
> >  ...
>
> >  @UiHandler("inBoxBtn")
> >   void btnClicked(ClickEvent e) {
> >     // TODO: HOW TO HANDLE THIS??
> >   }
>
> > }
>
> > I am not sure how to proceed in internally architecting the handling
> > code. The Mailboxes class is a view but doesn't really have an
> > associated presenter. I have an "outer presenter" which really deals
> > with the entire outer view of the application (the root layout panel).
> > I've been thinking about the following choices but not sure how to
> > proceed:
>
> > 1) I could put these events on the event bus, and dependency-inject
> > the event bus into the Mailboxes instance somehow (I'm looking into
> > gin/guice as a separate thing).
>
> > 2) I could define a Presenter interface for Mailboxes which has a
> > callback for this button. The Mailboxes class is a view class with no
> > corresponding presenter class though, so not sure how I could
> > implement this! The Mailboxes instance is created in Shortcuts.ui.xml
> > as follows:
>
> >     <g:stack>
> >       <g:header size='3'>Mailboxes</g:header>     // .N.B style divs
> > removed for brevity
> >       <mail:Mailboxes ui:field='mailboxes'/>           // <---
> > Mailboxes instance created here
> >     </g:stack>
>
> > 3) Define a Presenter interface for Mailboxes and implement the
> > callback in the outer presenter object. This means outer presenter is
> > dealing with things a lot lower in the object tree than I feel it
> > should.
>
> > If your task was to extend the Mail application in this way, how would
> > you think it should be done?
>
> > Thanks,
>
> > Pete

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

No comments:

Post a Comment