You should be able to find what you are looking for under "Large scale
application development and MVP - parts 1 and 2"
See : https://developers.google.com/web-toolkit/articles/mvp-architecture
I've long since abandoned the notion of hiding my pojos from my views so I
guess I'm in MVC denial.
On Wednesday, October 17, 2012 5:28:16 PM UTC-4, furious_panda wrote:
>
> Hi,
>
> I need some help, I did not found examples or forums discussions about
> these subjects.
>
> I want to try to do a GWT application using MVP pattern. But I have some
> difficulties.
>
> In MVP, Presenter have to contain Display interface that specifie what the
> View must implements and return.
>
> *I have two problems when I apply this pattern:*
>
> 1 - The View must not have to manipulate Model. Or, how it is possible for
> a collections of objects?
>
> For example, I have model object Person as follows:
>
> *public class Person{*
> * private String firstname;*
> * private String lastname;*
> * private Integer age;*
> *......
> *
> *}*
>
> The View must display a collection of Person in Table (Flextable for
> example) whithout manipulating Model. How it is possible ?
>
> This is my presenter, and what I do now:
>
> *public class PersonListPresenter extends
> WidgetPresenter<PersonListPresenter .Display> {
> *
> * public interface Display extends WidgetDisplay{*
> * public void setData(List<Person> data);*
> * }*
> * *
> * protected void onBind() {*
> * display.setData(data);*
> * }*
> *}*
>
> This is my view, and what I do now:
>
> *public class SongsView implements PersonListPresenter .Display {*
> *......*
> *public void setData(List<Person> data) {
> *
> * if(data!=null && data.size() > 0){*
> * for (Person person: data) {*
> * // I display all information about each Person in one row
> of table *
> * *
> * }*
> * }*
> *}*
> *.....*
> *}*
>
> *How can I do in MVP for this case ?*
>
> 2 - My second problem, is each row of this table must be clickable ? How I
> can do ?
>
> How can I get from display click event for each row ?
>
> *public class PersonListPresenter extends
> WidgetPresenter<PersonListPresenter .Display> {
> *
> * public interface Display extends WidgetDisplay{*
> * public void setData(List<Person> data);*
> * }*
> * *
> * protected void onBind() {*
> * display.setData(data);*
> * // I have to implement the same information for each row but
> the source information is different.*
> * // I have to fire an Event containing the Person information
> that is clicked*
> * display.get ????? *
> *
> *
> * .addClickHandler(new ClickHandler() {*
> * public void onClick(ClickEvent event) {*
> *
> *
> * }*
> * }*
> * }*
> *}*
>
> Thanks in advance.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/ro6a8GQEM3YJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.