private void encodeTabHeader( FacesContext context, AbstractTab tab, ResponseWriter writer, AbstractTogglePanelTitledItem.HeaderStates state) throws IOException { String headerStateClass = "rf-tab-hdr-" + state.abbreviation(); String headerPositionClass = "rf-tab-hdr-" + positionAbbreviation(tab); writer.startElement(TD_ELEM, tab); writer.writeAttribute(ID_ATTRIBUTE, tab.getClientId(context) + ":header", null); renderPassThroughAttributes(context, tab, HEADER_ATTRIBUTES); writer.writeAttribute( CLASS_ATTRIBUTE, concatClasses( "rf-tab-hdr", headerStateClass, headerPositionClass, attributeAsString(tab, "headerClass"), attributeAsString(tab, state.headerClass())), null); writer.writeAttribute(STYLE_ATTRIBUTE, attributeAsString(tab, "headerStyle"), null); writer.writeAttribute("data-tabname", tab.getName(), null); writer.startElement(SPAN_ELEM, tab); writer.writeAttribute(CLASS_ATTRIBUTE, "rf-tab-lbl", null); UIComponent headerFacet = tab.getHeaderFacet(state); if (headerFacet != null && headerFacet.isRendered()) { headerFacet.encodeAll(context); } else { Object headerText = tab.getAttributes().get("header"); if (headerText != null && !headerText.equals("")) { writer.writeText(headerText, null); } } writer.endElement(SPAN_ELEM); writer.endElement(TD_ELEM); }
@Override protected void doDecode(FacesContext context, UIComponent component) { Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap(); AbstractTab tab = (AbstractTab) component; String compClientId = component.getClientId(context); if (requestMap.get(compClientId) != null) { AbstractTabPanel parentTabPanel = getParentTabPanel(tab); if (parentTabPanel.isImmediate()) { tab.setImmediate(true); } new ActionEvent(tab).queue(); if (context.getPartialViewContext().isPartialRequest()) { context.getPartialViewContext().getRenderIds().add(component.getClientId(context)); addOnCompleteParam(context, tab.getName(), tab.getTabPanel().getClientId(context)); } } }