*/
protected ElementBean createCommandLinkMetadata(SelectItem item,
FacesContext context) {
// create a command link attribute
ElementBean link = new ElementBean();
link.setRenderId(generateId());
link.setJsfid("commandLink");
link.setComponentType("javax.faces.HtmlCommandLink");
// add a value attribute
AttributeBean attr = new AttributeBean();
attr.setName("value");
attr.setValue(item.getLabel());
link.addAttribute(attr);
// turn on the the immediate attribute so the validation
// logic is not invoked when switching tabs
attr = new AttributeBean();
attr.setName("immediate");
attr.setValue("true");
link.addAttribute(attr);
// add a action method binding event when the link is clicked
attr = new AttributeBean();
attr.setName("action");
attr.setValue("#{@managed-bean-name.changeTab}");
link.addAttribute(attr);
// create a parameter
ElementBean param = new ElementBean();
param.setJsfid("param");
param.setComponentType("javax.faces.Parameter");
// RenderId is the key to the Map. Increment for each new parameter
param.setRenderId(generateId());
// add a query param for the selected tab index
attr = new AttributeBean();
attr.setName("name");
attr.setValue("tabIndex");
param.addAttribute(attr);
// add a query parameter for the tab index
attr = new AttributeBean();
attr.setName("value");
attr.setValue(((Integer) item.getValue()).toString());
param.addAttribute(attr);
// add a parameter to the commandLink
link.addChild(param);
return link;