/** * Gets the Data_With_Titles columns from the data table body. Data_With_Titles start column consider to be the next * column after descriptor section of the table and till the end of the table. * * @param verticalTableBody Vertical representation of data table body. * @return Data_With_Titles columns for current data table body. */ private static ILogicalTable getVerticalDataWithTitle(ILogicalTable verticalTableBody) { ILogicalTable horizDataTableBody = verticalTableBody.transpose(); int startIndex = getStartIndexForDataWithTitlesSection(horizDataTableBody); return verticalTableBody.getColumns(startIndex); }
public static ILogicalTable getPropertiesTableSection(ILogicalTable table) { if (table.getHeight() < 2) { return null; } ILogicalTable propTable = table.getRows(1, 1); String header = propTable.getSource().getCell(0, 0).getStringValue(); if (!PROPERTIES_HEADER.equals(header)) { return null; } return propTable.getColumns(1); }
/** * Put subtable, that will be displayed at the business view.<br> * It must be without method header, properties section, conditions and return headers. * * @param tableSyntaxNode */ private void putTableForBusinessView(TableSyntaxNode tableSyntaxNode) { ILogicalTable tableBody = tableSyntaxNode.getTableBody(); if (DecisionTableHelper.isSimpleDecisionTableOrSmartDecisionTable(tableSyntaxNode) || DecisionTableHelper.isSimpleLookupTable(tableSyntaxNode)) { // if DT is simple, its body doesn`t contain conditions and return headers. // so put the body as it is. tableSyntaxNode.getSubTables().put(IXlsTableNames.VIEW_BUSINESS, tableBody); } else { // need to get the subtable without conditions and return headers. ILogicalTable businessView = null; if (DecisionTableHelper.looksLikeVertical(tableBody)) { // if table is vertical, remove service rows. businessView = tableBody.getRows(IDecisionTableConstants.SERVICE_COLUMNS_NUMBER - 1); } else { // table is horizontal, so remove service columns. businessView = tableBody.getColumns(IDecisionTableConstants.SERVICE_COLUMNS_NUMBER - 1); } tableSyntaxNode.getSubTables().put(IXlsTableNames.VIEW_BUSINESS, businessView); } }
public SpreadsheetComponentsBuilder(TableSyntaxNode tableSyntaxNode, IBindingContext bindingContext) { this.tableSyntaxNode = tableSyntaxNode; CellsHeaderExtractor extractor = ((SpreadsheetHeaderNode)tableSyntaxNode.getHeader()).getCellHeadersExtractor(); if (extractor == null) { extractor = new CellsHeaderExtractor(getSignature(tableSyntaxNode), tableSyntaxNode.getTableBody().getRow(0).getColumns(1), tableSyntaxNode.getTableBody().getColumn(0).getRows(1)); } this.cellsHeaderExtractor = extractor; this.bindingContext = bindingContext; }
private static CellsHeaderExtractor extractNames(TableSyntaxNode tableSyntaxNode) { CellsHeaderExtractor extractor; // try to get previously stored extractor // SpreadsheetHeaderNode header = (SpreadsheetHeaderNode) tableSyntaxNode.getHeader(); extractor = header.getCellHeadersExtractor(); if (extractor == null) { ILogicalTable body = tableSyntaxNode.getTableBody(); if (body != null) { extractor = new CellsHeaderExtractor(TableSyntaxNodeHelper.getSignature(tableSyntaxNode), body.getRow(0).getColumns(1), body.getColumn(0).getRows(1)); // set cells header extractor to the table syntax node, to avoid // extracting several times // header.setCellHeadersExtractor(extractor); } } return extractor; } }