/**
* setOMDataSource
*/
public OMDataSource setDataSource(OMDataSource dataSource) {
if (!isExpanded()) {
OMDataSource oldDS = this.dataSource;
this.dataSource = dataSource;
return oldDS; // Caller is responsible for closing the data source
} else {
// TODO
// Remove the entire subtree and replace with
// new datasource. There maybe a more performant way to do this.
OMDataSource oldDS = this.dataSource;
Iterator it = getChildren();
while(it.hasNext()) {
OMNode node = (OMNode) it.next();
node.detach();
}