test_class.file: persistence/src/test/java/org/devgateway/toolkit/persistence/excel/AbstractExcelSheetTest.java
test_class.identifier: AbstractExcelSheetTest
test_case.body: @Test
      public void writeCell() throws Exception {
          final Workbook workbook = new XSSFWorkbook();
          final ExcelSheet excelSheet = new MockExcelSheet(workbook);
          final Sheet sheet = workbook.createSheet("sheet");
          final Row row = sheet.createRow(0);
  
          excelSheet.writeCell(null, row, 0);
          excelSheet.writeCell(Boolean.TRUE, row, 1);
          excelSheet.writeCell("text", row, 2);
          excelSheet.writeCell(1, row, 3);
  
          Assert.assertEquals(CellType.BLANK, row.getCell(0).getCellType());
          Assert.assertEquals("Yes", row.getCell(1).getStringCellValue());
          Assert.assertEquals(CellType.STRING, row.getCell(2).getCellType());
          Assert.assertEquals(CellType.NUMERIC, row.getCell(3).getCellType());
      }
test_case.class_method_signature: AbstractExcelSheetTest.writeCell()
test_case.full_signature: @Test public void writeCell()
test_case.identifier: writeCell
test_case.invocations: createSheet createRow writeCell writeCell writeCell writeCell assertEquals getCellType getCell assertEquals getStringCellValue getCell assertEquals getCellType getCell assertEquals getCellType getCell
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void writeCell()
focal_class.declarator: workbook
focal_class.modifier: protected final
focal_class.original_string: protected final Workbook workbook;
focal_class.type: Workbook
focal_class.var_name: workbook
focal_class.declarator: dataFont
focal_class.modifier: private
focal_class.original_string: private Font dataFont;
focal_class.type: Font
focal_class.var_name: dataFont
focal_class.declarator: headerFont
focal_class.modifier: private
focal_class.original_string: private Font headerFont;
focal_class.type: Font
focal_class.var_name: headerFont
focal_class.declarator: linkFont
focal_class.modifier: private
focal_class.original_string: private Font linkFont;
focal_class.type: Font
focal_class.var_name: linkFont
focal_class.declarator: dataStyleCell
focal_class.modifier: private final
focal_class.original_string: private final CellStyle dataStyleCell;
focal_class.type: CellStyle
focal_class.var_name: dataStyleCell
focal_class.declarator: headerStyleCell
focal_class.modifier: private final
focal_class.original_string: private final CellStyle headerStyleCell;
focal_class.type: CellStyle
focal_class.var_name: headerStyleCell
focal_class.declarator: linkStyleCell
focal_class.modifier: private final
focal_class.original_string: private final CellStyle linkStyleCell;
focal_class.type: CellStyle
focal_class.var_name: linkStyleCell
focal_class.declarator: createHelper
focal_class.modifier: private final
focal_class.original_string: private final CreationHelper createHelper;
focal_class.type: CreationHelper
focal_class.var_name: createHelper
focal_class.declarator: cell
focal_class.modifier: private
focal_class.original_string: private Cell cell;
focal_class.type: Cell
focal_class.var_name: cell
focal_class.file: persistence/src/main/java/org/devgateway/toolkit/persistence/excel/AbstractExcelSheet.java
focal_class.identifier: AbstractExcelSheet
focal_class.interfaces: implements ExcelSheet
focal_class.class_method_signature: AbstractExcelSheet.AbstractExcelSheet(final Workbook workbook)
focal_class.full_signature: public  AbstractExcelSheet(final Workbook workbook)
focal_class.identifier: AbstractExcelSheet
focal_class.modifiers: public
focal_class.parameters: (final Workbook workbook)
focal_class.signature:  AbstractExcelSheet(final Workbook workbook)
focal_class.class_method_signature: AbstractExcelSheet.writeCell(final Object value, final Row row, final int column)
focal_class.full_signature: @Override public void writeCell(final Object value, final Row row, final int column)
focal_class.identifier: writeCell
focal_class.modifiers: @Override public
focal_class.parameters: (final Object value, final Row row, final int column)
focal_class.return: void
focal_class.signature: void writeCell(final Object value, final Row row, final int column)
focal_class.class_method_signature: AbstractExcelSheet.writeHeaderCell(final Object value, final Row row, final int column)
focal_class.full_signature: protected void writeHeaderCell(final Object value, final Row row, final int column)
focal_class.identifier: writeHeaderCell
focal_class.modifiers: protected
focal_class.parameters: (final Object value, final Row row, final int column)
focal_class.return: void
focal_class.signature: void writeHeaderCell(final Object value, final Row row, final int column)
focal_class.class_method_signature: AbstractExcelSheet.writeCellLink(final Object value, final Row row, final int column,
                                final String sheetName, final int rowNumber)
focal_class.full_signature: public void writeCellLink(final Object value, final Row row, final int column,
                                final String sheetName, final int rowNumber)
focal_class.identifier: writeCellLink
focal_class.modifiers: public
focal_class.parameters: (final Object value, final Row row, final int column,
                                final String sheetName, final int rowNumber)
focal_class.return: void
focal_class.signature: void writeCellLink(final Object value, final Row row, final int column,
                                final String sheetName, final int rowNumber)
focal_class.class_method_signature: AbstractExcelSheet.createRow(final Sheet sheet, final int rowNumber)
focal_class.full_signature: protected Row createRow(final Sheet sheet, final int rowNumber)
focal_class.identifier: createRow
focal_class.modifiers: protected
focal_class.parameters: (final Sheet sheet, final int rowNumber)
focal_class.return: Row
focal_class.signature: Row createRow(final Sheet sheet, final int rowNumber)
focal_class.class_method_signature: AbstractExcelSheet.getFreeColl(final Row row)
focal_class.full_signature: protected int getFreeColl(final Row row)
focal_class.identifier: getFreeColl
focal_class.modifiers: protected
focal_class.parameters: (final Row row)
focal_class.return: int
focal_class.signature: int getFreeColl(final Row row)
focal_method.body: @Override
      public void writeCell(final Object value, final Row row, final int column) {
          // try to determine the cell type based on the object value
          // if nothing matches then use 'CellType.STRING' as type and call the object toString() function.
          //      * don't create any cell if the value is null (Cell.CELL_TYPE_BLANK)
          //      * do nothing if we have an empty List/Set instead of display empty brackets like [ ]
          if (value != null && !((value instanceof List || value instanceof Set) && ((Collection) value).isEmpty())) {
              if (value instanceof String) {
                  cell = row.createCell(column, CellType.STRING);
                  cell.setCellValue((String) value);
              } else {
                  if (value instanceof Integer) {
                      cell = row.createCell(column, CellType.NUMERIC);
                      cell.setCellValue((Integer) value);
                  } else {
                      if (value instanceof BigDecimal) {
                          cell = row.createCell(column, CellType.NUMERIC);
                          cell.setCellValue(((BigDecimal) value).doubleValue());
                      } else {
                          if (value instanceof Boolean) {
                              cell = row.createCell(column, CellType.BOOLEAN);
                              cell.setCellValue(((Boolean) value) ? "Yes" : "No");
                          } else {
                              if (value instanceof Date) {
                                  final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  
                                  cell = row.createCell(column);
                                  cell.setCellValue(sdf.format((Date) value));
                              } else {
                                  cell = row.createCell(column, CellType.STRING);
                                  cell.setCellValue(value.toString());
                              }
                          }
                      }
                  }
              }
  
              cell.setCellStyle(dataStyleCell);
          } else {
              // create a CellType.BLANK
              row.createCell(column);
          }
      }
focal_method.class_method_signature: AbstractExcelSheet.writeCell(final Object value, final Row row, final int column)
focal_method.full_signature: @Override public void writeCell(final Object value, final Row row, final int column)
focal_method.identifier: writeCell
focal_method.invocations: isEmpty createCell setCellValue createCell setCellValue createCell setCellValue doubleValue createCell setCellValue createCell setCellValue format createCell setCellValue toString setCellStyle createCell
focal_method.modifiers: @Override public
focal_method.parameters: (final Object value, final Row row, final int column)
focal_method.return: void
focal_method.signature: void writeCell(final Object value, final Row row, final int column)