You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dmitriy Neretin <dm...@googlemail.com> on 2012/09/26 10:18:27 UTC

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

Posted by Dmitriy Neretin <dm...@googlemail.com>.
You know, you are a wicket god :) Thanks and have a nice day!

2012/9/26 Martin Grigorov <mg...@apache.org>

> On Wed, Sep 26, 2012 at 2:31 PM, Dmitriy Neretin
> <dm...@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 <mg...@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
> >> <dm...@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-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Anchor and Link between different Wicket Pages

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Sep 26, 2012 at 2:31 PM, Dmitriy Neretin
<dm...@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 <mg...@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
>> <dm...@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-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Anchor and Link between different Wicket Pages

Posted by Dmitriy Neretin <dm...@googlemail.com>.
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 <mg...@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
> <dm...@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Anchor and Link between different Wicket Pages

Posted by Martin Grigorov <mg...@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
<dm...@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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org