@Test public void testMakeValid() { String makeValidResult; makeValidResult = textBox.makeValidValue(null); assertEquals("", makeValidResult); makeValidResult = textBox.makeValidValue(""); assertEquals("", makeValidResult); makeValidResult = textBox.makeValidValue("aBc"); if (caseSensitive) { assertEquals("aBc", makeValidResult); } else { assertEquals("", makeValidResult); } makeValidResult = textBox.makeValidValue("CdE"); assertEquals("", makeValidResult); makeValidResult = textBox.makeValidValue("c"); assertEquals("c", makeValidResult); makeValidResult = textBox.makeValidValue("a#b$2%1"); assertEquals("ab21", makeValidResult); makeValidResult = textBox.makeValidValue("a#b$2%1.3-4_5"); assertEquals("ab213-4_5", makeValidResult); }
@Override protected String makeValidValue(final String value) { if (value == null || value.isEmpty()) { return ""; } if (testForInvalidValue(value) != null) { return ""; } else { StringBuilder validValue = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (isValidChar(c)) { validValue.append(c); } } return validValue.toString(); } }
AttributeValueTextBox extends AbstractValidatingTextBox { @Override protected String makeValidValue(final String value) { if (value == null || value.isEmpty()) { return ""; } if (testForInvalidValue(value) != null) { return ""; } else { StringBuilder validValue = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (isValidChar(c)) { validValue.append(c); } } return validValue.toString(); } } }
AttributeValueTextBox extends AbstractValidatingTextBox { @Override protected String makeValidValue(final String value) { if (value == null || value.isEmpty()) { return ""; } if (testForInvalidValue(value) != null) { return ""; } else { StringBuilder validValue = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (isValidChar(c)) { validValue.append(c); } } return validValue.toString(); } }  }
AttributeValueTextBox extends AbstractValidatingTextBox { @Override protected String makeValidValue(final String value) { if (value == null || value.isEmpty()) { return ""; } if (testForInvalidValue(value) != null) { return ""; } else { StringBuilder validValue = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (isValidChar(c)) { validValue.append(c); } } return validValue.toString(); } }  void setRegExp(final String pattern,
                          final String invalidCharactersInValueErrorMessage,
                          final String invalidCharacterTypedMessage); void setInvalidValues(final Set<String> invalidValues,
                                 final boolean isCaseSensitive,
                                 final String invalidValueErrorMessage); @Override String isValidValue(String value, boolean isOnFocusLost); }
AttributeValueTextBox extends AbstractValidatingTextBox { @Override protected String makeValidValue(final String value) { if (value == null || value.isEmpty()) { return ""; } if (testForInvalidValue(value) != null) { return ""; } else { StringBuilder validValue = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (isValidChar(c)) { validValue.append(c); } } return validValue.toString(); } }  void setRegExp(final String pattern,
                          final String invalidCharactersInValueErrorMessage,
                          final String invalidCharacterTypedMessage); void setInvalidValues(final Set<String> invalidValues,
                                 final boolean isCaseSensitive,
                                 final String invalidValueErrorMessage); @Override String isValidValue(String value, boolean isOnFocusLost);  }