file. Inside that class
I have a gwtUpload widget where I use @UiField and @UiHandler for the
Upload widget.
Then I reference the MUpld class as @UiField MUpld mUpld; in the
parent class: ViewImpl
In the ViewImpl class I use this code to define and set
the presenter, which is really an activity:
private Presenter presenter;
...
@Override
public void setPresenter(Presenter presenter)
{
this.presenter = presenter;
setMUpld(presenter);
}
So I have this working now, but I wasn't sure if it was proper GWT
coding as I keep
thinking somehow there is some mechanism in uiBinder I could use to
do
the same thing. The widget class: MUpld is a child of ViewImpl,
actually a
nested widget inside the ui.xml file of ViewImpl, so shouldn't it have
access to it's parent objects?
On Dec 29, 10:10 am, David <levy...@gmail.com> wrote:
> In your original thread you stated that you are calling
> "nameView.setPresenter(this); ... "
>
> If your implementation instance of nameView already has a handle to
> your widget when calling setPresenter , then you can simply
> change setPresenter to pass the presenter down to the widget.
>
> ...or you can try to use one of the techniques that I described in my
> prior thread.
>
> If that is still not clear then attach a zip of a trimmed done version
> of your implementation and perhaps someone can point you in the right
> direction.
>
> On Dec 28, 12:13 pm,JamesDrinkard<jdrinka...@gmail.com> wrote:
>
>
>
>
>
>
>
> > 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