Error repainting a FlowPanel on an onDrop event widget
Hi,
I'm repainting all the content of a FlowPanel that have DraggableWidget<DockPanel>.
I don't know where the application return the error, because the error is internal of GWT libraries.
The error is caused in this code:
public static void loadArbre(HandlerManager eventBus) {
List<FilaPanel> files = EditorView.getInstance().getFiles();
FlowPanel panell = EditorView.getInstance().getPanell();
files.clear();
panell.clear();
List<Fila> filesArbre = DRGUtils.getArbre().getElementRegistre(1).getElementNivell(1).getFiles();
for(int idFila=0; idFila<filesArbre.size(); idFila++) {
Fila fila = filesArbre.get(idFila);
FilaPanel filaPanel = new FilaPanel(false, idFila+1);
filaPanel.setWidth(FilaPanel.WIDTH_FILA + "px");
filaPanel.recalculaEspaisWidgets(FilaPanel.WIDTH_FILA, FilaPanel.SPACING_FILA);
files.add(filaPanel);
panell.add(filaPanel);
for(int idElement=0; idElement<fila.getElements().size(); idElement++) {
Component component = fila.getElements().get(idElement);
if(component instanceof Requadre) {
RequadrePanel requadre = new RequadrePanel("" + ((Requadre)component).getId(), false);
requadre.setFila(filaPanel);
filaPanel.addElement(idElement, requadre);
requadre.setHeight(FilaPanel.HEIGHT_FILA);
requadre.setEventBus(eventBus);
DRGUtils.inicialitzaFilesRequadre(((Requadre)component).getId());
for(int idFilaRequadre=0; idFilaRequadre<((Requadre)component).getFilesRequadre().size(); idFilaRequadre++) {
Fila filaRequadre = ((Requadre)component).getFilesRequadre().get(idFilaRequadre);
FilaRequadrePanel filaRequadrePanel = new FilaRequadrePanel(false, filaRequadre.getFilaID());
filaRequadrePanel.setWidth(FilaPanel.WIDTH_FILA + "px");
VariablePanel lastVariable = null;
for(int idVariable=0; idVariable<filaRequadre.getElements().size(); idVariable++) {
Component componentRequadre = filaRequadre.getElements().get(idVariable);
if(componentRequadre instanceof Variable) {
VariablePanel areaVariable = new VariablePanel("" + ((Variable)componentRequadre).getId(), false);
areaVariable.setInRequadre(true);
areaVariable.setRequadre(requadre);
areaVariable.setSizeInRequadre();
areaVariable.setFila(filaPanel);
areaVariable.setFilaRequadre(filaRequadrePanel);
areaVariable.setHeight(FilaPanel.HEIGHT_FILA);
areaVariable.setEventBus(eventBus);
if(idVariable==0) {
requadre.onVariableDinsRequadre(areaVariable, requadre, filaRequadrePanel);
} else {
requadre.onAfegirElementRequadre(areaVariable, lastVariable, filaRequadrePanel, AreesPanel.EAST, requadre);
}
lastVariable = areaVariable;
}
}
}
} else if(component instanceof Variable) {
VariablePanel arees = new VariablePanel("" + ((Variable)component).getId(), false);
arees.setFila(filaPanel);
arees.setEventBus(eventBus);
filaPanel.addElement(idElement, arees);
arees.setHeight(FilaPanel.HEIGHT_FILA);
}
}
}
}
I think the cause is de clear of the object panell that is a FlowPanel. This method is called in the onDrop event of a object that contains the FlowPanel panell. So I think the error is because I clear an object on the event onDrop of the same object. I hope I explain correcty.
This is the exception:
Uncaught exception: java.lang.NullPointerException
at gwtquery.plugins.draggable.client.events.DragContext.init(DragContext.java:104)
at gwtquery.plugins.draggable.client.events.DragContext.<init>(DragContext.java:48)
at gwtquery.plugins.draggable.client.events.AbstractDraggableEvent.<init>(AbstractDraggableEvent.java:41)
at gwtquery.plugins.draggable.client.events.DragStopEvent.<init>(DragStopEvent.java:37)
at gwtquery.plugins.draggable.client.Draggable$3.execute(Draggable.java:490)
at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:180)
at com.google.gwt.core.client.impl.SchedulerImpl.flushPostEventPumpCommands(SchedulerImpl.java:347)
at com.google.gwt.core.client.impl.SchedulerImpl$Flusher.execute(SchedulerImpl.java:78)
at com.google.gwt.core.client.impl.SchedulerImpl.execute(SchedulerImpl.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:724)
Thanks in advanced,
David Martínez
-- I'm repainting all the content of a FlowPanel that have DraggableWidget<DockPanel>.
I don't know where the application return the error, because the error is internal of GWT libraries.
The error is caused in this code:
public static void loadArbre(HandlerManager eventBus) {
List<FilaPanel> files = EditorView.getInstance().getFiles();
FlowPanel panell = EditorView.getInstance().getPanell();
files.clear();
panell.clear();
List<Fila> filesArbre = DRGUtils.getArbre().getElementRegistre(1).getElementNivell(1).getFiles();
for(int idFila=0; idFila<filesArbre.size(); idFila++) {
Fila fila = filesArbre.get(idFila);
FilaPanel filaPanel = new FilaPanel(false, idFila+1);
filaPanel.setWidth(FilaPanel.WIDTH_FILA + "px");
filaPanel.recalculaEspaisWidgets(FilaPanel.WIDTH_FILA, FilaPanel.SPACING_FILA);
files.add(filaPanel);
panell.add(filaPanel);
for(int idElement=0; idElement<fila.getElements().size(); idElement++) {
Component component = fila.getElements().get(idElement);
if(component instanceof Requadre) {
RequadrePanel requadre = new RequadrePanel("" + ((Requadre)component).getId(), false);
requadre.setFila(filaPanel);
filaPanel.addElement(idElement, requadre);
requadre.setHeight(FilaPanel.HEIGHT_FILA);
requadre.setEventBus(eventBus);
DRGUtils.inicialitzaFilesRequadre(((Requadre)component).getId());
for(int idFilaRequadre=0; idFilaRequadre<((Requadre)component).getFilesRequadre().size(); idFilaRequadre++) {
Fila filaRequadre = ((Requadre)component).getFilesRequadre().get(idFilaRequadre);
FilaRequadrePanel filaRequadrePanel = new FilaRequadrePanel(false, filaRequadre.getFilaID());
filaRequadrePanel.setWidth(FilaPanel.WIDTH_FILA + "px");
VariablePanel lastVariable = null;
for(int idVariable=0; idVariable<filaRequadre.getElements().size(); idVariable++) {
Component componentRequadre = filaRequadre.getElements().get(idVariable);
if(componentRequadre instanceof Variable) {
VariablePanel areaVariable = new VariablePanel("" + ((Variable)componentRequadre).getId(), false);
areaVariable.setInRequadre(true);
areaVariable.setRequadre(requadre);
areaVariable.setSizeInRequadre();
areaVariable.setFila(filaPanel);
areaVariable.setFilaRequadre(filaRequadrePanel);
areaVariable.setHeight(FilaPanel.HEIGHT_FILA);
areaVariable.setEventBus(eventBus);
if(idVariable==0) {
requadre.onVariableDinsRequadre(areaVariable, requadre, filaRequadrePanel);
} else {
requadre.onAfegirElementRequadre(areaVariable, lastVariable, filaRequadrePanel, AreesPanel.EAST, requadre);
}
lastVariable = areaVariable;
}
}
}
} else if(component instanceof Variable) {
VariablePanel arees = new VariablePanel("" + ((Variable)component).getId(), false);
arees.setFila(filaPanel);
arees.setEventBus(eventBus);
filaPanel.addElement(idElement, arees);
arees.setHeight(FilaPanel.HEIGHT_FILA);
}
}
}
}
I think the cause is de clear of the object panell that is a FlowPanel. This method is called in the onDrop event of a object that contains the FlowPanel panell. So I think the error is because I clear an object on the event onDrop of the same object. I hope I explain correcty.
This is the exception:
Uncaught exception: java.lang.NullPointerException
at gwtquery.plugins.draggable.client.events.DragContext.init(DragContext.java:104)
at gwtquery.plugins.draggable.client.events.DragContext.<init>(DragContext.java:48)
at gwtquery.plugins.draggable.client.events.AbstractDraggableEvent.<init>(AbstractDraggableEvent.java:41)
at gwtquery.plugins.draggable.client.events.DragStopEvent.<init>(DragStopEvent.java:37)
at gwtquery.plugins.draggable.client.Draggable$3.execute(Draggable.java:490)
at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:180)
at com.google.gwt.core.client.impl.SchedulerImpl.flushPostEventPumpCommands(SchedulerImpl.java:347)
at com.google.gwt.core.client.impl.SchedulerImpl$Flusher.execute(SchedulerImpl.java:78)
at com.google.gwt.core.client.impl.SchedulerImpl.execute(SchedulerImpl.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:724)
Thanks in advanced,
David Martínez
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.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home