Hey, thanks a lot Thijs! I'll give this a shot.
-----Original Message-----
From: Thijs [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2008 1:38 PM
To: [email protected]
Subject: Re: Anchors in Wicket?
This is a bookmarkable link (the only place I use it with) but you get
the idea :)
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.model.IModel;
public class AnchoredBookmarkablePageLink extends BookmarkablePageLink {
private static final long serialVersionUID = 1L;
private IModel stringAnchor;
public AnchoredBookmarkablePageLink(String id, Class pageClass, IModel
anchor) {
super(id, pageClass);
this.stringAnchor = anchor;
}
public AnchoredBookmarkablePageLink(String id, Class pageClass,
PageParameters params, IModel anchor) {
super(id, pageClass, params);
this.stringAnchor = anchor;
}
@Override
protected CharSequence appendAnchor(ComponentTag tag, CharSequence url) {
url = url + "#" + stringAnchor.getObject().toString();
return url;
}
}
Thijs
Michael Mehrle wrote:
> Mind sharing that? ;-)
>
> -----Original Message-----
> From: Thijs [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 10, 2008 11:23 PM
> To: [email protected]
> Subject: Re: Anchors in Wicket?
>
> The component is any wicket component in the same page or next page if
> you know that component.
>
> What you are doing, an anchor in a different page, I've solved by
> writing my own subclass of link where I append the '#rsvp' myself.
>
> Michael Mehrle schreef:
>> I don't get it - what is the 'component' in the setAnchor() method? If
> I
>> set an anchor in a completely different page like this:
>>
>> <a href="#rsvp" />
>>
>> What do I set as the 'component' in the link's setAnchor?
>>
>> Thanks,
>>
>> Michael
>>
>> -----Original Message-----
>> From: Thijs Vonk [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, June 10, 2008 12:39 PM
>> To: [email protected]
>> Subject: Re: Anchors in Wicket?
>>
>> Michael Mehrle wrote:
>>
>>> How do create a link that jumps to some anchor in a page? Is there a
>>>
>> way
>>
>>> to define this in Wicket or do I have to do this manually somehow?
>>>
>>>
>>>
>>> Michael
>>>
>>>
>>>
>>>
>> yes. use link.setAnchor(Component)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]