Thomas Singer <wicket <at> regnis.de> writes:

> Generally, I want to keep the text (including the links to other pages in 
> it) in the HTML files for now. My problem is the creation of these tags 
> without adding a separate component for each one:
> 
> <td align="center">
>    <img src="/graphics/feature-absent.gif" border="0" alt="-" width="9"
>         height="9">
> </td>
> 
> and
> 
> <td align="center">
>     <img src="/graphics/feature-present.gif" border="0" alt="+" width="9"
>          height="9">
> </td>

Put that code into a panel, eg, FeatureAvailability.html:

<wicket:panel>
<td align="center">
    <img wicket:id="img" src="/graphics/feature-present.gif" border="0" 
    alt="+" width="9" height="9">
</td>
</wicket:panel>

FeatureAvailability.java:

public class FeatureAvailability extends Panel {
        public FeatureAvailability(String id, IModel model) {
                super(id, model);
                boolean isPresent = ((Boolean) getModelObject()).booleanValue();
                WebMarkupContainer img = new WebMarkupContainer("img");
                img.add(new SimpleAttributeModifier("src", 
                    String.format("/graphics/feature-%s.gif",
                                new Object[] { 
                                isPresent ? "present" : "absent" })));
                img.add(new SimpleAttributeModifier("alt", 
                    isPresent ? "+" : "-"));
                add(img);
        }
}



-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to