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