view.displayResults(results);  // Display results with new view.

should be

currentView.displayResults(results);  // Display results with new
view.

On Aug 8, 12:54 pm, Eric Metcalf <[email protected]> wrote:
> Using MVP...
>
> Create a View interface that has ListView, DetailView, and
> ThumbnailView implement it.  Your presenter will take a default view
> implementation.  On change of view, apply the different implementation
> to your view and update your view.
>
> class Result {
>   String url;
>   String data1;
>   String data2;
> ...
>
> }
>
> interface View {
>   public displayResults(List<Result> results);
> ...
>
> }
>
> class ListView implements View {
>   displayResults(List<Result> results) {
>     for (result : results) {
>       // display each row.
>     }
>   }
> ...}
>
> ...
>
> class Presenter {
>   View currentView;
>
>   Presenter() {
>     this.listView = new ListView();
>     this.detailView = new DetailView();
>     this.currentView = listView;  // Default.
>   }
>
>   onViewChange(enum viewType) {
>     switch viewType:
>       this.currentView = detailView;
> ...
>     view.displayResults(results);  // Display results with new view.
>   }
>
> }
>
> On Aug 8, 11:54 am, d95sld95 <[email protected]> wrote:
>
>
>
>
>
>
>
> > The wrapping is mainly to manage the attache/detach from the DOM.
> > Since only one display (HasData) is shown at a time.
>
> > I did notice however that adding two HasData to
> > AbstractDataProvider.addDataDisplay(..) causes the
> > onRangeChanged(HasData<T> display) to be called twice. That is most
> > likely intentional but in my case I only have one of the displays
> > visible at a time. So loading the data once is sufficient. I was
> > hoping to deal with that in the wrapper as well.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
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