click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Malcolm Edgar <malcolm.ed...@gmail.com>
Subject Re: Static menu methods
Date Thu, 04 Mar 2010 12:06:38 GMT
With regard to the Menu creation. I would like to see a builder
pattern used. I have used this in a work application and I am very
happy with the results. The builder class can also support alternative
caching options (CLK-405)

In terms of rolling this pattern into Click, I would suggest a 2 step strategy:
version 2.2  add org.apache.click.extras.builder.MenuBuilder class and
depreciate the static factory methods on the Menu class
version 2.3 or 2.4  remove the static factory methods on the Menu class

In terms of adding arbitrary properties to the Menu class (CLK-407),
we could dynamically load other properties (visible, enabled, etc.)
from Menu XML attributes.

regards Malcolm Edgar

On Thu, Mar 4, 2010 at 9:21 PM, Adrian A. <a.adrian.tech@gmail.com> wrote:
>
>> The static methods on Menu is proving quit problematic when extending
>> the Menu control. I suggest we don't add static methods but rather look
>> at other ways to building the Menu which also allows easy subclassing
>> for custom features.
>
> Hmm, there's no other easy/nice way IMHO, or a total refactoring of the Menu
> class would be required.
>
> The main problem is that the Menu is in fact a self referenced MenuItem.
>
> This causes allot of confusion among users, and IMHO it's why is so hard to
> extend too by users. It's also missing some user usable ID, since the path
> must not be unique (i.e. more menu items could point to the same path).
>
> Maybe a better way would be to have Menu and MenuItem classes (similar to
> Swing and other frameworks). This way there would be no need for static
> methods at all.
>
> Adrian.
>
>

Mime
View raw message