Re: GWT 1.7 compiles null.nullMethod() into javascript for HTMLTable sub-class
aah, ok. thanks for that. I'll try that out, and see if I can get it to work. Cheers, Bob. On Aug 18, 11:13 pm, Thomas Broyer wrote: > On 18 août, 01:30, Bob The Cheese wrote: > > > > > OK, so I'm making a custom type of table which manages a datastore, > > has expandable sections, etc. > > > I've borrowed a couple of things off FlexTable, but modified/ > > simplified them. > > > When I run the project, I get this: > > == > > [ERROR] Failed to create an instance of 'vdc.module.billing.Billing' > > via deferred binding > > java.lang.NullPointerException: null > > at com.google.gwt.user.client.ui.HTMLTable$CellFormatter.access$0 > > (HTMLTable.java:373) > > at com.google.gwt.user.client.ui.HTMLTable.cleanCell(HTMLTable.java: > > 1370) > [...] > > I compile the project out and run it in firefox, and pull up the error > > here in the javascript: > > == > > function $setHTML(this$static, row, column, html){ > > var td; > > $prepareCell(this$static, row, column); > > td = null.nullMethod(); > > $internalClearCell(this$static, td, html == null); > > if (html != null) { > > null.nullMethod(); > > }} > > > == > > > in particular this line: > > td = null.nullMethod(); > > > I've looked around, and can't find anything which really explains to > > me what's going wrong. > > Looking at the equivalent method in Java world: > public void setHTML(int row, int column, String html) { > prepareCell(row, column); > Element td = cleanCell(row, column, html == null); > if (html != null) { > DOM.setInnerHTML(td, html); > } > } > ... > private Element cleanCell(int row, int column, boolean > clearInnerHTML) { > // Clear whatever is in the cell. > Element td = getCellFormatter().getRawElement(row, column); > internalClearCell(td, clearInnerHTML); > return td; > } > > It looks like getCellFormatter() always return 'null' so the compiler > translated the getRawElement(row,column) into 'null.nullMethod()' to > cause a "null pointer exception" equivalent in JavaScript. > > What it means is that you never ever called setCellFormatter(...) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
Re: GWT 1.7 compiles null.nullMethod() into javascript for HTMLTable sub-class
On 18 août, 01:30, Bob The Cheese wrote: > OK, so I'm making a custom type of table which manages a datastore, > has expandable sections, etc. > > I've borrowed a couple of things off FlexTable, but modified/ > simplified them. > > When I run the project, I get this: > == > [ERROR] Failed to create an instance of 'vdc.module.billing.Billing' > via deferred binding > java.lang.NullPointerException: null > at com.google.gwt.user.client.ui.HTMLTable$CellFormatter.access$0 > (HTMLTable.java:373) > at com.google.gwt.user.client.ui.HTMLTable.cleanCell(HTMLTable.java: > 1370) [...] > I compile the project out and run it in firefox, and pull up the error > here in the javascript: > == > function $setHTML(this$static, row, column, html){ > var td; > $prepareCell(this$static, row, column); > td = null.nullMethod(); > $internalClearCell(this$static, td, html == null); > if (html != null) { > null.nullMethod(); > }} > > == > > in particular this line: > td = null.nullMethod(); > > I've looked around, and can't find anything which really explains to > me what's going wrong. Looking at the equivalent method in Java world: public void setHTML(int row, int column, String html) { prepareCell(row, column); Element td = cleanCell(row, column, html == null); if (html != null) { DOM.setInnerHTML(td, html); } } ... private Element cleanCell(int row, int column, boolean clearInnerHTML) { // Clear whatever is in the cell. Element td = getCellFormatter().getRawElement(row, column); internalClearCell(td, clearInnerHTML); return td; } It looks like getCellFormatter() always return 'null' so the compiler translated the getRawElement(row,column) into 'null.nullMethod()' to cause a "null pointer exception" equivalent in JavaScript. What it means is that you never ever called setCellFormatter(...) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~--~~~~--~~--~--~---
GWT 1.7 compiles null.nullMethod() into javascript for HTMLTable sub-class
OK, so I'm making a custom type of table which manages a datastore, has expandable sections, etc. I've borrowed a couple of things off FlexTable, but modified/ simplified them. When I run the project, I get this: == [ERROR] Failed to create an instance of 'vdc.module.billing.Billing' via deferred binding java.lang.NullPointerException: null at com.google.gwt.user.client.ui.HTMLTable$CellFormatter.access$0 (HTMLTable.java:373) at com.google.gwt.user.client.ui.HTMLTable.cleanCell(HTMLTable.java: 1370) at com.google.gwt.user.client.ui.HTMLTable.setHTML(HTMLTable.java: 1006) at vdc.module.billing.clients.invoices.widget.InvoiceGrid. (InvoiceGrid.java:18) at vdc.module.billing.clients.invoices.Invoices.makeInvoiceGrid (Invoices.java:169) at vdc.module.billing.clients.invoices.Invoices.(Invoices.java: 110) at vdc.module.billing.clients.Clients.(Clients.java:66) at vdc.module.billing.Billing.(Billing.java:43) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate (ModuleSpace.java:373) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:318) at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace (BrowserWidget.java:343) at com.google.gwt.dev.shell.moz.BrowserWidgetMoz.access$100 (BrowserWidgetMoz.java:35) at com.google.gwt.dev.shell.moz.BrowserWidgetMoz $ExternalObjectImpl.gwtOnLoad(BrowserWidgetMoz.java:58) at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java: 1428) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2840) at com.google.gwt.dev.SwtHostedModeBase.processEvents (SwtHostedModeBase.java:235) at com.google.gwt.dev.HostedModeBase.pumpEventLoop (HostedModeBase.java:558) at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405) at com.google.gwt.dev.HostedMode.main(HostedMode.java:232) == I compile the project out and run it in firefox, and pull up the error here in the javascript: == function $setHTML(this$static, row, column, html){ var td; $prepareCell(this$static, row, column); td = null.nullMethod(); $internalClearCell(this$static, td, html == null); if (html != null) { null.nullMethod(); } } == in particular this line: td = null.nullMethod(); I've looked around, and can't find anything which really explains to me what's going wrong. Here are the methods that I've overwritten == @Override protected void prepareRow(int row) { if (row < 0) { throw new IndexOutOfBoundsException( "Cannot create a row with a negative index: " + row); } int rowCount = getRowCount(); for (int i = rowCount; i <= row; i++) { insertRow(i); } } @Override protected void prepareCell(int row, int column) { prepareRow(row); if (column < 0) { throw new IndexOutOfBoundsException( "Cannot create a column with a negative index: " + column); } int cellCount = getCellCount(row); for (int i = cellCount; i < column; i++) { insertCell(row, i); } } @Override public int getCellCount(int row) { if (row < 0) { throw new IndexOutOfBoundsException( "Cannot find a row with a negative index: " + row); } // Initialize - 0 cells in a row int count = 0; // check if the row exists yet int rows = getRowCount(); if (rows >= row) { count = getDOMCellCount(row); } return count; } // and the constructor public InvoiceGrid () { // set the headers setHTML(0,0," "); setText(0,1,"Invoice Number"); setText(0,2,"Client Name"); setText(0,3,"Invoice Date"); setText(0,4,"Due Date"); setText(0,5,"Terms"); setText(0,6,"Ageing"); setText(0,7,"Amount"); setText(0,8,"Status"); } == Can anyone help me with this? Any clues as to what I've done wrong here? Thanks guys. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups