PDA

View Full Version : RowEditor erronously marks NumberField setPropertyEditorType(Short.class) as modified



rherwig
26 Jun 2012, 3:42 PM
When I define a NumberField and call setPropertyEditorType() using java.lang.Short.class the RowEditor ALWAYS marks the field as modified. However (comma) if I set it to Integer.class it works fine. Am I missing something here??

Code that defines the RowEditor:
------------------------------------------------------------------------------------------------------
private static NumberField getSmallintField(String allowNulls) {
NumberField smallintField = new NumberField();
// --- allow/disallow nulls
if (MetadataColumnNullsMapper.SOR_COLUMN_ALLOW_NULLS.equals(allowNulls)) {
smallintField.setAllowBlank(true);
} else {
smallintField.setAllowBlank(false);
}
// -- disallow decimals
smallintField.setAllowDecimals(false);

// --- define editorType (defaults to Double)
smallintField.setPropertyEditorType(Integer.class);

// QUESTION: for 'some' reason if I use Short.class here the RowEditor ALWAYS thinks the column has been modified?!?!
//smallintField.setPropertyEditorType(Short.class);
// --- range (-32,768 to +32,767)
smallintField.setMinValue(Short.MIN_VALUE); // -2^15
smallintField.setMaxValue(Short.MAX_VALUE); // 2^15 - 1

// TODO: when attempting to enter a SMALLINT larger than +32,767 the RowEditor doesn't display an error, it just disables the 'Save' button; it should also display an error.

return smallintField;
}