@Override
    public void encodeBegin(FacesContext context) throws IOException {
        _initialDescendantComponentState = null;
        if (_isValidChilds && !hasErrorMessages(context)) {
            // Clear the data model so that when rendering code calls
            // getDataModel a fresh model is fetched from the backing
            // bean via the value-binding.
            _dataModelMap.clear();

            // When the data model is cleared it is also necessary to
            // clear the saved row state, as there is an implicit 1:1
            // relation between objects in the _rowStates and the
            // corresponding DataModel element.
            _rowStates.clear();
        }
        super.encodeBegin(context);
    }
Calculates the count value for the given index.

@param index

@return
primefaces/src/main/java/org/primefaces/component/api/UITabPanel.java