Note that there are some explanatory texts on larger screens.

plurals
  1. POMVP: Should the View implement a Presenter's interface or vice versa?
    text
    copied!<p>I am doing my first steps with <code>GWT</code>. I have a question after reading:</p> <ul> <li><a href="http://code.google.com/webtoolkit/articles/mvp-architecture.html" rel="noreferrer">Large scale application development and MVP</a></li> <li><a href="http://code.google.com/webtoolkit/articles/mvp-architecture-2.html" rel="noreferrer">Large scale application development and MVP - Part II</a></li> </ul> <p>In the first example the <code>Presenter</code> defines the interface for the <code>View</code>.</p> <pre><code>public class ContactsPresenter implements Presenter { ... public interface Display extends HasValue&lt;List&lt;String&gt;&gt; { HasClickHandlers getAddButton(); HasClickHandlers getDeleteButton(); HasClickHandlers getList(); void setData(List&lt;String&gt; data); int getClickedRow(ClickEvent event); List&lt;Integer&gt; getSelectedRows(); Widget asWidget(); } } </code></pre> <p>And in the second one, the <code>View</code> defines the interface for the <code>Presenter</code>.</p> <pre><code>public interface ContactsView&lt;T&gt; { public interface Presenter&lt;T&gt; { void onAddButtonClicked(); void onDeleteButtonClicked(); void onItemClicked(T clickedItem); void onItemSelected(T selectedItem); } void setPresenter(Presenter&lt;T&gt; presenter); void setColumnDefinitions(List&lt;ColumnDefinition&lt;T&gt;&gt; columnDefinitions); void setRowData(List&lt;T&gt; rowData); Widget asWidget(); } </code></pre> <p>What's the idea of this difference?</p> <p>Which should I choose?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload