/** * Formats paragraphs that were generated as a result of rendering an annotation value with global * formatting such as tab count and margins. This ensures that all paragraphs representing * annotation values have the correct indentation etc. * * @param valueRenderingParagraphs The paragraphs to be formatted. */ private void applyGlobalFormattingToAnnotationValueParagraphs( List<Paragraph> valueRenderingParagraphs) { for (Paragraph paragraph : valueRenderingParagraphs) { paragraph.setTabCount(0); paragraph.setMarginBottom(2); } }
/** * Renders an annotation value that is an OWLLiteral. * * @param page The page that the value will be rendered into. * @param literal The literal to be rendered. * @param foreground The default foreground. * @param background The default background. * @param isSelected Whether or not the cell containing the annotation value is selected. * @return A list of paragraphs that represent the rendering of the literal. */ private List<Paragraph> renderLiteral( Page page, OWLLiteral literal, Color foreground, Color background, boolean isSelected) { String rendering = EscapeUtils.unescapeString(literal.getLiteral()).trim(); List<Paragraph> result = new ArrayList<>(); if (rendering.length() > 0) { List<LinkSpan> linkSpans = extractLinks(rendering); Paragraph literalParagraph = new Paragraph(rendering, linkSpans); literalParagraph.setForeground(foreground); page.add(literalParagraph); result.add(literalParagraph); Paragraph tagParagraph = literalParagraph; // new Paragraph(""); tagParagraph.append(" ", foreground); page.add(tagParagraph); result.add(tagParagraph); tagParagraph.setMarginTop(2); tagParagraph.setTabCount(2); // appendTag(tagParagraph, literal, foreground, isSelected); } return result; }