}
private void updateMenuItems(FacesContext context, ColumnVisibilityMenu cvm) {
List<UIComponent> menuChildren = cvm.getChildren();
menuChildren.clear();
AbstractTable table = getTable(cvm);
cvm.getAttributes().put(PopupMenuRenderer.ATTR_DEFAULT_INDENT_CLASS, "o_popup_menu_indent o_columnVisibilityMenuIndent");
List<BaseColumn> visibleColumns = table.getRenderedColumns();
List<BaseColumn> allColumns = table.getAllColumns();
for (int i = 0, count = allColumns.size(); i < count; i++) {
BaseColumn column = allColumns.get(i);
MenuItem menuItem = Components.createComponent(context, MenuItem.COMPONENT_TYPE, MenuItem.class, cvm, "col" + i);
menuItem.setValue(column.getColumnHeader());
boolean columnVisible = visibleColumns.contains(column);