You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2012/02/23 16:14:29 UTC
ListChoice weird way to set default max rows
Hi,
ListChoice component uses a strange way to set/get the default max
rows via "protected static" methods.
What is the design choice here ?
This default value is used if the user didn't provide the value
explicitly as a constructor parameter.
By using 'protected' method to set a new value the user is obliged to
extend this class, but then why not pass his value to the super
constructor directly ?
By being 'protected' the user's impl can reach this method also if it
is in the same package 'o.a.w.***'. But I doubt anyone would go this
way either.
And the default value is 'static' which is yet another strange design
decision which other Wicket form components do not provide.
The code is there since 2005 so I guess it is a legacy which should be removed.
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
Re: ListChoice weird way to set default max rows
Posted by Igor Vaynberg <ig...@gmail.com>.
imho the entire component can be removed. all that code just to set
the size which can easily be done with an anon subclass.
the size attribute is usually static anyways and comes from markup...
-igor
On Thu, Feb 23, 2012 at 7:14 AM, Martin Grigorov <mg...@apache.org> wrote:
> Hi,
>
> ListChoice component uses a strange way to set/get the default max
> rows via "protected static" methods.
> What is the design choice here ?
>
> This default value is used if the user didn't provide the value
> explicitly as a constructor parameter.
> By using 'protected' method to set a new value the user is obliged to
> extend this class, but then why not pass his value to the super
> constructor directly ?
> By being 'protected' the user's impl can reach this method also if it
> is in the same package 'o.a.w.***'. But I doubt anyone would go this
> way either.
> And the default value is 'static' which is yet another strange design
> decision which other Wicket form components do not provide.
>
> The code is there since 2005 so I guess it is a legacy which should be removed.
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com