Hallo,
i crate my own TwinColSelect mit two ListSelect and four Buttons. I don’t use the Vaadin TwinColSelect because i don’t react for Button Click and the datasource from left side changed at runtime.
The right List only remove items by Botton.
My Problem:
How may I transfer the Item-Caption fom the left site to the right side.
I don’t bind the left ListSelect with a Datasource. I fill it manually.
Here my code to fill the left side (ListSelect)
public void setContainerDatasource(Container jpa, String strId, String strCaption) {
for (Iterator<?> i = jpa.getItemIds().iterator(); i.hasNext();) {
Object iid = i.next();
Item item = jpa.getItem(iid);
listLeft.addItem(item.getItemProperty(strId).getValue().toString().trim());
listLeft.setItemCaption(item.getItemProperty(strId).getValue().toString().trim(),
item.getItemProperty(strCaption).getValue().toString());
}
}
The right side is filling by this code by click on the first Button:
[code]
private Object cmdClickAllLeftToRight(ClickEvent event) {
//Container c = listLeft.getContainerDataSource();
List<Object> toAdd = new ArrayList<Object>();
for (Object id : listLeft.getItemIds()) {
toAdd.add(id);
}
for (Object id : toAdd) {
listRight.addItem(id);
[color=#FF0000]
// listRight.setItemCaption ???
[/color]
}
return null;
}
[/code]Is this the correct way to do this?
Thanks
Patrick