@Test public void testTableColumns() throws Exception { final MasterReport report = DebugReportRunner.parseGoldenSampleReport("Prd-4523.prpt"); report .getReportConfiguration() .setConfigProperty(ClassicEngineCoreModule.COMPLEX_TEXT_CONFIG_OVERRIDE_KEY, "false"); LogicalPageBox logicalPageBox = DebugReportRunner.layoutPage(report, 0); RenderNode[] elementsByNodeType = MatchFactory.findElementsByNodeType(logicalPageBox, LayoutNodeTypes.TYPE_BOX_TABLE); assertEquals(1, elementsByNodeType.length); TableRenderBox table = (TableRenderBox) elementsByNodeType[0]; long width = table.getWidth(); DebugLog.log(width); SeparateColumnModel columnModel = (SeparateColumnModel) table.getColumnModel(); long sum = 0; final ArrayList<TableColumn> expected = new ArrayList<TableColumn>(); expected.add(createTableColumn(4748666, 4222000, 0, 0, 0)); expected.add(createTableColumn(4694666, 4168000, 0, 0, 0)); expected.add(createTableColumn(8415666, 7889000, 0, 0, 2824000)); expected.add(createTableColumn(8415666, 7889000, 0, 0, 0)); expected.add(createTableColumn(8415666, 7889000, 0, 0, 0)); expected.add(createTableColumn(8415666, 7889000, 0, 0, 0)); expected.add(createTableColumn(8415666, 7889000, 0, 0, 2824000)); expected.add(createTableColumn(8415666, 7889000, 0, 0, 0)); expected.add(createTableColumn(8415666, 7889000, 0, 0, 0)); expected.add(createTableColumn(8415666, 7889000, 0, 0, 0)); expected.add(createTableColumn(8415666, 7889000, 2824000, 0, 0)); expected.add(createTableColumn(8415666, 7889000, 0, 0, 0)); TableColumn[] columns = columnModel.getColumns(); for (int i = 0; i < columns.length; i += 1) { TableColumn c = columnModel.getColumn(i); assertColumnsEqual(expected.get(i), c); } }
protected void finishTableRowLevelBox(final RenderBox box) { try { box.setCachedX(nodeContext.getX()); box.setContentAreaX1(nodeContext.getX1()); box.setContentAreaX2(nodeContext.getX2()); if (box.getNodeType() != LayoutNodeTypes.TYPE_BOX_TABLE_CELL) { // break-marker boxes etc. box.setCachedWidth(resolveTableWidthOnFinish(box)); nodeContext.updateParentX2(box.getCachedX2()); } else { box.setCachedWidth( MinorAxisLayoutStepUtil.resolveNodeWidthOnFinish( box, nodeContext, isStrictLegacyMode())); final TableCellRenderBox cell = (TableCellRenderBox) box; final MinorAxisTableContext tableContext = getTableContext(); final TableRenderBox table = tableContext.getTable(); if (tableContext.isStructureValidated() == false) { table .getColumnModel() .updateCellSize( cell.getColumnIndex(), cell.getColSpan(), box.getCachedWidth() - box.getInsets()); } nodeContext.updateParentX2(box.getCachedX2()); } } finally { nodeContext = nodeContext.pop(); } }
protected boolean startTableBox(final TableRenderBox table) { final long changeTracker = table.getChangeTracker(); final long age = table.getTableValidationAge(); if (changeTracker == age) { return false; } currentTable = new TableInfoStructure(table, currentTable); return true; }
protected void finishTableBox(final TableRenderBox table) { final long changeTracker = table.getChangeTracker(); final long age = table.getTableValidationAge(); if (changeTracker == age) { return; } // currentTable.columnModel.validateSizes(table); table.setTableValidationAge(age); table.setPredefinedColumnsValidated(true); currentTable = currentTable.pop(); }
public TableInfoStructure(final TableRenderBox table, final TableInfoStructure parent) { this.table = table; this.parent = parent; this.columnModel = table.getColumnModel(); this.rowSpans = new IntList(10); }