Ian,

When you mention your current solution fetches the MenuItem view from
the MenuPanel view, do you mean the MenuItem view(s) are already in
the MenuPanel view or do you mean the MenuPanel view acts as a factory
for MenuItem views? I have been experimenting a bit with the former,
though I imagine the latter would work. One approach I've also tried
for list based structures that might work for your list of Menu Items
is to make a function on the display interface to add the data
elements to build the MenuItem view from primitives:

interface MenuIPanelView {
  void addMenuItem( Object i.... );
}

This presents a similar mapping problem to managing DTOs if the data
your are representing in the view changes or the underlying model
object populating that data changes, but it is an option (especially
if the individual MenuItem's events could be bubbled up to the
MenuPanel and reduce code size).

The above are more what I've thought about or tried, and I don't claim
to be any expert. I've been trying to figure if there is some magic
approach that makes composition work, however I haven't seen a clear
winner yet. I hope we'll get from Ray Ryan's sample code when he's
able to put it together. Most non-GWT examples I've looked at seem to
imply that you don't directly instantiate the presenter, but that the
presenter is created when the view is constructed (and the view is
passed as an argument to the presenter at that time). For some reason,
this just feels wrong to me, though I can't put my finger on why this
bidirectional coupling would be an issue since the view is already
tightly coupled to the presenter. I don't know how well such an
approach would work with dependency injection or UI binder (my gut
feel is it wouldn't really).

I'll be interested to see anyone else's thoughts.

-Jason

On Sep 2, 1:22 pm, Ian Bambury <ianbamb...@gmail.com> wrote:
> Hi all,
>
> I have a question for the GWT-MVP experts out there. If there is a more
> suitable forum, please let me know.
>
> I have a menu panel which contains a flowpanel for menu items, and another
> flowpanel where the required page will display itself when the associated
> menu item is clicked.
>
> The MenuPanel presenter is creating menu items and sending the MenuItem
> views to the MenuPanel view to be added.
>
> The problem is this: If there are a number of possible MenuPanel views, then
> the MenuPanel presenter can't know which MenuItem view it should create
> (blue, green, red, text-based, image-based, therefore presumably each
> MenuPanel view should decide.
>
> The MenuPanel view can't be the creator of the MenuItems because it doesn't
> know which menu items should be created (for example, you might be allowed
> to see admin menu items or not - this kind of logic should not be in the
> view).
>
> So my current solution is to get the MenuPanel presenter to fetch the
> MenuItem view from the MenuPanel view.
>
> Now, if you are still following me, is this what I should be doing? Or have
> I completely lost the plot somewhere along the line?
>
> Although there are endless (generally slightly contradictory) explanations
> of MVP (and please note that I don't think I need another explanation of
> that), there isn't anything I can find that explains how to nail together
> the various self-contained MVP widgets - at least, not in a way that allows
> an event bus to operate.
>
> Ian
>
> http://examples.roughian.com
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to