My bad. Of course i need to initialize the ArrayList on the main Proxy when create a new one. So proxy.setArchivos(new ArrayList<ArchivoProxy>()); solved this issue.
Great GWT. El 9 de abril de 2012 15:08, Daniel Mauricio Patino León < [email protected]> escribió: > 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. > > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-web-toolkit/-/Y4W-kzI_qxUJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > -- ISC. Daniel Mauricio Patiño León. Liondev S.A. de C.V. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
