Hi, I using the gwt-sample-tab as a template.
I want to add another tab with a cell browser. My presenter should get data
from the database in the onBind method. ( or maybe onReset )
My problem is how to do this... if I instantiate the cellbrowser in the
onBind method..
Builder<PrintProviderMock> builder = new Builder<PrintProviderMock>(model,
null);
cellBrowser = builder.build();
I get a
com.google.gwt.user.cellview.client.CellBrowser has no default (zero args)
constructor. To fix this, you can define a @UiFactory method on the
UiBinder's owner, or annotate a constructor of CellBrowser with
@UiConstructor.
Sure, I need to create the cellbroser in the view...
@Inject
public PrintProvidersView(PrintProvidersUiBinder uiBinder) {
final PrintProviderModel model = new PrintProviderModel();
Builder<PrintProviderMock> builder = new Builder<PrintProviderMock>(model,
null);
cellBrowser = builder.build();
initWidget(uiBinder.createAndBindUi(this));
}
But how do I now update the model in the cellbrowser in the presenter ???
*ui.xml*
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:c='urn:import:com.google.gwt.user.cellview.client'>
<ui:style>
</ui:style>
<g:HTMLPanel>
<div align="center">
<c:CellBrowser defaultColumnWidth='300' ui:field='cellBrowser' />
</div>
</g:HTMLPanel>
</ui:UiBinder>
*View*
public class PrintProvidersView extends ViewImpl implements
PrintProvidersPresenter.MyView {
interface PrintProvidersUiBinder extends UiBinder<Widget,
PrintProvidersView> {
}
@UiField
CellBrowser cellBrowser;
@Inject
public PrintProvidersView(PrintProvidersUiBinder uiBinder) {
final PrintProviderModel model = new PrintProviderModel();
Builder<PrintProviderMock> builder = new Builder<PrintProviderMock>(model,
null);
cellBrowser = builder.build();
initWidget(uiBinder.createAndBindUi(this));
}
public CellBrowser getCellBrowser() {
return cellBrowser;
}
}
*Presenter*
public class PrintProvidersPresenter extends
Presenter<PrintProvidersPresenter.MyView, PrintProvidersPresenter.MyProxy> {
private final PrintProviderMockServiceAsync ppmockService =
GWT.create(PrintProviderMockService.class);
public interface MyView extends View {
public CellBrowser getCellBrowser();
}
@ProxyCodeSplit
@NameToken("PrintProviders")
@TabInfo(container = ApplicationPresenter.class, label = "Print Providers",
priority = 3)
public interface MyProxy extends
TabContentProxyPlace<PrintProvidersPresenter> {
}
@Inject
public PrintProvidersPresenter(EventBus eventBus, MyView view, MyProxy
proxy) {
super(eventBus, view, proxy);
}
@Override
protected void revealInParent() {
RevealContentEvent.fire(this, ApplicationPresenter.TYPE_SetTabContent,
this);
}
@Override
protected void onBind() {
super.onBind();
get data from database and update cellbrowser or if
possible instantiate cellbrowser here without getting the error about no
default (zero args) constructor
}
@Override
protected void onReset() {
super.onReset();
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.