That was the missing piece for me: the editor framework uses getvalueorthrow!
The issue is here: http://code.google.com/p/google-web-toolkit/issues/detail?id=6713 On Aug 19, 11:02 pm, Jens <[email protected]> wrote: > 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 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.
