I am doing my first steps with GWT
.
I have a question after reading:
In the first example the Presenter
defines the interface for the View
.
public class ContactsPresenter implements Presenter {
...
public interface Display extends HasValue<List<String>> {
HasClickHandlers getAddButton();
HasClickHandlers getDeleteButton();
HasClickHandlers getList();
void setData(List<String> data);
int getClickedRow(ClickEvent event);
List<Integer> getSelectedRows();
Widget asWidget();
}
}
And in the second one, the View
defines the interface for the Presenter
.
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();
}
What's the idea of this difference?
Which should I choose?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…