I'm trying to write a new DynamicImageMap class that basically does what ImageMap does, but it allows you to "link" it to any Image object. It would be set up using a <map> element, not an <img> element.
So, for each "area" within the image map, I need to generate its href attribute. The ImageMap class allows you to add Link objects to it using various helper methods. Then, when ImageMap renders itself, it renders the <area> elements dynamically by asking each of the Link objects for their URL, by calling getURL(). So, the question is, is there a line of code that I can use instead of the call to getURL() to the an appropriate URL for each Link in my image map? On Fri, Oct 24, 2008 at 3:27 PM, Jeremy Thomerson <[EMAIL PROTECTED]> wrote: > Instead of creating a link, try: > > RequestCycle.get().urlFor(null, YourBookmarkablePageClass.class, > yourPageParametersIfAny); > > That's what BookmarkablePageLink does. > > -- > Jeremy Thomerson > http://www.wickettraining.com > > On Fri, Oct 24, 2008 at 2:09 PM, James Carman <[EMAIL PROTECTED]>wrote: > >> Ok, so how do I get the same thing that getURL() returns for a >> BookmarkablePageLink? I need a line of code that gives me the proper >> URL to set on my area. >> >> I've tried RequestCycle.get().urlFor(link, ILinkListener.INTERFACE) >> >> >> On Fri, Oct 24, 2008 at 2:46 PM, Igor Vaynberg <[EMAIL PROTECTED]> >> wrote: >> > really? >> > >> > Link >> > protected CharSequence getURL() >> > { >> > return urlFor(ILinkListener.INTERFACE); >> > } >> > >> > BookmarkablePageLink >> > @Override >> > protected CharSequence getURL() >> > { >> > PageParameters parameters = getPageParameters(); >> > >> > if (getPopupSettings() != null) >> > { >> > return urlFor(getPopupSettings().getPageMap(this), >> getPageClass(), >> > parameters); >> > } >> > else >> > { >> > return urlFor(getPageMap(), getPageClass(), >> parameters); >> > } >> > } >> > >> > >> > >> > i dont see any special logic >> > >> > -igor >> > >> > On Fri, Oct 24, 2008 at 11:43 AM, James Carman >> > <[EMAIL PROTECTED]> wrote: >> >> But, there is logic in the getURL() methods on Link and >> >> BookmarkablePageLink that does some special logic. So, it's not as >> >> simple as calling urlFor() to get the appropriate url. >> >> >> >> On Fri, Oct 24, 2008 at 2:42 PM, Igor Vaynberg <[EMAIL PROTECTED]> >> wrote: >> >>> as far as i can see bookmarkablepagelink extends link, so you can use >> >>> it with the existing imagemap.... >> >>> >> >>> >> >>> links do not do anything special in wicket as far as url generation >> >>> goes, that is all neatly packaged in various requestcycle.urlfor >> >>> methods with some convinience urlfor methods on the component itself. >> >>> >> >>> -igor >> >>> >> >>> On Fri, Oct 24, 2008 at 11:37 AM, James Carman >> >>> <[EMAIL PROTECTED]> wrote: >> >>>> I'm not talking about a callback URL, necessarily. What about a >> >>>> bookmarkable page link? How would you rewrite ImageMap? >> >>>> >> >>>> On Fri, Oct 24, 2008 at 12:23 PM, Igor Vaynberg < >> [EMAIL PROTECTED]> wrote: >> >>>>> gah, sent too early... >> >>>>> >> >>>>> class dynimagemap extends webcomponent implements ILinkListener { >> >>>>> protected String urlfor(areaid) { >> >>>>> return urlfor(ILinkListener.INTERFACE)+"&areaid="+areaid; >> >>>>> } >> >>>>> >> >>>>> protected abstract void onClick(int areaid); >> >>>>> >> >>>>> public final onClick() { >> onClick(getrequest().getparameter("areaid")); } >> >>>>> } >> >>>>> >> >>>>> >> >>>>> see, in wicket url generation is completely open so you dont need to >> >>>>> create a Link just to get to a callback url. >> >>>>> >> >>>>> -igor >> >>>>> >> >>>>> On Fri, Oct 24, 2008 at 9:21 AM, Igor Vaynberg < >> [EMAIL PROTECTED]> wrote: >> >>>>>> using links for that stuff is a waste. you should generate the url >> >>>>>> yourself. something like this: >> >>>>>> >> >>>>>> class dynimagemap extends webcomponent implements ILinkListener { >> >>>>>> >> >>>>>> protected String urlfor(areaid) { >> >>>>>> return urlfor(ILinkListener.INTERFACE)+"&areaid="+areaid; >> >>>>>> } >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>>> public final onClick() { >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>>> On Fri, Oct 24, 2008 at 8:38 AM, James Carman >> >>>>>> <[EMAIL PROTECTED]> wrote: >> >>>>>>> I'm trying to write my own DynamicImageMap component. However, the >> >>>>>>> way the current ImageMap component works is that it uses >> Link.getURL() >> >>>>>>> to generate the <area> elements. That method is protected >> (ImageMap >> >>>>>>> is in the same package as Link, so it can see it). Is there any >> way >> >>>>>>> we can open this up a bit? >> >>>>>>> >> >>>>>> >> >>>>> >> >>>> >> >>> >> >> >> > >> >
