so what you want is to have an <img tag that has an actual path. Image component is made more for working with resources. what you want can be accomplished like this:

instead of using the Image component add a WebMarkupContainer - this is a generic component.
then to setup the path add an attribute modifier to the webmarkupcontainer that will alter the src attribute to the right value.

WebMarkupContainer img=new WebMarkupContainer("statusIcon");
if (status.....) {
   img.add(new SimpleAttributeModifier("src", "images/icon.gif"));


-Igor



On 2/11/06, VGJ <[EMAIL PROTECTED]> wrote:
I've got a case where I need to display an image dynamically based on
a test in a row of data.  I'm experimenting w/ the Image class but am
at a loss as to what to do next and cannot find any example code or
documentation.

Here's a snippet where I'm adding the Image based on a condition:

                                //determine status icon label
                                if (employee.getStatus().equals("in"))
                                        item.add(new Image("statusIcon", "icon_in_office.gif"));
                                else if (employee.getStatus().equals("lunch"))
                                        item.add(new Image("statusIcon", "icon_at_lunch.gif"));
                                else
                                        item.add(new Image("statusIcon", "icon_out_office.gif"));

Here's my HTML tag:

<img wicket:id="statusIcon" />

It replaces the image tag w/ this url, which is incorrect:

/resources/com.portlets.ui.CheckIn/icon_out_office.gif

So...I see a broken image.  Since the images weren't on the classpath
I put them in the same directory as the wicket source files so they
*would* be...

??

Will I also need to add my webroot's image directory ( e.g.
/assets/images/) to the classpath, put the images back in there...and
then point to the filename like I did in my Java snippet above?

Thanks!


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to