@Override public void emit(Steps stepContainer, ITextContext emitterContext) { PdfPTable steps = new PdfPTable(new float[]{1f, 2f, 22f}); for (StepExec stepExec : stepContainer.steps()) { emitStep(steps, stepExec, emitterContext); } steps.setWidthPercentage(100); steps.setSpacingBefore(5f); steps.setSpacingAfter(5f); steps.setHorizontalAlignment(Element.ALIGN_LEFT); emitterContext.append(steps); }
@Override public void process(int level, Node node, InvocationContext context) { TableNode tableNode = (TableNode) node; List<TableColumnNode> tableNodeColumns = tableNode.getColumns(); PdfPTable table = new PdfPTable(tableNodeColumns.size()); for (PdfPTableEvent tableEvent : tableEvents) { table.setTableEvent(tableEvent); } context.pushTable(new TableInfos(table, tableNodeColumns)); context.processChildren(level, node); context.popTable(); KeyValues kvs = context.iTextContext().keyValues(); Float spacingBefore = kvs.<Float>getNullable(TABLE_SPACING_BEFORE).or(5f); Float spacingAfter = kvs.<Float>getNullable(TABLE_SPACING_AFTER).or(5f); table.setSpacingBefore(spacingBefore); table.setSpacingAfter(spacingAfter); applyAttributes(context, table); context.append(table); }
private PdfPTable createTable(final TestRunCoverageStatistics runStats) throws DocumentException { final PdfPTable table = new PdfPTable(4); table.setSpacingBefore(10); table.setSpacingAfter(10); table.setWidthPercentage(100); table.setHeaderRows(1); table.setWidths(new int[] {70, 10, 10, 10}); addHeader(table); addTotalRow(runStats, table); addFileStatsRows(runStats, table); return table; }
switch (lastElement.type()) { case Element.PTABLE : ((PdfPTable)lastElement).setSpacingAfter(getSpacingAfter()); break; case Element.PARAGRAPH :
@Override public void emit(TagViews views, ITextContext emitterContext) { Styles styles = emitterContext.styles(); float w = 0.1f; PdfPTable table = new PdfPTable(new float[]{1 - 3 * w, w, w, w}); table.setWidthPercentage(100); table.setSpacingBefore(5f); table.setSpacingAfter(5f); table.setTableEvent(new AlternateTableRowBackground(styles)); emitHeader(table, emitterContext); emitBody(table, views, emitterContext); emitterContext.append(table); }
switch (lastElement.type()) { case Element.PTABLE : ((PdfPTable)lastElement).setSpacingAfter(getSpacingAfter()); break; case Element.PARAGRAPH :
private PdfPTable createTable( PdfPCell cell ) { PdfPTable table = new PdfPTable( 1 ); table.setSpacingBefore( this.spacingBefore() ); table.setSpacingAfter( this.spacingAfter() ); table.setHorizontalAlignment( this.getHorizontalAlignment() ); table.setTotalWidth( cell.getPaddingLeft() + this.getTotalWidth() + cell.getPaddingRight() ); table.setLockedWidth( true ); table.setSplitLate( false ); table.addCell( cell ); return table; }
@Override public void emit(TagDictionary dictionary, ITextContext emitterContext) { Styles styles = emitterContext.styles(); if (headerCellStyler == null) headerCellStyler = new DefaultHeaderCellStyler(styles); FluentIterable<Tag> tags = dictionary.tags(); float w = widthPercent(tags, emitterContext); PdfPTable table = new PdfPTable(new float[]{w, 1 - w}); table.setWidthPercentage(100); table.setSpacingBefore(5f); table.setSpacingAfter(5f); table.setTableEvent(new AlternateTableRowBackground(styles)); emitHeaders(table, headerCellStyler); emitBody(table, tags, emitterContext); emitterContext.append(table); }
private void emitFeature(FeatureExec feature, ITextContext emitterContext) { Styles styles = emitterContext.styles(); Sections sections = emitterContext.sections(); Section featureSection = sections.newSection(feature.name(), hLevel); try { PdfPTable table = new PdfPTable(new float[]{1f, 22f}); for (ScenarioExec scenarioExec : feature.scenario()) { table.addCell(statusCell(scenarioExec.status(), styles)); table.addCell(titleCell(scenarioExec, styles)); } table.setWidthPercentage(100); table.setSpacingBefore(5f); table.setSpacingAfter(5f); featureSection.add(table); } finally { sections.leaveSection(hLevel); } }
public List<Element> process(SourceCode sourceCode) { String lang = sourceCode.lang(); String content = sourceCode.content(); boolean linenos = sourceCode.showLineNumbers(); Tokens tokens = pygments.tokenize(lang, content); Paragraph p = new Paragraph(); for (TokenWithValue token : tokens) { Style style = styleSheet.styleOf(token.token); BaseColor color = toColor(style.fg()); int s = calculateStyle(style); Font font = styles.getFont(Styles.CODE_FONT, s, color).get(); Chunk o = new Chunk(token.value, font); RGB bg = style.bg(); if (bg != null) o.setBackground(toColor(bg)); p.add(o); } PdfPCell cell = new PdfPCell(p); cell.setPaddingBottom(5.0f); cell.setBorder(Rectangle.NO_BORDER); PdfPTable table = new PdfPTable(1); table.addCell(cell); table.setSpacingBefore(5.0f); table.setSpacingAfter(5.0f); table.setTableEvent(new TableBackground(toColor(styleSheet.backgroundColor()))); return Arrays.<Element>asList(table); }
private void emitStepInErrorLegend(ITextContext emitterContext) { Styles styles = emitterContext.styles(); PdfPTable table = new PdfPTable(new float[]{1f, 24f}); table.addCell(noBorder(topRight(new PdfPCell(stepInErrorMarker(styles))))); table.addCell(noBorder(new PdfPCell(new Phrase(": First step in error within the scenario", new FontCopier(styles.defaultFont()).italic().get())))); table.setSpacingBefore(10f); table.setSpacingAfter(10f); emitterContext.append(table); }
t.setWidthPercentage(w); t.setSpacingAfter(img.getSpacingAfter()); t.setSpacingBefore(img.getSpacingBefore()); switch (img.getAlignment()) {
t.setWidthPercentage(w); t.setSpacingAfter(img.getSpacingAfter()); t.setSpacingBefore(img.getSpacingBefore()); switch (img.getAlignment()) {
wrapperTable.setSpacingAfter( getSpacingAfter() ); setSpacingAfter( 0.0f );
table.addCell(cell); table.setSpacingBefore(20f); table.setSpacingAfter(20f);
table.addCell(cell); table.setSpacingBefore(20f); table.setSpacingAfter(20f); ITextUtils.applyAttributes(table, attrs);