}
return tb;
}
private AbstractRestrictedEntryTextBox makeNumericIntegerTextBox( final DTCellValue52 value ) {
final AbstractRestrictedEntryTextBox tb = new NumericIntegerTextBox( allowEmptyValues );
final Integer numericValue = (Integer) 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( Integer.valueOf( event.getValue() ) );
} catch ( NumberFormatException nfe ) {
if ( allowEmptyValues ) {
value.setNumericValue( (Integer) null );
tb.setValue( "" );
} else {
value.setNumericValue( 0 );
tb.setValue( "0" );
}
}
}
} );