/** * Callback method, used when recording state to a form, or called directly when not recording state. */ void setupForRow(int rowIndex) { row = gridModel.getDataSource().getRowValue(rowIndex); }
void setupRender() { GridDataSource dataSource = gridModel.getDataSource(); int numberOfRowsRequiredToShowCurrentPage = 1 + (currentPage - 1) * rowsPerPage; int numberOfRowsRequiredToFillCurrentPage = currentPage * rowsPerPage; int availableRowsWithLimit = dataSource.getAvailableRows(numberOfRowsRequiredToFillCurrentPage); // This can sometimes happen when the number of items shifts between requests. if (numberOfRowsRequiredToShowCurrentPage > availableRowsWithLimit) { int maxPages = ((availableRowsWithLimit - 1) / rowsPerPage) + 1; currentPage = maxPages; } startRow = (currentPage - 1) * rowsPerPage; endRow = Math.min(availableRowsWithLimit - 1, startRow + rowsPerPage - 1); dataRowIndex = startRow; boolean recordingStateInsideForm = !volatileState && formSupport != null; recordStateByIndex = recordingStateInsideForm && (encoder == null); recordStateByEncoder = recordingStateInsideForm && (encoder != null); }