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