TreeTable with checkboxes : listening on checkbox value change/click

Hello,

I am quite new to Vaadin framework thus forgive me if my question appears in the wrong place ( and eventually … please direct me to the correct one ) .

I am coding a liferay portlet (using Vaadin 6.8.8) in which I have a treetable with checkboxes and a standard table that shall be dinamically filled depending on the itemns checked in the treetable.
I am creating the treetable like this :


			tree.addContainerProperty("Available Segments", CheckBox.class, "");
			SegmentSelectionListener listener=new SegmentSelectionListener(dependentTable);
			CheckListener checkListener = new CheckListener();
			CheckBox countryNode;
			CheckBox segmentNode;
			Object item = null;
			for (Country country : indicator.getCountries()) {
				countryNode = new CheckBox(country.getName());
				countryNode.setData(country);
				item = tree.addItem(new Object[] { countryNode },	countryNode);
				countryNode.addListener(checkListener);
				if (country.hasChildren()) {
					for (Segment segment : country.getSegments()) {
						if (!Treenode.TOTAL.equals(segment.getName())) {
							segmentNode = new CheckBox(segment.getName());
							item = tree.addItem(new Object[] { segmentNode }, segmentNode);
							tree.setParent(segmentNode, countryNode);
							tree.setChildrenAllowed(segmentNode, false);
							segmentNode.addListener(checkListener);
						}
					}
				}
				tree.setChildrenAllowed(countryNode, country.hasChildren());
			}
			tree.setSelectable(true);

My SegmentSelectionListener implements ItemClickListener, CheckListener implements ClickListener.
When I select ( highlight ) an element in the treetable the SegmentSelectionListener gets correctly fired up, while, when I change the value in the checkbox, the CheckListener is not fired.

My final goal would be to select/unselect all the children checkboxes when a parent treetable node is checked and dinamically change the content / refresh a table ( change an IndexedContainer ? )

I guess I am approaching this in the wrong way … could you please advice ?

Try setting your CheckBoxes in immediate mode (call CheckBox.setImmediate(true);).

works like a charm !
Thanks !!!