private void extractCellValues() { CellsHeaderExtractor cellsHeadersExtractor = componentsBuilder.getCellsHeadersExtractor(); int rowsCount = cellsHeadersExtractor.getHeight(); int columnsCount = cellsHeadersExtractor.getWidth(); for (int rowIndex = 0; rowIndex < rowsCount; rowIndex++) { IBindingContext rowBindingContext = getRowContext(rowIndex); for (int columnIndex = 0; columnIndex < columnsCount; columnIndex++) { boolean found = false; for (SpreadsheetCell cell : extractedCellValues) { int row = cell.getRowIndex(); int column = cell.getColumnIndex(); if (row == rowIndex && columnIndex == column) { found = true; } } if (!found) { extractCellValue(rowBindingContext, rowIndex, columnIndex); } } } }
/** * Add to {@link SpreadsheetOpenClass} fields that are represented by spreadsheet cells. * * @param spreadsheetType open class of the spreadsheet */ public void addCellFields(SpreadsheetOpenClass spreadsheetType, boolean autoType) { IBindingContext generalBindingContext = componentsBuilder.getBindingContext(); CellsHeaderExtractor cellsHeadersExtractor = componentsBuilder.getCellsHeadersExtractor(); int rowsCount = cellsHeadersExtractor.getHeight(); int columnsCount = cellsHeadersExtractor.getWidth(); // create cells according to the size of the spreadsheet cells = new SpreadsheetCell[rowsCount][columnsCount]; // create the binding context for the spreadsheet level spreadsheetBindingContext = new SpreadsheetContext(generalBindingContext, spreadsheetType); for (int rowIndex = 0; rowIndex < rowsCount; rowIndex++) { for (int columnIndex = 0; columnIndex < columnsCount; columnIndex++) { // build spreadsheet cell SpreadsheetCell spreadsheetCell = buildCell(rowIndex, columnIndex, autoType); // init cells array with appropriate cell cells[rowIndex][columnIndex] = spreadsheetCell; // create and add field of the cell to the spreadsheetType addSpreadsheetFields(spreadsheetType, spreadsheetCell, rowIndex, columnIndex); } } }
componentsBuilder.getCellsHeadersExtractor().getRowNamesTable().getRow(rowIndex), componentsBuilder.getCellsHeadersExtractor().getColumnNamesTable().getColumn(columnIndex)); ICell sourceCell = cell.getSource().getCell(0, 0);
spreadsheet.setColumnNames(componentsBuilder.getColumnNames()); spreadsheet.setRowTitles(componentsBuilder.getCellsHeadersExtractor().getRowNames()); spreadsheet.setColumnTitles(componentsBuilder.getCellsHeadersExtractor().getColumnNames()); if (spreadsheet.isCustomSpreadsheetType()) {
componentsBuilder.getCellsHeadersExtractor().getRowNamesTable().getRow(rowIndex), componentsBuilder.getCellsHeadersExtractor().getColumnNamesTable().getColumn(columnIndex));