google-code-export / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 0 forks source link

NumberField and fieldListener type mismatch with onChange #65

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When using NumberField with a field Listener you get the following
error which looks like a String versus number problem which is what
the onChange method is expecting.

com.google.gwt.dev.shell.HostedModeException: Calling method
'onChange': JS value of type number, expected string 

Original issue reported on code.google.com by willi...@gmail.com on 18 Aug 2007 at 12:39

GoogleCodeExporter commented 9 years ago
Changed signature from FieldListener#onChange(Field f, String newVal, String 
oldVal)
to #onChange(Field f, Object newVal, Object oldVal)

NumberField oldValue / newValue  types are based on the data type and could be
java.lang.Integer. java.lang.Long, java.lang.Float or java.lang.Double 
depending on
type and precision. So its best to cast to java.lang.Number when dealing with
NumberField.

For TextField's, empty fields are treated to have a 'null' value and not empty 
String.

Original comment by sanjiv.j...@gmail.com on 18 Aug 2007 at 4:44