protected void renderColumnSelectorHeader(FacesContext facesContext,
TobagoResponseWriter writer, UIData component, UIColumn column)
throws IOException {
UIPanel menu = (UIPanel) column.getFacet(FACET_MENUPOPUP);
if (menu == null) {
final Application application = facesContext.getApplication();
menu = (UIPanel) application.createComponent(UIMenu.COMPONENT_TYPE);
menu.setId("selectorMenu");
column.getFacets().put(FACET_MENUPOPUP, menu);
menu.setRendererType(RENDERER_TYPE_MENUBAR);
menu.getAttributes().put(ATTR_MENU_POPUP, Boolean.TRUE);
menu.getAttributes().put(ATTR_MENU_POPUP_TYPE, "SheetSelector");
menu.getAttributes().put(ATTR_IMAGE, "image/sheetSelectorMenu.gif");
String sheetId = column.getParent().getClientId(facesContext);
String action = "Tobago.Sheets.selectAll('" + sheetId + "')";
String label = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago",
"sheetMenuSelect");
UICommand menuItem = createMenuItem(application, label, action);
menuItem.setId("menuSelectAll");
menu.getChildren().add(menuItem);
action = "Tobago.Sheets.unSelectAll('" + sheetId + "')";
label = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago",
"sheetMenuUnselect");
menuItem = createMenuItem(application, label, action);
menuItem.setId("menuUnselectAll");
menu.getChildren().add(menuItem);
action = "Tobago.Sheets.toggleAllSelections('" + sheetId + "')";
label = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago",
"sheetMenuToggleselect");
menuItem = createMenuItem(application, label, action);
menuItem.setId("menuToggleSelections");
menu.getChildren().add(menuItem);
}
menu.setRendered(UIData.MULTI.equals(component.getSelectable()));
writer.startElement(HtmlConstants.DIV, null);
writer.writeIdAttribute(column.getClientId(facesContext));
writer.writeClassAttribute("tobago-sheet-selector-menu");
writer.endElement(HtmlConstants.DIV);