We have a SimpleType that we define in our entry point class as currency4Type = new SimpleType("currency4", FieldType.FLOAT). We then add display and edit formatters so fields of that type are handled as decimal numbers with 4 digits to the right of the decimal point. All works well, except for the following scenario.
One of these fields is in an editable ListGrid that has an EditCompleteHandler. In the onEditComplete code we are using (Float) event.getNewValues().get("theField") to get the new value (we need to know if it was changed). If the user enters a number with digits to the right of the decimal point all is well and the value is returned as a Float. But if the user enters a whole number the value is returned as an Integer and we get a ClassCastException.
Why the inconsistency in data type?
One of these fields is in an editable ListGrid that has an EditCompleteHandler. In the onEditComplete code we are using (Float) event.getNewValues().get("theField") to get the new value (we need to know if it was changed). If the user enters a number with digits to the right of the decimal point all is well and the value is returned as a Float. But if the user enters a whole number the value is returned as an Integer and we get a ClassCastException.
Why the inconsistency in data type?
Comment