And what would you do, if the AppController does not contain both the
presenter and the view (which should be the case IMHO).
How would that code look?


On 25 Jan, 18:35, jarrod <[email protected]> wrote:
> The constructors in the last post should have been as follows:
>
>   public AppControler(ServiceAsync service, HandlerManager eventBus,
> HeaderPresenter header, ContentPresenter content) {
>     this.service = service;
>     this.eventBus = eventBus;
>     this.header = header.getView().asWidget();
>     this.content = content.getView().asWidget();
>     widget = binder.createAndBind(this);
>   }
>
> I mistyped the name of the ContentPresenter argument...
>
> On Jan 25, 12:32 pm, jarrod <[email protected]> wrote:
>
>
>
> > Were the HeaderView, HeaderPresenter, ContentView and ContentPresenter
> > split out accordingly, your AppPresenter might look something more
> > like this:
>
> > public class AppController implements Presenter, View {
>
> >   interface Binder extends UiBinder<DockLayoutPanel, AppController>
> > {}
>
> >   private static Binder binder = GWT.create(Binder.class);
>
> >   @UiField(provided=true)
> >   HeaderView header;
>
> >   @UiField(provided=true)
> >   ContentView content;
>
> >   ServiceAsync service;
>
> >   HandlerManager eventBus;
>
> >   DockLayoutPanel widget;
>
> >   public AppControler(ServiceAsync service, HandlerManager eventBus,
> > HeaderPresenter header, ContentPresenter presenter) {
> >     this.service = service;
> >     this.eventBus = eventBus;
> >     this.header = header.getView();
> >     this.content = content.getView();
> >     widget = binder.createAndBind(this);
> >   }
>
> >   @Override
> >   public void bind() {
> >     // when I bind you bind we bind!
> >     header.bind();
> >     content.bind();
> >   }
> >   @Override
> >   public void unbind() {
> >     header.unbind();
> >     content.unbind();
> >   }
>
> >   // the remaining methods will vary,
> >   // depending on your framework of choice
>
> >   @Override
> >   public void go(Panel panel) {
> >     panel.add(widget);
> >   }
>
> >   @Override
> >   public View getView() {
> >     return this;
> >   }
>
> >   @Override
> >   public Widget asWidget() {
> >     return widget;
> >   }
>
> > }
>
> > This should work with the same App.ui.xml I previously posted above.
>
> > I should also note that I haven't specifically tested this code. It's
> > possible that the "View" classes will need to extend Widget to be
> > included in the UI by UiBinder. If that is the case, then the
> > following might be more appropriate:
>
> > <g:DockLayoutPanel unit='PX'>
> >   <g:north size='121'>
> >     <my:HeaderViewWidget ui:field="header" /> <!-- NB: ui:field -->
> >   </g:north>
> >   <g:center size="200">
> >     <g:ScrollPanel>
> >       <my:ContentViewWidget ui:field="content" /> <!-- NB: ui:field --
>
> >     </g:ScrollPanel>
> >   </g:center>
> > </g:DockLayoutPanel>
>
> > public class AppController implements Presenter, View {
>
> >   interface Binder extends UiBinder<DockLayoutPanel, AppController>
> > {}
>
> >   private static Binder binder = GWT.create(Binder.class);
>
> >   @UiField(provided=true)
> >   HeaderViewWidget header;
>
> >   @UiField(provided=true)
> >   ContentViewWidget content;
>
> >   ServiceAsync service;
>
> >   HandlerManager eventBus;
>
> >   DockLayoutPanel widget;
>
> >   public AppControler(ServiceAsync service, HandlerManager eventBus,
> > HeaderPresenter header, ContentPresenter presenter) {
> >     this.service = service;
> >     this.eventBus = eventBus;
> >     this.header = header.getView().asWidget();
> >     this.content = content.getView().asWidget();
> >     widget = binder.createAndBind(this);
> >   }
>
> >   // the remainder is unchanged
>
> > }
>
> > On Jan 25, 4:16 am, Stine Søndergaard <[email protected]> wrote:
>
> > > ... And how would the code example look if it was done the way you 
> > > describe
> > > in your first paragraph?

-- 
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