You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Freddy Daoud <fd...@proinbox.com> on 2009/05/19 14:35:32 UTC

Menu selected class

Hi gang,

Apologies if this has already been addressed (my search on the archives did not 
bear fruit).

Any chance of having the Extras Menu control render a selected class by default 
on the menu for which isSelected() returns true? i.e.

a class="selected" ...

This would be nice because you could just iterate over the menus and render 
each with $menu, instead of having to write an if/else block and render the 
link "by hand" for the selected menu. Note that I don't mind the if/else block, 
but rather that there's no easy way to inherit the default rendering and just 
adding the "selected" class on the selected menu. (Correct me if I'm wrong.)

Thanks for your help!

Cheers,
Freddy



Re: Menu selected class

Posted by Freddy Daoud <fd...@proinbox.com>.
Hi Malcolm,

> That could be an enhancement, but the issue I have is that there are
> so many ways you could render a Menu: drop down list, accordion style,
> I don't think the control can deal with all the permutations. This is
> why I think a Velocity macros are good for this stuff.

I absolutely agree, the control cannot and should not try to deal with
all the possibilities.

But I was referring to the default rendering of Menu (i.e. toString())
which renders itself as a simple anchor link. When you are happy with
that default, I don't think it would be out of scope to add class="selected"
on the selected item. When you are rendering menus in a different way,
you are not using the toString() method of Menu anyway, so you can still
use whichever representation that suits you.

What do you think?

Thanks,
Freddy



Re: Menu selected class

Posted by Malcolm Edgar <ma...@gmail.com>.
That could be an enhancement, but the issue I have is that there are
so many ways you could render a Menu: drop down list, accordion style,
I don't think the control can deal with all the permutations. This is
why I think a Velocity macros are good for this stuff.

Another question which springs to mind is with hierarchical menu,
should the top level menu item also be selected, i.e. render
class="selected", as well as the selected child element?

regards Malcolm Edgar

On Tue, May 19, 2009 at 10:35 PM, Freddy Daoud <fd...@proinbox.com> wrote:
> Hi gang,
>
> Apologies if this has already been addressed (my search on the archives did not
> bear fruit).
>
> Any chance of having the Extras Menu control render a selected class by default
> on the menu for which isSelected() returns true? i.e.
>
> a class="selected" ...
>
> This would be nice because you could just iterate over the menus and render
> each with $menu, instead of having to write an if/else block and render the
> link "by hand" for the selected menu. Note that I don't mind the if/else block,
> but rather that there's no easy way to inherit the default rendering and just
> adding the "selected" class on the selected menu. (Correct me if I'm wrong.)
>
> Thanks for your help!
>
> Cheers,
> Freddy
>
>
>

Re: Menu selected class

Posted by Frederic Daoud <fd...@proinbox.com>.
> OK guys, sounds fare.  Freddy do you want to raise a JIRA request.

The issue is here:
https://issues.apache.org/jira/browse/CLK-551

> Should the parent menu item also be selected?

I think so, yes.

Thanks very much for your help!

Freddy

Re: Menu selected class

Posted by Malcolm Edgar <ma...@gmail.com>.
OK guys, sounds fare.  Freddy do you want to raise a JIRA request.

Should the parent menu item also be selected?

regards Malcolm Edgar

On Wed, May 20, 2009 at 2:42 AM, Freddy Daoud <fd...@proinbox.com> wrote:
> Hi Bob,
>
>> Adding "selected" should be useful or the Menu could be enhanced to
>> render its attribute Map to the buffer. That way a subclass should be
>> able to manipulate the attributes e.g. set the necessary CSS classes.
>
> I agree, either way it would make it easier to use the default and
> highlight the currently selected menu.
>
>> You could also nab the Menu[1] available at the ClickClick project[2]
>> which can render a menu hierarchy (vertical or horizontal) of 4 levels
>> deep using only CSS (and a little JS for IE6).
>
> I wasn't aware of the ClickClick project.
> Thanks for the tip!
>
> Freddy
>
>
>

Re: Menu selected class

Posted by Freddy Daoud <fd...@proinbox.com>.
Hi Bob,

> Adding "selected" should be useful or the Menu could be enhanced to 
> render its attribute Map to the buffer. That way a subclass should be 
> able to manipulate the attributes e.g. set the necessary CSS classes.

I agree, either way it would make it easier to use the default and
highlight the currently selected menu.

> You could also nab the Menu[1] available at the ClickClick project[2] 
> which can render a menu hierarchy (vertical or horizontal) of 4 levels 
> deep using only CSS (and a little JS for IE6).

I wasn't aware of the ClickClick project.
Thanks for the tip!

Freddy



Re: Menu selected class

Posted by Bob Schellink <sa...@gmail.com>.
Hi Freddy,

Adding "selected" should be useful or the Menu could be enhanced to 
render its attribute Map to the buffer. That way a subclass should be 
able to manipulate the attributes e.g. set the necessary CSS classes.

You could also nab the Menu[1] available at the ClickClick project[2] 
which can render a menu hierarchy (vertical or horizontal) of 4 levels 
deep using only CSS (and a little JS for IE6).

A screenshot of the menu is available on the project homepage.

kind regards

bob

[1]: 
http://code.google.com/p/clickclick/source/browse/#svn/trunk/clickclick/core/src/net/sf/clickclick/control/menu
[2]: http://code.google.com/p/clickclick/



Freddy Daoud wrote:
> Hi gang,
> 
> Apologies if this has already been addressed (my search on the archives did not 
> bear fruit).
> 
> Any chance of having the Extras Menu control render a selected class by default 
> on the menu for which isSelected() returns true? i.e.
> 
> a class="selected" ...
> 
> This would be nice because you could just iterate over the menus and render 
> each with $menu, instead of having to write an if/else block and render the 
> link "by hand" for the selected menu. Note that I don't mind the if/else block, 
> but rather that there's no easy way to inherit the default rendering and just 
> adding the "selected" class on the selected menu. (Correct me if I'm wrong.)
> 
> Thanks for your help!
> 
> Cheers,
> Freddy
> 
> 
>