Ok after digging around in GWT's source code:

TextBox uses the generic ValueBoxEditor (see link in my previous answer) and 
does not have its own TextBoxEditor. The ValueBoxEditor knows the TextBox 
(but as ValueBoxBase<T>, because the ValueBoxEditor is generic) and 
calls ValueBoxBase.getValueOrThrow() to get the editor value. This call 
returns null for empty Strings as mentioned before. Thats why you got null 
for TextBoxes.

But I can see your point. TextBox overwrites ValueBoxBase<String>.getValue() 
and changes null to an empty String. But it does not 
overwrite ValueBoxBase<String>.getValueOrThrow(). So you end up having two 
methods that return the value but they have a different result for an empty 
String in the wrapped input element:

- getValue() returns an empty String (called by you in your example)
- getValueOrThrow() returns null (called by the editor framework)

In addition to these both methods you also have TextBox.getText() which 
returns the text via a DOM operation. This method never returns null for an 
empty TextBox so maybe thats why Google has overwritten getValue() to act 
the same way. Unfortunately they forgot getValueOrThrow() which is used by 
the Editor Framework. So I think its a bug in TextBoxBase: getText(), 
getValue() and getValueOrThrow() should all act the same way.

Maybe you can open an issue and ask to align both getValue methods so that 
they return the same for an empty string in the wrapped input element.

Hope that helps.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/s7kDdoAXNYUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to