My 2 cents:
The pattern for adding child elements seems a little surprising to me.
I'm used to seeing builder methods always return an object to "keep the
building going". But with this, startOption() (for example) jumps on a
tangent, building something else -- with no way to return to building
the original element.
So I'd have to do this to build a select element with two options:
HtmlBuilderFactory fact = HtmlBuilderFactory.get();
SelectElementBuilder selectBuilder =
fact.createSelectElementBuilder().setSomeAttributesForSelect(...);
// option #1
selectBuilder.startOption().setSomeAttributesForOption(...);
// option #2
selectBuilder.startOption().setSomeAttributesForOption(...);
// build the element
return selectBuilder.end();
But I think something like this is what I'd expect (more intuitive,
imo):
HtmlBuilderFactory fact = HtmlBuilderFactory.get();
// create select w/ two options
return fact.createSelectElementBuilder()
.setSomeAttributesForSelect(...)
.addOption(fact.createOptionElementBuilder()
.setSomeAttributesForOption(...)
.end())
.addOption(fact.createOptionElementBuilder()
.setSomeAttributesForOption(...)
.end())
.end();
http://gwt-code-reviews.appspot.com/1455802/
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors