click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <sab...@gmail.com>
Subject Method chaining revisited
Date Thu, 25 Jun 2009 17:19:35 GMT
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

Mime
View raw message