Here's my updated code using the container method:
RorPresenter.java
public class RorPresenter {
private RorView view;
public void setView(RorView view){
this.view = view;
}
@Inject
public RorPresenter(){
bind();
}
public void doMyClickEvent(){
Window.alert("FIT");
}
public void doYourClickEvent(){
Window.alert("MEH");
}
public void bind(){}
}
RorView.java
public class RorView {
interface Binder extends UiBinder<Widget, RorView> {}
private static Binder BINDER = GWT.create(Binder.class);
private RorPresenter presenter;
@Inject
public RorView(RorPresenter presenter){
this.presenter = presenter;
presenter.setView(this);
presenter.bind();
}
@UiHandler("myButton")
void onMyButtonClick(ClickEvent event){
presenter.doMyClickEvent();
}
@UiHandler("yourButton")
void onYourButtonClick(ClickEvent event){
presenter.doYourClickEvent();
}
}
RorContainer.java
public class RorViewContainer extends Composite {
interface Binder extends UiBinder<Widget, RorViewContainer> {}
private static Binder BINDER = GWT.create(Binder.class);
@UiField(provided=true)
RorView view;
@Inject
@UiConstructor
public RorViewContainer(RorView view){
this.view = view;
initWidget(BINDER.createAndBindUi(this));
}
@UiFactory RorViewContainer makeRorViewContainer(){
return new RorViewContainer(this.view);
}
}
And now I use <ig:RorViewContainer /> in the applicationscaffold's xml configu.
It doesn't like the paramaters in the constructor and the @UiFactory doesn't fix it
[ERROR] <ig:RorViewContainer> missing required attribute(s): view Element <ig:RorViewContainer> (:156)
Jeff, can I mail you my maven project sample code, it'll be easier to show the problem if you have the whole context under eyes, been struggling to bind the view and the presenter for literally weeks now, just need one working example.
Thanks
J
--
Jan Vladimir Mostert
BEngSci
Mail: jan@mycee.com
MyCee Technologies
On Mon, Jan 31, 2011 at 9:36 PM, Jeff Larsen <larsenje@gmail.com> wrote:
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 apublic class RorViewContainer extends Composite {.. uibinder boilerplate...UiField(provided=true)RorView view;@Injectpublic RorViewContainer(RorView view){this.view = view;initWidget(uiBinder.createAndBindUi(this));}private RorPresenter presenter;@InjectRorView(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.
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