Strange TextField repaint behavior

Hi,

i extended TextField to my BigDecimalTextField which has a PropertyFormatter to handle the input and format the output.
Setting immediate=true i expected the TextField to repaint and format the entered value on focus lost, e.g: “25000.1” → “25,000.10”. But nothing happens.

The valueChangeEvent gets fired but according to the implementation of AbstractField.valueChange() the event will not bubble up:


        if (!suppressValueChangePropagation
                && (isReadThrough() && !isModified())) {
            setInternalValue(event.getProperty().getValue());
            fireValueChange(false);
        }

Reading: if NOT modified then fireValueChange()!? Thats interesting.
I had to override the valueChange like this:


	@Override
	public void valueChange(final com.vaadin.data.Property.ValueChangeEvent event) {
		super.valueChange(event);
		requestRepaint();
	}

Now the formatted text will be send to the client and all is fine.

Is this a vaadin bug?

I didn’t look deeper into the code but the part that you looked at:

.. if(isReadThrough() && !isModified()) .. 

I think this has a slightly different meaning than what you thought. If the field is at a read through state and the field value is not modified, then fire an event. In a read through mode, I think the field value updates itself from the underlying source for value, if there is one. So I’d guess that that means if the underlying datasource has changed, then we shouldn’t handle this value change but take that change into account first before handling this separate value change. In other words, there are two conflicting value changes. This might also be some fix for a loop of valuechanges where the change calls upon itself.