Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've implemented an application using MVP with GWT, which is working out very nicely for views that have a single purpose. Now, it has evolved into views that are achieving multiple purposes in a single window. So now I have a view of views with each view having its own presenter. I used this example as my model for building out the application, take a look.

The "view of views" also has its own presenter, which instantiates (or receives) the presenters for each of the other views it needs to fulfill its purpose. I reveal event interfaces through those presenters for the "view of views" presenter to hook into and listen and react to what's going on inside those other presenters & views.

My questions are:

  • Am I still following MVP principles or have I violated the separation of concerns somewhere by having presenters create/receive and control other presenters? aka Should I be doing this?

  • What are some other design patterns for creating interfaces that are also composed of other complex interfaces?

Update

In response to Robert Harvey's question, there is difficulty with passing objects from a presenter of a view to the presenter of the "view of views" when an event is triggered. For instance, a button will flag a ClickEvent and the handler attached to this will need to pick up the data object related to the ClickEvent through another method revealed by the view's presenter. So this works, but do feel it will cause more problems later on as this kind of object handling grows in complexity.

share|improve this question
    
How is this arrangement working out, from a practical standpoint? –  Robert Harvey Feb 7 '13 at 20:04
    
@RobertHarvey, It is working, but my complaints with it is that it is difficult to trigger something in the "view of views" presenter. Almost to the point of where I feel like I'm doing something wrong - which is why I posted this question. –  hulkmeister Feb 7 '13 at 21:05

1 Answer 1

up vote 0 down vote accepted

In order to make it easier for the presenter at the lowest level to interact with the views of other presenters, I just added a method to the interface of the various presenters to return the view they are controlling. This way I can hook my presenter at the lowest level into the events of those views.

If anyone can point out any problems this will cause down the line, I am all ears. Thanks!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.