[font=Verdana]
Hi all,
It seems like, the caching problem of ComboBox goes on.
The one which is described in this thread :
http://vaadin.com/forum/-/message_boards/message/151590
It says
this ticket
solved the problem, but i still experience it (using 6.4.5)
I’ve 2 combos. One is for city, other for region. Region combo is tied to a Form through a FieldWrapper.
Although i change the city selection, the
previously selected region
still appears as selected, although it is no longer valid.
Here is the code for FieldWrapper
public class RegionField extends FieldWrapper<Region> {
private BeanItemContainer<Region> regionContainer;
private BeanItemContainer<City> cityContainer;
private List<Region> regions;
public RegionField(final List<Region> regions) {
// no conversions
super(new ComboBox("Select Region"), null, Region.class);
this.regions = regions;
VerticalLayout layout = new VerticalLayout();
layout.setMargin(false);
layout.setSpacing(true);
final ComboBox cityCombo = new ComboBox("Select City", getCityContainer());
cityCombo.setNullSelectionAllowed(false);
cityCombo.setImmediate(true);
layout.addComponent(cityCombo);
final ComboBox regionCombo = (ComboBox) getWrappedField();
regionCombo.setNullSelectionAllowed(false);
regionCombo.setImmediate(true);
regionCombo.setContainerDataSource(getRegionContainer());
regionCombo.setItemCaptionPropertyId("name");
layout.addComponent(regionCombo);
cityCombo.addListener(new Property.ValueChangeListener() {
public void valueChange(Property.ValueChangeEvent event) {
getRegionContainer().removeAllContainerFilters();
getRegionContainer().addContainerFilter("city", event.getProperty().getValue().toString(), true, true);
}
});
setCompositionRoot(layout);
}
protected BeanItemContainer<Region> getRegionContainer() {
if (regionContainer == null) {
regionContainer = new BeanItemContainer<Region>(Region.class);
for (Region region : regions) {
regionContainer.addBean(region);
}
}
return regionContainer;
}
protected BeanItemContainer<City> getCityContainer() {
if (cityContainer == null) {
cityContainer = new BeanItemContainer<City>(City.class);
for (Region region : regions) {
cityContainer.addBean(region.getCity());
}
}
return cityContainer;
}
}
Btw, I’m new to Vaadin. I’ve used most of the alternative web frameworks, and i love the idea behind Vaadin. I believe this is the way to go. But, it has been 4 days of trial and unfortunately i’m having difficulties even with basics(like the problem above). This makes me suspicious about its maturity. I know, it is too early to say anything but i thought i could get on board faster-as it is not hard to understand the underlying architecture-. I sincerely hope, it just needs some more time to learn how to use correctly.
[/font]