You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matthias Keller <ma...@ergon.ch> on 2009/07/22 16:05:27 UTC

Generic Navigation Panel

Hi

I'm creating a new website with wicket which should have a normal 
navigation bar. I'd like to be able to detect whether a link points to 
the current page to give the surrounding <div> a special class.
For example on page1:
<div class="activeLink">
    <a href="page1">page1</a>
</div>
<div>
    <a href="page2">page2</a>
</div>

I thought about autolinking which does that automatically, except it 
adds very ugly <span><em> tags. I also don't want to change this 
globally just to have a nicer navigation autolinking going. In addition 
this would be tricky as I need the <div>s around the links, but with 
different CSS classes.

I'm thinking about creating a panel (representing the <div> with the 
link) which then adds the link and which has to be created by giving the 
current page via the constructor in order for it to find out if the link 
represents the current page. But this seems to be very complicated so I 
think there must be a more elegant solution for that, as this 
requirement surely isn't anything new....?!

Thanks for your hints

Matt

-- 
matthias.keller@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
______________________________________________________________
e r g o n    smart people - smart software



Re: Generic Navigation Panel

Posted by Igor Vaynberg <ig...@gmail.com>.
cant you use PagingNavigator?

-igor

On Wed, Jul 22, 2009 at 7:05 AM, Matthias
Keller<ma...@ergon.ch> wrote:
> Hi
>
> I'm creating a new website with wicket which should have a normal navigation
> bar. I'd like to be able to detect whether a link points to the current page
> to give the surrounding <div> a special class.
> For example on page1:
> <div class="activeLink">
>   <a href="page1">page1</a>
> </div>
> <div>
>   <a href="page2">page2</a>
> </div>
>
> I thought about autolinking which does that automatically, except it adds
> very ugly <span><em> tags. I also don't want to change this globally just to
> have a nicer navigation autolinking going. In addition this would be tricky
> as I need the <div>s around the links, but with different CSS classes.
>
> I'm thinking about creating a panel (representing the <div> with the link)
> which then adds the link and which has to be created by giving the current
> page via the constructor in order for it to find out if the link represents
> the current page. But this seems to be very complicated so I think there
> must be a more elegant solution for that, as this requirement surely isn't
> anything new....?!
>
> Thanks for your hints
>
> Matt
>
> --
> matthias.keller@ergon.ch  +41 44 268 83 98
> Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
> http://www.ergon.ch
> ______________________________________________________________
> e r g o n    smart people - smart software
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Generic Navigation Panel

Posted by John Armstrong <si...@siberian.org>.
Good info, thanks Igor, I'll check it out.
J

On Wed, Jul 22, 2009 at 10:27 AM, Igor Vaynberg<ig...@gmail.com> wrote:
> it is on component level. abstractlink has those methods i believe.
>
> -igor
>
> On Wed, Jul 22, 2009 at 10:16 AM, John Armstrong<si...@siberian.org> wrote:
>> Any plans to move this down to the Component level? I've had
>> situations where I needed to override this at the page level and even
>> within a panel within a page..
>>
>> John-
>>
>> On Wed, Jul 22, 2009 at 7:14 AM, Iain
>> Reddick<ia...@beatsystems.com> wrote:
>>> You can actually configure the tags that are put around a disabled link at
>>> application level, like this:
>>>
>>> getMarkupSettings().setDefaultBeforeDisabledLink( "" );
>>> getMarkupSettings().setDefaultAfterDisabledLink( "" );
>>>
>>> This would give <span>*linktext*</span> for disabled lnks (such as an
>>> autolink to the current page).
>>>
>>> Matthias Keller wrote:
>>>>
>>>> Hi
>>>>
>>>> I'm creating a new website with wicket which should have a normal
>>>> navigation bar. I'd like to be able to detect whether a link points to the
>>>> current page to give the surrounding <div> a special class.
>>>> For example on page1:
>>>> <div class="activeLink">
>>>>   <a href="page1">page1</a>
>>>> </div>
>>>> <div>
>>>>   <a href="page2">page2</a>
>>>> </div>
>>>>
>>>> I thought about autolinking which does that automatically, except it adds
>>>> very ugly <span><em> tags. I also don't want to change this globally just to
>>>> have a nicer navigation autolinking going. In addition this would be tricky
>>>> as I need the <div>s around the links, but with different CSS classes.
>>>>
>>>> I'm thinking about creating a panel (representing the <div> with the link)
>>>> which then adds the link and which has to be created by giving the current
>>>> page via the constructor in order for it to find out if the link represents
>>>> the current page. But this seems to be very complicated so I think there
>>>> must be a more elegant solution for that, as this requirement surely isn't
>>>> anything new....?!
>>>>
>>>> Thanks for your hints
>>>>
>>>> Matt
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Generic Navigation Panel

Posted by Igor Vaynberg <ig...@gmail.com>.
it is on component level. abstractlink has those methods i believe.

-igor

On Wed, Jul 22, 2009 at 10:16 AM, John Armstrong<si...@siberian.org> wrote:
> Any plans to move this down to the Component level? I've had
> situations where I needed to override this at the page level and even
> within a panel within a page..
>
> John-
>
> On Wed, Jul 22, 2009 at 7:14 AM, Iain
> Reddick<ia...@beatsystems.com> wrote:
>> You can actually configure the tags that are put around a disabled link at
>> application level, like this:
>>
>> getMarkupSettings().setDefaultBeforeDisabledLink( "" );
>> getMarkupSettings().setDefaultAfterDisabledLink( "" );
>>
>> This would give <span>*linktext*</span> for disabled lnks (such as an
>> autolink to the current page).
>>
>> Matthias Keller wrote:
>>>
>>> Hi
>>>
>>> I'm creating a new website with wicket which should have a normal
>>> navigation bar. I'd like to be able to detect whether a link points to the
>>> current page to give the surrounding <div> a special class.
>>> For example on page1:
>>> <div class="activeLink">
>>>   <a href="page1">page1</a>
>>> </div>
>>> <div>
>>>   <a href="page2">page2</a>
>>> </div>
>>>
>>> I thought about autolinking which does that automatically, except it adds
>>> very ugly <span><em> tags. I also don't want to change this globally just to
>>> have a nicer navigation autolinking going. In addition this would be tricky
>>> as I need the <div>s around the links, but with different CSS classes.
>>>
>>> I'm thinking about creating a panel (representing the <div> with the link)
>>> which then adds the link and which has to be created by giving the current
>>> page via the constructor in order for it to find out if the link represents
>>> the current page. But this seems to be very complicated so I think there
>>> must be a more elegant solution for that, as this requirement surely isn't
>>> anything new....?!
>>>
>>> Thanks for your hints
>>>
>>> Matt
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Generic Navigation Panel

Posted by John Armstrong <si...@siberian.org>.
Any plans to move this down to the Component level? I've had
situations where I needed to override this at the page level and even
within a panel within a page..

John-

On Wed, Jul 22, 2009 at 7:14 AM, Iain
Reddick<ia...@beatsystems.com> wrote:
> You can actually configure the tags that are put around a disabled link at
> application level, like this:
>
> getMarkupSettings().setDefaultBeforeDisabledLink( "" );
> getMarkupSettings().setDefaultAfterDisabledLink( "" );
>
> This would give <span>*linktext*</span> for disabled lnks (such as an
> autolink to the current page).
>
> Matthias Keller wrote:
>>
>> Hi
>>
>> I'm creating a new website with wicket which should have a normal
>> navigation bar. I'd like to be able to detect whether a link points to the
>> current page to give the surrounding <div> a special class.
>> For example on page1:
>> <div class="activeLink">
>>   <a href="page1">page1</a>
>> </div>
>> <div>
>>   <a href="page2">page2</a>
>> </div>
>>
>> I thought about autolinking which does that automatically, except it adds
>> very ugly <span><em> tags. I also don't want to change this globally just to
>> have a nicer navigation autolinking going. In addition this would be tricky
>> as I need the <div>s around the links, but with different CSS classes.
>>
>> I'm thinking about creating a panel (representing the <div> with the link)
>> which then adds the link and which has to be created by giving the current
>> page via the constructor in order for it to find out if the link represents
>> the current page. But this seems to be very complicated so I think there
>> must be a more elegant solution for that, as this requirement surely isn't
>> anything new....?!
>>
>> Thanks for your hints
>>
>> Matt
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Generic Navigation Panel

Posted by Iain Reddick <ia...@beatsystems.com>.
You can actually configure the tags that are put around a disabled link 
at application level, like this:

getMarkupSettings().setDefaultBeforeDisabledLink( "" );
getMarkupSettings().setDefaultAfterDisabledLink( "" );

This would give <span>*linktext*</span> for disabled lnks (such as an 
autolink to the current page).

Matthias Keller wrote:
> Hi
>
> I'm creating a new website with wicket which should have a normal 
> navigation bar. I'd like to be able to detect whether a link points to 
> the current page to give the surrounding <div> a special class.
> For example on page1:
> <div class="activeLink">
>    <a href="page1">page1</a>
> </div>
> <div>
>    <a href="page2">page2</a>
> </div>
>
> I thought about autolinking which does that automatically, except it 
> adds very ugly <span><em> tags. I also don't want to change this 
> globally just to have a nicer navigation autolinking going. In 
> addition this would be tricky as I need the <div>s around the links, 
> but with different CSS classes.
>
> I'm thinking about creating a panel (representing the <div> with the 
> link) which then adds the link and which has to be created by giving 
> the current page via the constructor in order for it to find out if 
> the link represents the current page. But this seems to be very 
> complicated so I think there must be a more elegant solution for that, 
> as this requirement surely isn't anything new....?!
>
> Thanks for your hints
>
> Matt
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org