DynamicTableModel extends TableModel { public RectF getCellRect(RectF tableRect, int numElements) { RectF cellRect = new RectF(); cellRect.left = tableRect.left; cellRect.top = tableRect.top; cellRect.bottom = tableRect.top + calculateCellSize(tableRect, TableModel.Axis.ROW, numElements); cellRect.right = tableRect.left + calculateCellSize(tableRect, TableModel.Axis.COLUMN, numElements); return cellRect; } DynamicTableModel(int numColumns, int numRows);  DynamicTableModel(int numColumns, int numRows, TableOrder order); @Override TableModelIterator getIterator(RectF tableRect, int totalElements); RectF getCellRect(RectF tableRect, int numElements); int getNumRows(); void setNumRows(int numRows); int getNumColumns(); void setNumColumns(int numColumns);  }
@Test public void testGetCellRect() throws Exception { DynamicTableModel model = new DynamicTableModel(5, 5); RectF tableRect = new RectF(0, 0, 1000, 2000); RectF cellRect = model.getCellRect(tableRect, 10); assertEquals(200f, cellRect.width()); model = new DynamicTableModel(5, 0); cellRect = model.getCellRect(tableRect, 10); assertEquals(200f, cellRect.width()); model = new DynamicTableModel(0, 5); cellRect = model.getCellRect(tableRect, 10); assertEquals(400f, cellRect.height()); }