You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gaetan Zoritchak <g....@moncoachfinance.com> on 2012/05/15 19:09:08 UTC
Bookmarkablepagelink with anchor
Hi all,
I wanted to make a link on a Bookmarkablepage with an anchor. I didn't find
how to do it. The link has a setAnchor(Component) method but it can't be
that because the targeted anchor does not exist yet.
My hope was that the method would take a String as parameter:
myLink.setAnchor("#8765");
What is the best way of doing it under wicket 1.5.x?
Thanks,
Re: Bookmarkablepagelink with anchor
Posted by Gaetan Zoritchak <g....@moncoachfinance.com>.
Thanks for the tip. It was simple... I must be very tired.
Regards,
Gaetan,
2012/5/15 Alexander Cherednichenko <le...@gmail.com>
> Hi!
>
> For this case we have subclassed protected CharSequence getURL() which is
> in BookmarkablePageLink. And - we just append anchor to it while passing it
> in the constructor or even model to the BookmarkablePageLink.
>
> In the override we call super.getURL() and then append an anchor.
>
> I see pretty much the same logic in some inner class of AutoLinkResolver --
> so we are on the right way :)
>
> Regards,
> Alex.
>
>
> 2012/5/15 Gaetan Zoritchak <g....@moncoachfinance.com>
>
> > Hi all,
> >
> > I wanted to make a link on a Bookmarkablepage with an anchor. I didn't
> find
> > how to do it. The link has a setAnchor(Component) method but it can't be
> > that because the targeted anchor does not exist yet.
> >
> > My hope was that the method would take a String as parameter:
> >
> > myLink.setAnchor("#8765");
> >
> > What is the best way of doing it under wicket 1.5.x?
> >
> > Thanks,
> >
>
>
>
> --
> Alexander Cherednichenko
>
> [ the only way out is the way up ]
>
Re: Bookmarkablepagelink with anchor
Posted by Alexander Cherednichenko <le...@gmail.com>.
Hi!
For this case we have subclassed protected CharSequence getURL() which is
in BookmarkablePageLink. And - we just append anchor to it while passing it
in the constructor or even model to the BookmarkablePageLink.
In the override we call super.getURL() and then append an anchor.
I see pretty much the same logic in some inner class of AutoLinkResolver --
so we are on the right way :)
Regards,
Alex.
2012/5/15 Gaetan Zoritchak <g....@moncoachfinance.com>
> Hi all,
>
> I wanted to make a link on a Bookmarkablepage with an anchor. I didn't find
> how to do it. The link has a setAnchor(Component) method but it can't be
> that because the targeted anchor does not exist yet.
>
> My hope was that the method would take a String as parameter:
>
> myLink.setAnchor("#8765");
>
> What is the best way of doing it under wicket 1.5.x?
>
> Thanks,
>
--
Alexander Cherednichenko
[ the only way out is the way up ]