On 7/3/07, Erik Dreyer <[EMAIL PROTECTED]> wrote:

I'm trying to create a link component that will produce output similar to
the following:

<a href="link/to/somewhere"><img src="imgA" onmousedown="this.src='imgB';"
onmouseup=" this.src='imgA';"></a>

where:
1) The link handler (onClick) is defined by users of the component
2) The two images are provided in the component constructor
    for example, ImageLink link = new ImageLink("id", "path/to/imageA",
"path/to/imageB");

The idea is that anytime I want to create an image link, I can just drop
that in with the paths to the image(s) I want to use.

I've got working code for the image:

        StaticImage image = new StaticImage("image", new
Model(imageOffPath));
        if (StringUtils.isNotBlank(imageOnPath)) {
            image.add(new AttributeModifier("onmousedown", true, new
Model("this.src='"+imageOnPath+"'")));
            image.add (new AttributeModifier("onmouseup", true, new
Model("this.src='"+imageOffPath+"'")));
        }

But I'm having trouble figuring out the rest of it.
I started by extending Panel, but that doesn't work due to Panels
requiring their own markup.
I tried extending Link, but I'm not sure how to get it to render the image
above without creating a markup file.

Any assistance is greatly appreciated.


i would make a panel and forward link's onclick to the panel's onclick. the
panels markup would look like this:
<wicket:panel><a wicket:id="link"><img wicke:id="img"/></a></wicket:panel>

-igor






Thanks,
Erik

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to