Dear Jaga,
thank you for your answer. I have tried your
Am Freitag, 22. November 2013 19:39:42 UTC+1 schrieb jaga:
Overriding the render() method was also my intention. However, I get a NPE when user clicks on the DatePicketCell for setting a new date. See stack trace below.
Nov 24, 2013 9:54:17 PM com.google.gwt.logging.server.RemoteLoggingServiceUtil logOnServer
SEVERE: null
com.google.gwt.core.client.impl.SerializableThrowable$ThrowableWithClassName
at com.google.gwt.user.datepicker.client.CalendarModel.setCurrentMonth(CalendarModel.java:148)
at com.google.gwt.user.datepicker.client.DatePicker.setCurrentMonth(DatePicker.java:527)
at com.google.gwt.cell.client.DatePickerCell.onEnterKeyDown(DatePickerCell.java:220)
at com.google.gwt.cell.client.DatePickerCell.onBrowserEvent(DatePickerCell.java:183)
at com.google.gwt.cell.client.DatePickerCell.onBrowserEvent(DatePickerCell.java:1)
at com.google.gwt.user.cellview.client.Column.onBrowserEvent(Column.java:154)
at com.google.gwt.user.cellview.client.AbstractCellTable.fireEventToCell(AbstractCellTable.java:2437)
at com.google.gwt.user.cellview.client.AbstractCellTable.onBrowserEvent2(AbstractCellTable.java:2006)
at com.google.gwt.user.cellview.client.AbstractHasData.onBrowserEvent(AbstractHasData.java:739)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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.GeneratedMethodAccessor136.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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(Unknown Source)
There is a GWT-Bug here.
In case you use default DatePickerCell constructor, or the one with the DateTimeFormat, the DatePicker will show up the chosen date, and it WILL KEEP SHOWING IT even if you decide not to set it. Calling CellTable.redraw() or refresh on data provider will not have any effect to its value in the CellTable!
In case you override its render method, such as the one I have here:
...
@Override
public void render(Context context, Date value, SafeHtmlBuilder sb) {
if(value != null) {
sb.appendEscaped(DateTimeFormat.getFormat("dd.MM.yyy").format(value));
}
}
In that case it works fine. DatePickerCell will not show the new value until the data provider is not re-loaded with the new data.
In my opinion this looks like a bug.
My first question sounds also like a bug or like a feature request.
Can someone check this and report a bug/feature-request to GWT-developers?
Thank you:
Nermin
-- thank you for your answer. I have tried your
Am Freitag, 22. November 2013 19:39:42 UTC+1 schrieb jaga:
For 1) just override the render() method of the cell or column. If the value is null do nothing otherwise render as normal .
Overriding the render() method was also my intention. However, I get a NPE when user clicks on the DatePicketCell for setting a new date. See stack trace below.
Nov 24, 2013 9:54:17 PM com.google.gwt.logging.server.RemoteLoggingServiceUtil logOnServer
SEVERE: null
com.google.gwt.core.client.impl.SerializableThrowable$ThrowableWithClassName
at com.google.gwt.user.datepicker.client.CalendarModel.setCurrentMonth(CalendarModel.java:148)
at com.google.gwt.user.datepicker.client.DatePicker.setCurrentMonth(DatePicker.java:527)
at com.google.gwt.cell.client.DatePickerCell.onEnterKeyDown(DatePickerCell.java:220)
at com.google.gwt.cell.client.DatePickerCell.onBrowserEvent(DatePickerCell.java:183)
at com.google.gwt.cell.client.DatePickerCell.onBrowserEvent(DatePickerCell.java:1)
at com.google.gwt.user.cellview.client.Column.onBrowserEvent(Column.java:154)
at com.google.gwt.user.cellview.client.AbstractCellTable.fireEventToCell(AbstractCellTable.java:2437)
at com.google.gwt.user.cellview.client.AbstractCellTable.onBrowserEvent2(AbstractCellTable.java:2006)
at com.google.gwt.user.cellview.client.AbstractHasData.onBrowserEvent(AbstractHasData.java:739)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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.GeneratedMethodAccessor136.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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(Unknown Source)
For 2) I suggest you look at the cell validation example in the gwt showcase. You could also probably just as well ignore the modified value and just call CellTable.redraw() or refresh your data provider.
There is a GWT-Bug here.
In case you use default DatePickerCell constructor, or the one with the DateTimeFormat, the DatePicker will show up the chosen date, and it WILL KEEP SHOWING IT even if you decide not to set it. Calling CellTable.redraw() or refresh on data provider will not have any effect to its value in the CellTable!
In case you override its render method, such as the one I have here:
...
@Override
public void render(Context context, Date value, SafeHtmlBuilder sb) {
if(value != null) {
sb.appendEscaped(DateTimeFormat.getFormat("dd.MM.yyy").format(value));
}
}
In that case it works fine. DatePickerCell will not show the new value until the data provider is not re-loaded with the new data.
In my opinion this looks like a bug.
My first question sounds also like a bug or like a feature request.
Can someone check this and report a bug/feature-request to GWT-developers?
Thank you:
Nermin
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.
No comments:
Post a Comment