Vaadin 7 TextField enhancement suggestion

Hello,
I have TextField enhancement suggestion for Vaadin 7.

Vaadin is mainly for LOB database application. Right?
Columns in database is defined as “Varchar(10)”, “Numeric(10,2)”, “Integer”, etc…

I want TextField with mode for entering Integer - allowing only numbers.
I want TextField with mode for entering Number(10,2) - allowing only this format.

I want really user friendly TextField.
Why allow user enter letters when databinding to Integer property? Why?


Disallowing obviously wrong input on client side is very user friendly and common.

Databinding should be one of the metadata source.


For applications mainly based on databases this is first thing I check and want.


It is done in ten years old Borland Delphi.

This functionality is available in the form of the
MaskedTextField add-on
in the directory as well as several more specific add-ons for entering of numerical data etc.

Note, though, that input masks can often be a source of irritation rather than helpful if overused or not very carefully designed, especially with respect to operations such as editing an already entered value or copying and pasting values. Furthermore, developers often tend to restrict too much what is truly allowable, making applications impossible to use for some users (e.g. the allowable characters and structure of postal codes vary a lot from country to country, see e.g.
this page
for a few examples).

Yes,
mask overuse or mask itself is not user friendly. No doubt.

But I dont want mask edit (and certainly not with visible mask placeholdert).


I miss the simple “NumberField” (no mask, no visible mask placeholder),
just “Integer mode”, “Double mode”, “Strict or BigDecimal mode- specify places before and after decimal point” (for values from database).

I try this components

  1. MaskedTextField
  • visible mask placeholder
  • can enter decimal point multiple times
  1. NumericField (from MaskedTextField addon)
  • can not enter negative sign “-”
  • can enter decimal point multiple times
  • can not enter max size before and after dot
  1. NumericField (from NumericField addon)
  • show wrong input char, and after half-second change value to previous allowed value


I still wonder why this must-have-component is not in core vaadin.
In every nontrivial application users enter numbers

For integer field you can use a converter

TextField ultimonumero = new TextField(); ultimonumero.setCaption("Último número"); ultimonumero.setConverter(new StringToIntegerConverter()); For non negative integer:

[code]
public class StringToNonNegativeIntegerConverter extends StringToIntegerConverter {

@Override
public Integer convertToModel(String value,
        Class<? extends Integer> targetType, Locale locale)
        throws com.vaadin.data.util.converter.Converter.ConversionException {
    return abs(super.convertToModel(value, targetType, locale));
}

private Integer abs(Integer value){
    return value < 0 ? - value : value;
}

}
[/code]example

TextField ultimonumero = new TextField();
ultimonumero.setCaption("Último número");
ultimonumero.setConverter(new StringToNonNegativeIntegerConverter());

Or one of validator from
package com.vaadin.data.validator

Or you write a component extension.