I saw a lot of sample code, most of them use the following way of creating 
MVP:

public interface ContactsView<T> {

  public interface Presenter<T> {
    void onAddButtonClicked();
    void onDeleteButtonClicked();
    void onItemClicked(T clickedItem);
    void onItemSelected(T selectedItem);
  }
  
  void setPresenter(Presenter<T> presenter);
  void setColumnDefinitions(List<ColumnDefinition<T>> columnDefinitions);
  void setRowData(List<T> rowData);
  Widget asWidget();
}


Then let the presenter implement ContactsView.Presenter<Contact>. However 
some do the following:


public class ContactsPresenter implements Presenter {  

  public interface Display {
    HasClickHandlers getAddButton();
    HasClickHandlers getDeleteButton();
    HasClickHandlers getList();
    void setData(List<String> data);
    int getClickedRow(ClickEvent event);
    List<Integer> getSelectedRows();
    Widget asWidget();
  }
//.........................
}

Then let the view implement the ContactsPresenter.Display.
Are there any good points for doing either methods, maybe one is better 
suited for UiBinder?


2- Another question, is the view not suppose to directly communicate with 
the model at all. For instance, if I've got a ListBox that should 
be populated from an Enum class that sits in the model, should that be done 
through the presenter?

-- 
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/-/MCtXV5RXLckJ.
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.

Reply via email to