@Test public void validInputNonEmpty() throws Exception { NumericTextBox numericTextBox = new NumericTextBox(); assertTrue( numericTextBox.isValidValue( "5", true ) ); assertFalse( numericTextBox.isValidValue( "", true ) ); }
@Override public boolean isValidValue( String value, boolean isOnFocusLost ) { boolean isValid = VALID_NUMBER.test( value ); if ( !isValid ) { return isValid; } if ( !isOnFocusLost && "-".equals( value ) ) { return true; } try { @SuppressWarnings("unused") BigDecimal check = new BigDecimal( value ); } catch ( NumberFormatException nfe ) { isValid = ( "".equals( value ) && allowEmptyValue ); } return isValid; }
NumericTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue( String value, boolean isOnFocusLost ) { boolean isValid = VALID_NUMBER.test( value ); if ( !isValid ) { return isValid; } if ( !isOnFocusLost && "-".equals( value ) ) { return true; } try { @SuppressWarnings("unused") BigDecimal check = new BigDecimal( value ); } catch ( NumberFormatException nfe ) { isValid = ( "".equals( value ) && allowEmptyValue ); } return isValid; } }
NumericTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue( String value, boolean isOnFocusLost ) { boolean isValid = VALID_NUMBER.test( value ); if ( !isValid ) { return isValid; } if ( !isOnFocusLost && "-".equals( value ) ) { return true; } try { @SuppressWarnings("unused") BigDecimal check = new BigDecimal( value ); } catch ( NumberFormatException nfe ) { isValid = ( "".equals( value ) && allowEmptyValue ); } return isValid; } NumericTextBox();  NumericTextBox( final boolean allowEmptyValue ); }
NumericTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue( String value, boolean isOnFocusLost ) { boolean isValid = VALID_NUMBER.test( value ); if ( !isValid ) { return isValid; } if ( !isOnFocusLost && "-".equals( value ) ) { return true; } try { @SuppressWarnings("unused") BigDecimal check = new BigDecimal( value ); } catch ( NumberFormatException nfe ) { isValid = ( "".equals( value ) && allowEmptyValue ); } return isValid; } NumericTextBox();  NumericTextBox( final boolean allowEmptyValue ); @Override boolean isValidValue( String value,
                                 boolean isOnFocusLost ); }
NumericTextBox extends AbstractRestrictedEntryTextBox { @Override public boolean isValidValue( String value, boolean isOnFocusLost ) { boolean isValid = VALID_NUMBER.test( value ); if ( !isValid ) { return isValid; } if ( !isOnFocusLost && "-".equals( value ) ) { return true; } try { @SuppressWarnings("unused") BigDecimal check = new BigDecimal( value ); } catch ( NumberFormatException nfe ) { isValid = ( "".equals( value ) && allowEmptyValue ); } return isValid; } NumericTextBox();  NumericTextBox( final boolean allowEmptyValue ); @Override boolean isValidValue( String value,
                                 boolean isOnFocusLost );  }