I am trying to implement MVP pattern using MVP4g framework. The core GWT's "Composite" class allows my view classes to be initialized as Widget objects (by extending Composite and calling initWidget(myMainPanel)). It also has "HasClickHandlers" and "HasValue<String>" which I can return from my UI widgets (like textbox and passwordtextbox). My issue is that I cannot leverage the framework's support using just the smartGwt UI widgets. How do I manage onClick events and returning my view instance as widgets ?
Announcement
Collapse
No announcement yet.
X
-
In Other words, I need to know the following when I am implementing a MVP pattern.
1) I can define my view class as "public class LoginView extends Composite". How can I do the same using SmartGWT. If I extend the Composite class, all I need to do is all the initWidget(theMainPanel). If I need to get the entire widget to be displayed somewhere, I just create a getter
in my view and call it from my presenter.Code:public Widget getViewWidget() { return this; }
2) In my view class, I can simply define
and use these methods in my presenter as follows:Code:public HasClickHandlers getButton() { return (HasClickHandlers) login; } public HasValue<String> getPassword() { return password; }
andCode:view.getButton().addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event) { //do something } )};
How do I use SmartGWT to achieve the same functionality ?Code:view.getPassword().getValue();
Last edited by dmanchikalapudi; 23 Feb 2010, 19:11.
Comment