Here's a test case for Anil's comment on December 11, 2007:
public static class RowElem {
private static int uniqueCounter = 0;
private Date date = new Date();
public Date getDate()
{ return date; }
public void setDate(Date d)
{ date = d; }
private int unique = uniqueCounter++;
public int getUnique()
{ return unique; }
public void setUnique(int u)
{ unique = u; }
}
private String count = "1";
public String getCount()
{ return count; }
public void setCount(String c)
{ count = c; }
private List rows;
public List getRows()
{ return rows; }
public void setRows(List r)
{ rows = r; }
public void valueChangeListener(ValueChangeEvent event) {
Object newValue = event.getNewValue();
int newCount = Integer.parseInt(String.valueOf(newValue));
int oldSize = rows.size();
if(newCount > oldSize)
{
for(int i = oldSize + 1; i <= newCount; i++)
rows.add( new RowElem() );
}
else if(newCount < oldSize)
{
for(int i = oldSize-1; i >= newCount; i--)
rows.remove(i);
}
}
public TextFieldsBean()
{
rowList = new ArrayList();
for(int i = 0; i < 10; i++)
rowList.add( new RowEntry(i) );
rows = new ArrayList();
rows.add( new RowElem() );
}
<ice:panelGroup style="width:300px;height:300px">
<ice:selectOneMenu value="#
{textFields.count}
"
partialSubmit="true"
valueChangeListener="#
{textFields.valueChangeListener}
">
<f:selectItem itemValue="1"/>
<f:selectItem itemValue="2"/>
<f:selectItem itemValue="3"/>
<f:selectItem itemValue="4"/>
<f:selectItem itemValue="5"/>
</ice:selectOneMenu>
<ice:dataTable var="rowElem" value="#
{textFields.rows}
">
<ice:column>
<f:facet name="header">
<ice:outputText value="Date"/>
</f:facet>
<ice:selectInputDate value="#
{rowElem.date}
" renderAsPopup="true"/>
</ice:column>
<ice:column>
<f:facet name="header">
<ice:outputText value="Unique"/>
</f:facet>
<ice:outputText value="#
{rowElem.unique}
"/>
</ice:column>
</ice:dataTable>
</ice:panelGroup>
The "unique" field shows that I am getting a new RowElem object, it's just that it's having its date field reset to the old one's value.
I have also run into the same issue, the I have 2 panelseries nested to show a set of images in a 2 dimensional matrix(when a set of checkboxes are clicked), If i use a single panel series it works but all the images shows up in a single row. Using the nested panelseries with nested beans solves the problem half way first time all the images gets rendered, but when the checkbox is clicked. When i uncheck the checkbox the image disappears if the full row is unchecked but, when i check it again it somehow remebers the whole row.