}
return tb;
}
private AbstractRestrictedEntryTextBox makeNumericBigDecimalTextBox( final DTCellValue52 value ) {
final AbstractRestrictedEntryTextBox tb = new NumericBigDecimalTextBox( allowEmptyValues );
final BigDecimal numericValue = (BigDecimal) value.getNumericValue();
tb.setValue( numericValue == null ? "" : numericValue.toPlainString() );
// Wire up update handler
tb.setEnabled( !isReadOnly );
if ( !isReadOnly ) {
tb.addValueChangeHandler( new ValueChangeHandler<String>() {
public void onValueChange( ValueChangeEvent<String> event ) {
try {
value.setNumericValue( new BigDecimal( event.getValue() ) );
} catch ( NumberFormatException nfe ) {
if ( allowEmptyValues ) {
value.setNumericValue( (BigDecimal) null );
tb.setValue( "" );
} else {
value.setNumericValue( BigDecimal.ZERO );
tb.setValue( BigDecimal.ZERO.toPlainString() );
}
}
}
} );