/** * The base method to perform iteration. Also reset all inner variables when 'index' is null. * * @param index index of row or */ private void setIndex(Integer index) { if (index == null) { reset(); } else { saveChildrenState(); this.index = index; data = getData(); if (data != null) data.setRowIndex(this.index); setIterationStatus(); putVariables(); restoreChildrenState(); } }
/** * reset inner variables and remove 'var' and 'varStatus' from requestMap. This method must been * called at the start of iteration and at the end. */ private void reset() { saveChildrenState(); index = null; data = null; status = null; if (childrenOriginalState != null) restoreChildrenState(); childrenOriginalState = null; FacesContext context = FacesContext.getCurrentInstance(); Map<String, Object> requestMap = context.getExternalContext().getRequestMap(); String var = getVar(); String varStatus = getVarStatus(); if (var != null) requestMap.remove(var); if (varStatus != null) requestMap.remove(varStatus); }