public int getWidth() { return table.getHeight(); }
/** * @param entireTable The entire table with two dimensions(WITHOUT a * header). * @param lookupValuesTable The "values subtable" */ public TwoDimensionDecisionTableTranformer(IGridTable entireTable, IGridTable lookupValuesTable, int retTableWidth) { this.lookupValuesTableHeight = lookupValuesTable.getHeight(); this.lookupValuesTableWidth = lookupValuesTable.getWidth(); this.conditionsWidth = entireTable.getWidth() - lookupValuesTableWidth; this.hConditionsCount = entireTable.getHeight() - lookupValuesTableHeight - HCONDITION_HEADERS_HEIGHT; this.retTableWidth = retTableWidth; this.dtHeaderHeight = CONDITION_HEADERS_HEIGHT + (hConditionsCount - 1); }
public int getHeight() { return getSource().getHeight(); }
private void validateHCHeaders(IGridTable hcHeaderTable) throws OpenLCompilationException { String message = String.format("The width of the horizontal keys must be equal to the number of the %s headers", DecisionTableColumnHeaders.HORIZONTAL_CONDITION.getHeaderKey()); assertEQ(hcHeaders.size(), hcHeaderTable.getHeight(), message); }
private boolean hasEmptyRow(TableEditorModel editorModel) { IGridTable gridTable = editorModel.getOriginalGridTable(); int height = gridTable.getHeight(); for (int i = 0; i < height; i++) { IGridTable row = gridTable.getRow(i); if (isEmptyRow(row)) { return true; } } return false; }
private boolean hasEmptyRow(TableEditorModel editorModel) { IGridTable gridTable = editorModel.getOriginalGridTable(); int height = gridTable.getHeight(); for (int i = 0; i < height; i++) { IGridTable row = gridTable.getRow(i); if (isEmptyRow(row)) { return true; } } return false; }
private void preprocessImportTable(IGridTable table) { int height = table.getHeight(); for (int i = 0; i < height; i++) { String singleImport = table.getCell(1, i).getStringValue(); if (StringUtils.isNotBlank(singleImport)) { addImport(singleImport.trim()); } } }
private int getWidthWithIgnoredEmptyCells(IGridTable table) { int width = table.getWidth(); while (width > 0) { for (int i = 0; i < table.getHeight(); i++) { if (table.getCell(width - 1, 0).getStringValue() != null) { return width; } } width--; } return 0; }
/** * If there is no merged cells in the top row and left column - returns {@link SimpleLogicalTable} * in other case return {@link LogicalTable} * * @param table Original source grid table. * @return {@link ILogicalTable} table with correctly calculated height and width. */ public static ILogicalTable logicalTable(IGridTable table) { int width = calcLogicalColumns(table); int height = calcLogicalRows(table); if (width == table.getWidth() && height == table.getHeight()) { return new SimpleLogicalTable(table); } return new LogicalTable(table, width, height); }
private void preprocessDependency(TableSyntaxNode tableSyntaxNode, IGridTable gridTable) { int height = gridTable.getHeight(); for (int i = 0; i < height; i++) { String dependency = gridTable.getCell(1, i).getStringValue(); if (StringUtils.isNotBlank(dependency)) { dependency = dependency.trim(); IdentifierNode node = new IdentifierNode(IXlsTableNames.DEPENDENCY, LocationUtils.createTextInterval(dependency), dependency, new GridCellSourceCodeModule(gridTable, 1, i, null)); node.setParent(tableSyntaxNode); Dependency moduleDependency = new Dependency(DependencyType.MODULE, node); dependencies.add(moduleDependency); } } }
public Integer getRowIndex() { if (runnableTestMethods.length > 0 && !runnableTestMethods[0].hasId()) { if (method instanceof TestSuiteMethod) { TestMethodBoundNode boundNode = ((TestSuiteMethod) method).getBoundNode(); if (boundNode != null && !boundNode.getTable().getHeaderTable().isNormalOrientation()) { // Currently row indexes aren't supported for transposed test tables return null; } } return table.getGridTable().getHeight() - runnableTestMethods.length + 1; } return null; }
public Integer getRowIndex() { if (runnableTestMethods.length > 0 && !runnableTestMethods[0].hasId()) { if (method instanceof TestSuiteMethod) { TestMethodBoundNode boundNode = ((TestSuiteMethod) method).getBoundNode(); if (boundNode != null && !boundNode.getTable().getHeaderTable().isNormalOrientation()) { // Currently row indexes aren't supported for transposed test tables return null; } } return table.getGridTable().getHeight() - runnableTestMethods.length + 1; } return null; }
@Override public boolean select(TableSyntaxNode node) { if (StringUtils.isBlank(value)) { return true; } IGridTable table = node.getGridTable(); for (int row = 0; row < table.getHeight(); row++) { for (int col = 0; col < table.getWidth(); col++) { ICell cell = table.getCell(col, row); Object cellValue = cell.getObjectValue(); if (selectValue(cellValue)) { return true; } } } return false; }
public String[] getParamPresentation() { int length = paramsTable.getHeight(); String[] result = new String[length]; int fromHeight = 0; for (int i = 0; i < result.length; i++) { int gridHeight = paramsTable.getRow(i).getSource().getHeight(); IGridTable singleParamGridTable = presentationTable.getSource().getRows(fromHeight, fromHeight + gridHeight - 1); result[i] = singleParamGridTable.getCell(0, 0).getStringValue(); fromHeight += gridHeight; } return result; }
public void fillProps(XlsProjection projection, XlsTable xlsTable) { projection.addProperty(new AbstractProperty("name", xlsTable.getTableName())); projection.addProperty(new AbstractProperty("location", xlsTable.getLocation().getStart().toString())); IGridTable grid = xlsTable.getTable().getGridTable(); projection.addProperty(new AbstractProperty("size", grid.getWidth() + "x" + grid.getHeight())); }
public void fillProps(XlsProjection projection, XlsTable xlsTable) { projection.addProperty(new AbstractProperty("name", xlsTable.getTableName())); projection.addProperty(new AbstractProperty("location", xlsTable.getLocation().getStart().toString())); IGridTable grid = xlsTable.getTable().getGridTable(); projection.addProperty(new AbstractProperty("size", grid.getWidth() + "x" + grid.getHeight())); }
public TableValueFilter(final SpreadsheetResult res) { this.res = res; ILogicalTable table = res.getLogicalTable(); IGridTable t = table.getSource(); this.startX = t.getGridColumn(0, 0) + table.getColumn(0).getSource().getWidth(); this.startY = t.getGridRow(0, 0) + table.getRow(0).getSource().getHeight(); }
public GridLocation(IGridTable table) { int width = table.getWidth(); int height = table.getHeight(); start = new GridPosition(table.getGridColumn(0, 0), table.getGridRow(0, 0), table.getGrid()); end = new GridPosition(table.getGridColumn(width - 1, height - 1), table.getGridRow(width - 1, height - 1), table.getGrid()); }
public TableValueFilter(final SpreadsheetResult res) { this.res = res; ILogicalTable table = res.getLogicalTable(); IGridTable t = table.getSource(); this.startX = t.getGridColumn(0, 0) + table.getColumn(0).getSource().getWidth(); this.startY = t.getGridRow(0, 0) + table.getRow(0).getSource().getHeight(); }
public synchronized void moveTableTo(IGridTable table, IGridRegion destRegion) throws TableServiceException { if (Tool.height(destRegion) != table.getHeight() || Tool.width(destRegion) != table.getWidth()) { throw new TableServiceException("Bad destination region size."); } try { TableBuilder tableBuilder = new TableBuilder((XlsSheetGridModel) table.getGrid(), metaInfoWriter); tableBuilder.beginTable(destRegion); tableBuilder.writeGridTable(table); tableBuilder.endTable(); } catch (Exception e) { throw new TableServiceException("Could not move the table", e); } removeTable(table); } }