I didn't think have a seperate component just for being an anchor was
the best idea. Setting an anchor works only if you have the component
and that component is rendered on the same page. Which should be a
pretty common use case. Furthermore, if you don't provide an anchor
component, it checks if you set one in your markup (like <a
href="#someAnchor"). That works for static anchors, which are not
necesarily coupled to wicket components. If what you want doesn't fall
into one of these categories, you can either
* override getURL and append the anchor, or
* override appendAnchor (since 1.2.1) which has the advantage of
passing in the ComponentTag that the link is coupled to, and providing
the url that was constructed so far.

This should be enough to cover any use case you have. In your case,
you might even implement your original proposal yourself; set your
custom component as an anchor, and do what you want with your custom
implementation of appendAnchor.


Eelco


On 6/29/06, Crash_neo <[EMAIL PROTECTED]> wrote:
>
> Eelco,
>
> I do have a question. Does this implementation not limit me to
> components(anchors) on the current page/panel only?
>
> How would I use this component based anchor in the following use case?
>
> Say I have 2 pages.
> page1 contains a list of recently added comments on blog posts. (some
> global overview page)
> page2 is the post with it's comments.
> I wanted to use a Link to go to page 2 (the 'post') and directly jump to
> the correct comment (not per say the last on the page).
> In my implementation, I would use a bookmarkablepageLink (on page1)
> going to page2.class with the post_id as pageparameter and set the
> comment_id as the anchor.
>
> However I don't think that this is possible with the current implementation.
>
> thijs
>
>
> Eelco Hillenius wrote:
> > Anchor functionality is in now. Works with Links, not with Buttons,
> > and I added an example for anchor functionality to the LinkOMatic
> > example of wicket-examples.
> >
> > In short, you can either set a component that should act as the anchor
> > to jump to on the Link using Link.setAnchor (and that anchor component
> > should either have outputMarkupId == true, or should be attached to a
> > <a tag with an href attribute that starts with # and is more than one
> > char long) or you can provide a #xx value in the href attribute of
> > links yourself. If you provide your own  implementation of
> > Link.getUrl, and append an anchor in that method, this new
> > functionality will not alter the url in any way.
> >
> > Have fun with it.
> >
> > Eelco
> >
> >
> >
>
>
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-develop mailing list
> Wicket-develop@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
>

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to