private void encodeNameAndConditionDefined( SheetGraphics graphics, VirtueFlawContent content, Bounds textBounds) throws DocumentException { Phrase phrase = new Phrase(); phrase.add(new Chunk(content.getVirtueFlawName() + ": ", createNameFont(graphics))); phrase.add(new Chunk(content.getLimitBreakCondition(), createConditionFont(graphics))); graphics .createSimpleColumn(textBounds) .withLeading(REDUCED_LINE_HEIGHT) .andTextPart(phrase) .encode(); }
@Override public void encode(SheetGraphics graphics, ReportContent reportContent, Bounds bounds) throws DocumentException { VirtueFlawContent content = createContent(reportContent); VirtueFlawBoxEncoder traitEncoder = new VirtueFlawBoxEncoder(); float traitHeight = traitEncoder.encodeHeight(graphics, bounds, content.getLimitValue()); float traitInterval = traitHeight + 1f; Bounds textBounds = new Bounds(bounds.x, bounds.y, bounds.width, bounds.height - traitInterval); if (!content.isNameDefined() && !content.isConditionDefined()) { encodeLines(graphics, bounds, REDUCED_LINE_HEIGHT, textBounds.getMaxY()); } if (content.isNameDefined() && content.isConditionDefined()) { encodeNameAndConditionDefined(graphics, content, textBounds); } if (content.isNameDefined() && !content.isConditionDefined()) { encodeOnlyNameDefined(graphics, bounds, content, textBounds); } if (!content.isNameDefined() && content.isConditionDefined()) { encodeOnlyConditionDefined(graphics, content, textBounds); } }
private void encodeOnlyNameDefined( SheetGraphics graphics, Bounds bounds, VirtueFlawContent content, Bounds textBounds) throws DocumentException { Phrase phrase = new Phrase(); phrase.add(new Chunk(content.getVirtueFlawName(), createNameFont(graphics))); float baseLine = graphics .createSimpleColumn(textBounds) .withLeading(REDUCED_LINE_HEIGHT) .andTextPart(phrase) .encode() .getYLine(); encodeLines(graphics, bounds, REDUCED_LINE_HEIGHT, baseLine); }
private void encodeOnlyConditionDefined( SheetGraphics graphics, VirtueFlawContent content, Bounds textBounds) throws DocumentException { Phrase phrase = new Phrase(); Font undefinedFont = new Font(createNameFont(graphics)); undefinedFont.setStyle(Font.UNDERLINE); phrase.add( new Chunk(" : ", undefinedFont)); // $NON-NLS-1$ phrase.add(new Chunk(": ", createNameFont(graphics))); // $NON-NLS-1$ phrase.add(new Chunk(content.getLimitBreakCondition(), createConditionFont(graphics))); graphics .createSimpleColumn(textBounds) .withLeading(REDUCED_LINE_HEIGHT) .andTextPart(phrase) .encode(); }