Monday, January 31, 2011

Re: Spring ROO GWT with GIN injection on widgets created by ui:binder.

Sorry, I had forgotten you're using Roo. I don't have much experience with Roo/gwt but here is one way to get it done. This might not be the optimal way though since I haven't played around with the Roo/gwt framework for more than about an hour as I'm not able to use it in my current projects. 

Is the presenter generated for you by Roo or is that your own implementation? If it is your own, you could remove the Display from the constructor and add a setter for it instead. 

Here is what your uiBinder class could look like.

The only catch here is everywhere you use this, you'll have to do a


public class RorViewContainer extends Composite {

.. uibinder boilerplate...


UiField(provided=true)
RorView view;

@Inject
public RorViewContainer(RorView view){
   this.view = view;

        initWidget(uiBinder.createAndBindUi(this));
}



private RorPresenter presenter;

@Inject
RorView(RorPresenter presenter){
  this.presenter = presenter;
  presenter.setView(this);
  presenter.bind();
}

@UiHandler("myButton")
public void myButtonClick(ClickEvent event){
    presenter.doMyClickEvent();
}


@UiHandler("yourButton")

public void yourButtonClick(ClickEvent event){
  presenter.doYourClickEvent();
}

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