/** * @see {@link javax.faces.model.DataModel#getRowCount()} */ @Override public int getRowCount() { if (rowCount == -1) { rowCount = countRows(); } return rowCount; }
/** * @see javax.faces.model.DataModel#isRowAvailable() */ @Override public boolean isRowAvailable() { int rowIndex = getRowIndex(); return (rowIndex >= 0) && (rowIndex < getRowCount()); }
/** * @see Sortable#setSortCriteria(java.util.List) */ @Override public void setSortCriteria(List<SortCriterion> sortCriteria) { this.sortCriteria = sortCriteria; reset(); }
/** * Resets (clears) the underlying wrapped data. */ public void reset() { setRowCount(-1); setWrappedData(null); setStartRowIndex(-1); setFinishRowIndex(-1); }
/** * @see javax.faces.model.DataModel#getWrappedData() */ @Override public List<E> getWrappedData() { if (wrappedData == null) { int startRowIndex = rowIndex; int finishRowIndex = Math.min(rowIndex + getRowsPerPage() - 1, getRowCount() - 1); logger.debug("finding new startRowIndex=[{0}] finishRowIndex=[{1}]", startRowIndex, finishRowIndex); setWrappedData(findRows(startRowIndex, finishRowIndex, sortCriteria)); setFinishRowIndex(finishRowIndex); setStartRowIndex(startRowIndex); } return wrappedData; }
/** * @see {@link javax.faces.model.DataModel#setRowIndex(int)} */ @Override public void setRowIndex(int rowIndex) { // If the specified rowIndex is outside the range of cached rows, then clear the cache so that the // findRows(int startRow, int finishRow) method will be called in order to load the set of rows // associated with the specified rowIndex. if (rowIndex >= 0) { int startRowIndex = getStartRowIndex(); int finishRowIndex = getFinishRowIndex(); if ((startRowIndex >= 0) && (finishRowIndex >= 0)) { int maxFinishRowIndex = startRowIndex + getRowsPerPage() - 1; if ((rowIndex < startRowIndex) || (rowIndex > maxFinishRowIndex)) { if (logger.isDebugEnabled()) { logger.debug("Clearing cache since rowIndex=[{0}] is outside the range of cached rows.", rowIndex); } reset(); } } } this.rowIndex = rowIndex; }
/** * @see {@link javax.faces.model.DataModel#getRowData()} */ @Override public E getRowData() { if (getRowIndex() >= 0) { int adjustedRowIndex = getRowIndex() % getRowsPerPage(); Collection<E> wrappedData = getWrappedData(); if (adjustedRowIndex >= wrappedData.size()) { logger.error("adjustedRowIndex=[{0}] higher than wrappedData.size=[{1}]", adjustedRowIndex, wrappedData.size()); return null; } return getWrappedData().get(adjustedRowIndex); } else { return null; } }
/** * @see {@link javax.faces.model.DataModel#getWrappedData()} */ @Override public List<E> getWrappedData() { if (wrappedData == null) { int startRowIndex = rowIndex; int finishRowIndex = Math.min(rowIndex + getRowsPerPage() - 1, getRowCount() - 1); logger.debug("finding new startRowIndex=[{0}] finishRowIndex=[{1}]", startRowIndex, finishRowIndex); setWrappedData(findRows(startRowIndex, finishRowIndex, sortCriteria)); setFinishRowIndex(finishRowIndex); setStartRowIndex(startRowIndex); } return wrappedData; }
/** * Resets (clears) the underlying wrapped data. */ public void reset() { setRowCount(-1); setWrappedData(null); setStartRowIndex(-1); setFinishRowIndex(-1); }
/** * @see javax.faces.model.DataModel#setRowIndex(int) */ @Override public void setRowIndex(int rowIndex) { // If the specified rowIndex is outside the range of cached rows, then clear the cache so that the // findRows(int startRow, int finishRow) method will be called in order to load the set of rows // associated with the specified rowIndex. if (rowIndex >= 0) { int startRowIndex = getStartRowIndex(); int finishRowIndex = getFinishRowIndex(); if ((startRowIndex >= 0) && (finishRowIndex >= 0)) { int maxFinishRowIndex = startRowIndex + getRowsPerPage() - 1; if ((rowIndex < startRowIndex) || (rowIndex > maxFinishRowIndex)) { if (logger.isDebugEnabled()) { logger.debug("Clearing cache since rowIndex=[{0}] is outside the range of cached rows.", rowIndex); } reset(); } } } this.rowIndex = rowIndex; }
/** * @see {@link javax.faces.model.DataModel#getRowData()} */ @Override public E getRowData() { if (getRowIndex() >= 0) { int adjustedRowIndex = getRowIndex() % getRowsPerPage(); Collection<E> wrappedData = getWrappedData(); if (adjustedRowIndex >= wrappedData.size()) { logger.error("adjustedRowIndex=[{0}] higher than wrappedData.size=[{1}]", adjustedRowIndex, wrappedData.size()); return null; } return getWrappedData().get(adjustedRowIndex); } else { return null; } }
/** * @see {@link javax.faces.model.DataModel#getWrappedData()} */ @Override public List<E> getWrappedData() { if (wrappedData == null) { int startRowIndex = rowIndex; int finishRowIndex = Math.min(rowIndex + getRowsPerPage() - 1, getRowCount() - 1); logger.debug("finding new startRowIndex=[{0}] finishRowIndex=[{1}]", startRowIndex, finishRowIndex); setWrappedData(findRows(startRowIndex, finishRowIndex, sortCriteria)); setFinishRowIndex(finishRowIndex); setStartRowIndex(startRowIndex); } return wrappedData; }
/** * Resets (clears) the underlying wrapped data. */ public void reset() { setRowCount(-1); setWrappedData(null); setStartRowIndex(-1); setFinishRowIndex(-1); }
/** * @see {@link javax.faces.model.DataModel#setRowIndex(int)} */ @Override public void setRowIndex(int rowIndex) { // If the specified rowIndex is outside the range of cached rows, then clear the cache so that the // findRows(int startRow, int finishRow) method will be called in order to load the set of rows // associated with the specified rowIndex. if (rowIndex >= 0) { int startRowIndex = getStartRowIndex(); int finishRowIndex = getFinishRowIndex(); if ((startRowIndex >= 0) && (finishRowIndex >= 0)) { int maxFinishRowIndex = startRowIndex + getRowsPerPage() - 1; if ((rowIndex < startRowIndex) || (rowIndex > maxFinishRowIndex)) { if (logger.isDebugEnabled()) { logger.debug("Clearing cache since rowIndex=[{0}] is outside the range of cached rows.", rowIndex); } reset(); } } } this.rowIndex = rowIndex; }
/** * @see javax.faces.model.DataModel#getRowData() */ @Override public E getRowData() { if (getRowIndex() >= 0) { int adjustedRowIndex = getRowIndex() % getRowsPerPage(); Collection<E> wrappedData = getWrappedData(); if (adjustedRowIndex >= wrappedData.size()) { logger.error("adjustedRowIndex=[{0}] higher than wrappedData.size=[{1}]", adjustedRowIndex, wrappedData.size()); return null; } return getWrappedData().get(adjustedRowIndex); } else { return null; } }
/** * @see {@link javax.faces.model.DataModel#isRowAvailable()} */ @Override public boolean isRowAvailable() { int rowIndex = getRowIndex(); return (rowIndex >= 0) && (rowIndex < getRowCount()); }
/** * @see {@link Sortable#setSortCriteria(java.util.List)} */ @Override public void setSortCriteria(List<SortCriterion> sortCriteria) { this.sortCriteria = sortCriteria; reset(); }
/** * @see javax.faces.model.DataModel#getRowCount() */ @Override public int getRowCount() { if (rowCount == -1) { rowCount = countRows(); } return rowCount; }
/** * @see {@link javax.faces.model.DataModel#isRowAvailable()} */ @Override public boolean isRowAvailable() { int rowIndex = getRowIndex(); return (rowIndex >= 0) && (rowIndex < getRowCount()); }
/** * @see {@link Sortable#setSortCriteria(java.util.List)} */ @Override public void setSortCriteria(List<SortCriterion> sortCriteria) { this.sortCriteria = sortCriteria; reset(); }