@Test public void testWalk() { final List<Object> rowKeys = new ArrayList<Object>(); DataVisitor visitor = new DataVisitor() { public DataVisitResult process(FacesContext context, Object rowKey, Object argument) { arrangeableModel.setRowKey(rowKey); if (arrangeableModel.isRowAvailable()) { rowKeys.add(rowKey); } return DataVisitResult.CONTINUE; } }; arrangeableModel.walk(facesContext, visitor, new SequenceRange(0, -1), null); Assert.assertEquals(FILTERD_AND_SORTED_ROW_KEYS, rowKeys); rowKeys.clear(); arrangeableModel.walk(facesContext, visitor, new SequenceRange(0, ROWS), null); Assert.assertEquals(FILTERD_AND_SORTED_ROW_KEYS.subList(0, ROWS), rowKeys); }
public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) { final SequenceRange seqRange = (SequenceRange) range; int rows = seqRange.getRows(); int rowCount = getRowCount(); int currentRow = seqRange.getFirstRow(); if (rows > 0) { rows += currentRow; rows = Math.min(rows, rowCount); } else { rows = rowCount; } for (; currentRow < rows; currentRow++) { visitor.process(context, rowKeys.get(currentRow), argument); } }
ArrangeableModel extends ExtendedDataModel<Object> implements Arrangeable { public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) { final SequenceRange seqRange = (SequenceRange) range; int rows = seqRange.getRows(); int rowCount = getRowCount(); int currentRow = seqRange.getFirstRow(); if (rows > 0) { rows += currentRow; rows = Math.min(rows, rowCount); } else { rows = rowCount; } for (; currentRow < rows; currentRow++) { visitor.process(context, rowKeys.get(currentRow), argument); } } }
ArrangeableModel extends ExtendedDataModel<Object> implements Arrangeable { public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) { final SequenceRange seqRange = (SequenceRange) range; int rows = seqRange.getRows(); int rowCount = getRowCount(); int currentRow = seqRange.getFirstRow(); if (rows > 0) { rows += currentRow; rows = Math.min(rows, rowCount); } else { rows = rowCount; } for (; currentRow < rows; currentRow++) { visitor.process(context, rowKeys.get(currentRow), argument); } } ArrangeableModel(ExtendedDataModel<?> originalModel, String var, String filterVar); }
ArrangeableModel extends ExtendedDataModel<Object> implements Arrangeable { public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) { final SequenceRange seqRange = (SequenceRange) range; int rows = seqRange.getRows(); int rowCount = getRowCount(); int currentRow = seqRange.getFirstRow(); if (rows > 0) { rows += currentRow; rows = Math.min(rows, rowCount); } else { rows = rowCount; } for (; currentRow < rows; currentRow++) { visitor.process(context, rowKeys.get(currentRow), argument); } } ArrangeableModel(ExtendedDataModel<?> originalModel, String var, String filterVar); void addDataModelListener(DataModelListener listener); void removeDataModelListener(DataModelListener listener); DataModelListener[] getDataModelListeners(); Object getRowKey(); void setRowKey(Object key); void walk(FacesContext context, DataVisitor visitor, Range range, Object argument); int getRowCount(); Object getRowData(); int getRowIndex(); Object getWrappedData(); boolean isRowAvailable(); void setRowIndex(int rowIndex); void setWrappedData(Object data); void arrange(FacesContext context, ArrangeableState state); }
ArrangeableModel extends ExtendedDataModel<Object> implements Arrangeable { public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) { final SequenceRange seqRange = (SequenceRange) range; int rows = seqRange.getRows(); int rowCount = getRowCount(); int currentRow = seqRange.getFirstRow(); if (rows > 0) { rows += currentRow; rows = Math.min(rows, rowCount); } else { rows = rowCount; } for (; currentRow < rows; currentRow++) { visitor.process(context, rowKeys.get(currentRow), argument); } } ArrangeableModel(ExtendedDataModel<?> originalModel, String var, String filterVar); void addDataModelListener(DataModelListener listener); void removeDataModelListener(DataModelListener listener); DataModelListener[] getDataModelListeners(); Object getRowKey(); void setRowKey(Object key); void walk(FacesContext context, DataVisitor visitor, Range range, Object argument); int getRowCount(); Object getRowData(); int getRowIndex(); Object getWrappedData(); boolean isRowAvailable(); void setRowIndex(int rowIndex); void setWrappedData(Object data); void arrange(FacesContext context, ArrangeableState state);  }