I'm still confused here. Maybe I didn't spell out things. I have
more details on this question here:
http://stackoverflow.com/questions/8580225/how-to-set-a-presenter-in-a-composite-widget-in-gwt
Basically, I'm using clientFactory to bind an Activity(Presenter) to a
viewImpl. I have a viewImpl and in the ViewImpl.ui.xml I have a
reference to a widget class: MUpld, which contains a gwtUpload widget.
I have a fileUploadServlet defined in the web.xml that gets called
when the file upload starts. The servlet gets data from the widget
and returns it back to the MUpld class, which is the composite widget,
nested into
the ViewImpl.ui.xml file. Everything is in place, but now, I need
some way to get the instance of the Presenter, the Activity class that
the clientFactory created and bound the view, from inside the
composite widget.
It's probably really simple, I'm just not still seeing how to do it.
I'm using GWT 2.4 and the last project I worked on, we just used GIN
to inject the presenter into the composite widget. I may have to
rewrite this to add GIN
in and take out the clientFactory, I was just not wanting to do that
for sake of time as I have setup GIN in an app before.
My composite widget class is defined in the viewImp as:
@UiField = MUpld mUpld;
and in hte MUpld class I define a handler, using an inner class in the
constructor like so:
public MUpld() {
IUploader.OnFinishUploaderHandler onFinishUploaderHandler = new
IUploader.OnFinishUploaderHandler() {
public void onFinish(IUploader uploader) {
if (uploader.getStatus() == Status.SUCCESS){
...
//
presenter.setRowDataList(rowData);
}
}
};
initWidget(uiBinder.createAndBindUi(this));
uploader.addOnFinishUploadHandler(onFinishUploaderHandler);
On Dec 21, 8:53 am, David <[email protected]> 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, James Drinkard <[email protected]> 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 [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.