Hi,
I'm starting to learn wicket and thus far I like it very much. I have a newbie
questions.
say i have a list of items where each is colored differently, according to
order (zebra) or some model property ('priority'). in the examples this is
achieved by having one example item in the html and modifing its class property
in the java code according to logic. i don't like this approach sine it means a
very basic design feature (the class attribute) is handled in the java code. is
there a way for the html to contain an example item per possible variation and
have the java code pick the right one?
so instead of (this is from the displaytag examples)
<tbody>
<tr wicket:id="rows" class="even">
<td class="idcol"><span wicket:id="id">Test
ID</span></td>
<td><span wicket:id="name">Test Name</span></td>
<td><span wicket:id="email">Test
EMail</span></td>
<td class="tableCellError"><span wicket:id="status">Test
Status</span></td>
<td><span wicket:id="comments">Test
Comments</span></td>
</tr>
<wicket:remove>
<tr class="odd">
<td class="idcol">Test ID</td>
<td>Test Name</td>
<td>Test Email</td>
<td class="tableCellError">Test Status</td>
<td>Test Comments</td>
</tr>
</wicket:remove>
and
return new ListItem(index, getListItemModel(getModel(), index))
{
protected void onComponentTag(final ComponentTag tag)
{
// add/modify the attribute controlling the CSS style
tag.put("class", (getIndex() % 2) == 0 ? "even" : "odd");
// continue with default behaviour
super.onComponentTag(tag);
}
};
i'll have something like
<tbody>
<tr wicket:id="even-row" class="even">
<td class="idcol"><span wicket:id="id">Test
ID</span></td>
<td><span wicket:id="name">Test Name</span></td>
<td><span wicket:id="email">Test
EMail</span></td>
<td class="tableCellError"><span wicket:id="status">Test
Status</span></td>
<td><span wicket:id="comments">Test
Comments</span></td>
</tr>
<tr wicket:id="odd-row" class="odd">
<td class="idcol"><span wicket:id="id">Test
ID</span></td>
<td><span wicket:id="name">Test Name</span></td>
<td><span wicket:id="email">Test
EMail</span></td>
<td class="tableCellError"><span wicket:id="status">Test
Status</span></td>
<td><span wicket:id="comments">Test
Comments</span></td>
</tr>
</wicket:remove>
and the code will somehow decide to use the even-row or odd-row elements.
--
===================================
Ittay Dror ([EMAIL PROTECTED])
openQRM (http://openqrm.sourceforge.net) Team Leader,
R&D, Qlusters Inc.
+972-3-6081994 Fax: +972-3-6081841
-------------------------------------------------------
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?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user