LoginForm Ugliness


I’m new to Vaadin, and while reading the Book I came across the section that talks about how one extends the LoginForm by overriding getLoginHTML():


Can someone please explain to me in technical detail why all of this hard-coded HTML and JS code is necessary simply to customize the LoginForm? If I were using GWT, I would have customized the Login in a much cleaner way. Is this level of ‘hack’ necessary wishing to customize other Vaadin components (I sure hope not)? Will this be ‘fixed’ in Vaadin 7?

Thank You.

I think the first paragraph of the chapter says it all:

The way LoginForm is built is not common at all in Vaadin components. I think (someone correct me if I’m wrong) that the main purpose is allow customizing the form
doing any client-side stuff. If you know GWT (which is easy) and want to do i18n on the client-side then you definitively should do it yourself (instead of customizing the getLoginHtml on the server side). On the other hand, If you just want to change a string or two, you might be better of just overriding getLoginHtml as in the example in the book.

The reason why LoginForm is based on HTML like this rather than GWT widgets is to enable form autocompletion in browsers. If that is not needed, you are probably better off composing your own login screen out of standard Vaadin components or implementing it in some other way.