setValue(Integer) in TextField

Hi,

I had a problem trying to set different types of value in a TextField in Vaadin 7 beta 1. I made some tests setting an ObjectProperty on the constructor, and it works fine, but it doesn’t when I use setValue.

There is a code that can explain what I’m trying to say…

 VerticalLayout vl = new VerticalLayout();
  final TextField component = new TextField("Component", new ObjectProperty<Integer>(20));
  Button btn = new Button("SetValue");
  btn.addClickListener(new ClickListener() {
   
   @Override
   public void buttonClick(ClickEvent event) {
    component.setValue(new Integer(25));  
   }
  });
  
  setContent(vl);
  vl.addComponent(component);
  vl.addComponent(btn); 

If a setValue receives an object, it should receive an Integer right?

The description of the error:
Caused by: com.vaadin.data.util.converter.Converter$ConversionException: Value of type class java.lang.Integer cannot be assigned to java.lang.String

TextField is an AbstractField, so its value type is always String, independent of the data source type. A Converter is used to convert between the field type and the data source type. TextField.setValue(Object) should be setValue(String), but the genericization of AbstractField is not yet complete. You can set a value of the property type by calling TextField.setConvertedValue() or using setValue() of the data source directly.

Please do not post multiple copies of a question. I have already replied to you elsewhere that forum guidelines forbid multiple posting, and I can at least tell on my part that I have a personal policy of not answering the questions of those who repeatedly double post questions as they often waste a lot of time for those answering questions.