Hello Every one.
I have a problem with ListEditor. The case is this:
I have a main editor for AProxy then AProxy has a list of BProxy 's
so in the main view i have this:
@UiField RespositorioUsuario archivos;
Then i have a sub view with something like this:
public class RespositorioUsuario extends Composite implements IsEditor<ListEditor<ArchivoProxy, RepositoryItem>> , HasRequestContext<List<ArchivoProxy>> {
// i manage a list of RepositoryItem editors
private class RepositorioEditorSource extends EditorSource<RepositoryItem> {
@Override
public RepositoryItem create(int index) {
RepositoryItem item = new RepositoryItem();
container.insert(item, index);
return item;
}
@Override
public void dispose(RepositoryItem subEditor) {
subEditor.removeFromParent();
}
@Override
public void setIndex(RepositoryItem subEditor, int index) {
container.insert(subEditor, index);
}
}
private ListEditor<ArchivoProxy, RepositoryItem> subeditors = ListEditor.of(new RepositorioEditorSource());
@Override
public ListEditor<ArchivoProxy, RepositoryItem> asEditor() {
return subeditors;
}
private AlumnoRequest request;
@Override
public void setRequestContext(RequestContext ctx) {
request = (AlumnoRequest) ctx;
}
}
Then the BProxy editor is RepositoryItem
public class RepositoryItem extends Composite implements Editor<ArchivoProxy> {
// iam the editor of BProxy
}
So finally i want to add one Item the the list with something like this:
ArchivoProxy a = request.create(ArchivoProxy.class);
subeditors.getList().add(a);
But i cant, and dont know why... i got a NullPointerException.
Caused by: java.lang.NullPointerException: null
at x.y.z.client.Alumnos.Editor.RespositorioUsuario$1.onChange(RespositorioUsuario.java:160)
at com.google.gwt.event.dom.client.ChangeEvent.dispatch(ChangeEvent.java:54)
at com.google.gwt.event.dom.client.ChangeEvent.dispatch(ChangeEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
etc ....
So the getList() is returning nulll
Why?
Any help would be apreciated.
Thank you.