/** * Creates a table with the given indicator * * @param indicator The indicator * @param i18n i18n object * @param expressionService The expression service * @param HEADER3 The header3 font * @param ITALIC The italic font * @param TEXT The text font * @param keepTogether Indicates whether the table could be broken across multiple pages or should * be kept at one page. * @param columnWidths The column widths. */ public static PdfPTable printIndicator( Indicator indicator, I18n i18n, ExpressionService expressionService, boolean keepTogether, float... columnWidths) { PdfPTable table = getPdfPTable(keepTogether, columnWidths); table.addCell(getHeaderCell(indicator.getName(), 2)); table.addCell(getEmptyCell(2, 15)); table.addCell(getItalicCell(i18n.getString("short_name"))); table.addCell(getTextCell(indicator.getShortName())); if (nullIfEmpty(indicator.getCode()) != null) { table.addCell(getItalicCell(i18n.getString("code"))); table.addCell(getTextCell(indicator.getCode())); } if (nullIfEmpty(indicator.getDescription()) != null) { table.addCell(getItalicCell(i18n.getString("description"))); table.addCell(getTextCell(indicator.getDescription())); } table.addCell(getItalicCell(i18n.getString("annualized"))); table.addCell(getTextCell(i18n.getString(getBoolean().get(indicator.isAnnualized())))); table.addCell(getItalicCell(i18n.getString("indicator_type"))); table.addCell(getTextCell(indicator.getIndicatorType().getName())); table.addCell(getItalicCell(i18n.getString("numerator_description"))); table.addCell(getTextCell(indicator.getNumeratorDescription())); table.addCell(getItalicCell(i18n.getString("numerator_formula"))); table.addCell( getTextCell(expressionService.getExpressionDescription(indicator.getNumerator()))); table.addCell(getItalicCell(i18n.getString("denominator_description"))); table.addCell(getTextCell(indicator.getDenominatorDescription())); table.addCell(getItalicCell(i18n.getString("denominator_formula"))); table.addCell( getTextCell(expressionService.getExpressionDescription(indicator.getDenominator()))); for (AttributeValue value : indicator.getAttributeValues()) { table.addCell(getItalicCell(value.getAttribute().getName())); table.addCell(getTextCell(value.getValue())); } table.addCell(getEmptyCell(2, 30)); return table; }
/** * Creates a table with the given validation rule * * @param validationRule The validation rule * @param i18n i18n object * @param expressionService The expression service * @param HEADER3 The header3 font * @param ITALIC The italic font * @param TEXT The text font * @param keepTogether Indicates whether the table could be broken across multiple pages or should * be kept at one page. * @param columnWidths The column widths. */ public static PdfPTable printValidationRule( ValidationRule validationRule, I18n i18n, ExpressionService expressionService, boolean keepTogether, float... columnWidths) { PdfPTable table = getPdfPTable(keepTogether, columnWidths); table.addCell(getHeaderCell(validationRule.getName(), 2)); table.addCell(getEmptyCell(2, 15)); if (nullIfEmpty(validationRule.getDescription()) != null) { table.addCell(getItalicCell(i18n.getString("description"))); table.addCell(getTextCell(validationRule.getDescription())); } table.addCell(getItalicCell(i18n.getString("operator"))); table.addCell(getTextCell(i18n.getString(validationRule.getOperator().toString()))); table.addCell(getItalicCell(i18n.getString("left_side_of_expression"))); table.addCell( getTextCell( expressionService.getExpressionDescription( validationRule.getLeftSide().getExpression()))); table.addCell(getItalicCell(i18n.getString("left_side_description"))); table.addCell(getTextCell(validationRule.getLeftSide().getDescription())); table.addCell(getItalicCell(i18n.getString("right_side_of_expression"))); table.addCell( getTextCell( expressionService.getExpressionDescription( validationRule.getRightSide().getExpression()))); table.addCell(getItalicCell(i18n.getString("right_side_description"))); table.addCell(getTextCell(validationRule.getRightSide().getDescription())); table.addCell(getItalicCell(i18n.getString("period_type"))); table.addCell(getTextCell(i18n.getString(validationRule.getPeriodType().getName()))); table.addCell(getEmptyCell(2, 30)); return table; }