How to check all child nodes when parent node checkbox is selected in tree

Hi all
Am using Component tree Have added checkbox to all the nodes of a tree like this

private Component createDummyComponent (String header) {
	
    CssLayout l = new CssLayout();
    l.setWidth("200px");
    Label l1 = new Label( header );
    String l4=l1.toString();
    CheckBox c= new CheckBox(l4);
    l.addComponent(c);
    
 

    return l;
}

When i check parentnode in a tree i want all of its child nodes checkbox to be autoselected . Can anyone please help me out how to achieve this

Thanks a lot in Advance