Anchor and Link between different Wicket Pages
Hi Folks, I don't really unterstand how to do it. I have two Wicket Pages: Page1 and Page2 On the Page1 I define the Label, wich will be contain the anchor id. So now I want to define a link on the Page1, wich will get setResponsePage(Page1) but I also want that the user will be forwarded to the anchor on the Page1! What I don't understand ist how to do it in a right way :)? hot to set link.setAnchor(anchorComponentFromThePage1)??? Thank You!
Re: Anchor and Link between different Wicket Pages
Hi, Case 1) both the link and the anchor are in the same page (Page1) To be able to use Link#setAnchor(Component) you need to use a Label component for the anchor and pass it to link: link.setAnchor(label) Case 2) the link is in Page1 and the anchor in is Page2 Use a BookmarkablePageLink and override its #getURL() method and just append '#anchor' to the returned url from super.getURL(); On Wed, Sep 26, 2012 at 11:18 AM, Dmitriy Neretin dmitriy.nere...@googlemail.com wrote: Hi Folks, I don't really unterstand how to do it. I have two Wicket Pages: Page1 and Page2 On the Page1 I define the Label, wich will be contain the anchor id. So now I want to define a link on the Page1, wich will get setResponsePage(Page1) but I also want that the user will be forwarded to the anchor on the Page1! What I don't understand ist how to do it in a right way :)? hot to set link.setAnchor(anchorComponentFromThePage1)??? Thank You! -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Anchor and Link between different Wicket Pages
Thank You! Well I have the second case. What I don't really understand is how to get the '#anchor'? I defined on the Page1 an anchor (Wicket Label with markupid). On the Page2 I define the BookmarkablePageLink with overriden getURL Method where I return #anchor + super.getURL(). My problem is that I don't understand how to translate my anchor-label from the page1 into #anchor to append it to the CharSequence! Regards, Dmitriy 2012/9/26 Martin Grigorov mgrigo...@apache.org Hi, Case 1) both the link and the anchor are in the same page (Page1) To be able to use Link#setAnchor(Component) you need to use a Label component for the anchor and pass it to link: link.setAnchor(label) Case 2) the link is in Page1 and the anchor in is Page2 Use a BookmarkablePageLink and override its #getURL() method and just append '#anchor' to the returned url from super.getURL(); On Wed, Sep 26, 2012 at 11:18 AM, Dmitriy Neretin dmitriy.nere...@googlemail.com wrote: Hi Folks, I don't really unterstand how to do it. I have two Wicket Pages: Page1 and Page2 On the Page1 I define the Label, wich will be contain the anchor id. So now I want to define a link on the Page1, wich will get setResponsePage(Page1) but I also want that the user will be forwarded to the anchor on the Page1! What I don't understand ist how to do it in a right way :)? hot to set link.setAnchor(anchorComponentFromThePage1)??? Thank You! -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Anchor and Link between different Wicket Pages
On Wed, Sep 26, 2012 at 2:31 PM, Dmitriy Neretin dmitriy.nere...@googlemail.com wrote: Thank You! Well I have the second case. What I don't really understand is how to get the '#anchor'? I defined on the Page1 an anchor (Wicket Label with markupid). On the Page2 I define the BookmarkablePageLink with overriden getURL Method where I return #anchor + super.getURL(). This should be: super.getURL() + #anchor; The value of 'anchor' can be : 1) passed as request parameter to Page2 (setResponsePage(Page2.class, paramsWithTheAnchor) 2) passed as a pure object to Page2 (setResponsePage(new Page2(label.getMarkupId( 3) a predefined value in Page1.java: label.setMarkupId(Constants.ANCHOR_VALUE) in Page2: super.getURL() + # + Constants.ANCHOR_VALUE; My problem is that I don't understand how to translate my anchor-label from the page1 into #anchor to append it to the CharSequence! Regards, Dmitriy 2012/9/26 Martin Grigorov mgrigo...@apache.org Hi, Case 1) both the link and the anchor are in the same page (Page1) To be able to use Link#setAnchor(Component) you need to use a Label component for the anchor and pass it to link: link.setAnchor(label) Case 2) the link is in Page1 and the anchor in is Page2 Use a BookmarkablePageLink and override its #getURL() method and just append '#anchor' to the returned url from super.getURL(); On Wed, Sep 26, 2012 at 11:18 AM, Dmitriy Neretin dmitriy.nere...@googlemail.com wrote: Hi Folks, I don't really unterstand how to do it. I have two Wicket Pages: Page1 and Page2 On the Page1 I define the Label, wich will be contain the anchor id. So now I want to define a link on the Page1, wich will get setResponsePage(Page1) but I also want that the user will be forwarded to the anchor on the Page1! What I don't understand ist how to do it in a right way :)? hot to set link.setAnchor(anchorComponentFromThePage1)??? Thank You! -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Anchor and Link between different Wicket Pages
You know, you are a wicket god :) Thanks and have a nice day! 2012/9/26 Martin Grigorov mgrigo...@apache.org On Wed, Sep 26, 2012 at 2:31 PM, Dmitriy Neretin dmitriy.nere...@googlemail.com wrote: Thank You! Well I have the second case. What I don't really understand is how to get the '#anchor'? I defined on the Page1 an anchor (Wicket Label with markupid). On the Page2 I define the BookmarkablePageLink with overriden getURL Method where I return #anchor + super.getURL(). This should be: super.getURL() + #anchor; The value of 'anchor' can be : 1) passed as request parameter to Page2 (setResponsePage(Page2.class, paramsWithTheAnchor) 2) passed as a pure object to Page2 (setResponsePage(new Page2(label.getMarkupId( 3) a predefined value in Page1.java: label.setMarkupId(Constants.ANCHOR_VALUE) in Page2: super.getURL() + # + Constants.ANCHOR_VALUE; My problem is that I don't understand how to translate my anchor-label from the page1 into #anchor to append it to the CharSequence! Regards, Dmitriy 2012/9/26 Martin Grigorov mgrigo...@apache.org Hi, Case 1) both the link and the anchor are in the same page (Page1) To be able to use Link#setAnchor(Component) you need to use a Label component for the anchor and pass it to link: link.setAnchor(label) Case 2) the link is in Page1 and the anchor in is Page2 Use a BookmarkablePageLink and override its #getURL() method and just append '#anchor' to the returned url from super.getURL(); On Wed, Sep 26, 2012 at 11:18 AM, Dmitriy Neretin dmitriy.nere...@googlemail.com wrote: Hi Folks, I don't really unterstand how to do it. I have two Wicket Pages: Page1 and Page2 On the Page1 I define the Label, wich will be contain the anchor id. So now I want to define a link on the Page1, wich will get setResponsePage(Page1) but I also want that the user will be forwarded to the anchor on the Page1! What I don't understand ist how to do it in a right way :)? hot to set link.setAnchor(anchorComponentFromThePage1)??? Thank You! -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org