This is a topic I wanted to raise for 2.2 is introducing a
builder/factory capability in Click. We have used this in projects
and it greatly number of lines of code.
Personally I think this is a better approach than method chaining. I
will u pload some builder/factory patterns later today.
regards Malcolm Edgar
On Fri, Jun 26, 2009 at 2:07 PM, florin.g<florin@bytenotes.com> wrote:
>
> I'm a fan
>
>
>
> sabob wrote:
>>
>> Its been suggested before to add method chaining to Click controls.
>>
>> With Java5 support of Covariant return types, I'd like to revisit this
>> feature. It would allow us to write the following:
>>
>> form.add(new TextField("name").required(true).width("200px"));
>>
>> instead of:
>>
>> TextField field = new TextField("name");
>> field.setRequired(true);
>> field.setWidth("200px");
>> form.add(field);
>>
>>
>> I think Field and Column would get the most benefit from such a change.
>>
>> Couple of issues are API bloat, which is why I'd like to limit this to
>> only a couple of controls. The other issue is NPE but that shouldn't
>> be a problem because a reference to the Control instance is always
>> returned.
>>
>> Thoughts?
>>
>> bob
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/Method-chaining-revisited-tp3156429p3159580.html
> Sent from the click-development mailing list archive at Nabble.com.
>
>
|