RE: Anchors in Wicket?
I created an Link to another page's anchor similar to the code shown below. The anchor actually gets tagged on to the bookmarkable URL. However, for some reason the browser does not jump to my anchor. Not sure what's going on - is there a particular way I have to create an anchor in Wicket so that the URL causes the browser to scroll further down in the page? Thanks, Michael -Original Message- From: Thijs [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2008 1:38 PM To: users@wicket.apache.org 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: users@wicket.apache.org > 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: >> >> >> >> 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: users@wicket.apache.org >> 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]
RE: Anchors in Wicket?
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: users@wicket.apache.org 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: users@wicket.apache.org > 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: >> >> >> >> 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: users@wicket.apache.org >> 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]
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: users@wicket.apache.org 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: 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: users@wicket.apache.org 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]
RE: Anchors in Wicket?
Mind sharing that? ;-) -Original Message- From: Thijs [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2008 11:23 PM To: users@wicket.apache.org 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: > > > > 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: users@wicket.apache.org > 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]
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: 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: users@wicket.apache.org 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]
RE: Anchors in Wicket?
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: 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: users@wicket.apache.org 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]
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]