code: private static void setSelections(final WComponent component, final boolean selected) {
  		if (component instanceof WCheckBox) {
  			((WCheckBox) component).setSelected(selected);
  		} else if (component instanceof WCheckBoxSelect) {
  			WCheckBoxSelect select = (WCheckBoxSelect) component;
  			select.setSelected(selected ? select.getOptions() : new ArrayList(0));
  		} else if (component instanceof WMultiSelect) {
  			WMultiSelect list = (WMultiSelect) component;
  			list.setSelected(selected ? list.getOptions() : new ArrayList(0));
  		} else if (component instanceof WDataTable) {
  			WDataTable table = (WDataTable) component;
  
  			if (table.getSelectMode() == SelectMode.MULTIPLE) {
  				if (selected) {
  					TableDataModel model = table.getDataModel();
  					int rowCount = model.getRowCount();
  
  					List<Integer> indices = new ArrayList<>(rowCount);
  
  					for (int i = 0; i < rowCount; i++) {
  						if (model.isSelectable(i)) {
  							indices.add(i);
  						}
  					}
  
  					table.setSelectedRows(indices);
  				} else {
  					table.setSelectedRows(new ArrayList<Integer>(0));
  				}
  			}
  		} else if (component instanceof Container) {
  			Container container = (Container) component;
  			final int childCount = container.getChildCount();
  
  			for (int i = 0; i < childCount; i++) {
  				WComponent child = container.getChildAt(i);
  				setSelections(child, selected);
  			}
  		}
  	}
docs: Sets the selections for the given context.
  
  @param component the container to modify the selected state for.
  @param selected if true, select everything. If false, deselect everything.