Friday, April 26, 2013

UiField cellBrowser with 'provided = true' was null

When running in dev mode I get : 

Caused by: java.lang.AssertionError: UiField cellBrowser with 'provided = true' was null
at com.farheap.jsi.ppmock.client.PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl$Widgets.build_cellBrowser(PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl.java:129)
at com.farheap.jsi.ppmock.client.PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl$Widgets.get_cellBrowser(PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl.java:124)
at com.farheap.jsi.ppmock.client.PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl$Widgets.build_f_HTMLPanel1(PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl.java:99)
at com.farheap.jsi.ppmock.client.PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl$Widgets.get_f_HTMLPanel1(PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl.java:86)
at com.farheap.jsi.ppmock.client.PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl$Widgets.access$0(PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl.java:85)
at com.farheap.jsi.ppmock.client.PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl.createAndBindUi(PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl.java:30)
at com.farheap.jsi.ppmock.client.PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl.createAndBindUi(PrintProviderCellBrowser_PrintProviderCellBrowserUIBinderImpl.java:1)
at com.farheap.jsi.ppmock.client.PrintProviderCellBrowser.<init>(PrintProviderCellBrowser.java:30)
at com.farheap.jsi.ppmock.client.Main.onModuleLoad(Main.java:47)
... 9 more


package com.farheap.jsi.ppmock.client;

import java.beans.Beans;
import java.util.ArrayList;
import java.util.List;

import com.farheap.jsi.ppmock.client.service.PrintProviderMockService;
import com.farheap.jsi.ppmock.client.service.PrintProviderMockServiceAsync;
import com.farheap.jsi.ppmock.shared.pojo.PrintProviderMock;
import com.farheap.jsi.ppmock.shared.pojo.PrintProviderMockError;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.cellview.client.CellBrowser;
import com.google.gwt.user.cellview.client.CellBrowser.Builder;
import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class PrintProviderCellBrowser extends Composite {
private final PrintProviderMockServiceAsync ppmockService = GWT.create(PrintProviderMockService.class);
private static PrintProviderCellBrowserUIBinder uiBinder = GWT.create(PrintProviderCellBrowserUIBinder.class);
interface PrintProviderCellBrowserUIBinder extends UiBinder<Widget, PrintProviderCellBrowser> {}

@UiField(provided=true)
CellBrowser cellBrowser;

public PrintProviderCellBrowser() throws Exception {
   initWidget(uiBinder.createAndBindUi(this));
   final PrintProviderModel model = new PrintProviderModel();
if (!Beans.isDesignTime() && Main.live) {
ppmockService.getPrintProviders(new AsyncCallback<ArrayList<PrintProviderMock>>() {

@Override
public void onSuccess(ArrayList<PrintProviderMock> result) {
model.setData(result);
}

@Override
public void onFailure(Throwable t) {
t.printStackTrace();
}
});
} else {
PrintProviderMock printProviderMock1 = new PrintProviderMock();
printProviderMock1.setId(1L);
printProviderMock1.setName("Print Provider 1");

PrintProviderMock printProviderMock2 = new PrintProviderMock();
printProviderMock2.setId(2L);
printProviderMock2.setName("Print Provider 2");

PrintProviderMockError error1 = new PrintProviderMockError();
error1.setEnabled(true);
error1.setErrorCode(1);
error1.setId(1L);
error1.setName("Error 1");

PrintProviderMockError error2 = new PrintProviderMockError();
error2.setEnabled(true);
error2.setErrorCode(2);
error2.setId(2L);
error2.setName("Error 2");

PrintProviderMockError error3 = new PrintProviderMockError();
error3.setEnabled(true);
error3.setErrorCode(3);
error3.setId(3L);
error3.setName("Error 3");

printProviderMock1.addPrintProviderMockError(error1);
printProviderMock1.addPrintProviderMockError(error2);
printProviderMock1.addPrintProviderMockError(error3);

printProviderMock2.addPrintProviderMockError(error1);
printProviderMock2.addPrintProviderMockError(error2);

List<PrintProviderMock> list = new ArrayList<PrintProviderMock>();
list.add(printProviderMock1);
list.add(printProviderMock2);

model.setData(list);

}

Builder<PrintProviderMock> builder = new Builder<PrintProviderMock>(model, null);
cellBrowser = builder.build();
cellBrowser.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
Widget widget = uiBinder.createAndBindUi(this);
initWidget(widget);

}
}





--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
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.
 
 

No comments:

Post a Comment