/** * Copy constructor for <CODE>Phrase</CODE>. * @param phrase the Phrase to copy */ public Phrase(final Phrase phrase) { super(); this.addAll(phrase); setLeading(phrase.getLeading(), phrase.getMultipliedLeading()); font = phrase.getFont(); tabSettings = phrase.getTabSettings(); setHyphenation(phrase.getHyphenation()); }
/** * Copy constructor for <CODE>Phrase</CODE>. * @param phrase the Phrase to copy */ public Phrase(final Phrase phrase) { super(); this.addAll(phrase); setLeading(phrase.getLeading(), phrase.getMultipliedLeading()); font = phrase.getFont(); tabSettings = phrase.getTabSettings(); setHyphenation(phrase.getHyphenation()); }
@SuppressWarnings("unchecked") @Override public void process(int level, Node node, InvocationContext context) { TreeNavigation nav = context.treeNavigation(); boolean isHeaderCell = nav.ancestorTreeMatches(TableCellNode.class, TableRowNode.class, TableHeaderNode.class); CellStyler cellStyler = context.peekCellStyler(); context.pushFont(cellStyler.cellFont()); List<Element> elements = context.collectChildren(level, node); context.popFont(); Phrase phrase = new Phrase(); phrase.addAll(elements); int colspan = ((TableCellNode) node).getColSpan(); PdfPCell cell = isHeaderCell ? headerCell(phrase) : new PdfPCell(phrase); cell.setColspan(colspan); cellStyler.applyStyle(cell); context.append(cell); }
@Override public void process(int level, Node node, InvocationContext context) { ExpLinkNode linkNode = (ExpLinkNode) node; String url = context.variableResolver().resolve(linkNode.url); Font anchorFont = new FontCopier(context.peekFont()) .style(Font.UNDERLINE) .color(Colors.DARK_RED) .get(); context.pushFont(anchorFont); List<Element> subs = context.collectChildren(level, node); context.popFont(); Phrase p = new Phrase(); p.addAll(subs); Anchor anchor = new Anchor(p); anchor.setReference(url); context.append(anchor); } }