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

2011-12-29 Thread James Drinkard
The way I did this was create a MUpld class with it's own ui.xml
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  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 wrote:
>
>
>
>
>
>
>
> > Would you show a fuller implementation for this?
>
> > On Dec 21, 8:53 am, David  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 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 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



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

2011-12-29 Thread David

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, James Drinkard  wrote:
> Would you show a fuller implementation for this?
>
> On Dec 21, 8:53 am, David  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 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 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



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

2011-12-28 Thread James Drinkard
Would you show a fuller implementation for this?

On Dec 21, 8:53 am, David  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 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 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



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

2011-12-22 Thread James Drinkard
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  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  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 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



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

2011-12-21 Thread David

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  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 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



How to set a Presenter in a composite Widget?

2011-12-20 Thread James Drinkard
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 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.