List of usage examples for com.itextpdf.text.pdf PdfPCell setMinimumHeight
public void setMinimumHeight(float minimumHeight)
From source file:com.softwaremagico.tm.pdf.complete.traits.VictoryPointsTable.java
License:Open Source License
private static PdfPCell createLine(String text, BaseColor color) { PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, color, FadingSunsTheme.getLineFont(), FadingSunsTheme.VICTORY_POINTS_FONT_SIZE); cell.setMinimumHeight(11); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell;/*from w ww. ja va 2 s. com*/ }
From source file:com.softwaremagico.tm.pdf.complete.traits.VictoryPointsTable.java
License:Open Source License
private static PdfPCell createSubTitle(String text, BaseColor color) { PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, color, FadingSunsTheme.getLineFontBold(), FadingSunsTheme.VICTORY_POINTS_FONT_SIZE); cell.setMinimumHeight(13); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell;//from w w w. j a v a 2s . c o m }
From source file:com.softwaremagico.tm.pdf.small.characteristics.CharacteristicsColumn.java
License:Open Source License
private PdfPCell createContent(CharacterPlayer characterPlayer, List<CharacteristicDefinition> content) { float[] widths = { 4f, 1f }; PdfPTable table = new PdfPTable(widths); BaseElement.setTablePropierties(table); table.getDefaultCell().setBorder(0); for (CharacteristicDefinition characteristic : content) { Paragraph paragraph = new Paragraph(); paragraph.add(new Paragraph(getTranslator().getTranslatedText(characteristic.getId()), new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE))); paragraph.add(new Paragraph(" (", new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE))); if (characterPlayer == null) { paragraph.add(new Paragraph(GAP, new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE))); } else {/*from w w w.ja va 2s. co m*/ paragraph.add( new Paragraph(characterPlayer.getStartingValue(characteristic.getCharacteristicName()) + "", new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.getHandWrittingFontSize( FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE)))); } paragraph.add(new Paragraph(")", new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE))); PdfPCell characteristicTitle = new PdfPCell(paragraph); characteristicTitle.setBorder(0); characteristicTitle.setMinimumHeight(ROW_HEIGHT / content.size()); table.addCell(characteristicTitle); // Rectangle if (characterPlayer == null) { table.addCell(createCharacteristicLine(SKILL_VALUE_GAP)); } else { table.addCell(getHandwrittingCell(getCharacteristicValueRepresentation(characterPlayer, characteristic.getCharacteristicName()), Element.ALIGN_LEFT)); } } PdfPCell cell = new PdfPCell(); cell.addElement(table); BaseElement.setCellProperties(cell); return cell; }
From source file:com.softwaremagico.tm.pdf.small.counters.CounterTable.java
License:Open Source License
protected PdfPCell createValue(String text, Font font, int alignment) { Phrase content = new Phrase(text, font); PdfPCell circleCell = new PdfPCell(content); // Not putting correctly the "o" at the center of the cell. // http://stackoverflow.com/questions/5554553/itext-pdftable-cell-vertical-alignment circleCell.setPaddingTop(paddingTop); circleCell.setHorizontalAlignment(Element.ALIGN_CENTER); circleCell.setVerticalAlignment(alignment); circleCell.setBorder(0);// www . ja v a2s . c o m circleCell.setMinimumHeight(20); return circleCell; }
From source file:com.softwaremagico.tm.pdf.small.fighting.WeaponsTable.java
License:Open Source License
public WeaponsTable(CharacterPlayer characterPlayer) { super(WIDTHS); getDefaultCell().setBorder(0);/*from www . ja v a 2 s.c om*/ PdfPCell title = createTitle(getTranslator().getTranslatedText("combat"), FadingSunsTheme.CHARACTER_SMALL_WEAPONS_TITLE_FONT_SIZE); // To adapt height with Occultism. title.setMinimumHeight(20); addCell(title); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponsAction"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, Element.ALIGN_LEFT)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponGoal"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponDamage"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponRange"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponShots"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponRate"), FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE)); int added = 0; if (characterPlayer != null) { for (Weapon weapon : characterPlayer.getAllWeapons()) { addCell(createFirstElementLine(weapon.getName(), NAME_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); addCell(createElementLine((weapon.getGoal() != null ? weapon.getGoal() : ""), GOAL_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(weapon.getDamageWithoutArea()); if (!weapon.getDamageWithoutArea().endsWith("d")) { stringBuilder.append("d"); } if (weapon.getAreaMeters() > 0) { stringBuilder.append(" "); stringBuilder.append(weapon.getAreaMeters()); } addCell(createElementLine(stringBuilder.toString(), DAMAGE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); addCell(createElementLine( weapon.getShots() == null ? characterPlayer.getStrengthDamangeModification() + "" : weapon.getStrengthOrRange(), RANGE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); addCell(createElementLine(weapon.getShots() + "", SHOTS_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); addCell(createElementLine(weapon.getRate(), RATE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_SMALL_CONTENT_FONT_SIZE)); added++; for (Ammunition ammunition : weapon.getAmmunitions()) { addCell(createFirstElementLine(" - " + ammunition.getName(), NAME_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); addCell(createElementLine((ammunition.getGoal() != null ? weapon.getGoal() : ""), GOAL_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); addCell(createElementLine(ammunition.getDamage() + "d", DAMAGE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); addCell(createElementLine(ammunition.getStrengthOrRange(), RANGE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); addCell(createElementLine("", SHOTS_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); addCell(createElementLine("", RATE_COLUMN_WIDTH, FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); added++; } } } if (characterPlayer == null) { for (int i = added; i < ROWS; i++) { addCell(createEmptyElementLine(GAP, NAME_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, GOAL_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, DAMAGE_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, RANGE_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, SHOTS_COLUMN_WIDTH)); addCell(createEmptyElementLine(GAP, RATE_COLUMN_WIDTH)); } } else { for (int i = added; i < ROWS; i++) { for (int j = 0; j < WIDTHS.length; j++) { addCell(createEmptyElementLine(FadingSunsTheme.WEAPONS_CONTENT_FONT_SIZE)); } } } }
From source file:com.softwaremagico.tm.pdf.small.victorytable.VerticalVictoryPointsTable.java
License:Open Source License
private static PdfPCell createLine(String text, BaseColor color) { PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, color, FadingSunsTheme.getLineFont(), FadingSunsTheme.VICTORY_SMALL_POINTS_FONT_SIZE); cell.setMinimumHeight(12); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell;//from w w w. j a va2s. c o m }
From source file:com.softwaremagico.tm.pdf.small.victorytable.VerticalVictoryPointsTable.java
License:Open Source License
private static PdfPCell createSubTitle(String text, BaseColor color) { PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, color, FadingSunsTheme.getLineFontBold(), FadingSunsTheme.VICTORY_SMALL_POINTS_FONT_SIZE + 1); cell.setMinimumHeight(18); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell;//from w w w. j a va 2 s.co m }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void insertCell(PdfPTable table, String text, Integer colSpan) { if (text == null) { text = ""; }/*from w ww.j a v a 2s. c o m*/ // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_PARAGRAPH)); // set the cell alignment // in case there is no text and you wan to create an empty row if (text.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(colSpan); cell.setPadding(5f); // add the call to the table table.addCell(cell); }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void insertCellAlteracao(PdfPTable table, String text) { if (text == null) { text = ""; }// w w w .j a va 2 s . c o m // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER)); // set the cell alignment // in case there is no text and you wan to create an empty row if (text.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(2); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorderWidth(2); cell.setPadding(3f); // add the call to the table table.addCell(cell); }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void insertCellAlteracaoOption(PdfPTable table, String number, String text, Boolean selected) { String fullText = ""; if (selected) { fullText += number + " |X|" + " " + text; } else {/*from www . jav a2 s . c o m*/ fullText += number + " | |" + " " + text; } if (StringUtils.isBlank(number) && StringUtils.isBlank(text)) { fullText = ""; } // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(fullText.trim(), FONT_PARAGRAPH)); // set the cell alignment // in case there is no text and you wan to create an empty row if (fullText.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorder(Rectangle.RIGHT); cell.setPaddingTop(10f); cell.setPaddingBottom(10f); cell.setPaddingLeft(10f); cell.setPaddingRight(10f); // add the call to the table table.addCell(cell); }