@Test public void testMakeValid() { String makeValidResult; makeValidResult = textBox.makeValidValue(null); assertEquals("", makeValidResult); makeValidResult = textBox.makeValidValue(""); 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("ab21.34_5", makeValidResult); }
@Override protected String makeValidValue(final String value) { if (value == null || value.isEmpty()) { return ""; } StringBuilder validValue = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (isValidChar(regExp, c)) { validValue.append(c); } } return validValue.toString(); }
CustomDataTypeTextBox extends AbstractValidatingTextBox { @Override protected String makeValidValue(final String value) { if (value == null || value.isEmpty()) { return ""; } StringBuilder validValue = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (isValidChar(regExp, c)) { validValue.append(c); } } return validValue.toString(); } }
CustomDataTypeTextBox extends AbstractValidatingTextBox { @Override protected String makeValidValue(final String value) { if (value == null || value.isEmpty()) { return ""; } StringBuilder validValue = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (isValidChar(regExp, c)) { validValue.append(c); } } return validValue.toString(); } CustomDataTypeTextBox(); }
CustomDataTypeTextBox extends AbstractValidatingTextBox { @Override protected String makeValidValue(final String value) { if (value == null || value.isEmpty()) { return ""; } StringBuilder validValue = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (isValidChar(regExp, c)) { validValue.append(c); } } return validValue.toString(); } CustomDataTypeTextBox(); void setRegExp(final String pattern,
                          final String invalidCharactersInNameErrorMessage,
                          final String invalidCharacterTypedMessage); @Override String isValidValue(final String value,
                               final boolean isOnFocusLost); }
CustomDataTypeTextBox extends AbstractValidatingTextBox { @Override protected String makeValidValue(final String value) { if (value == null || value.isEmpty()) { return ""; } StringBuilder validValue = new StringBuilder(value.length()); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (isValidChar(regExp, c)) { validValue.append(c); } } return validValue.toString(); } CustomDataTypeTextBox(); void setRegExp(final String pattern,
                          final String invalidCharactersInNameErrorMessage,
                          final String invalidCharacterTypedMessage); @Override String isValidValue(final String value,
                               final boolean isOnFocusLost);  }