private int getRowHeight(Object value, List<FieldDescriptor> fields) { if (value == null || fields == null) { return 1; } if (value.getClass().isArray()) { int count = Array.getLength(value); int height = 0; for (int i = 0; i < count; i++) { height += getRowHeight(Array.get(value, i), fields); } return height == 0 ? 1 : height; } int maxSize = 1; for (FieldDescriptor fieldDescriptor : fields) { int size = fieldDescriptor.getMaxArraySize(value); if (size > maxSize) { maxSize = size; } } return maxSize; }
private int getMaxHeight(TestDescription description, List<List<FieldDescriptor>> nonEmptyFields) { int maxHeight = 1; ParameterWithValueDeclaration[] executionParams = description.getExecutionParams(); for (int i = 0; i < executionParams.length; i++) { ParameterWithValueDeclaration param = executionParams[i]; List<FieldDescriptor> fields = nonEmptyFields.get(i); int rowHeight = getRowHeight(param.getValue(), fields); if (rowHeight > maxHeight) { maxHeight = rowHeight; } } return maxHeight; }
private void addValueTasks(TreeSet<WriteTask> tasks, Cursor cursor, List<FieldDescriptor> fields, Object value, int rowHeight) { int colNum = cursor.getColNum(); int rowNum = cursor.getRowNum(); if (value != null && value.getClass().isArray()) { int count = Array.getLength(value); int heightLeft = rowHeight; for (int i = 0; i < count; i++) { Object elem = Array.get(value, i); int height = getRowHeight(elem, fields); if (i < count - 1) { addValueTasks(tasks, new Cursor(rowNum, colNum), fields, elem, height); heightLeft -= height; } else { addValueTasks(tasks, new Cursor(rowNum, colNum), fields, elem, heightLeft); } rowNum += height; } } else { for (FieldDescriptor fieldDescriptor : fields) { Object fieldValue = ExportUtils.fieldValue(value, fieldDescriptor.getField()); List<FieldDescriptor> children = fieldDescriptor.getChildren(); if (children == null) { tasks.add(new WriteTask(new Cursor(rowNum, colNum), fieldValue, styles.parameterValue, rowHeight)); } else { addValueTasks(tasks, new Cursor(rowNum, colNum), children, fieldValue, rowHeight); } colNum += fieldDescriptor.getLeafNodeCount(); } } }
int count = Array.getLength(id); for (int i = 0; i < count; i++) { int height = getRowHeight(Array.get(value, i), fields); tasks.add(new WriteTask(new Cursor(pkRow, colNum), Array.get(id, i),