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?