Wednesday, December 28, 2011

Re: How to set a Presenter in a composite Widget?

Would you show a fuller implementation for this?

On Dec 21, 8:53 am, David <levy...@gmail.com> wrote:
> Many  ways to do this.   ViewImpl.ui.java will have a binding  for the
> composite widget
> So you can simply pass the presenter or the instance of
> ViewImpl.ui.java to the composite widget.
>
> @UiField  MyCompositeWidget  theWidget;
>
> .. theWidget.setParent(this)
>
> Or you can use @UiField(provided=true)    ,  @UiConstructor ,  or
> @UiFactory.
>
> see:http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html
>
> On Dec 20, 1:37 pm,JamesDrinkard<jdrinka...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hello All,
>
> > I have a GWT 2.4 app using MVP, clientFactory, activities, places, and
> > uiBinder. I have a composite widget that I created as a standalone
> > object with it's own ui.xml file. I reference that class and insert it
> > into the main viewImpl.ui.xml file.
>
> > The composite widget receives some data from the backend and I need to
> > get it back to the activity so it can be displayed in a table. I'm
> > using the presenter that is associated with the view to get to the
> > activity. Here is the code: In the View interface:
>
> > public interface NameView extends IsWidget
> > {
> >     void setPresenter(Presenter presenter);
> > ...
>
> > public interface Presenter{
> >             void goTo(Place place);
> >             void setRowDataList(List<Data> rowData);
> >         }
>
> > In my Activity I implement the View.Presenter as in:
>
> >  Activity extends AbstractActivity implements NameView.Presenter
>
> > and in the start method for the activity I use:
>
> > NameView  nameView = clientFactory.getNameView();//NameView is just an
> > example.
> > nameView.setPresenter(this); ...
>
> > to setup the presenter and instantiate it. My problem is, in the
> > widget I need this:
>
> > presenter.setRowDataList(rowData);
>
> > but I'm not sure how to reference the instantiated Presenter from the
> > widget?
>
> > I know GIN would do it, but I'm not using that in the app as I've
> > never setup GIN with GWT. Any ideas as to the correct way to do this?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment