Java源码示例:com.vaadin.data.util.converter.StringToIntegerConverter

示例1
private TextField createIntegerTextField(final String in18Key, final String id) {
    final TextField textField = createTextField(in18Key, id, 32);
    textField.setConverter(new StringToIntegerConverter());
    textField.setConversionError(i18n.getMessage(MESSAGE_ENTER_NUMBER));
    textField.setSizeUndefined();
    return textField;
}
 
示例2
private TextField createPercentageField(final String in18Key, final String id) {
    final TextField textField = new TextFieldBuilder(32).prompt(i18n.getMessage(in18Key)).id(id)
            .buildTextComponent();
    textField.setWidth(80, Unit.PIXELS);
    textField.setConverter(new StringToIntegerConverter());
    textField.addValidator(this::validateMandatoryPercentage);
    return textField;
}